at master 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 autoPatchelfHook, 5 graalvm-ce, 6 makeWrapper, 7 zlib, 8 libxcrypt-legacy, 9 # extra params 10 product, 11 extraBuildInputs ? [ ], 12 extraNativeBuildInputs ? [ ], 13 ... 14}@args: 15 16let 17 extraArgs = builtins.removeAttrs args [ 18 "lib" 19 "stdenv" 20 "autoPatchelfHook" 21 "darwin" 22 "graalvm-ce" 23 "libxcrypt-legacy" 24 "makeWrapper" 25 "zlib" 26 "product" 27 "extraBuildInputs" 28 "extraNativeBuildInputs" 29 "meta" 30 ]; 31in 32stdenv.mkDerivation ( 33 { 34 pname = product; 35 36 nativeBuildInputs = [ 37 makeWrapper 38 ] 39 ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook 40 ++ extraNativeBuildInputs; 41 42 buildInputs = [ 43 (lib.getLib stdenv.cc.cc) # libstdc++.so.6 44 zlib 45 libxcrypt-legacy # libcrypt.so.1 (default is .2 now) 46 ] 47 ++ extraBuildInputs; 48 49 unpackPhase = '' 50 runHook preUnpack 51 52 mkdir -p "$out" 53 54 tar xf "$src" -C "$out" --strip-components=1 55 56 # Sanity check 57 if [ ! -d "$out/bin" ]; then 58 echo "The `bin` is directory missing after extracting the graalvm" 59 echo "tarball, please compare the directory structure of the" 60 echo "tarball with what happens in the unpackPhase (in particular" 61 echo "with regards to the `--strip-components` flag)." 62 exit 1 63 fi 64 65 runHook postUnpack 66 ''; 67 68 dontStrip = true; 69 70 passthru = { 71 updateScript = [ 72 ./update.sh 73 product 74 ]; 75 } 76 // (args.passhtru or { }); 77 78 meta = ( 79 { 80 inherit (graalvm-ce.meta) 81 homepage 82 license 83 sourceProvenance 84 teams 85 platforms 86 ; 87 description = "High-Performance Polyglot VM (Product: ${product})"; 88 mainProgram = "js"; 89 } 90 // (args.meta or { }) 91 ); 92 } 93 // extraArgs 94)