diff options
author | volth <volth@webmaster.ms> | 2018-02-27 16:26:59 +0000 |
---|---|---|
committer | volth <volth@volth.com> | 2018-02-27 17:10:18 +0000 |
commit | 4f811dea25871957b38957d4e721e8aa089eb7a4 (patch) | |
tree | fe6bed21a94114426e6f8c16c47321eb57116d71 /pkgs/development/compilers/graalvm/default.nix | |
parent | d9d09d8c95e3b47ec3f9351c0e97efc5cdbf29bd (diff) | |
download | nixlib-4f811dea25871957b38957d4e721e8aa089eb7a4.tar nixlib-4f811dea25871957b38957d4e721e8aa089eb7a4.tar.gz nixlib-4f811dea25871957b38957d4e721e8aa089eb7a4.tar.bz2 nixlib-4f811dea25871957b38957d4e721e8aa089eb7a4.tar.lz nixlib-4f811dea25871957b38957d4e721e8aa089eb7a4.tar.xz nixlib-4f811dea25871957b38957d4e721e8aa089eb7a4.tar.zst nixlib-4f811dea25871957b38957d4e721e8aa089eb7a4.zip |
graalvm8: more robust hash replace on derivation copy
Diffstat (limited to 'pkgs/development/compilers/graalvm/default.nix')
-rw-r--r-- | pkgs/development/compilers/graalvm/default.nix | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/pkgs/development/compilers/graalvm/default.nix b/pkgs/development/compilers/graalvm/default.nix index 9645d84d4b5c..7183ede1a665 100644 --- a/pkgs/development/compilers/graalvm/default.nix +++ b/pkgs/development/compilers/graalvm/default.nix @@ -78,7 +78,12 @@ in rec { # copy of pkgs.oraclejvm8 with JVMCI interface (TODO: it should work with pkgs.openjdk8 too) jvmci8 = stdenv.mkDerivation rec { version = "0.41"; - name = "jvmci8-${version}"; + name = let + n = "jvmci8u161-${version}"; + in if (lib.stringLength n) == (lib.stringLength oraclejdk8.name) then + n + else + throw "length of string `${n}' must be equal to the length of `${oraclejdk8.name}'"; src = fetchFromGitHub { owner = "graalvm"; repo = "graal-jvmci-8"; @@ -109,12 +114,7 @@ in rec { ''; installPhase = '' mv jdk1.8.0_*/linux-amd64/product $out - - # overide references to unpatched JDK - find $out -type f -perm -0100 \ - -exec bash -c 'patchelf --set-rpath "$(patchelf --print-rpath {} | sed -r "s#${oraclejdk8}#$out#g")" {}' \; - sed -i -r "s#${oraclejdk8}#$out#g" $out/bin/jmc - sed -i -r "s#${oraclejdk8}#$out#g" $out/nix-support/setup-hook + find $out -type f -exec sed -i "s#${oraclejdk8}#$out#g" {} \; ''; dontStrip = true; # why? see in oraclejdk derivation inherit (oraclejdk8) meta; @@ -122,7 +122,12 @@ in rec { graalvm8 = stdenv.mkDerivation rec { version = "0.31"; - name = "graalvm8-${version}"; + name = let + n = "graal-vm-8-${version}"; + in if (lib.stringLength n) == (lib.stringLength jvmci8.name) then + n + else + throw "length of string `${n}' must be equal to the length of `${jvmci8.name}'"; src = fetchFromGitHub { owner = "oracle"; repo = "graal"; @@ -141,23 +146,20 @@ in rec { ) ''; buildPhase = '' - export MX_ALT_OUTPUT_ROOT=$NIX_BUILD_TOP/mxbuild - export MX_CACHE_DIR=${makeMxCache graal-mxcache} - ( cd substratevm; mx build --no-daemon ) - ''; - installPhase = '' # make a copy of jvmci8 cp -dpR ${jvmci8} $out chmod +w -R $out - find $out -type f -perm -0100 \ - -exec bash -c 'patchelf --set-rpath "$(patchelf --print-rpath {} | sed -r "s#${jvmci8}#$out#g")" {}' \; - sed -i -r "s#${jvmci8}#$out#g" $out/bin/jmc - sed -i -r "s#${jvmci8}#$out#g" $out/nix-support/setup-hook + find $out -type f -exec sed -i "s#${jvmci8}#$out#g" {} \; + export MX_ALT_OUTPUT_ROOT=$NIX_BUILD_TOP/mxbuild + export MX_CACHE_DIR=${makeMxCache graal-mxcache} + ( cd substratevm; mx --java-home $out build --no-daemon ) + ''; + installPhase = '' # add graal files mkdir -p $out/jre/tools/{profiler,chromeinspector} cp -pR substratevm/svmbuild/native-image-root/linux-amd64/bin/* $out/jre/bin/ - cp -pLR substratevm/svmbuild/native-image-root/lib/* $out/jre/lib/ + cp -pLR substratevm/svmbuild/native-image-root/lib/* $out/jre/lib/ || true # ignore "same file" error when dereferencing symlinks cp -pLR substratevm/svmbuild/native-image-root/tools/* $out/jre/tools/ cp -pR $MX_ALT_OUTPUT_ROOT/truffle/dists/* $out/jre/lib/truffle/ cp -pR $MX_ALT_OUTPUT_ROOT/tools/dists/truffle-profiler* $out/jre/tools/profiler/ |