about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix
blob: 579e4058080206418bb7f6505a1227135a51d65c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ lib
, stdenv
, autoPatchelfHook
, darwin
, graalvm-ce
, makeWrapper
, zlib
, libxcrypt-legacy
  # extra params
, product
, extraBuildInputs ? [ ]
, extraNativeBuildInputs ? [ ]
, ...
} @ args:

let
  extraArgs = builtins.removeAttrs args [
    "lib"
    "stdenv"
    "autoPatchelfHook"
    "darwin"
    "graalvm-ce"
    "libxcrypt-legacy"
    "makeWrapper"
    "zlib"
    "product"
    "extraBuildInputs"
    "extraNativeBuildInputs"
    "meta"
  ];
in
stdenv.mkDerivation ({
  pname = product;

  nativeBuildInputs = [ makeWrapper ]
    ++ lib.optional stdenv.isLinux autoPatchelfHook
    ++ extraNativeBuildInputs;

  buildInputs = [
    stdenv.cc.cc.lib # libstdc++.so.6
    zlib
    libxcrypt-legacy # libcrypt.so.1 (default is .2 now)
  ]
  ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Foundation
  ++ extraBuildInputs;

  unpackPhase = ''
    runHook preUnpack

    mkdir -p "$out"

    tar xf "$src" -C "$out" --strip-components=1

    # Sanity check
    if [ ! -d "$out/bin" ]; then
      echo "The `bin` is directory missing after extracting the graalvm"
      echo "tarball, please compare the directory structure of the"
      echo "tarball with what happens in the unpackPhase (in particular"
      echo "with regards to the `--strip-components` flag)."
      exit 1
    fi

    runHook postUnpack
  '';

  dontStrip = true;

  passthru = {
    updateScript = [ ./update.sh product ];
  } // (args.passhtru or { });

  meta = ({
    inherit (graalvm-ce.meta) homepage license sourceProvenance maintainers platforms;
    description = "High-Performance Polyglot VM (Product: ${product})";
  } // (args.meta or { }));
} // extraArgs)