Skip to content

Commit

Permalink
megasync: 4.9.1.0 -> 5.6.1.0 (NixOS#352162)
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegendeWurst authored Jan 1, 2025
2 parents 1c5eed9 + b0ad8ea commit c1372d0
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 108 deletions.
161 changes: 87 additions & 74 deletions pkgs/applications/misc/megasync/default.nix
Original file line number Diff line number Diff line change
@@ -1,75 +1,110 @@
{ lib
, stdenv
, autoconf
, automake
, c-ares
, cryptopp
, curl
, doxygen
, fetchFromGitHub
, ffmpeg
, libmediainfo
, libraw
, libsodium
, libtool
, libuv
, libzen
, lsb-release
, mkDerivation
, pkg-config
, qtbase
, qttools
, qtx11extras
, sqlite
, swig
, unzip
, wget
{
lib,
stdenv,
c-ares,
cmake,
cryptopp,
curl,
fetchFromGitHub,
fetchpatch,
ffmpeg,
hicolor-icon-theme,
icu,
libmediainfo,
libsodium,
libtool,
libuv,
libxcb,
libzen,
mkDerivation,
openssl,
pkg-config,
qtbase,
qtdeclarative,
qtgraphicaleffects,
qttools,
qtquickcontrols,
qtquickcontrols2,
qtsvg,
qtx11extras,
readline,
sqlite,
unzip,
wget,
xorg,
zlib,
qt5,
}:
mkDerivation rec {
pname = "megasync";
version = "4.9.1.0";
version = "5.6.1.0";

src = fetchFromGitHub {
src = fetchFromGitHub rec {
owner = "meganz";
repo = "MEGAsync";
rev = "v${version}_Linux";
hash = "sha256-Y1nfY5iP64iSCYwzqxbjZAQNHyj4yVbSudSInm+yJzY=";
fetchSubmodules = true;
hash = "sha256-EjXmx+beYH3J60RidkEbZHFS5ZAOpJKmNC+WCIM84RA=";
fetchSubmodules = false; # DesignTokensImporter cannot be fetched, see #1010 in github:meganz/megasync
leaveDotGit = true;
postFetch = ''
cd $out
git remote add origin $url
git fetch origin
git clean -fdx
git checkout ${rev}
git submodule update --init src/MEGASync/mega
rm -rf .git
''; # Why so complicated, I just want a single submodule
};

nativeBuildInputs = [
autoconf
automake
doxygen
cmake
libtool
lsb-release
pkg-config
qttools
swig
unzip
];
buildInputs = [
c-ares
cryptopp
curl
ffmpeg
hicolor-icon-theme
icu
libmediainfo
libraw
libsodium
libuv
libxcb
libzen
openssl
qtbase
qtdeclarative
qtgraphicaleffects
qtquickcontrols
qtquickcontrols2
qtsvg
qtx11extras
readline
sqlite
wget
zlib
];

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
(fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/020-megasync-sdk-fix-cmake-dependencies-detection.patch?h=megasync&id=4b1eca5bc0d75709dee3a1260264d1b6386d3398";
hash = "sha256-y3WhLkawFzQRzzRBpioiyAT3F1NDQvYBOm2888g5V5c=";
extraPrefix = "src/MEGASync/mega/";
stripLen = true;
})
(fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/030-megasync-app-fix-cmake-dependencies-detection.patch?h=megasync&id=4b1eca5bc0d75709dee3a1260264d1b6386d3398";
hash = "sha256-11XWctv1veUEguc9Xvz2hMYw26CaCwu6M4hyA+5r81U=";
})
./megasync-fix-cmake-install-bindir.patch
./dont-fetch-clang-format.patch
];

postPatch = ''
Expand All @@ -81,46 +116,24 @@ mkDerivation rec {
dontUseQmakeConfigure = true;
enableParallelBuilding = true;

preConfigure = ''
cd src/MEGASync/mega
./autogen.sh
'';

configureFlags = [
"--disable-examples"
"--disable-java"
"--disable-php"
"--enable-chat"
"--with-cares"
"--with-cryptopp"
"--with-curl"
"--with-ffmpeg"
"--without-freeimage"
"--without-readline"
"--without-termcap"
"--with-sodium"
"--with-sqlite"
"--with-zlib"
cmakeFlags = [
(lib.cmakeBool "USE_PDFIUM" false) # PDFIUM is not in nixpkgs
(lib.cmakeBool "USE_FREEIMAGE" false) # freeimage is insecure
(lib.cmakeBool "ENABLE_DESIGN_TOKENS_IMPORTER" false) # cannot be fetched
];

postConfigure = ''
cd ../..
'';

preBuild = ''
qmake CONFIG+="nofreeimage release" MEGA.pro
pushd MEGASync
lrelease MEGASync.pro
DESKTOP_DESTDIR="$out" qmake PREFIX="$out" -o Makefile MEGASync.pro CONFIG+="nofreeimage release"
popd
preFixup = ''
qtWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ xorg.xrdb ]})
'';

meta = with lib; {
description =
"Easy automated syncing between your computers and your MEGA Cloud Drive";
description = "Easy automated syncing between your computers and your MEGA Cloud Drive";
homepage = "https://mega.nz/";
license = licenses.unfree;
platforms = [ "i686-linux" "x86_64-linux" ];
platforms = [
"i686-linux"
"x86_64-linux"
];
maintainers = [ ];
};
}
10 changes: 10 additions & 0 deletions pkgs/applications/misc/megasync/dont-fetch-clang-format.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b04f57067..0f6e7b163 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,5 +63,3 @@ include(desktopapp_configuration)
# Load the MEGA targets
add_subdirectory(src)

-include(get_clang_format)
-get_clang_format()
21 changes: 0 additions & 21 deletions pkgs/applications/misc/megasync/install-megasync.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/contrib/cmake/modules/desktopapp_configuration.cmake b/contrib/cmake/modules/desktopapp_configuration.cmake
index 8e9f35cb2..b62f5a9b5 100644
--- a/contrib/cmake/modules/desktopapp_configuration.cmake
+++ b/contrib/cmake/modules/desktopapp_configuration.cmake
@@ -30,7 +30,6 @@ if(UNIX AND NOT APPLE)
# Used for building packages: in which install dir is a path construction folder that will not be there in packages

set(CMAKE_INSTALL_LIBDIR "opt/megasync/lib") # override default "lib" from GNUInstallDirs
- set(CMAKE_INSTALL_BINDIR "usr/bin") # override default "bin" from GNUInstallDirs

# Override CMAKE_INSTALL_PREFIX
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # In consecutive runs it will always be undef/false
13 changes: 0 additions & 13 deletions pkgs/applications/misc/megasync/noinstall-distro-version.patch

This file was deleted.

0 comments on commit c1372d0

Please sign in to comment.