Merge pull request #7823 from Friendseeker/musl

[1.x] Static link `musl` during x86 Linux Native Image build
This commit is contained in:
eugene yokota 2024-10-24 17:27:09 -04:00 committed by GitHub
commit 0c00dbaf4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -80,6 +80,13 @@ jobs:
repository: sbt/zinc
ref: 1.10.x
path: zinc
- uses: graalvm/setup-graalvm@v1
if: ${{ matrix.jobtype >= 7 && matrix.jobtype <= 9 }}
with:
java-version: '23'
native-image-musl: 'true'
set-java-home: 'false'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup JDK
uses: actions/setup-java@v4
with:

View File

@ -1176,8 +1176,7 @@ lazy val sbtClientProj = (project in file("client"))
nativeImageReady := { () =>
()
},
nativeImageVersion := "23.0",
nativeImageJvm := "graalvm-java23",
nativeImageInstalled := true,
nativeImageOutput := {
val outputDir = (target.value / "bin").toPath
if (!Files.exists(outputDir)) {
@ -1199,7 +1198,7 @@ lazy val sbtClientProj = (project in file("client"))
s"-H:Name=${target.value / "bin" / "sbtn"}",
) ++ (if (isLinux && isArmArchitecture)
Seq("-H:PageSize=65536") // Make sure binary runs on kernels with page size set to 4k, 16 and 64k
else Nil),
else Nil) ++ (if (isLinux && !isArmArchitecture) Seq("--static", "--libc=musl") else Nil),
buildThinClient := {
val isFish = Def.spaceDelimited("").parsed.headOption.fold(false)(_ == "--fish")
val ext = if (isWin) ".bat" else if (isFish) ".fish" else ".sh"