caddy: 2.9.0 -> 2.9.1 (#375655)
[NixPkgs.git] / pkgs / by-name / me / megacmd / package.nix
blobea68f8fa84cee929cc17e16ff73130a91cae5031
2   lib,
3   stdenv,
4   autoreconfHook,
5   c-ares,
6   cryptopp,
7   curl,
8   fetchFromGitHub,
9   ffmpeg,
10   freeimage,
11   gcc-unwrapped,
12   icu,
13   libmediainfo,
14   libraw,
15   libsodium,
16   libuv,
17   libzen,
18   pcre-cpp,
19   pkg-config,
20   readline,
21   sqlite,
22   withFreeImage ? false, # default to false because freeimage is insecure
25 let
26   pname = "megacmd";
27   version = "1.7.0";
28   srcOptions =
29     if stdenv.isLinux then
30       {
31         tag = "${version}_Linux";
32         hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM=";
33       }
34     else
35       {
36         tag = "${version}_macOS";
37         hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM=";
38       };
40 stdenv.mkDerivation {
41   inherit pname version;
43   src = fetchFromGitHub (
44     srcOptions
45     // {
46       owner = "meganz";
47       repo = "MEGAcmd";
48       fetchSubmodules = true;
49     }
50   );
52   enableParallelBuilding = true;
53   nativeBuildInputs = [
54     autoreconfHook
55     pkg-config
56   ];
58   buildInputs =
59     lib.optionals stdenv.isLinux [ gcc-unwrapped ] # fix: ld: cannot find lib64/libstdc++fs.a
60     ++ [
61       c-ares
62       cryptopp
63       curl
64       ffmpeg
65       icu
66       libmediainfo
67       libraw
68       libsodium
69       libuv
70       libzen
71       pcre-cpp
72       readline
73       sqlite
74     ]
75     ++ lib.optionals withFreeImage [ freeimage ];
77   configureFlags = [
78     "--disable-examples"
79     "--with-cares"
80     "--with-cryptopp"
81     "--with-curl"
82     "--with-ffmpeg"
83     "--with-icu"
84     "--with-libmediainfo"
85     "--with-libuv"
86     "--with-libzen"
87     "--with-pcre"
88     "--with-readline"
89     "--with-sodium"
90     "--with-termcap"
91   ] ++ (if withFreeImage then [ "--with-freeimage" ] else [ "--without-freeimage" ]);
93   # On darwin, some macros defined in AssertMacros.h (from apple-sdk) are conflicting.
94   postConfigure = ''
95     echo '#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0' >> sdk/include/mega/config.h
96   '';
98   patches = [
99     ./fix-ffmpeg.patch # https://github.com/meganz/sdk/issues/2635#issuecomment-1495405085
100     ./fix-darwin.patch # fix: libtool tag not found; MacFileSystemAccess not declared; server cannot init
101   ];
103   meta = {
104     description = "MEGA Command Line Interactive and Scriptable Application";
105     homepage = "https://mega.io/cmd";
106     license = with lib.licenses; [
107       bsd2
108       gpl3Only
109     ];
110     platforms = lib.platforms.linux ++ lib.platforms.darwin;
111     maintainers = with lib.maintainers; [
112       lunik1
113       ulysseszhan
114     ];
115   };