git.iko.soy/typeable/nixpkgs
on master help sign in
dropbox: prepare for Qt upgrade
commitd8d5e9868cecd03e7a8e73208e019d79f1376ed8 authorThomas Tuegel <ttuegel@gmail.com> dateSun 27 Sep 2015, 12:14 (11 years ago) parentf998d50
2 files changed+58−30
pkgs/applications/networking/dropbox/default.nix+53−29 pkgs/top-level/all-packages.nix+5−1
pkgs/applications/networking/dropbox/default.nix+53−29
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, makeDesktopItem, makeWrapper
1+{ stdenv, fetchurl, makeDesktopItem, makeWrapper, patchelf
22, dbus_libs, gcc, glib, libdrm, libffi, libICE, libSM
33, libX11, libXmu, ncurses, popt, qt5, zlib
44, qtbase, qtdeclarative, qtwebkit
@@ -33,20 +33,13 @@ let
3333 "i686-linux" = "x86";
3434 }."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
3535
36− interpreter =
37− {
38− "x86_64-linux" = "ld-linux-x86-64.so.2";
39− "i686-linux" = "ld-linux.so.2";
40− }."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
41−
4236 # relative location where the dropbox libraries are stored
4337 appdir = "opt/dropbox";
4438
4539 ldpath = stdenv.lib.makeSearchPath "lib"
4640 [
47− dbus_libs gcc glib libdrm libffi libICE libSM libX11
48− libXmu ncurses popt qtbase qtdeclarative qtwebkit
49− zlib
41+ dbus_libs gcc.cc glib libdrm libffi libICE libSM libX11 libXmu
42+ ncurses popt qtbase qtdeclarative qtwebkit zlib
5043 ];
5144
5245 desktopItem = makeDesktopItem {
@@ -59,24 +52,22 @@ let
5952 };
6053
6154in stdenv.mkDerivation {
62− name = "dropbox-${version}-bin";
55+ name = "dropbox-${version}";
6356 src = fetchurl {
6457 name = "dropbox-${version}.tar.gz";
6558 url = "https://dl-web.dropbox.com/u/17/dropbox-lnx.${arch}-${version}.tar.gz";
6659 inherit sha256;
6760 };
6861
69− sourceRoot = ".";
62+ sourceRoot = ".dropbox-dist";
7063
71− patchPhase = ''
72− rm -f .dropbox-dist/dropboxd
73− '';
74−
75− buildInputs = [ makeWrapper ];
64+ buildInputs = [ makeWrapper patchelf ];
65+ dontPatchELF = true; # patchelf invoked explicitly below
66+ dontStrip = true; # already done
7667
7768 installPhase = ''
7869 mkdir -p "$out/${appdir}"
79− cp -r ".dropbox-dist/dropbox-lnx.${arch}-${version}"/* "$out/${appdir}/"
70+ cp -r "dropbox-lnx.${arch}-${version}"/* "$out/${appdir}/"
8071
8172 rm "$out/${appdir}/libdrm.so.2"
8273 rm "$out/${appdir}/libffi.so.6"
@@ -102,23 +93,56 @@ in stdenv.mkDerivation {
10293 rm "$out/${appdir}/qt.conf"
10394 rm -fr "$out/${appdir}/plugins"
10495
105− find "$out/${appdir}" -type f -a -perm -0100 \
106− -print -exec patchelf --set-interpreter ${stdenv.glibc}/lib/${interpreter} {} \;
107−
108− RPATH=${ldpath}:${gcc.cc}/lib:$out/${appdir}
109− echo "updating rpaths to: $RPATH"
110− find "$out/${appdir}" -type f -a -perm -0100 \
111− -print -exec patchelf --force-rpath --set-rpath "$RPATH" {} \;
112−
11396 mkdir -p "$out/share/applications"
11497 cp "${desktopItem}/share/applications/"* $out/share/applications
11598
99+ mkdir -p "$out/share/icons"
100+ ln -s "$out/${appdir}/images/hicolor" "$out/share/icons/hicolor"
101+
116102 mkdir -p "$out/bin"
103+ RPATH="${ldpath}:$out/${appdir}"
117104 makeWrapper "$out/${appdir}/dropbox" "$out/bin/dropbox" \
118− --prefix LD_LIBRARY_PATH : "${ldpath}"
105+ --prefix LD_LIBRARY_PATH : "$RPATH"
106+ '';
119107
120− mkdir -p "$out/share/icons"
121− ln -s "$out/${appdir}/images/hicolor" "$out/share/icons/hicolor"
108+ fixupPhase = ''
109+ INTERP=$(cat $NIX_CC/nix-support/dynamic-linker)
110+ RPATH="${ldpath}:$out/${appdir}"
111+ getType='s/ *Type: *\([A-Z]*\) (.*/\1/'
112+ find "$out/${appdir}" -type f -a -perm -0100 -print | while read obj; do
113+ dynamic=$(readelf -S "$obj" 2>/dev/null | grep "DYNAMIC" || true)
114+
115+ if [[ -n "$dynamic" ]]; then
116+ type=$(readelf -h "$obj" 2>/dev/null | grep 'Type:' | sed -e "$getType")
117+
118+ if [[ "$type" == "EXEC" ]]; then
119+
120+ echo "patching interpreter path in $type $obj"
121+ patchelf --set-interpreter "$INTERP" "$obj"
122+
123+ echo "patching RPATH in $type $obj"
124+ oldRPATH=$(patchelf --print-rpath "$obj")
125+ patchelf --set-rpath "''${oldRPATH:+$oldRPATH:}$RPATH" "$obj"
126+
127+ echo "shrinking RPATH in $type $obj"
128+ patchelf --shrink-rpath "$obj"
129+
130+ elif [[ "$type" == "DYN" ]]; then
131+
132+ echo "patching RPATH in $type $obj"
133+ oldRPATH=$(patchelf --print-rpath "$obj")
134+ patchelf --set-rpath "''${oldRPATH:+$oldRPATH:}$RPATH" "$obj"
135+
136+ echo "shrinking RPATH in $type $obj"
137+ patchelf --shrink-rpath "$obj"
138+
139+ else
140+
141+ echo "unknown ELF type \"$type\"; not patching $obj"
142+
143+ fi
144+ fi
145+ done
122146 '';
123147
124148 meta = {
pkgs/top-level/all-packages.nix+5−1
@@ -12681,7 +12681,11 @@ let
1268112681
1268212682 copy-com = callPackage ../applications/networking/copy-com { };
1268312683
12684− dropbox = qt5Libs.callPackage ../applications/networking/dropbox { };
12684+ dropbox = callPackage ../applications/networking/dropbox {
12685+ qtbase = qt5.base;
12686+ qtdeclarative = qt5.declarative;
12687+ qtwebkit = qt5.webkit;
12688+ };
1268512689
1268612690 dropbox-cli = callPackage ../applications/networking/dropbox-cli { };
1268712691