mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2024-10-12 14:09:56 +08:00
Cache musl setup in GitHub tool-cache.
This commit is contained in:
parent
66dc2bf069
commit
a02f4df8f7
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
@ -2,46 +2,51 @@ import * as core from '@actions/core'
|
|||||||
import * as tc from '@actions/tool-cache'
|
import * as tc from '@actions/tool-cache'
|
||||||
import {IS_LINUX} from './constants'
|
import {IS_LINUX} from './constants'
|
||||||
import {exec} from '@actions/exec'
|
import {exec} from '@actions/exec'
|
||||||
import {homedir} from 'os'
|
|
||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
import {mkdirP} from '@actions/io'
|
|
||||||
|
const MUSL_NAME = 'x86_64-linux-musl-native'
|
||||||
|
const MUSL_VERSION = '10.2.1'
|
||||||
|
|
||||||
export async function setUpNativeImageMusl(): Promise<void> {
|
export async function setUpNativeImageMusl(): Promise<void> {
|
||||||
if (!IS_LINUX) {
|
if (!IS_LINUX) {
|
||||||
core.warning('musl is only supported on Linux')
|
core.warning('musl is only supported on Linux')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
core.startGroup(`Setting up musl for GraalVM Native Image...`)
|
let toolPath = tc.find(MUSL_NAME, MUSL_VERSION)
|
||||||
const basePath = join(homedir(), '.musl_feature')
|
if (toolPath) {
|
||||||
await mkdirP(basePath)
|
core.info(`Found ${MUSL_NAME} ${MUSL_VERSION} in tool-cache @ ${toolPath}`)
|
||||||
|
} else {
|
||||||
|
core.startGroup(`Setting up musl for GraalVM Native Image...`)
|
||||||
|
const muslDownloadPath = await tc.downloadTool(
|
||||||
|
`http://more.musl.cc/10/x86_64-linux-musl/${MUSL_NAME}.tgz`
|
||||||
|
)
|
||||||
|
const muslExtractPath = await tc.extractTar(muslDownloadPath)
|
||||||
|
const muslPath = join(muslExtractPath, MUSL_NAME)
|
||||||
|
|
||||||
const muslName = 'x86_64-linux-musl-native'
|
const zlibVersion = '1.2.11'
|
||||||
const muslDownloadPath = await tc.downloadTool(
|
const zlibDownloadPath = await tc.downloadTool(
|
||||||
`http://more.musl.cc/10/x86_64-linux-musl/${muslName}.tgz`
|
`https://zlib.net/zlib-${zlibVersion}.tar.gz`
|
||||||
)
|
)
|
||||||
await tc.extractTar(muslDownloadPath, basePath)
|
const zlibExtractPath = await tc.extractTar(zlibDownloadPath)
|
||||||
const muslPath = join(basePath, muslName)
|
const zlibPath = join(zlibExtractPath, `zlib-${zlibVersion}`)
|
||||||
core.addPath(join(muslPath, 'bin'))
|
const zlibBuildOptions = {
|
||||||
|
cwd: zlibPath,
|
||||||
const zlibVersion = '1.2.11'
|
env: {
|
||||||
const zlibDownloadPath = await tc.downloadTool(
|
...process.env,
|
||||||
`https://zlib.net/zlib-${zlibVersion}.tar.gz`
|
CC: join(muslPath, 'bin', 'gcc')
|
||||||
)
|
}
|
||||||
await tc.extractTar(zlibDownloadPath, basePath)
|
|
||||||
const zlibPath = join(basePath, `zlib-${zlibVersion}`)
|
|
||||||
const zlibBuildOptions = {
|
|
||||||
cwd: zlibPath,
|
|
||||||
env: {
|
|
||||||
...process.env,
|
|
||||||
CC: join(muslPath, 'bin', 'gcc')
|
|
||||||
}
|
}
|
||||||
|
await exec(
|
||||||
|
'./configure',
|
||||||
|
[`--prefix=${muslPath}`, '--static'],
|
||||||
|
zlibBuildOptions
|
||||||
|
)
|
||||||
|
await exec('make', [], zlibBuildOptions)
|
||||||
|
await exec('make', ['install'], {cwd: zlibPath})
|
||||||
|
|
||||||
|
core.info(`Adding ${MUSL_NAME} ${MUSL_VERSION} to tool-cache ...`)
|
||||||
|
toolPath = await tc.cacheDir(muslPath, MUSL_NAME, MUSL_VERSION)
|
||||||
|
core.endGroup()
|
||||||
}
|
}
|
||||||
await exec(
|
core.addPath(join(toolPath, 'bin'))
|
||||||
'./configure',
|
|
||||||
[`--prefix=${muslPath}`, '--static'],
|
|
||||||
zlibBuildOptions
|
|
||||||
)
|
|
||||||
await exec('make', [], zlibBuildOptions)
|
|
||||||
await exec('make', ['install'], {cwd: zlibPath})
|
|
||||||
core.endGroup()
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user