graalvm11-ce, graalvm8-ce: add support for GTK+ Look and Feel

This commit is contained in:
taku0 2020-12-20 17:52:16 +09:00
parent 032b5cd156
commit 26fb8f9110

View File

@ -2,8 +2,10 @@
, lib , lib
, fetchurl , fetchurl
, autoPatchelfHook , autoPatchelfHook
, Foundation
, setJavaClassPath , setJavaClassPath
, makeWrapper
# minimum dependencies
, Foundation
, alsaLib , alsaLib
, fontconfig , fontconfig
, freetype , freetype
@ -13,10 +15,23 @@
, unzip , unzip
, xorg , xorg
, zlib , zlib
# runtime dependencies
, cups
# runtime dependencies for GTK+ Look and Feel
, gtkSupport ? true
, cairo
, glib
, gtk3
}: }:
let let
platform = if stdenv.isDarwin then "darwin-amd64" else "linux-amd64"; platform = if stdenv.isDarwin then "darwin-amd64" else "linux-amd64";
runtimeDependencies = [
cups
] ++ lib.optionals gtkSupport [
cairo glib gtk3
];
runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
common = javaVersion: common = javaVersion:
let let
javaVersionPlatform = "${javaVersion}-${platform}"; javaVersionPlatform = "${javaVersion}-${platform}";
@ -67,24 +82,24 @@ let
]; ];
buildInputs = lib.optionals stdenv.isLinux [ buildInputs = lib.optionals stdenv.isLinux [
zlib alsaLib # libasound.so wanted by lib/libjsound.so
fontconfig fontconfig
freetype freetype
openssl # libssl.so wanted by languages/ruby/lib/mri/openssl.so
stdenv.cc.cc.lib # libstdc++.so.6
xorg.libX11 xorg.libX11
xorg.libXext
xorg.libXi xorg.libXi
xorg.libXrender xorg.libXrender
xorg.libXext
xorg.libXtst xorg.libXtst
stdenv.cc.cc.lib # libstdc++.so.6 zlib
alsaLib # libasound.so wanted by lib/libjsound.so
openssl # libssl.so wanted by languages/ruby/lib/mri/openssl.so
]; ];
# Workaround for libssl.so.10 wanted by TruffleRuby # Workaround for libssl.so.10 wanted by TruffleRuby
# Resulting TruffleRuby cannot use `openssl` library. # Resulting TruffleRuby cannot use `openssl` library.
autoPatchelfIgnoreMissingDeps = true; autoPatchelfIgnoreMissingDeps = true;
nativeBuildInputs = [ unzip perl autoPatchelfHook ]; nativeBuildInputs = [ unzip perl autoPatchelfHook makeWrapper ];
unpackPhase = '' unpackPhase = ''
unpack_jar() { unpack_jar() {
@ -171,8 +186,17 @@ let
dontStrip = true; dontStrip = true;
# copy-paste openjdk's preFixup
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. # Set JAVA_HOME automatically.
mkdir -p $out/nix-support mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook cat <<EOF > $out/nix-support/setup-hook