From 4b6daa0e158c57d5489070568e28402310a52f13 Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Tue, 29 Oct 2024 19:48:18 +0100 Subject: [PATCH 1/8] megasync: 4.9.1.0 -> 5.5.0.0 --- ...eimage-remove-obsolete-ffmpeg-macros.patch | 26 ++++ ...sdk-fix-cmake-dependencies-detection.patch | 20 +++ ...app-fix-cmake-dependencies-detection.patch | 16 ++ ...40-megasync-fix-cmake-install-bindir.patch | 12 ++ pkgs/applications/misc/megasync/default.nix | 138 ++++++++---------- .../misc/megasync/install-megasync.patch | 21 --- .../megasync/noinstall-distro-version.patch | 13 -- 7 files changed, 138 insertions(+), 108 deletions(-) create mode 100644 pkgs/applications/misc/megasync/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch create mode 100644 pkgs/applications/misc/megasync/020-megasync-sdk-fix-cmake-dependencies-detection.patch create mode 100644 pkgs/applications/misc/megasync/030-megasync-app-fix-cmake-dependencies-detection.patch create mode 100644 pkgs/applications/misc/megasync/040-megasync-fix-cmake-install-bindir.patch delete mode 100644 pkgs/applications/misc/megasync/install-megasync.patch delete mode 100644 pkgs/applications/misc/megasync/noinstall-distro-version.patch diff --git a/pkgs/applications/misc/megasync/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch b/pkgs/applications/misc/megasync/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch new file mode 100644 index 000000000000..19c96c78dc61 --- /dev/null +++ b/pkgs/applications/misc/megasync/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch @@ -0,0 +1,26 @@ +--- a/src/MEGASync/mega/src/gfx/freeimage.cpp ++++ b/src/MEGASync/mega/src/gfx/freeimage.cpp +@@ -200,12 +200,6 @@ bool GfxProviderFreeImage::readbitmapFreeimage(const LocalPath& imagePath, int s + + #ifdef HAVE_FFMPEG + +-#ifdef AV_CODEC_CAP_TRUNCATED +-#define CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED +-#else +-#define CAP_TRUNCATED CODEC_CAP_TRUNCATED +-#endif +- + const char *GfxProviderFreeImage::supportedformatsFfmpeg() + { + return ".264.265.3g2.3gp.3gpa.3gpp.3gpp2.mp3" +@@ -321,10 +315,6 @@ bool GfxProviderFreeImage::readbitmapFfmpeg(const LocalPath& imagePath, int size + + // Force seeking to key frames + formatContext->seek2any = false; +- if (decoder->capabilities & CAP_TRUNCATED) +- { +- codecContext->flags |= CAP_TRUNCATED; +- } + + AVPixelFormat sourcePixelFormat = static_cast(codecParm->format); + AVPixelFormat targetPixelFormat = AV_PIX_FMT_BGR24; //raw data expected by freeimage is in this format diff --git a/pkgs/applications/misc/megasync/020-megasync-sdk-fix-cmake-dependencies-detection.patch b/pkgs/applications/misc/megasync/020-megasync-sdk-fix-cmake-dependencies-detection.patch new file mode 100644 index 000000000000..ce0d9d10b56c --- /dev/null +++ b/pkgs/applications/misc/megasync/020-megasync-sdk-fix-cmake-dependencies-detection.patch @@ -0,0 +1,20 @@ +--- a/src/MEGASync/mega/contrib/cmake/modules/sdklib_libraries.cmake ++++ b/src/MEGASync/mega/contrib/cmake/modules/sdklib_libraries.cmake +@@ -95,7 +95,7 @@ macro(load_sdklib_libraries) + + find_package(PkgConfig REQUIRED) # For libraries loaded using pkg-config + +- pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcrypto++) ++ pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcryptopp) + target_link_libraries(SDKlib PUBLIC PkgConfig::cryptopp) # TODO: Private for SDK core + + pkg_check_modules(sodium REQUIRED IMPORTED_TARGET libsodium) +@@ -139,7 +139,7 @@ macro(load_sdklib_libraries) + endif() + + if(USE_PDFIUM) +- pkg_check_modules(pdfium REQUIRED IMPORTED_TARGET pdfium) ++ pkg_check_modules(pdfium REQUIRED IMPORTED_TARGET libpdfium) + target_link_libraries(SDKlib PRIVATE PkgConfig::pdfium) + set(HAVE_PDFIUM 1) + endif() diff --git a/pkgs/applications/misc/megasync/030-megasync-app-fix-cmake-dependencies-detection.patch b/pkgs/applications/misc/megasync/030-megasync-app-fix-cmake-dependencies-detection.patch new file mode 100644 index 000000000000..e8703d1ce0e0 --- /dev/null +++ b/pkgs/applications/misc/megasync/030-megasync-app-fix-cmake-dependencies-detection.patch @@ -0,0 +1,16 @@ +--- a/src/MEGAUpdateGenerator/CMakeLists.txt ++++ b/src/MEGAUpdateGenerator/CMakeLists.txt +@@ -15,10 +15,11 @@ target_sources(MEGAUpdateGenerator + ) + + # Load and link needed libraries for the CHATlib target +-find_package(cryptopp CONFIG REQUIRED) ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcryptopp) + target_link_libraries(MEGAUpdateGenerator + PRIVATE +- cryptopp::cryptopp ++ PkgConfig::cryptopp + MEGA::SDKlib + ) + diff --git a/pkgs/applications/misc/megasync/040-megasync-fix-cmake-install-bindir.patch b/pkgs/applications/misc/megasync/040-megasync-fix-cmake-install-bindir.patch new file mode 100644 index 000000000000..8e15acf60e8f --- /dev/null +++ b/pkgs/applications/misc/megasync/040-megasync-fix-cmake-install-bindir.patch @@ -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 diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index ef35db703087..b76650b4f2d7 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -1,51 +1,57 @@ -{ 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, + ffmpeg, + freeimage, + 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, + zlib, + qt5, }: mkDerivation rec { pname = "megasync"; - version = "4.9.1.0"; + version = "5.5.0.0"; src = fetchFromGitHub { owner = "meganz"; repo = "MEGAsync"; rev = "v${version}_Linux"; - hash = "sha256-Y1nfY5iP64iSCYwzqxbjZAQNHyj4yVbSudSInm+yJzY="; + hash = "sha256-f+FZdMMdGZvYvJZ0xTUuO9zk0/VHFAISvM2cW0zwfaE="; fetchSubmodules = true; }; nativeBuildInputs = [ - autoconf - automake - doxygen + cmake libtool - lsb-release pkg-config qttools - swig unzip ]; buildInputs = [ @@ -53,23 +59,33 @@ mkDerivation rec { cryptopp curl ffmpeg + freeimage + 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 + ./010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch + ./020-megasync-sdk-fix-cmake-dependencies-detection.patch + ./030-megasync-app-fix-cmake-dependencies-detection.patch #Thanks Arch Linux + ./040-megasync-fix-cmake-install-bindir.patch ]; postPatch = '' @@ -81,46 +97,20 @@ 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 = [ + "-DCMAKE_MODULE_PATH:PATH=${src}/src/MEGASync/mega/contrib/cmake/modules/packages" + "-Wno-dev" + "-DUSE_PDFIUM=FALSE" # PDFIUM is not in nixpkgs ]; - 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 - ''; - 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 = [ ]; }; } diff --git a/pkgs/applications/misc/megasync/install-megasync.patch b/pkgs/applications/misc/megasync/install-megasync.patch deleted file mode 100644 index 7d8748528e7f..000000000000 --- a/pkgs/applications/misc/megasync/install-megasync.patch +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index bbf100737bc4..000000000000 --- a/pkgs/applications/misc/megasync/noinstall-distro-version.patch +++ /dev/null @@ -1,13 +0,0 @@ -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 \ From fad94949b18d7ee62a2f5c9127624176ce82670d Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Tue, 12 Nov 2024 23:11:10 +0100 Subject: [PATCH 2/8] megasync: remove freeimage also use lib.cmakeBool --- ...eimage-remove-obsolete-ffmpeg-macros.patch | 26 ------------------- pkgs/applications/misc/megasync/default.nix | 7 ++--- 2 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 pkgs/applications/misc/megasync/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch diff --git a/pkgs/applications/misc/megasync/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch b/pkgs/applications/misc/megasync/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch deleted file mode 100644 index 19c96c78dc61..000000000000 --- a/pkgs/applications/misc/megasync/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/src/MEGASync/mega/src/gfx/freeimage.cpp -+++ b/src/MEGASync/mega/src/gfx/freeimage.cpp -@@ -200,12 +200,6 @@ bool GfxProviderFreeImage::readbitmapFreeimage(const LocalPath& imagePath, int s - - #ifdef HAVE_FFMPEG - --#ifdef AV_CODEC_CAP_TRUNCATED --#define CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED --#else --#define CAP_TRUNCATED CODEC_CAP_TRUNCATED --#endif -- - const char *GfxProviderFreeImage::supportedformatsFfmpeg() - { - return ".264.265.3g2.3gp.3gpa.3gpp.3gpp2.mp3" -@@ -321,10 +315,6 @@ bool GfxProviderFreeImage::readbitmapFfmpeg(const LocalPath& imagePath, int size - - // Force seeking to key frames - formatContext->seek2any = false; -- if (decoder->capabilities & CAP_TRUNCATED) -- { -- codecContext->flags |= CAP_TRUNCATED; -- } - - AVPixelFormat sourcePixelFormat = static_cast(codecParm->format); - AVPixelFormat targetPixelFormat = AV_PIX_FMT_BGR24; //raw data expected by freeimage is in this format diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index b76650b4f2d7..56c4347b36b7 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -8,7 +8,6 @@ curl, fetchFromGitHub, ffmpeg, - freeimage, hicolor-icon-theme, icu, libmediainfo, @@ -59,7 +58,6 @@ mkDerivation rec { cryptopp curl ffmpeg - freeimage hicolor-icon-theme icu libmediainfo @@ -82,7 +80,6 @@ mkDerivation rec { ]; patches = [ - ./010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch ./020-megasync-sdk-fix-cmake-dependencies-detection.patch ./030-megasync-app-fix-cmake-dependencies-detection.patch #Thanks Arch Linux ./040-megasync-fix-cmake-install-bindir.patch @@ -99,8 +96,8 @@ mkDerivation rec { cmakeFlags = [ "-DCMAKE_MODULE_PATH:PATH=${src}/src/MEGASync/mega/contrib/cmake/modules/packages" - "-Wno-dev" - "-DUSE_PDFIUM=FALSE" # PDFIUM is not in nixpkgs + (lib.cmakeBool "USE_PDFIUM" false) # PDFIUM is not in nixpkgs + (lib.cmakeBool "USE_FREEIMAGE" false) # freeimage is insecure ]; meta = with lib; { From fe4fac1fe40a2939e6025347cc1776b5d7313f21 Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Mon, 18 Nov 2024 16:14:05 +0100 Subject: [PATCH 3/8] megasync: use fetchpatch --- ...sdk-fix-cmake-dependencies-detection.patch | 20 ------------------- ...app-fix-cmake-dependencies-detection.patch | 16 --------------- pkgs/applications/misc/megasync/default.nix | 16 +++++++++++---- ...> megasync-fix-cmake-install-bindir.patch} | 0 4 files changed, 12 insertions(+), 40 deletions(-) delete mode 100644 pkgs/applications/misc/megasync/020-megasync-sdk-fix-cmake-dependencies-detection.patch delete mode 100644 pkgs/applications/misc/megasync/030-megasync-app-fix-cmake-dependencies-detection.patch rename pkgs/applications/misc/megasync/{040-megasync-fix-cmake-install-bindir.patch => megasync-fix-cmake-install-bindir.patch} (100%) diff --git a/pkgs/applications/misc/megasync/020-megasync-sdk-fix-cmake-dependencies-detection.patch b/pkgs/applications/misc/megasync/020-megasync-sdk-fix-cmake-dependencies-detection.patch deleted file mode 100644 index ce0d9d10b56c..000000000000 --- a/pkgs/applications/misc/megasync/020-megasync-sdk-fix-cmake-dependencies-detection.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/src/MEGASync/mega/contrib/cmake/modules/sdklib_libraries.cmake -+++ b/src/MEGASync/mega/contrib/cmake/modules/sdklib_libraries.cmake -@@ -95,7 +95,7 @@ macro(load_sdklib_libraries) - - find_package(PkgConfig REQUIRED) # For libraries loaded using pkg-config - -- pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcrypto++) -+ pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcryptopp) - target_link_libraries(SDKlib PUBLIC PkgConfig::cryptopp) # TODO: Private for SDK core - - pkg_check_modules(sodium REQUIRED IMPORTED_TARGET libsodium) -@@ -139,7 +139,7 @@ macro(load_sdklib_libraries) - endif() - - if(USE_PDFIUM) -- pkg_check_modules(pdfium REQUIRED IMPORTED_TARGET pdfium) -+ pkg_check_modules(pdfium REQUIRED IMPORTED_TARGET libpdfium) - target_link_libraries(SDKlib PRIVATE PkgConfig::pdfium) - set(HAVE_PDFIUM 1) - endif() diff --git a/pkgs/applications/misc/megasync/030-megasync-app-fix-cmake-dependencies-detection.patch b/pkgs/applications/misc/megasync/030-megasync-app-fix-cmake-dependencies-detection.patch deleted file mode 100644 index e8703d1ce0e0..000000000000 --- a/pkgs/applications/misc/megasync/030-megasync-app-fix-cmake-dependencies-detection.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/src/MEGAUpdateGenerator/CMakeLists.txt -+++ b/src/MEGAUpdateGenerator/CMakeLists.txt -@@ -15,10 +15,11 @@ target_sources(MEGAUpdateGenerator - ) - - # Load and link needed libraries for the CHATlib target --find_package(cryptopp CONFIG REQUIRED) -+find_package(PkgConfig REQUIRED) -+pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcryptopp) - target_link_libraries(MEGAUpdateGenerator - PRIVATE -- cryptopp::cryptopp -+ PkgConfig::cryptopp - MEGA::SDKlib - ) - diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index 56c4347b36b7..45192bb0d241 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -1,7 +1,7 @@ - { lib, stdenv, + fetchpatch, c-ares, cmake, cryptopp, @@ -80,9 +80,17 @@ mkDerivation rec { ]; patches = [ - ./020-megasync-sdk-fix-cmake-dependencies-detection.patch - ./030-megasync-app-fix-cmake-dependencies-detection.patch #Thanks Arch Linux - ./040-megasync-fix-cmake-install-bindir.patch + (fetchpatch { + url = "https://aur.archlinux.org/cgit/aur.git/plain/020-megasync-sdk-fix-cmake-dependencies-detection.patch?h=megasync"; + 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"; + hash = "sha256-11XWctv1veUEguc9Xvz2hMYw26CaCwu6M4hyA+5r81U="; + }) + ./megasync-fix-cmake-install-bindir.patch ]; postPatch = '' diff --git a/pkgs/applications/misc/megasync/040-megasync-fix-cmake-install-bindir.patch b/pkgs/applications/misc/megasync/megasync-fix-cmake-install-bindir.patch similarity index 100% rename from pkgs/applications/misc/megasync/040-megasync-fix-cmake-install-bindir.patch rename to pkgs/applications/misc/megasync/megasync-fix-cmake-install-bindir.patch From 55fdc8ea50647ffe51fa5a116fbed8b105aa9f25 Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Mon, 18 Nov 2024 16:20:14 +0100 Subject: [PATCH 4/8] megasync: version fetchpatch urls so they don't magically break --- pkgs/applications/misc/megasync/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index 45192bb0d241..a66581fb334c 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -81,13 +81,13 @@ mkDerivation rec { patches = [ (fetchpatch { - url = "https://aur.archlinux.org/cgit/aur.git/plain/020-megasync-sdk-fix-cmake-dependencies-detection.patch?h=megasync"; + 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"; + 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 From 6982710bb21a84d9b37ea5760050245950a64d95 Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Sat, 23 Nov 2024 11:51:53 +0100 Subject: [PATCH 5/8] megasync: 5.5.0.0 -> 5.6.1.0 As stated, the DesignTokensImporter submodule cannot be fetched, so I only check out the megasdk submodule. The get_clang_format fails, so copy it from local --- pkgs/applications/misc/megasync/default.nix | 27 ++++++++++++++----- .../megasync/dont-fetch-clang-format.patch | 10 +++++++ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 pkgs/applications/misc/megasync/dont-fetch-clang-format.patch diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index a66581fb334c..b0e80a4b5a41 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -1,12 +1,12 @@ { lib, stdenv, - fetchpatch, c-ares, cmake, cryptopp, curl, fetchFromGitHub, + fetchpatch, ffmpeg, hicolor-icon-theme, icu, @@ -36,14 +36,28 @@ }: mkDerivation rec { pname = "megasync"; - version = "5.5.0.0"; + version = "5.6.1.0"; - src = fetchFromGitHub { + src = fetchFromGitHub rec { owner = "meganz"; repo = "MEGAsync"; rev = "v${version}_Linux"; - hash = "sha256-f+FZdMMdGZvYvJZ0xTUuO9zk0/VHFAISvM2cW0zwfaE="; - 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 + + cp src/MEGASync/mega/.clang-format .clang-format + + rm -rf .git + ''; # Why so complicated, I just want a single submodule }; nativeBuildInputs = [ @@ -91,6 +105,7 @@ mkDerivation rec { hash = "sha256-11XWctv1veUEguc9Xvz2hMYw26CaCwu6M4hyA+5r81U="; }) ./megasync-fix-cmake-install-bindir.patch + ./dont-fetch-clang-format.patch ]; postPatch = '' @@ -103,9 +118,9 @@ mkDerivation rec { enableParallelBuilding = true; cmakeFlags = [ - "-DCMAKE_MODULE_PATH:PATH=${src}/src/MEGASync/mega/contrib/cmake/modules/packages" (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 ]; meta = with lib; { diff --git a/pkgs/applications/misc/megasync/dont-fetch-clang-format.patch b/pkgs/applications/misc/megasync/dont-fetch-clang-format.patch new file mode 100644 index 000000000000..ae76fbdcf5e2 --- /dev/null +++ b/pkgs/applications/misc/megasync/dont-fetch-clang-format.patch @@ -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() From a0f0eafede8a035794f41dbd509937738e832e11 Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Fri, 29 Nov 2024 10:54:39 +0100 Subject: [PATCH 6/8] megasync: don't cp clang-format --- pkgs/applications/misc/megasync/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index b0e80a4b5a41..938795d001bb 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -54,8 +54,6 @@ mkDerivation rec { git checkout ${rev} git submodule update --init src/MEGASync/mega - cp src/MEGASync/mega/.clang-format .clang-format - rm -rf .git ''; # Why so complicated, I just want a single submodule }; From f6bb4417aa9b86f4239666c3f16b02d16fb0c3a1 Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Mon, 16 Dec 2024 21:45:27 +0100 Subject: [PATCH 7/8] megasync: Wrap xorg.xrdb --- pkgs/applications/misc/megasync/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index 938795d001bb..6d9c23ce13da 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -31,6 +31,7 @@ sqlite, unzip, wget, + xorg, zlib, qt5, }: @@ -121,6 +122,10 @@ mkDerivation rec { (lib.cmakeBool "ENABLE_DESIGN_TOKENS_IMPORTER" false) # cannot be fetched ]; + postInstall = '' + wrapProgram $out/bin/megasync --prefix PATH : ${lib.makeBinPath [ xorg.xrdb ]} + ''; + meta = with lib; { description = "Easy automated syncing between your computers and your MEGA Cloud Drive"; homepage = "https://mega.nz/"; From b0ad8eafb04bdc948bc3a35ebe3a92cadd56d511 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 1 Jan 2025 12:57:47 +0100 Subject: [PATCH 8/8] megasync: avoid double wrapping --- pkgs/applications/misc/megasync/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix index 6d9c23ce13da..8ac1a9099e37 100644 --- a/pkgs/applications/misc/megasync/default.nix +++ b/pkgs/applications/misc/megasync/default.nix @@ -122,8 +122,8 @@ mkDerivation rec { (lib.cmakeBool "ENABLE_DESIGN_TOKENS_IMPORTER" false) # cannot be fetched ]; - postInstall = '' - wrapProgram $out/bin/megasync --prefix PATH : ${lib.makeBinPath [ xorg.xrdb ]} + preFixup = '' + qtWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ xorg.xrdb ]}) ''; meta = with lib; {