Merge pull request #107784 from taku0/jdk_gtk_look_and_feel
This commit is contained in:
commit
05b0e49fd9
@ -4,16 +4,31 @@ sourcePerArch:
|
||||
, lib
|
||||
, fetchurl
|
||||
, autoPatchelfHook
|
||||
, makeWrapper
|
||||
# minimum dependencies
|
||||
, alsaLib
|
||||
, freetype
|
||||
, fontconfig
|
||||
, zlib
|
||||
, xorg
|
||||
, freetype
|
||||
, libffi
|
||||
, xorg
|
||||
, zlib
|
||||
# runtime dependencies
|
||||
, cups
|
||||
# runtime dependencies for GTK+ Look and Feel
|
||||
, gtkSupport ? true
|
||||
, cairo
|
||||
, glib
|
||||
, gtk3
|
||||
}:
|
||||
|
||||
let
|
||||
cpuName = stdenv.hostPlatform.parsed.cpu.name;
|
||||
runtimeDependencies = [
|
||||
cups
|
||||
] ++ lib.optionals gtkSupport [
|
||||
cairo glib gtk3
|
||||
];
|
||||
runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
|
||||
in
|
||||
|
||||
let result = stdenv.mkDerivation rec {
|
||||
@ -28,11 +43,19 @@ let result = stdenv.mkDerivation rec {
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
alsaLib freetype fontconfig zlib xorg.libX11 xorg.libXext xorg.libXtst
|
||||
xorg.libXi xorg.libXrender stdenv.cc.cc.lib
|
||||
alsaLib # libasound.so wanted by lib/libjsound.so
|
||||
fontconfig
|
||||
freetype
|
||||
stdenv.cc.cc.lib # libstdc++.so.6
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXi
|
||||
xorg.libXrender
|
||||
xorg.libXtst
|
||||
zlib
|
||||
] ++ lib.optional stdenv.isAarch32 libffi;
|
||||
|
||||
nativeBuildInputs = [ autoPatchelfHook ];
|
||||
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
|
||||
|
||||
# See: https://github.com/NixOS/patchelf/issues/10
|
||||
dontStrip = 1;
|
||||
@ -57,6 +80,13 @@ let result = stdenv.mkDerivation rec {
|
||||
cat <<EOF >> "$out/nix-support/setup-hook"
|
||||
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||
EOF
|
||||
|
||||
# We cannot use -exec since wrapProgram is a function but not a command.
|
||||
for bin in $( find "$out" -executable -type f ); do
|
||||
if patchelf --print-interpreter "$bin" &> /dev/null; then
|
||||
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
|
@ -1,7 +1,37 @@
|
||||
{ lib, stdenv, fetchurl, perl, unzip, glibc, zlib, setJavaClassPath, Foundation, openssl }:
|
||||
{ stdenv
|
||||
, lib
|
||||
, fetchurl
|
||||
, autoPatchelfHook
|
||||
, setJavaClassPath
|
||||
, makeWrapper
|
||||
# minimum dependencies
|
||||
, Foundation
|
||||
, alsaLib
|
||||
, fontconfig
|
||||
, freetype
|
||||
, glibc
|
||||
, openssl
|
||||
, perl
|
||||
, 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}";
|
||||
@ -50,7 +80,27 @@ let
|
||||
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/wasm-installable-svm-java${javaVersionPlatform}-${version}.jar";
|
||||
})
|
||||
];
|
||||
nativeBuildInputs = [ unzip perl ];
|
||||
|
||||
buildInputs = lib.optionals stdenv.isLinux [
|
||||
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.libXtst
|
||||
zlib
|
||||
];
|
||||
|
||||
# Workaround for libssl.so.10 wanted by TruffleRuby
|
||||
# Resulting TruffleRuby cannot use `openssl` library.
|
||||
autoPatchelfIgnoreMissingDeps = true;
|
||||
|
||||
nativeBuildInputs = [ unzip perl autoPatchelfHook makeWrapper ];
|
||||
|
||||
unpackPhase = ''
|
||||
unpack_jar() {
|
||||
jar=$1
|
||||
@ -136,32 +186,25 @@ 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 <<EOF > $out/nix-support/setup-hook
|
||||
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||
EOF
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
rpath="${ { "8" = "$out/jre/lib/amd64/jli:$out/jre/lib/amd64/server:$out/jre/lib/amd64:$out/jre/languages/ruby/lib/cext";
|
||||
"11" = "$out/lib/jli:$out/lib/server:$out/lib:$out/languages/ruby/lib/cext";
|
||||
}.${javaVersion}
|
||||
}:${
|
||||
lib.makeLibraryPath [
|
||||
stdenv.cc.cc.lib # libstdc++.so.6
|
||||
zlib # libz.so.1
|
||||
]}"
|
||||
|
||||
${lib.optionalString stdenv.isLinux ''
|
||||
for f in $(find $out -type f -perm -0100); do
|
||||
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f" || true
|
||||
patchelf --set-rpath "$rpath" "$f" || true
|
||||
if ldd "$f" | fgrep 'not found'; then echo "in file $f"; fi
|
||||
done
|
||||
''}
|
||||
find "$out" -name libfontmanager.so -exec \
|
||||
patchelf --add-needed libfontconfig.so {} \;
|
||||
'';
|
||||
|
||||
# $out/bin/native-image needs zlib to build native executables.
|
||||
|
@ -1,7 +1,24 @@
|
||||
{ stdenv, lib, fetchurl, unzip, makeWrapper, setJavaClassPath
|
||||
, zulu, glib, libxml2, ffmpeg_3, libxslt, libGL, alsaLib
|
||||
, fontconfig, freetype, pango, gtk2, cairo, gdk-pixbuf, atk, xorg
|
||||
, swingSupport ? true }:
|
||||
{ stdenv
|
||||
, lib
|
||||
, fetchurl
|
||||
, autoPatchelfHook
|
||||
, unzip
|
||||
, makeWrapper
|
||||
, setJavaClassPath
|
||||
, zulu
|
||||
# minimum dependencies
|
||||
, alsaLib
|
||||
, fontconfig
|
||||
, freetype
|
||||
, xorg
|
||||
# runtime dependencies
|
||||
, cups
|
||||
# runtime dependencies for GTK+ Look and Feel
|
||||
, gtkSupport ? stdenv.isLinux
|
||||
, cairo
|
||||
, glib
|
||||
, gtk3
|
||||
}:
|
||||
|
||||
let
|
||||
version = "8.48.0.53";
|
||||
@ -14,14 +31,12 @@ let
|
||||
hash = if stdenv.isDarwin then sha256_darwin else sha256_linux;
|
||||
extension = if stdenv.isDarwin then "zip" else "tar.gz";
|
||||
|
||||
libraries = [
|
||||
stdenv.cc.libc glib libxml2 ffmpeg_3 libxslt libGL
|
||||
xorg.libXxf86vm alsaLib fontconfig freetype pango
|
||||
gtk2 cairo gdk-pixbuf atk
|
||||
] ++ (lib.optionals swingSupport (with xorg; [
|
||||
xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXp
|
||||
xorg.libXt xorg.libXrender stdenv.cc.cc
|
||||
]));
|
||||
runtimeDependencies = [
|
||||
cups
|
||||
] ++ lib.optionals gtkSupport [
|
||||
cairo glib gtk3
|
||||
];
|
||||
runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
inherit version openjdk platform hash extension;
|
||||
@ -33,26 +48,28 @@ in stdenv.mkDerivation {
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
buildInputs = [ makeWrapper ] ++ lib.optional stdenv.isDarwin unzip;
|
||||
buildInputs = lib.optionals stdenv.isLinux [
|
||||
alsaLib # libasound.so wanted by lib/libjsound.so
|
||||
fontconfig
|
||||
freetype
|
||||
stdenv.cc.cc # libstdc++.so.6
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXi
|
||||
xorg.libXrender
|
||||
xorg.libXtst
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook makeWrapper
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
unzip
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r ./* "$out/"
|
||||
|
||||
jrePath="$out/jre"
|
||||
|
||||
rpath=$rpath''${rpath:+:}$jrePath/lib/amd64/jli
|
||||
rpath=$rpath''${rpath:+:}$jrePath/lib/amd64/server
|
||||
rpath=$rpath''${rpath:+:}$jrePath/lib/amd64/xawt
|
||||
rpath=$rpath''${rpath:+:}$jrePath/lib/amd64
|
||||
|
||||
# set all the dynamic linkers
|
||||
find $out -type f -perm -0100 \
|
||||
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath "$rpath" {} \;
|
||||
|
||||
find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \;
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
|
||||
|
||||
@ -60,9 +77,19 @@ in stdenv.mkDerivation {
|
||||
cat <<EOF >> $out/nix-support/setup-hook
|
||||
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||
EOF
|
||||
'' + lib.optionalString stdenv.isLinux ''
|
||||
# We cannot use -exec since wrapProgram is a function but not a command.
|
||||
for bin in $( find "$out" -executable -type f ); do
|
||||
if patchelf --print-interpreter "$bin" &> /dev/null; then
|
||||
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
rpath = lib.strings.makeLibraryPath libraries;
|
||||
preFixup = ''
|
||||
find "$out" -name libfontmanager.so -exec \
|
||||
patchelf --add-needed libfontconfig.so {} \;
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
home = zulu;
|
||||
|
@ -1,7 +1,25 @@
|
||||
{ stdenv, lib, fetchurl, unzip, makeWrapper, setJavaClassPath
|
||||
, zulu, glib, libxml2, ffmpeg_3, libxslt, libGL, alsaLib
|
||||
, fontconfig, freetype, pango, gtk2, cairo, gdk-pixbuf, atk, xorg, zlib
|
||||
, swingSupport ? true }:
|
||||
{ stdenv
|
||||
, lib
|
||||
, fetchurl
|
||||
, autoPatchelfHook
|
||||
, unzip
|
||||
, makeWrapper
|
||||
, setJavaClassPath
|
||||
, zulu
|
||||
# minimum dependencies
|
||||
, alsaLib
|
||||
, fontconfig
|
||||
, freetype
|
||||
, zlib
|
||||
, xorg
|
||||
# runtime dependencies
|
||||
, cups
|
||||
# runtime dependencies for GTK+ Look and Feel
|
||||
, gtkSupport ? stdenv.isLinux
|
||||
, cairo
|
||||
, glib
|
||||
, gtk3
|
||||
}:
|
||||
|
||||
let
|
||||
version = "11.41.23";
|
||||
@ -14,14 +32,12 @@ let
|
||||
hash = if stdenv.isDarwin then sha256_darwin else sha256_linux;
|
||||
extension = if stdenv.isDarwin then "zip" else "tar.gz";
|
||||
|
||||
libraries = [
|
||||
stdenv.cc.libc glib libxml2 ffmpeg_3 libxslt libGL
|
||||
xorg.libXxf86vm alsaLib fontconfig freetype pango
|
||||
gtk2 cairo gdk-pixbuf atk zlib
|
||||
] ++ (lib.optionals swingSupport (with xorg; [
|
||||
xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXp
|
||||
xorg.libXt xorg.libXrender stdenv.cc.cc
|
||||
]));
|
||||
runtimeDependencies = [
|
||||
cups
|
||||
] ++ lib.optionals gtkSupport [
|
||||
cairo glib gtk3
|
||||
];
|
||||
runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
inherit version openjdk platform hash extension;
|
||||
@ -33,23 +49,29 @@ in stdenv.mkDerivation {
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
buildInputs = [ makeWrapper ] ++ lib.optional stdenv.isDarwin unzip;
|
||||
buildInputs = lib.optionals stdenv.isLinux [
|
||||
alsaLib # libasound.so wanted by lib/libjsound.so
|
||||
fontconfig
|
||||
freetype
|
||||
stdenv.cc.cc # libstdc++.so.6
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXi
|
||||
xorg.libXrender
|
||||
xorg.libXtst
|
||||
zlib
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook makeWrapper
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
unzip
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r ./* "$out/"
|
||||
|
||||
rpath=$rpath''${rpath:+:}$out/lib/jli
|
||||
rpath=$rpath''${rpath:+:}$out/lib/server
|
||||
rpath=$rpath''${rpath:+:}$out/lib
|
||||
|
||||
# set all the dynamic linkers
|
||||
find $out -type f -perm -0100 \
|
||||
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath "$rpath" {} \;
|
||||
|
||||
find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \;
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
|
||||
|
||||
@ -57,9 +79,17 @@ in stdenv.mkDerivation {
|
||||
cat <<EOF >> $out/nix-support/setup-hook
|
||||
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||
EOF
|
||||
'' + lib.optionalString stdenv.isLinux ''
|
||||
# We cannot use -exec since wrapProgram is a function but not a command.
|
||||
for bin in $( find "$out" -executable -type f ); do
|
||||
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
|
||||
done
|
||||
'';
|
||||
|
||||
rpath = lib.strings.makeLibraryPath libraries;
|
||||
preFixup = ''
|
||||
find "$out" -name libfontmanager.so -exec \
|
||||
patchelf --add-needed libfontconfig.so {} \;
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
home = zulu;
|
||||
|
Loading…
Reference in New Issue
Block a user