tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
dropbox: prepare for Qt upgrade
Thomas Tuegel
10 years ago
d8d5e986
f998d502
+58
-30
2 changed files
expand all
collapse all
unified
split
pkgs
applications
networking
dropbox
default.nix
top-level
all-packages.nix
+53
-29
pkgs/applications/networking/dropbox/default.nix
···
1
1
-
{ stdenv, fetchurl, makeDesktopItem, makeWrapper
1
1
+
{ stdenv, fetchurl, makeDesktopItem, makeWrapper, patchelf
2
2
, dbus_libs, gcc, glib, libdrm, libffi, libICE, libSM
3
3
, libX11, libXmu, ncurses, popt, qt5, zlib
4
4
, qtbase, qtdeclarative, qtwebkit
···
33
33
"i686-linux" = "x86";
34
34
}."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
35
35
36
36
-
interpreter =
37
37
-
{
38
38
-
"x86_64-linux" = "ld-linux-x86-64.so.2";
39
39
-
"i686-linux" = "ld-linux.so.2";
40
40
-
}."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
41
41
-
42
36
# relative location where the dropbox libraries are stored
43
37
appdir = "opt/dropbox";
44
38
45
39
ldpath = stdenv.lib.makeSearchPath "lib"
46
40
[
47
47
-
dbus_libs gcc glib libdrm libffi libICE libSM libX11
48
48
-
libXmu ncurses popt qtbase qtdeclarative qtwebkit
49
49
-
zlib
41
41
+
dbus_libs gcc.cc glib libdrm libffi libICE libSM libX11 libXmu
42
42
+
ncurses popt qtbase qtdeclarative qtwebkit zlib
50
43
];
51
44
52
45
desktopItem = makeDesktopItem {
···
59
52
};
60
53
61
54
in stdenv.mkDerivation {
62
62
-
name = "dropbox-${version}-bin";
55
55
+
name = "dropbox-${version}";
63
56
src = fetchurl {
64
57
name = "dropbox-${version}.tar.gz";
65
58
url = "https://dl-web.dropbox.com/u/17/dropbox-lnx.${arch}-${version}.tar.gz";
66
59
inherit sha256;
67
60
};
68
61
69
69
-
sourceRoot = ".";
62
62
+
sourceRoot = ".dropbox-dist";
70
63
71
71
-
patchPhase = ''
72
72
-
rm -f .dropbox-dist/dropboxd
73
73
-
'';
74
74
-
75
75
-
buildInputs = [ makeWrapper ];
64
64
+
buildInputs = [ makeWrapper patchelf ];
65
65
+
dontPatchELF = true; # patchelf invoked explicitly below
66
66
+
dontStrip = true; # already done
76
67
77
68
installPhase = ''
78
69
mkdir -p "$out/${appdir}"
79
79
-
cp -r ".dropbox-dist/dropbox-lnx.${arch}-${version}"/* "$out/${appdir}/"
70
70
+
cp -r "dropbox-lnx.${arch}-${version}"/* "$out/${appdir}/"
80
71
81
72
rm "$out/${appdir}/libdrm.so.2"
82
73
rm "$out/${appdir}/libffi.so.6"
···
102
93
rm "$out/${appdir}/qt.conf"
103
94
rm -fr "$out/${appdir}/plugins"
104
95
105
105
-
find "$out/${appdir}" -type f -a -perm -0100 \
106
106
-
-print -exec patchelf --set-interpreter ${stdenv.glibc}/lib/${interpreter} {} \;
107
107
-
108
108
-
RPATH=${ldpath}:${gcc.cc}/lib:$out/${appdir}
109
109
-
echo "updating rpaths to: $RPATH"
110
110
-
find "$out/${appdir}" -type f -a -perm -0100 \
111
111
-
-print -exec patchelf --force-rpath --set-rpath "$RPATH" {} \;
112
112
-
113
96
mkdir -p "$out/share/applications"
114
97
cp "${desktopItem}/share/applications/"* $out/share/applications
98
98
+
99
99
+
mkdir -p "$out/share/icons"
100
100
+
ln -s "$out/${appdir}/images/hicolor" "$out/share/icons/hicolor"
115
101
116
102
mkdir -p "$out/bin"
103
103
+
RPATH="${ldpath}:$out/${appdir}"
117
104
makeWrapper "$out/${appdir}/dropbox" "$out/bin/dropbox" \
118
118
-
--prefix LD_LIBRARY_PATH : "${ldpath}"
105
105
+
--prefix LD_LIBRARY_PATH : "$RPATH"
106
106
+
'';
119
107
120
120
-
mkdir -p "$out/share/icons"
121
121
-
ln -s "$out/${appdir}/images/hicolor" "$out/share/icons/hicolor"
108
108
+
fixupPhase = ''
109
109
+
INTERP=$(cat $NIX_CC/nix-support/dynamic-linker)
110
110
+
RPATH="${ldpath}:$out/${appdir}"
111
111
+
getType='s/ *Type: *\([A-Z]*\) (.*/\1/'
112
112
+
find "$out/${appdir}" -type f -a -perm -0100 -print | while read obj; do
113
113
+
dynamic=$(readelf -S "$obj" 2>/dev/null | grep "DYNAMIC" || true)
114
114
+
115
115
+
if [[ -n "$dynamic" ]]; then
116
116
+
type=$(readelf -h "$obj" 2>/dev/null | grep 'Type:' | sed -e "$getType")
117
117
+
118
118
+
if [[ "$type" == "EXEC" ]]; then
119
119
+
120
120
+
echo "patching interpreter path in $type $obj"
121
121
+
patchelf --set-interpreter "$INTERP" "$obj"
122
122
+
123
123
+
echo "patching RPATH in $type $obj"
124
124
+
oldRPATH=$(patchelf --print-rpath "$obj")
125
125
+
patchelf --set-rpath "''${oldRPATH:+$oldRPATH:}$RPATH" "$obj"
126
126
+
127
127
+
echo "shrinking RPATH in $type $obj"
128
128
+
patchelf --shrink-rpath "$obj"
129
129
+
130
130
+
elif [[ "$type" == "DYN" ]]; then
131
131
+
132
132
+
echo "patching RPATH in $type $obj"
133
133
+
oldRPATH=$(patchelf --print-rpath "$obj")
134
134
+
patchelf --set-rpath "''${oldRPATH:+$oldRPATH:}$RPATH" "$obj"
135
135
+
136
136
+
echo "shrinking RPATH in $type $obj"
137
137
+
patchelf --shrink-rpath "$obj"
138
138
+
139
139
+
else
140
140
+
141
141
+
echo "unknown ELF type \"$type\"; not patching $obj"
142
142
+
143
143
+
fi
144
144
+
fi
145
145
+
done
122
146
'';
123
147
124
148
meta = {
+5
-1
pkgs/top-level/all-packages.nix
···
12681
12681
12682
12682
copy-com = callPackage ../applications/networking/copy-com { };
12683
12683
12684
12684
-
dropbox = qt5Libs.callPackage ../applications/networking/dropbox { };
12684
12684
+
dropbox = callPackage ../applications/networking/dropbox {
12685
12685
+
qtbase = qt5.base;
12686
12686
+
qtdeclarative = qt5.declarative;
12687
12687
+
qtwebkit = qt5.webkit;
12688
12688
+
};
12685
12689
12686
12690
dropbox-cli = callPackage ../applications/networking/dropbox-cli { };
12687
12691