From 26fb8f91106d63810c21f820c5bee2103da0995b Mon Sep 17 00:00:00 2001 From: taku0 Date: Sun, 20 Dec 2020 17:52:16 +0900 Subject: [PATCH] graalvm11-ce, graalvm8-ce: add support for GTK+ Look and Feel --- .../compilers/graalvm/community-edition.nix | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition.nix b/pkgs/development/compilers/graalvm/community-edition.nix index b4a0528611c..ea18be56250 100644 --- a/pkgs/development/compilers/graalvm/community-edition.nix +++ b/pkgs/development/compilers/graalvm/community-edition.nix @@ -2,8 +2,10 @@ , lib , fetchurl , autoPatchelfHook -, Foundation , setJavaClassPath +, makeWrapper +# minimum dependencies +, Foundation , alsaLib , fontconfig , freetype @@ -13,10 +15,23 @@ , unzip , xorg , zlib +# runtime dependencies +, cups +# runtime dependencies for GTK+ Look and Feel +, gtkSupport ? true +, cairo +, glib +, gtk3 }: let platform = if stdenv.isDarwin then "darwin-amd64" else "linux-amd64"; + runtimeDependencies = [ + cups + ] ++ lib.optionals gtkSupport [ + cairo glib gtk3 + ]; + runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies; common = javaVersion: let javaVersionPlatform = "${javaVersion}-${platform}"; @@ -67,24 +82,24 @@ let ]; buildInputs = lib.optionals stdenv.isLinux [ - zlib + alsaLib # libasound.so wanted by lib/libjsound.so fontconfig freetype + openssl # libssl.so wanted by languages/ruby/lib/mri/openssl.so + stdenv.cc.cc.lib # libstdc++.so.6 xorg.libX11 + xorg.libXext xorg.libXi xorg.libXrender - xorg.libXext xorg.libXtst - stdenv.cc.cc.lib # libstdc++.so.6 - alsaLib # libasound.so wanted by lib/libjsound.so - openssl # libssl.so wanted by languages/ruby/lib/mri/openssl.so + zlib ]; # Workaround for libssl.so.10 wanted by TruffleRuby # Resulting TruffleRuby cannot use `openssl` library. autoPatchelfIgnoreMissingDeps = true; - nativeBuildInputs = [ unzip perl autoPatchelfHook ]; + nativeBuildInputs = [ unzip perl autoPatchelfHook makeWrapper ]; unpackPhase = '' unpack_jar() { @@ -171,8 +186,17 @@ let dontStrip = true; - # copy-paste openjdk's preFixup preFixup = '' + # We cannot use -exec since wrapProgram is a function but not a + # command. + for bin in $( find "$out" -executable -type f -not -path '*/languages/ruby/lib/gems/*' ); do + if patchelf --print-interpreter "$bin" &> /dev/null || head -n 1 "$bin" | grep '^#!' -q; then + wrapProgram "$bin" \ + --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}" + fi + done + + # copy-paste openjdk's preFixup # Set JAVA_HOME automatically. mkdir -p $out/nix-support cat < $out/nix-support/setup-hook