@@ -1,14 +1,12 @@
1−{ lib
2−, stdenv
1+{ stdenv
32, autoconf
43, automake
5−, bash
6−, bashInteractive
74, c-ares
85, cryptopp
96, curl
107, doxygen
118, fetchFromGitHub
9+, ffmpeg
1210, hicolor-icon-theme
1311, libmediainfo
1412, libraw
@@ -17,18 +15,14 @@
1715, libuv
1816, libzen
1917, lsb-release
20−, makeDesktopItem
2118, pkgconfig
2219, qt5
2320, sqlite
2421, swig
2522, unzip
2623, wget
27−, enableFFmpeg ? true, ffmpeg ? ffmpeg
2824}:
2925
30−assert enableFFmpeg -> ffmpeg != null;
31−
3226stdenv.mkDerivation rec {
3327 name = "megasync-${version}";
3428 version = "4.1.1.0";
@@ -41,17 +35,6 @@ stdenv.mkDerivation rec {
4135 fetchSubmodules = true;
4236 };
4337
44− desktopItem = makeDesktopItem {
45− name = "megasync";
46− exec = "megasync";
47− icon = "megasync";
48− comment = meta.description;
49− desktopName = "MEGASync";
50− genericName = "File Synchronizer";
51− categories = "Network;FileTransfer;";
52− startupNotify = "false";
53− };
54−
5538 nativeBuildInputs = [
5639 autoconf
5740 automake
@@ -66,7 +49,7 @@ stdenv.mkDerivation rec {
6649 c-ares
6750 cryptopp
6851 curl
69− #freeimage # unreferenced
52+ ffmpeg
7053 hicolor-icon-theme
7154 libmediainfo
7255 libraw
@@ -79,22 +62,30 @@ stdenv.mkDerivation rec {
7962 sqlite
8063 unzip
8164 wget
82− ] ++ stdenv.lib.optionals enableFFmpeg [ ffmpeg ];
65+ ];
8366
8467 patchPhase = ''
8568 for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do
86− substituteInPlace "$file" \
87− --replace "/bin/bash" "${bashInteractive}/bin/bash"
69+ substituteInPlace "$file" --replace "/bin/bash" "${stdenv.shell}"
8870 done
71+
72+ # Distro and version targets attempt to use lsb_release which is broken
73+ # (see issue: https://github.com/NixOS/nixpkgs/issues/22729)
74+ substituteInPlace src/MEGASync/platform/platform.pri \
75+ --replace "INSTALLS += distro" "# INSTALLS += distro"
76+
77+ # megasync target is not part of the install rule thanks to a commented block
78+ sed -i '/#\s*isEmpty(PREFIX)/,/#\s*INSTALLS\s*+=\s*target/s/^\s*#//' \
79+ src/MEGASync/MEGASync.pro
8980 '';
9081
82+ dontUseQmakeConfigure = true;
83+
9184 preConfigure = ''
9285 cd src/MEGASync/mega
9386 ./autogen.sh
9487 '';
9588
96− configureScript = "./configure";
97−
9889 configureFlags = [
9990 "--disable-examples"
10091 "--disable-java"
@@ -103,34 +94,25 @@ stdenv.mkDerivation rec {
10394 "--with-cares"
10495 "--with-cryptopp"
10596 "--with-curl"
97+ "--with-ffmpeg"
10698 "--without-freeimage" # unreferenced even when found
10799 "--without-readline"
108100 "--without-termcap"
109101 "--with-sodium"
110102 "--with-sqlite"
111103 "--with-zlib"
112− ] ++ stdenv.lib.optionals enableFFmpeg ["--with-ffmpeg"];
104+ ];
113105
114− # TODO: unless overriden, qmake is called instead ??
115− configurePhase = ''
116− runHook preConfigure
117− ./configure ${toString configureFlags}
118− runHook postConfigure
106+ postConfigure = ''
107+ cd ../..
119108 '';
120109
121− postConfigure = "cd ../..";
122−
123110 preBuild = ''
124111 qmake CONFIG+="release" MEGA.pro
125− lrelease MEGASync/MEGASync.pro
126− '';
127−
128− # TODO: install bindings
129− installPhase = ''
130− mkdir -p $out/share/icons
131− install -Dm 755 MEGASync/megasync $out/bin/megasync
132− cp -r ${desktopItem}/share/applications $out/share
133− cp MEGASync/gui/images/uptodate.svg $out/share/icons/megasync.svg
112+ pushd MEGASync
113+ lrelease MEGASync.pro
114+ DESKTOP_DESTDIR="$out" qmake PREFIX="$out" -o Makefile MEGASync.pro CONFIG+=release
115+ popd
134116 '';
135117
136118 meta = with stdenv.lib; {