fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ stdenv, fetchurl, makeDesktopItem, makeWrapper, patchelf
2, dbus_libs, gcc, glib, libdrm, libffi, libICE, libSM
3, libX11, libXmu, ncurses, popt, qt5, zlib
4, qtbase, qtdeclarative, qtwebkit
5}:
6
7# this package contains the daemon version of dropbox
8# it's unfortunately closed source
9#
10# note: the resulting program has to be invoced as
11# 'dropbox' because the internal python engine takes
12# uses the name of the program as starting point.
13
14# Dropbox ships with its own copies of some libraries.
15# Unfortunately, upstream makes changes to the source of
16# some libraries, rendering them incompatible with the
17# open-source versions. Wherever possible, we must try
18# to make the bundled libraries work, rather than replacing
19# them with our own.
20
21let
22 # NOTE: When updating, please also update in current stable, as older versions stop working
23 version = "3.12.6";
24 sha256 =
25 {
26 "x86_64-linux" = "16d0g9bygvaixv4r42p72z6a6wqhkf5qzb058lijih93zjr8zjlj";
27 "i686-linux" = "1pgqz6axzzyaahql01g0l80an39hd9j4dnq0vfavwvb2qkb27dph";
28 }."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
29
30 arch =
31 {
32 "x86_64-linux" = "x86_64";
33 "i686-linux" = "x86";
34 }."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
35
36 # relative location where the dropbox libraries are stored
37 appdir = "opt/dropbox";
38
39 ldpath = stdenv.lib.makeSearchPath "lib"
40 [
41 dbus_libs gcc.cc glib libdrm libffi libICE libSM libX11 libXmu
42 ncurses popt qtbase qtdeclarative qtwebkit zlib
43 ];
44
45 desktopItem = makeDesktopItem {
46 name = "dropbox";
47 exec = "dropbox";
48 comment = "Sync your files across computers and to the web";
49 desktopName = "Dropbox";
50 genericName = "File Synchronizer";
51 categories = "Network;FileTransfer;";
52 startupNotify = "false";
53 };
54
55in stdenv.mkDerivation {
56 name = "dropbox-${version}";
57 src = fetchurl {
58 name = "dropbox-${version}.tar.gz";
59 url = "https://dl-web.dropbox.com/u/17/dropbox-lnx.${arch}-${version}.tar.gz";
60 inherit sha256;
61 };
62
63 sourceRoot = ".dropbox-dist";
64
65 buildInputs = [ makeWrapper patchelf ];
66 dontPatchELF = true; # patchelf invoked explicitly below
67 dontStrip = true; # already done
68
69 installPhase = ''
70 mkdir -p "$out/${appdir}"
71 cp -r "dropbox-lnx.${arch}-${version}"/* "$out/${appdir}/"
72
73 rm "$out/${appdir}/libdrm.so.2"
74 rm "$out/${appdir}/libffi.so.6"
75 rm "$out/${appdir}/libicudata.so.42"
76 rm "$out/${appdir}/libicui18n.so.42"
77 rm "$out/${appdir}/libicuuc.so.42"
78 rm "$out/${appdir}/libGL.so.1"
79 rm "$out/${appdir}/libpopt.so.0"
80 rm "$out/${appdir}/libQt5Core.so.5"
81 rm "$out/${appdir}/libQt5DBus.so.5"
82 rm "$out/${appdir}/libQt5Gui.so.5"
83 rm "$out/${appdir}/libQt5Network.so.5"
84 rm "$out/${appdir}/libQt5OpenGL.so.5"
85 rm "$out/${appdir}/libQt5PrintSupport.so.5"
86 rm "$out/${appdir}/libQt5Qml.so.5"
87 rm "$out/${appdir}/libQt5Quick.so.5"
88 rm "$out/${appdir}/libQt5Sql.so.5"
89 rm "$out/${appdir}/libQt5WebKit.so.5"
90 rm "$out/${appdir}/libQt5WebKitWidgets.so.5"
91 rm "$out/${appdir}/libQt5Widgets.so.5"
92 rm "$out/${appdir}/libX11-xcb.so.1"
93
94 rm "$out/${appdir}/qt.conf"
95 rm -fr "$out/${appdir}/plugins"
96
97 mkdir -p "$out/share/applications"
98 cp "${desktopItem}/share/applications/"* $out/share/applications
99
100 mkdir -p "$out/share/icons"
101 ln -s "$out/${appdir}/images/hicolor" "$out/share/icons/hicolor"
102
103 mkdir -p "$out/bin"
104 RPATH="${ldpath}:$out/${appdir}"
105 makeWrapper "$out/${appdir}/dropbox" "$out/bin/dropbox" \
106 --prefix LD_LIBRARY_PATH : "$RPATH"
107 '';
108
109 fixupPhase = ''
110 INTERP=$(cat $NIX_CC/nix-support/dynamic-linker)
111 RPATH="${ldpath}:$out/${appdir}"
112 getType='s/ *Type: *\([A-Z]*\) (.*/\1/'
113 find "$out/${appdir}" -type f -a -perm -0100 -print | while read obj; do
114 dynamic=$(readelf -S "$obj" 2>/dev/null | grep "DYNAMIC" || true)
115
116 if [[ -n "$dynamic" ]]; then
117 type=$(readelf -h "$obj" 2>/dev/null | grep 'Type:' | sed -e "$getType")
118
119 if [[ "$type" == "EXEC" ]]; then
120
121 echo "patching interpreter path in $type $obj"
122 patchelf --set-interpreter "$INTERP" "$obj"
123
124 echo "patching RPATH in $type $obj"
125 oldRPATH=$(patchelf --print-rpath "$obj")
126 patchelf --set-rpath "''${oldRPATH:+$oldRPATH:}$RPATH" "$obj"
127
128 echo "shrinking RPATH in $type $obj"
129 patchelf --shrink-rpath "$obj"
130
131 elif [[ "$type" == "DYN" ]]; then
132
133 echo "patching RPATH in $type $obj"
134 oldRPATH=$(patchelf --print-rpath "$obj")
135 patchelf --set-rpath "''${oldRPATH:+$oldRPATH:}$RPATH" "$obj"
136
137 echo "shrinking RPATH in $type $obj"
138 patchelf --shrink-rpath "$obj"
139
140 else
141
142 echo "unknown ELF type \"$type\"; not patching $obj"
143
144 fi
145 fi
146 done
147 '';
148
149 meta = {
150 homepage = "http://www.dropbox.com";
151 description = "Online stored folders (daemon version)";
152 maintainers = with stdenv.lib.maintainers; [ ttuegel ];
153 platforms = [ "i686-linux" "x86_64-linux" ];
154 };
155}