diff options
author | Thibault Gagnaux <tgagnaux@gmail.com> | 2022-04-02 10:54:44 +0200 |
---|---|---|
committer | Thibault Gagnaux <tgagnaux@gmail.com> | 2022-04-02 10:54:44 +0200 |
commit | bfc501493fd792d5e9a874db54e15d4f51dfe5b7 (patch) | |
tree | be4469c1a331d397af75c389132587d099744aef | |
parent | 440d4f9ff71f173ebcc6f0c878681eac8006459c (diff) | |
download | nixpkgs-bfc501493fd792d5e9a874db54e15d4f51dfe5b7.tar nixpkgs-bfc501493fd792d5e9a874db54e15d4f51dfe5b7.tar.gz nixpkgs-bfc501493fd792d5e9a874db54e15d4f51dfe5b7.tar.bz2 nixpkgs-bfc501493fd792d5e9a874db54e15d4f51dfe5b7.tar.lz nixpkgs-bfc501493fd792d5e9a874db54e15d4f51dfe5b7.tar.xz nixpkgs-bfc501493fd792d5e9a874db54e15d4f51dfe5b7.tar.zst nixpkgs-bfc501493fd792d5e9a874db54e15d4f51dfe5b7.zip |
graalvmXX-ce: add review suggestions
Co-authored-by: Thiago Kenji Okada <thiagokokada@gmail.com>
-rw-r--r-- | pkgs/development/compilers/graalvm/community-edition/mkGraal.nix | 74 | ||||
-rw-r--r-- | pkgs/development/compilers/graalvm/community-edition/update.nix | 4 |
2 files changed, 35 insertions, 43 deletions
diff --git a/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix b/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix index 7642f25ac2c..2986baca4e9 100644 --- a/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix +++ b/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix @@ -44,7 +44,7 @@ let version = platform.version; name = "graalvm${javaVersion}-ce"; sourcesFilename = "${name}-sources.json"; - sources = builtins.fromJSON (builtins.readFile (./. + "/${sourcesFilename}")); + sources = builtins.fromJSON (builtins.readFile (./${sourcesFilename})); runtimeLibraryPath = lib.makeLibraryPath ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]); @@ -132,48 +132,40 @@ let outputs = [ "out" "lib" ]; - installPhase = - let - copyClibrariesToOut = basepath: '' - # provide libraries needed for static compilation - ${ - if useMusl then - "for f in ${musl.stdenv.cc.cc}/lib/* ${musl}/lib/* ${zlib.static}/lib/*; do" - else - "for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do" - } - ln -s $f ${basepath}/${platform.arch}/$(basename $f) - done - ''; - copyClibrariesToLib = '' - # add those libraries to $lib output too, so we can use them with - # `native-image -H:CLibraryPath=''${lib.getLib graalvm11-ce}/lib ...` and reduce - # closure size by not depending on GraalVM $out (that is much bigger) - mkdir -p $lib/lib - for f in ${glibc}/lib/*; do - ln -s $f $lib/lib/$(basename $f) - done - ''; - in - '' - # ensure that $lib/lib exists to avoid breaking builds - mkdir -p $lib/lib - # jni.h expects jni_md.h to be in the header search path. - ln -s $out/include/linux/*_md.h $out/include/ - - # copy-paste openjdk's preFixup - # Set JAVA_HOME automatically. - mkdir -p $out/nix-support - cat > $out/nix-support/setup-hook << EOF - if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi - EOF + installPhase = '' + # ensure that $lib/lib exists to avoid breaking builds + mkdir -p $lib/lib + # jni.h expects jni_md.h to be in the header search path. + ln -s $out/include/linux/*_md.h $out/include/ + + # copy-paste openjdk's preFixup + # Set JAVA_HOME automatically. + mkdir -p $out/nix-support + cat > $out/nix-support/setup-hook << EOF + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi + EOF + ${ + lib.optionalString (stdenv.isLinux) '' + # provide libraries needed for static compilation ${ - lib.optionalString (stdenv.isLinux) '' - ${copyClibrariesToOut "$out/lib/svm/clibraries"} - ${copyClibrariesToLib} - '' + if useMusl then + "for f in ${musl.stdenv.cc.cc}/lib/* ${musl}/lib/* ${zlib.static}/lib/*; do" + else + "for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do" } - ''; + ln -s $f $out/lib/svm/clibraries/${platform.arch}/$(basename $f) + done + + # add those libraries to $lib output too, so we can use them with + # `native-image -H:CLibraryPath=''${lib.getLib graalvmXX-ce}/lib ...` and reduce + # closure size by not depending on GraalVM $out (that is much bigger) + mkdir -p $lib/lib + for f in ${glibc}/lib/*; do + ln -s $f $lib/lib/$(basename $f) + done + '' + } + ''; dontStrip = true; diff --git a/pkgs/development/compilers/graalvm/community-edition/update.nix b/pkgs/development/compilers/graalvm/community-edition/update.nix index 724282e7b92..a687667eff5 100644 --- a/pkgs/development/compilers/graalvm/community-edition/update.nix +++ b/pkgs/development/compilers/graalvm/community-edition/update.nix @@ -183,7 +183,7 @@ let newVersion = getLatestVersion graalVersion; sourcesJson = genSources javaVersion config; - sourcesJsonPath = lib.strings.escapeShellArg ././${sourcesFilename}; + sourcesJsonPath = lib.strings.escapeShellArg ./${sourcesFilename}; # versionKeyInDefaultNix String -> String versionKeyInDefaultNix = graalVersion: @@ -208,7 +208,7 @@ let export PATH="${lib.makeBinPath [ jq gnused ]}:$PATH" jq . ${sourcesJson} > ${sourcesJsonPath} sed -i 's|${versionKey} = "${currentVersion}";|${versionKey} = "${newVersion}";|' \ - ${lib.strings.escapeShellArg ././default.nix} + ${lib.strings.escapeShellArg ./default.nix} '' else ''echo "No new version found. Skip updating."''; |