mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-11 21:50:38 +00:00
Build mostly static native image, loose linux glibc requirement to 2.12 (#730)
This commit is contained in:
19
.github/workflows/early-access.yaml
vendored
19
.github/workflows/early-access.yaml
vendored
@@ -57,8 +57,25 @@ jobs:
|
|||||||
components: 'native-image'
|
components: 'native-image'
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: 'Maven clean'
|
||||||
|
run: ./mvnw clean -Dmrm=false -B -ntp -e
|
||||||
|
|
||||||
|
- name: 'Patch Graal libs for only requiring glibc 2.12'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ $OS == linux ]] && [[ $GRAALVM_HOME ]] && [[ -d "$GRAALVM_HOME/lib/static/linux-amd64/glibc" ]]; then
|
||||||
|
mkdir -p client/target/graalvm-libs-for-glibc-2.12
|
||||||
|
echo "memcpy memcpy@GLIBC_2.2.5" >client/target/glibc.redef
|
||||||
|
echo "posix_spawn posix_spawn@GLIBC_2.2.5" >>client/target/glibc.redef
|
||||||
|
find "$GRAALVM_HOME/lib/static/linux-amd64/glibc" -name '*.a' | while IFS= read -r input; do
|
||||||
|
output="client/target/graalvm-libs-for-glibc-2.12/$(basename -- "$input")"
|
||||||
|
objcopy --redefine-syms=client/target/glibc.redef -- "$input" "$output" 2>/dev/null
|
||||||
|
done
|
||||||
|
find /usr/lib -name libz.a | xargs -r -I {} objcopy --redefine-syms=client/target/glibc.redef {} client/target/graalvm-libs-for-glibc-2.12/libz.a
|
||||||
|
fi
|
||||||
|
|
||||||
- name: 'Build native distribution'
|
- name: 'Build native distribution'
|
||||||
run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e
|
run: ./mvnw verify -Pnative -Dmrm=false -B -ntp -e
|
||||||
|
|
||||||
- name: 'Upload daemon test logs'
|
- name: 'Upload daemon test logs'
|
||||||
if: always()
|
if: always()
|
||||||
|
19
.github/workflows/release.yaml
vendored
19
.github/workflows/release.yaml
vendored
@@ -58,8 +58,25 @@ jobs:
|
|||||||
components: 'native-image'
|
components: 'native-image'
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: 'Maven clean'
|
||||||
|
run: ./mvnw clean -Dmrm=false -B -ntp -e
|
||||||
|
|
||||||
|
- name: 'Patch Graal libs for only requiring glibc 2.12'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ $OS == linux ]] && [[ $GRAALVM_HOME ]] && [[ -d "$GRAALVM_HOME/lib/static/linux-amd64/glibc" ]]; then
|
||||||
|
mkdir -p client/target/graalvm-libs-for-glibc-2.12
|
||||||
|
echo "memcpy memcpy@GLIBC_2.2.5" >client/target/glibc.redef
|
||||||
|
echo "posix_spawn posix_spawn@GLIBC_2.2.5" >>client/target/glibc.redef
|
||||||
|
find "$GRAALVM_HOME/lib/static/linux-amd64/glibc" -name '*.a' | while IFS= read -r input; do
|
||||||
|
output="client/target/graalvm-libs-for-glibc-2.12/$(basename -- "$input")"
|
||||||
|
objcopy --redefine-syms=client/target/glibc.redef -- "$input" "$output" 2>/dev/null
|
||||||
|
done
|
||||||
|
find /usr/lib -name libz.a | xargs -r -I {} objcopy --redefine-syms=client/target/glibc.redef {} client/target/graalvm-libs-for-glibc-2.12/libz.a
|
||||||
|
fi
|
||||||
|
|
||||||
- name: 'Build native distribution'
|
- name: 'Build native distribution'
|
||||||
run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e -DskipTests
|
run: ./mvnw verify -Pnative -Dmrm=false -B -ntp -e -DskipTests
|
||||||
|
|
||||||
- name: 'Upload artifact'
|
- name: 'Upload artifact'
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<graalvm-native-static-opt/>
|
||||||
|
<graalvm-native-glibc-opt/>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -134,8 +136,34 @@
|
|||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
<id>native</id>
|
<id>enable-partial-static-native</id>
|
||||||
|
<activation>
|
||||||
|
<os>
|
||||||
|
<family>!mac</family>
|
||||||
|
</os>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<graalvm-native-static-opt>-H:+StaticExecutableWithDynamicLibC</graalvm-native-static-opt>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>linux-image-only-require-glibc-2.12</id>
|
||||||
|
<activation>
|
||||||
|
<os>
|
||||||
|
<family>linux</family>
|
||||||
|
</os>
|
||||||
|
<file>
|
||||||
|
<exists>target/graalvm-libs-for-glibc-2.12</exists>
|
||||||
|
</file>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<graalvm-native-glibc-opt>-H:CLibraryPath=${project.build.directory}/graalvm-libs-for-glibc-2.12</graalvm-native-glibc-opt>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>native</id>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -148,10 +176,13 @@
|
|||||||
<buildArgs>--no-server
|
<buildArgs>--no-server
|
||||||
--no-fallback
|
--no-fallback
|
||||||
--allow-incomplete-classpath
|
--allow-incomplete-classpath
|
||||||
|
${graalvm-native-static-opt}
|
||||||
|
${graalvm-native-glibc-opt}
|
||||||
-H:IncludeResources=org/mvndaemon/mvnd/.*
|
-H:IncludeResources=org/mvndaemon/mvnd/.*
|
||||||
-H:IncludeResources=mvnd-bash-completion.bash
|
-H:IncludeResources=mvnd-bash-completion.bash
|
||||||
-H:-ParseRuntimeOptions
|
-H:-ParseRuntimeOptions
|
||||||
-H:+AddAllCharsets
|
-H:+AddAllCharsets
|
||||||
|
-H:+ReportExceptionStackTraces
|
||||||
-ea</buildArgs>
|
-ea</buildArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
Reference in New Issue
Block a user