Skip to content

Commit a8c0509

Browse files
committed
Revert "Upgrade musl and follow recommendation."
This reverts commit 9dd2b41.
1 parent 557ffcf commit a8c0509

File tree

2 files changed

+28
-63
lines changed

2 files changed

+28
-63
lines changed

dist/main/index.js

Lines changed: 13 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/musl.ts

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@ import * as core from '@actions/core'
33
import * as tc from '@actions/tool-cache'
44
import {exec} from '../utils'
55
import {join} from 'path'
6-
import {homedir} from 'os'
7-
import {promises as fs} from 'fs'
86

9-
const MUSL_NAME = 'musl-gcc'
10-
const MUSL_VERSION = '1.2.4'
11-
const ZLIB_VERSION = '1.2.13'
12-
13-
// Build instructions: https://github.com/oracle/graal/blob/6dab549194b85252f88bda4ee825762d8b02c687/docs/reference-manual/native-image/guides/build-static-and-mostly-static-executable.md?plain=1#L38-L67
7+
const MUSL_NAME = 'x86_64-linux-musl-native'
8+
const MUSL_VERSION = '10.2.1'
149

1510
export async function setUpNativeImageMusl(): Promise<void> {
1611
if (!c.IS_LINUX) {
@@ -19,55 +14,38 @@ export async function setUpNativeImageMusl(): Promise<void> {
1914
}
2015
let toolPath = tc.find(MUSL_NAME, MUSL_VERSION)
2116
if (toolPath) {
22-
core.info(`Found musl ${MUSL_VERSION} in tool-cache @ ${toolPath}`)
17+
core.info(`Found ${MUSL_NAME} ${MUSL_VERSION} in tool-cache @ ${toolPath}`)
2318
} else {
24-
core.startGroup(`Building musl with zlib for GraalVM Native Image...`)
25-
// Build musl
26-
const muslHome = join(homedir(), 'musl-toolchain')
19+
core.startGroup(`Setting up musl for GraalVM Native Image...`)
2720
const muslDownloadPath = await tc.downloadTool(
28-
`https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz`
21+
`https://github.com/graalvm/setup-graalvm/releases/download/x86_64-linux-musl-${MUSL_VERSION}/${MUSL_NAME}.tgz`
2922
)
3023
const muslExtractPath = await tc.extractTar(muslDownloadPath)
31-
const muslPath = join(muslExtractPath, `musl-${MUSL_VERSION}`)
32-
const muslBuildOptions = {cwd: muslPath}
33-
await exec(
34-
'./configure',
35-
[`--prefix=${muslHome}`, '--static'],
36-
muslBuildOptions
37-
)
38-
await exec('make', [], muslBuildOptions)
39-
await exec('make', ['install'], muslBuildOptions)
40-
const muslGCC = join(muslHome, 'bin', MUSL_NAME)
41-
await fs.symlink(
42-
muslGCC,
43-
join(muslHome, 'bin', 'x86_64-linux-musl-gcc'),
44-
'file'
45-
)
46-
// Build zlib
24+
const muslPath = join(muslExtractPath, MUSL_NAME)
25+
26+
const zlibCommit = 'ec3df00224d4b396e2ac6586ab5d25f673caa4c2'
4727
const zlibDownloadPath = await tc.downloadTool(
48-
`https://zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz`
28+
`https://github.com/madler/zlib/archive/${zlibCommit}.tar.gz`
4929
)
5030
const zlibExtractPath = await tc.extractTar(zlibDownloadPath)
51-
const zlibPath = join(zlibExtractPath, `zlib-${ZLIB_VERSION}`)
31+
const zlibPath = join(zlibExtractPath, `zlib-${zlibCommit}`)
5232
const zlibBuildOptions = {
5333
cwd: zlibPath,
5434
env: {
5535
...process.env,
56-
CC: muslGCC
36+
CC: join(muslPath, 'bin', 'gcc')
5737
}
5838
}
5939
await exec(
6040
'./configure',
61-
[`--prefix=${muslHome}`, '--static'],
41+
[`--prefix=${muslPath}`, '--static'],
6242
zlibBuildOptions
6343
)
6444
await exec('make', [], zlibBuildOptions)
6545
await exec('make', ['install'], {cwd: zlibPath})
66-
// Store in cache
67-
core.info(
68-
`Adding musl ${MUSL_VERSION} with zlib ${ZLIB_VERSION} to tool-cache ...`
69-
)
70-
toolPath = await tc.cacheDir(muslHome, MUSL_NAME, MUSL_VERSION)
46+
47+
core.info(`Adding ${MUSL_NAME} ${MUSL_VERSION} to tool-cache ...`)
48+
toolPath = await tc.cacheDir(muslPath, MUSL_NAME, MUSL_VERSION)
7149
core.endGroup()
7250
}
7351
core.addPath(join(toolPath, 'bin'))

0 commit comments

Comments
 (0)