Merge pull request #40703 from gnidorah/autopatchelf

franz, maxx: switch to autoPatchelfHook
This commit is contained in:
xeji 2018-05-18 18:20:51 +02:00 committed by GitHub
commit cfc016c7cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 32 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, makeDesktopItem, makeWrapper
{ stdenv, fetchurl, makeDesktopItem, makeWrapper, autoPatchelfHook
, xorg, gtk2, atk, glib, pango, gdk_pixbuf, cairo, freetype, fontconfig
, gnome2, dbus, nss, nspr, alsaLib, cups, expat, udev, libnotify, xdg_utils }:
@ -8,17 +8,6 @@ let
version = "4.0.4";
runtimeDeps = [
udev libnotify
];
deps = (with xorg; [
libXi libXcursor libXdamage libXrandr libXcomposite libXext libXfixes
libXrender libX11 libXtst libXScrnSaver
]) ++ [
gtk2 atk glib pango gdk_pixbuf cairo freetype fontconfig dbus
gnome2.GConf nss nspr alsaLib cups expat stdenv.cc.cc
] ++ runtimeDeps;
desktopItem = makeDesktopItem rec {
name = "Franz";
exec = name;
@ -39,16 +28,21 @@ in stdenv.mkDerivation rec {
# don't remove runtime deps
dontPatchELF = true;
buildInputs = [ makeWrapper ];
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
buildInputs = (with xorg; [
libXi libXcursor libXdamage libXrandr libXcomposite libXext libXfixes
libXrender libX11 libXtst libXScrnSaver
]) ++ [
gtk2 atk glib pango gdk_pixbuf cairo freetype fontconfig dbus
gnome2.GConf nss nspr alsaLib cups expat stdenv.cc.cc
];
runtimeDependencies = [ udev.lib libnotify ];
unpackPhase = ''
tar xzf $src
'';
installPhase = ''
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" Franz
patchelf --set-rpath "$out/opt/franz:${stdenv.lib.makeLibraryPath deps}" Franz
mkdir -p $out/bin $out/opt/franz
cp -r * $out/opt/franz
ln -s $out/opt/franz/Franz $out/bin

View File

@ -1,4 +1,5 @@
{ stdenv, fetchurl, makeWrapper, libredirect, gcc-unwrapped, bash, gtk-engine-murrine, gtk_engines, librsvg
{ stdenv, fetchurl, makeWrapper, autoPatchelfHook
, libredirect, gcc-unwrapped, bash, gtk-engine-murrine, gtk_engines, librsvg
, libX11, libXext, libXi, libXau, libXrender, libXft, libXmu, libSM, libXcomposite, libXfixes, libXpm
, libXinerama, libXdamage, libICE, libXtst, libXaw, fontconfig, pango, cairo, glib, libxml2, atk, gtk2
@ -9,11 +10,6 @@
let
version = "Indy-1.1.0";
deps = [
stdenv.cc.cc libX11 libXext libXi libXau libXrender libXft libXmu libSM libXcomposite libXfixes libXpm
libXinerama libXdamage libICE libXtst libXaw fontconfig pango cairo glib libxml2 atk gtk2
gdk_pixbuf libGL ncurses
];
runtime_deps = [
xclock xsettingsd
];
@ -31,7 +27,12 @@ in stdenv.mkDerivation {
})
];
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ makeWrapper autoPatchelfHook ];
buildInputs = [
stdenv.cc.cc libX11 libXext libXi libXau libXrender libXft libXmu libSM libXcomposite libXfixes libXpm
libXinerama libXdamage libICE libXtst libXaw fontconfig pango cairo glib libxml2 atk gtk2
gdk_pixbuf libGL ncurses
];
buildPhase = ''
while IFS= read -r -d ''$'\0' i; do
@ -58,15 +59,11 @@ in stdenv.mkDerivation {
--prefix PATH : ${stdenv.lib.makeBinPath runtime_deps}
while IFS= read -r -d ''$'\0' i; do
if isELF "$i"; then
bin=`patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i"; echo $?`
patchelf --set-rpath "$maxx/lib64:$maxx/OpenMotif-2.1.32/lib64:$maxx/OpenMotif-2.3.1/lib64:${stdenv.lib.makeLibraryPath deps}" "$i"
if [ "$bin" -eq 0 ]; then
wrapProgram "$i" \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS /opt/MaXX=$maxx \
--prefix PATH : $maxx/sbin
fi
if isExecutable "$i"; then
wrapProgram "$i" \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS /opt/MaXX=$maxx \
--prefix PATH : $maxx/sbin
fi
done < <(find "$maxx" -type f -print0)