addressed comments

- ditched configurePhase and installPhase
- ffmpeg no longer optional

Signed-off-by: Michal Minář <mic.liamg@gmail.com>
This commit is contained in:
Michal Minář 2019-06-24 16:19:48 +02:00
parent 5864dfb513
commit 6877159dc0

View File

@ -1,14 +1,12 @@
{ lib { stdenv
, stdenv
, autoconf , autoconf
, automake , automake
, bash
, bashInteractive
, c-ares , c-ares
, cryptopp , cryptopp
, curl , curl
, doxygen , doxygen
, fetchFromGitHub , fetchFromGitHub
, ffmpeg
, hicolor-icon-theme , hicolor-icon-theme
, libmediainfo , libmediainfo
, libraw , libraw
@ -17,18 +15,14 @@
, libuv , libuv
, libzen , libzen
, lsb-release , lsb-release
, makeDesktopItem
, pkgconfig , pkgconfig
, qt5 , qt5
, sqlite , sqlite
, swig , swig
, unzip , unzip
, wget , wget
, enableFFmpeg ? true, ffmpeg ? ffmpeg
}: }:
assert enableFFmpeg -> ffmpeg != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "megasync-${version}"; name = "megasync-${version}";
version = "4.1.1.0"; version = "4.1.1.0";
@ -41,17 +35,6 @@ stdenv.mkDerivation rec {
fetchSubmodules = true; fetchSubmodules = true;
}; };
desktopItem = makeDesktopItem {
name = "megasync";
exec = "megasync";
icon = "megasync";
comment = meta.description;
desktopName = "MEGASync";
genericName = "File Synchronizer";
categories = "Network;FileTransfer;";
startupNotify = "false";
};
nativeBuildInputs = [ nativeBuildInputs = [
autoconf autoconf
automake automake
@ -66,7 +49,7 @@ stdenv.mkDerivation rec {
c-ares c-ares
cryptopp cryptopp
curl curl
#freeimage # unreferenced ffmpeg
hicolor-icon-theme hicolor-icon-theme
libmediainfo libmediainfo
libraw libraw
@ -79,22 +62,30 @@ stdenv.mkDerivation rec {
sqlite sqlite
unzip unzip
wget wget
] ++ stdenv.lib.optionals enableFFmpeg [ ffmpeg ]; ];
patchPhase = '' patchPhase = ''
for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do
substituteInPlace "$file" \ substituteInPlace "$file" --replace "/bin/bash" "${stdenv.shell}"
--replace "/bin/bash" "${bashInteractive}/bin/bash"
done done
# Distro and version targets attempt to use lsb_release which is broken
# (see issue: https://github.com/NixOS/nixpkgs/issues/22729)
substituteInPlace src/MEGASync/platform/platform.pri \
--replace "INSTALLS += distro" "# INSTALLS += distro"
# megasync target is not part of the install rule thanks to a commented block
sed -i '/#\s*isEmpty(PREFIX)/,/#\s*INSTALLS\s*+=\s*target/s/^\s*#//' \
src/MEGASync/MEGASync.pro
''; '';
dontUseQmakeConfigure = true;
preConfigure = '' preConfigure = ''
cd src/MEGASync/mega cd src/MEGASync/mega
./autogen.sh ./autogen.sh
''; '';
configureScript = "./configure";
configureFlags = [ configureFlags = [
"--disable-examples" "--disable-examples"
"--disable-java" "--disable-java"
@ -103,34 +94,25 @@ stdenv.mkDerivation rec {
"--with-cares" "--with-cares"
"--with-cryptopp" "--with-cryptopp"
"--with-curl" "--with-curl"
"--with-ffmpeg"
"--without-freeimage" # unreferenced even when found "--without-freeimage" # unreferenced even when found
"--without-readline" "--without-readline"
"--without-termcap" "--without-termcap"
"--with-sodium" "--with-sodium"
"--with-sqlite" "--with-sqlite"
"--with-zlib" "--with-zlib"
] ++ stdenv.lib.optionals enableFFmpeg ["--with-ffmpeg"]; ];
# TODO: unless overriden, qmake is called instead ?? postConfigure = ''
configurePhase = '' cd ../..
runHook preConfigure
./configure ${toString configureFlags}
runHook postConfigure
''; '';
postConfigure = "cd ../..";
preBuild = '' preBuild = ''
qmake CONFIG+="release" MEGA.pro qmake CONFIG+="release" MEGA.pro
lrelease MEGASync/MEGASync.pro pushd MEGASync
''; lrelease MEGASync.pro
DESKTOP_DESTDIR="$out" qmake PREFIX="$out" -o Makefile MEGASync.pro CONFIG+=release
# TODO: install bindings popd
installPhase = ''
mkdir -p $out/share/icons
install -Dm 755 MEGASync/megasync $out/bin/megasync
cp -r ${desktopItem}/share/applications $out/share
cp MEGASync/gui/images/uptodate.svg $out/share/icons/megasync.svg
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {