Loading pkgs/by-name/me/megacmd/fix-darwin.patch 0 → 100644 +49 −0 Original line number Diff line number Diff line --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,11 @@ AM_CPPFLAGS = \ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/sdk/include +if DARWIN +AM_LIBTOOLFLAGS="--tag=CXX" +AM_CPPFLAGS+=-I$(top_srcdir)/include/mega/osx -I$(top_srcdir)/sdk/include/mega/osx +endif + if WIN32 AM_CPPFLAGS+=-I$(top_srcdir)/sdk/include/mega/win32 else --- a/src/megacmdshell/megacmdshellcommunications.cpp +++ b/src/megacmdshell/megacmdshellcommunications.cpp @@ -306,10 +306,6 @@ SOCKET MegaCmdShellCommunications::createSocket(int number, bool initializeserve #endif const char executable2[] = "./mega-cmd-server"; #else - #ifdef __MACH__ - const char executable[] = "/Applications/MEGAcmd.app/Contents/MacOS/mega-cmd"; - const char executable2[] = "./mega-cmd"; - #else const char executable[] = "mega-cmd-server"; #ifdef __linux__ char executable2[PATH_MAX]; @@ -317,7 +313,6 @@ SOCKET MegaCmdShellCommunications::createSocket(int number, bool initializeserve #else const char executable2[] = "./mega-cmd-server"; #endif - #endif #endif std::vector<char*> argsVector{ --- a/sdk/Makefile.am +++ b/sdk/Makefile.am @@ -27,6 +27,11 @@ AM_CPPFLAGS = \ include m4/aminclude.am +if DARWIN +AM_LIBTOOLFLAGS="--tag=CXX" +AM_CPPFLAGS+=-I$(top_srcdir)/include/mega/osx +endif + if WIN32 AM_CPPFLAGS+=-I$(top_srcdir)/include/mega/win32 else pkgs/by-name/me/megacmd/fix-ffmpeg.patch 0 → 100644 +29 −0 Original line number Diff line number Diff line --- a/sdk/src/gfx/freeimage.cpp +++ b/sdk/src/gfx/freeimage.cpp @@ -216,11 +216,13 @@ bool GfxProviderFreeImage::readbitmapFreeimage(const LocalPath& imagePath, int s #ifdef HAVE_FFMPEG +#if LIBAVCODEC_VERSION_MAJOR < 60 #ifdef AV_CODEC_CAP_TRUNCATED #define CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED #else #define CAP_TRUNCATED CODEC_CAP_TRUNCATED #endif +#endif const char *GfxProviderFreeImage::supportedformatsFfmpeg() { @@ -323,10 +325,12 @@ bool GfxProviderFreeImage::readbitmapFfmpeg(const LocalPath& imagePath, int size // Force seeking to key frames formatContext->seek2any = false; +#if LIBAVCODEC_VERSION_MAJOR < 60 if (decoder->capabilities & CAP_TRUNCATED) { codecContext->flags |= CAP_TRUNCATED; } +#endif AVPixelFormat sourcePixelFormat = static_cast<AVPixelFormat>(codecParm->format); AVPixelFormat targetPixelFormat = AV_PIX_FMT_BGR24; //raw data expected by freeimage is in this format pkgs/by-name/me/megacmd/package.nix +88 −53 Original line number Diff line number Diff line { lib , stdenv , autoreconfHook , c-ares , cryptopp , curl , fetchFromGitHub # build fails with latest ffmpeg, see https://github.com/meganz/MEGAcmd/issues/523. # to be re-enabled when patch available # , ffmpeg , gcc-unwrapped , icu , libmediainfo , libraw , libsodium , libuv , libzen , pcre-cpp , pkg-config , readline , sqlite { lib, stdenv, autoreconfHook, c-ares, cryptopp, curl, fetchFromGitHub, ffmpeg, freeimage, gcc-unwrapped, icu, libmediainfo, libraw, libsodium, libuv, libzen, pcre-cpp, pkg-config, readline, sqlite, withFreeImage ? false, # default to false because freeimage is insecure }: stdenv.mkDerivation rec { let pname = "megacmd"; version = "1.7.0"; srcOptions = if stdenv.isLinux then { tag = "${version}_Linux"; hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM="; } else { tag = "${version}_macOS"; hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM="; }; in stdenv.mkDerivation { inherit pname version; src = fetchFromGitHub { src = fetchFromGitHub ( srcOptions // { owner = "meganz"; repo = "MEGAcmd"; rev = "${version}_Linux"; hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM="; fetchSubmodules = true; }; } ); enableParallelBuilding = true; nativeBuildInputs = [ autoreconfHook pkg-config ]; nativeBuildInputs = [ autoreconfHook pkg-config ]; buildInputs = [ buildInputs = lib.optionals stdenv.isLinux [ gcc-unwrapped ] # fix: ld: cannot find lib64/libstdc++fs.a ++ [ c-ares cryptopp curl # ffmpeg ffmpeg icu gcc-unwrapped libmediainfo libraw libsodium Loading @@ -51,16 +71,15 @@ stdenv.mkDerivation rec { pcre-cpp readline sqlite ]; ] ++ lib.optionals withFreeImage [ freeimage ]; configureFlags = [ "--disable-curl-checks" "--disable-examples" "--with-cares" "--with-cryptopp" "--with-curl" # "--with-ffmpeg" "--without-freeimage" # disabled as freeimage is insecure "--with-ffmpeg" "--with-icu" "--with-libmediainfo" "--with-libuv" Loading @@ -69,13 +88,29 @@ stdenv.mkDerivation rec { "--with-readline" "--with-sodium" "--with-termcap" ] ++ (if withFreeImage then [ "--with-freeimage" ] else [ "--without-freeimage" ]); # On darwin, some macros defined in AssertMacros.h (from apple-sdk) are conflicting. postConfigure = '' echo '#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0' >> sdk/include/mega/config.h ''; patches = [ ./fix-ffmpeg.patch # https://github.com/meganz/sdk/issues/2635#issuecomment-1495405085 ./fix-darwin.patch # fix: libtool tag not found; MacFileSystemAccess not declared; server cannot init ]; meta = with lib; { meta = { description = "MEGA Command Line Interactive and Scriptable Application"; homepage = "https://mega.io/cmd"; license = with licenses; [ bsd2 gpl3Only ]; platforms = [ "i686-linux" "x86_64-linux" ]; maintainers = with maintainers; [ lunik1 ]; license = with lib.licenses; [ bsd2 gpl3Only ]; platforms = lib.platforms.linux ++ lib.platforms.darwin; maintainers = with lib.maintainers; [ lunik1 ulysseszhan ]; }; } Loading
pkgs/by-name/me/megacmd/fix-darwin.patch 0 → 100644 +49 −0 Original line number Diff line number Diff line --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,11 @@ AM_CPPFLAGS = \ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/sdk/include +if DARWIN +AM_LIBTOOLFLAGS="--tag=CXX" +AM_CPPFLAGS+=-I$(top_srcdir)/include/mega/osx -I$(top_srcdir)/sdk/include/mega/osx +endif + if WIN32 AM_CPPFLAGS+=-I$(top_srcdir)/sdk/include/mega/win32 else --- a/src/megacmdshell/megacmdshellcommunications.cpp +++ b/src/megacmdshell/megacmdshellcommunications.cpp @@ -306,10 +306,6 @@ SOCKET MegaCmdShellCommunications::createSocket(int number, bool initializeserve #endif const char executable2[] = "./mega-cmd-server"; #else - #ifdef __MACH__ - const char executable[] = "/Applications/MEGAcmd.app/Contents/MacOS/mega-cmd"; - const char executable2[] = "./mega-cmd"; - #else const char executable[] = "mega-cmd-server"; #ifdef __linux__ char executable2[PATH_MAX]; @@ -317,7 +313,6 @@ SOCKET MegaCmdShellCommunications::createSocket(int number, bool initializeserve #else const char executable2[] = "./mega-cmd-server"; #endif - #endif #endif std::vector<char*> argsVector{ --- a/sdk/Makefile.am +++ b/sdk/Makefile.am @@ -27,6 +27,11 @@ AM_CPPFLAGS = \ include m4/aminclude.am +if DARWIN +AM_LIBTOOLFLAGS="--tag=CXX" +AM_CPPFLAGS+=-I$(top_srcdir)/include/mega/osx +endif + if WIN32 AM_CPPFLAGS+=-I$(top_srcdir)/include/mega/win32 else
pkgs/by-name/me/megacmd/fix-ffmpeg.patch 0 → 100644 +29 −0 Original line number Diff line number Diff line --- a/sdk/src/gfx/freeimage.cpp +++ b/sdk/src/gfx/freeimage.cpp @@ -216,11 +216,13 @@ bool GfxProviderFreeImage::readbitmapFreeimage(const LocalPath& imagePath, int s #ifdef HAVE_FFMPEG +#if LIBAVCODEC_VERSION_MAJOR < 60 #ifdef AV_CODEC_CAP_TRUNCATED #define CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED #else #define CAP_TRUNCATED CODEC_CAP_TRUNCATED #endif +#endif const char *GfxProviderFreeImage::supportedformatsFfmpeg() { @@ -323,10 +325,12 @@ bool GfxProviderFreeImage::readbitmapFfmpeg(const LocalPath& imagePath, int size // Force seeking to key frames formatContext->seek2any = false; +#if LIBAVCODEC_VERSION_MAJOR < 60 if (decoder->capabilities & CAP_TRUNCATED) { codecContext->flags |= CAP_TRUNCATED; } +#endif AVPixelFormat sourcePixelFormat = static_cast<AVPixelFormat>(codecParm->format); AVPixelFormat targetPixelFormat = AV_PIX_FMT_BGR24; //raw data expected by freeimage is in this format
pkgs/by-name/me/megacmd/package.nix +88 −53 Original line number Diff line number Diff line { lib , stdenv , autoreconfHook , c-ares , cryptopp , curl , fetchFromGitHub # build fails with latest ffmpeg, see https://github.com/meganz/MEGAcmd/issues/523. # to be re-enabled when patch available # , ffmpeg , gcc-unwrapped , icu , libmediainfo , libraw , libsodium , libuv , libzen , pcre-cpp , pkg-config , readline , sqlite { lib, stdenv, autoreconfHook, c-ares, cryptopp, curl, fetchFromGitHub, ffmpeg, freeimage, gcc-unwrapped, icu, libmediainfo, libraw, libsodium, libuv, libzen, pcre-cpp, pkg-config, readline, sqlite, withFreeImage ? false, # default to false because freeimage is insecure }: stdenv.mkDerivation rec { let pname = "megacmd"; version = "1.7.0"; srcOptions = if stdenv.isLinux then { tag = "${version}_Linux"; hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM="; } else { tag = "${version}_macOS"; hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM="; }; in stdenv.mkDerivation { inherit pname version; src = fetchFromGitHub { src = fetchFromGitHub ( srcOptions // { owner = "meganz"; repo = "MEGAcmd"; rev = "${version}_Linux"; hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM="; fetchSubmodules = true; }; } ); enableParallelBuilding = true; nativeBuildInputs = [ autoreconfHook pkg-config ]; nativeBuildInputs = [ autoreconfHook pkg-config ]; buildInputs = [ buildInputs = lib.optionals stdenv.isLinux [ gcc-unwrapped ] # fix: ld: cannot find lib64/libstdc++fs.a ++ [ c-ares cryptopp curl # ffmpeg ffmpeg icu gcc-unwrapped libmediainfo libraw libsodium Loading @@ -51,16 +71,15 @@ stdenv.mkDerivation rec { pcre-cpp readline sqlite ]; ] ++ lib.optionals withFreeImage [ freeimage ]; configureFlags = [ "--disable-curl-checks" "--disable-examples" "--with-cares" "--with-cryptopp" "--with-curl" # "--with-ffmpeg" "--without-freeimage" # disabled as freeimage is insecure "--with-ffmpeg" "--with-icu" "--with-libmediainfo" "--with-libuv" Loading @@ -69,13 +88,29 @@ stdenv.mkDerivation rec { "--with-readline" "--with-sodium" "--with-termcap" ] ++ (if withFreeImage then [ "--with-freeimage" ] else [ "--without-freeimage" ]); # On darwin, some macros defined in AssertMacros.h (from apple-sdk) are conflicting. postConfigure = '' echo '#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0' >> sdk/include/mega/config.h ''; patches = [ ./fix-ffmpeg.patch # https://github.com/meganz/sdk/issues/2635#issuecomment-1495405085 ./fix-darwin.patch # fix: libtool tag not found; MacFileSystemAccess not declared; server cannot init ]; meta = with lib; { meta = { description = "MEGA Command Line Interactive and Scriptable Application"; homepage = "https://mega.io/cmd"; license = with licenses; [ bsd2 gpl3Only ]; platforms = [ "i686-linux" "x86_64-linux" ]; maintainers = with maintainers; [ lunik1 ]; license = with lib.licenses; [ bsd2 gpl3Only ]; platforms = lib.platforms.linux ++ lib.platforms.darwin; maintainers = with lib.maintainers; [ lunik1 ulysseszhan ]; }; }