From 5864dfb51319a14cde0bea8a55a6a0b181535afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Min=C3=A1=C5=99?= Date: Sun, 23 Jun 2019 16:08:52 +0200 Subject: [PATCH 1/3] megasync: init at 4.1.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Minář --- maintainers/maintainer-list.nix | 5 + pkgs/applications/misc/megasync/default.nix | 143 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 150 insertions(+) create mode 100644 pkgs/applications/misc/megasync/default.nix diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 10d3447af618..266522ab469d 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -3278,6 +3278,11 @@ github = "michelk"; name = "Michel Kuhlmann"; }; + michojel = { + email = "mic.liamg@gmail.com"; + github = "michojel"; + name = "Michal Minář"; + }; mickours = { email = "mickours@gmail.com<"; github = "mickours"; diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix new file mode 100644 index 000000000000..a04370f3acdb --- /dev/null +++ b/pkgs/applications/misc/megasync/default.nix @@ -0,0 +1,143 @@ +{ lib +, stdenv +, autoconf +, automake +, bash +, bashInteractive +, c-ares +, cryptopp +, curl +, doxygen +, fetchFromGitHub +, hicolor-icon-theme +, libmediainfo +, libraw +, libsodium +, libtool +, libuv +, libzen +, lsb-release +, makeDesktopItem +, pkgconfig +, qt5 +, sqlite +, swig +, unzip +, wget +, enableFFmpeg ? true, ffmpeg ? ffmpeg +}: + +assert enableFFmpeg -> ffmpeg != null; + +stdenv.mkDerivation rec { + name = "megasync-${version}"; + version = "4.1.1.0"; + + src = fetchFromGitHub { + owner = "meganz"; + repo = "MEGAsync"; + rev = "v${version}_Linux"; + sha256 = "0lc228q3s9xp78dxjn22g6anqlsy1hi7a6yfs4q3l6gyfc3qcxl2"; + fetchSubmodules = true; + }; + + desktopItem = makeDesktopItem { + name = "megasync"; + exec = "megasync"; + icon = "megasync"; + comment = meta.description; + desktopName = "MEGASync"; + genericName = "File Synchronizer"; + categories = "Network;FileTransfer;"; + startupNotify = "false"; + }; + + nativeBuildInputs = [ + autoconf + automake + doxygen + lsb-release + pkgconfig + qt5.qmake + qt5.qttools + swig + ]; + buildInputs = [ + c-ares + cryptopp + curl + #freeimage # unreferenced + hicolor-icon-theme + libmediainfo + libraw + libsodium + libtool + libuv + libzen + qt5.qtbase + qt5.qtsvg + sqlite + unzip + wget + ] ++ stdenv.lib.optionals enableFFmpeg [ ffmpeg ]; + + patchPhase = '' + for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do + substituteInPlace "$file" \ + --replace "/bin/bash" "${bashInteractive}/bin/bash" + done + ''; + + preConfigure = '' + cd src/MEGASync/mega + ./autogen.sh + ''; + + configureScript = "./configure"; + + configureFlags = [ + "--disable-examples" + "--disable-java" + "--disable-php" + "--enable-chat" + "--with-cares" + "--with-cryptopp" + "--with-curl" + "--without-freeimage" # unreferenced even when found + "--without-readline" + "--without-termcap" + "--with-sodium" + "--with-sqlite" + "--with-zlib" + ] ++ stdenv.lib.optionals enableFFmpeg ["--with-ffmpeg"]; + + # TODO: unless overriden, qmake is called instead ?? + configurePhase = '' + runHook preConfigure + ./configure ${toString configureFlags} + runHook postConfigure + ''; + + postConfigure = "cd ../.."; + + preBuild = '' + qmake CONFIG+="release" MEGA.pro + lrelease MEGASync/MEGASync.pro + ''; + + # TODO: install bindings + 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; { + description = "Easy automated syncing between your computers and your MEGA Cloud Drive"; + homepage = https://mega.nz/; + license = licenses.free; + platforms = [ "i686-linux" "x86_64-linux" ]; + maintainers = [ maintainers.michojel ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2090543ba942..9ec6334a5a50 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1695,6 +1695,8 @@ in massren = callPackage ../tools/misc/massren { }; + megasync = callPackage ../applications/misc/megasync { }; + meritous = callPackage ../games/meritous { }; opendune = callPackage ../games/opendune { }; From 6877159dc0cbd066d233d93c92b47e0f9d87eac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Min=C3=A1=C5=99?= Date: Mon, 24 Jun 2019 16:19:48 +0200 Subject: [PATCH 2/3] addressed comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ditched configurePhase and installPhase - ffmpeg no longer optional Signed-off-by: Michal Minář --- pkgs/applications/misc/megasync/default.nix | 66 ++++++++------------- 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index a04370f3acdb..c8c49d7b5d71 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -1,14 +1,12 @@ -{ lib -, stdenv +{ stdenv , autoconf , automake -, bash -, bashInteractive , c-ares , cryptopp , curl , doxygen , fetchFromGitHub +, ffmpeg , hicolor-icon-theme , libmediainfo , libraw @@ -17,18 +15,14 @@ , libuv , libzen , lsb-release -, makeDesktopItem , pkgconfig , qt5 , sqlite , swig , unzip , wget -, enableFFmpeg ? true, ffmpeg ? ffmpeg }: -assert enableFFmpeg -> ffmpeg != null; - stdenv.mkDerivation rec { name = "megasync-${version}"; version = "4.1.1.0"; @@ -41,17 +35,6 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; - desktopItem = makeDesktopItem { - name = "megasync"; - exec = "megasync"; - icon = "megasync"; - comment = meta.description; - desktopName = "MEGASync"; - genericName = "File Synchronizer"; - categories = "Network;FileTransfer;"; - startupNotify = "false"; - }; - nativeBuildInputs = [ autoconf automake @@ -66,7 +49,7 @@ stdenv.mkDerivation rec { c-ares cryptopp curl - #freeimage # unreferenced + ffmpeg hicolor-icon-theme libmediainfo libraw @@ -79,22 +62,30 @@ stdenv.mkDerivation rec { sqlite unzip wget - ] ++ stdenv.lib.optionals enableFFmpeg [ ffmpeg ]; + ]; patchPhase = '' for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do - substituteInPlace "$file" \ - --replace "/bin/bash" "${bashInteractive}/bin/bash" + substituteInPlace "$file" --replace "/bin/bash" "${stdenv.shell}" 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 = '' cd src/MEGASync/mega ./autogen.sh ''; - configureScript = "./configure"; - configureFlags = [ "--disable-examples" "--disable-java" @@ -103,34 +94,25 @@ stdenv.mkDerivation rec { "--with-cares" "--with-cryptopp" "--with-curl" + "--with-ffmpeg" "--without-freeimage" # unreferenced even when found "--without-readline" "--without-termcap" "--with-sodium" "--with-sqlite" "--with-zlib" - ] ++ stdenv.lib.optionals enableFFmpeg ["--with-ffmpeg"]; + ]; - # TODO: unless overriden, qmake is called instead ?? - configurePhase = '' - runHook preConfigure - ./configure ${toString configureFlags} - runHook postConfigure + postConfigure = '' + cd ../.. ''; - postConfigure = "cd ../.."; - preBuild = '' qmake CONFIG+="release" MEGA.pro - lrelease MEGASync/MEGASync.pro - ''; - - # TODO: install bindings - 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 + pushd MEGASync + lrelease MEGASync.pro + DESKTOP_DESTDIR="$out" qmake PREFIX="$out" -o Makefile MEGASync.pro CONFIG+=release + popd ''; meta = with stdenv.lib; { From a2585fff238949c45d1f4bb4be0ffddb641b4eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Min=C3=A1=C5=99?= Date: Tue, 25 Jun 2019 04:23:47 +0200 Subject: [PATCH 3/3] reworked patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lincense free -> unfree enabled parallel build Signed-off-by: Michal Minář --- pkgs/applications/misc/megasync/default.nix | 22 +++++++++---------- .../misc/megasync/install-megasync.patch | 21 ++++++++++++++++++ .../megasync/noinstall-distro-version.patch | 13 +++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 pkgs/applications/misc/megasync/install-megasync.patch create mode 100644 pkgs/applications/misc/megasync/noinstall-distro-version.patch diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index c8c49d7b5d71..b3e739864171 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -64,22 +64,22 @@ stdenv.mkDerivation rec { wget ]; - patchPhase = '' + patches = [ + # Distro and version targets attempt to use lsb_release which is broken + # (see issue: https://github.com/NixOS/nixpkgs/issues/22729) + ./noinstall-distro-version.patch + # megasync target is not part of the install rule thanks to a commented block + ./install-megasync.patch + ]; + + postPatch = '' for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do substituteInPlace "$file" --replace "/bin/bash" "${stdenv.shell}" 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; + enableParallelBuilding = true; preConfigure = '' cd src/MEGASync/mega @@ -118,7 +118,7 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "Easy automated syncing between your computers and your MEGA Cloud Drive"; homepage = https://mega.nz/; - license = licenses.free; + license = licenses.unfree; platforms = [ "i686-linux" "x86_64-linux" ]; maintainers = [ maintainers.michojel ]; }; diff --git a/pkgs/applications/misc/megasync/install-megasync.patch b/pkgs/applications/misc/megasync/install-megasync.patch new file mode 100644 index 000000000000..7d8748528e7f --- /dev/null +++ b/pkgs/applications/misc/megasync/install-megasync.patch @@ -0,0 +1,21 @@ +Index: source/src/MEGASync/MEGASync.pro +=================================================================== +--- source.orig/src/MEGASync/MEGASync.pro ++++ source/src/MEGASync/MEGASync.pro +@@ -28,11 +28,11 @@ unix:!macx { + TARGET = megasync + + # Uncomment the following if "make install" doesn't copy megasync in /usr/bin directory +-# isEmpty(PREFIX) { +-# PREFIX = /usr +-# } +-# target.path = $$PREFIX/bin +-# INSTALLS += target ++ isEmpty(PREFIX) { ++ PREFIX = /usr ++ } ++ target.path = $$PREFIX/bin ++ INSTALLS += target + } + else { + TARGET = MEGAsync diff --git a/pkgs/applications/misc/megasync/noinstall-distro-version.patch b/pkgs/applications/misc/megasync/noinstall-distro-version.patch new file mode 100644 index 000000000000..bbf100737bc4 --- /dev/null +++ b/pkgs/applications/misc/megasync/noinstall-distro-version.patch @@ -0,0 +1,13 @@ +Index: source/src/MEGASync/platform/platform.pri +=================================================================== +--- source.orig/src/MEGASync/platform/platform.pri ++++ source/src/MEGASync/platform/platform.pri +@@ -37,7 +37,7 @@ unix:!macx { + system(command -v lsb_release): version.commands = lsb_release -rs > $$version.target + version.files = $$version.target + +- INSTALLS += distro version ++ # INSTALLS += distro version + + QT += dbus + SOURCES += $$PWD/linux/LinuxPlatform.cpp \