addressed comments

- ditched configurePhase and installPhase
- ffmpeg no longer optional

Signed-off-by: Michal Minář <mic.liamg@gmail.com>

+24 -42
+24 -42
pkgs/applications/misc/megasync/default.nix
··· 1 - { lib 2 - , stdenv 1 + { stdenv 3 2 , autoconf 4 3 , automake 5 - , bash 6 - , bashInteractive 7 4 , c-ares 8 5 , cryptopp 9 6 , curl 10 7 , doxygen 11 8 , fetchFromGitHub 9 + , ffmpeg 12 10 , hicolor-icon-theme 13 11 , libmediainfo 14 12 , libraw ··· 17 15 , libuv 18 16 , libzen 19 17 , lsb-release 20 - , makeDesktopItem 21 18 , pkgconfig 22 19 , qt5 23 20 , sqlite 24 21 , swig 25 22 , unzip 26 23 , wget 27 - , enableFFmpeg ? true, ffmpeg ? ffmpeg 28 24 }: 29 25 30 - assert enableFFmpeg -> ffmpeg != null; 31 - 32 26 stdenv.mkDerivation rec { 33 27 name = "megasync-${version}"; 34 28 version = "4.1.1.0"; ··· 41 35 fetchSubmodules = true; 42 36 }; 43 37 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 - 55 38 nativeBuildInputs = [ 56 39 autoconf 57 40 automake ··· 66 49 c-ares 67 50 cryptopp 68 51 curl 69 - #freeimage # unreferenced 52 + ffmpeg 70 53 hicolor-icon-theme 71 54 libmediainfo 72 55 libraw ··· 79 62 sqlite 80 63 unzip 81 64 wget 82 - ] ++ stdenv.lib.optionals enableFFmpeg [ ffmpeg ]; 65 + ]; 83 66 84 67 patchPhase = '' 85 68 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}" 88 70 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 89 80 ''; 90 81 82 + dontUseQmakeConfigure = true; 83 + 91 84 preConfigure = '' 92 85 cd src/MEGASync/mega 93 86 ./autogen.sh 94 87 ''; 95 - 96 - configureScript = "./configure"; 97 88 98 89 configureFlags = [ 99 90 "--disable-examples" ··· 103 94 "--with-cares" 104 95 "--with-cryptopp" 105 96 "--with-curl" 97 + "--with-ffmpeg" 106 98 "--without-freeimage" # unreferenced even when found 107 99 "--without-readline" 108 100 "--without-termcap" 109 101 "--with-sodium" 110 102 "--with-sqlite" 111 103 "--with-zlib" 112 - ] ++ stdenv.lib.optionals enableFFmpeg ["--with-ffmpeg"]; 104 + ]; 113 105 114 - # TODO: unless overriden, qmake is called instead ?? 115 - configurePhase = '' 116 - runHook preConfigure 117 - ./configure ${toString configureFlags} 118 - runHook postConfigure 106 + postConfigure = '' 107 + cd ../.. 119 108 ''; 120 109 121 - postConfigure = "cd ../.."; 122 - 123 110 preBuild = '' 124 111 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 134 116 ''; 135 117 136 118 meta = with stdenv.lib; {