Subject: [bug#52238] [PATCH] gnu: Add mega-sdk.

From: "Wamm K. D" <[email-masked]>
Date: Thu, 3 Feb 2022 18:30:12 -0600

* gnu/packages/sync.scm (mega-sdk): New package.
---
 gnu/packages/sync.scm | 62 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/sync.scm b/gnu/packages/sync.scm
index f897c1ec4a..52003a7c9d 100644
--- a/gnu/packages/sync.scm
+++ b/gnu/packages/sync.scm
@@ -210,6 +210,68 @@ (define-public nextcloud-client
                    license:lgpl2.1+  ; qtokenizer
                    license:gpl2+))))
 
+(define-public mega-sdk
+  (package
+    (name "mega-sdk")
+    (version "3.9.10")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/meganz/sdk/")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256 (base32
+                       "08qw23rm4rrvlsbcixrncbi5x0qgqkpx74l5f1gq2rgll0ksx8ph"))
+              (modules '((guix build utils)))))
+    (build-system gnu-build-system)
+    (native-inputs `(("autoconf" ,autoconf)
+                     ("automake" ,automake)
+                     ("libtool" ,libtool)))
+    (inputs `(("c-ares" ,c-ares)
+              ("crypto++" ,crypto++)
+              ("curl" ,curl)
+              ("freeimage" ,freeimage)
+              ("libsodium" ,libsodium)
+              ("openssl" ,openssl)
+              ("readline" ,readline)
+              ("sqlite" ,sqlite)
+              ("zlib" ,zlib)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'bootstrap 'remove-tests-that-require-a-mega-account
+           (lambda _
+             (substitute* "tests/include.am"
+               (("TESTS = tests/test_unit .+") "TESTS = tests/test_unit")
+               ;; tool_purge_account related
+               (("tests_tool_purge_account_SOURCES = \\\\") "")
+               (("    tests/tool/purge_account\\.cpp") "")
+               (("tests_tool_purge_account_CXXFLAGS = .+") "")
+               (("tests_tool_purge_account_LDADD = .+") "")
+               ;; test_integration related
+               (("tests_test_integration_SOURCES = \\\\") "")
+               (("    tests/integration/main\\.cpp \\\\") "")
+               (("    tests/integration/SdkTest_test\\.cpp \\\\") "")
+               (("    tests/integration/Sync_test\\.cpp") "")
+               (("tests_test_integration_CXXFLAGS = .+") "")
+               (("tests_test_integration_LDADD = .+") ""))
+
+             (substitute* "contrib/QtCreator/MEGAtests/MEGAtests.pro"
+               (("SUBDIRS [+]= MEGAtest_integration") "")
+               (("SUBDIRS [+]= MEGAtest_purge_account") "")
+               (("    SUBDIRS [+]= MEGAtest_integration_fsevents_loader") "")
+               (("    MEGAtest_integration_fsevents_loader\\.depends = .+") "")))))))
+    (home-page "https://mega.nz/sdk")
+    (synopsis "SDK for the MEGA service, offered by MEGA Limited")
+    (description "A low-level SDK for the MEGA service which powers the
+file-sharing site.  This package provides two executables:
+@itemize
+@item megacli: a command-line tool that allows usage of all SDK features
+@item megasimplesync: a command line tool that allows usage of the
+synchronization engine
+@end itemize")
+    (license license:bsd-2)))
+
 (define-public megacmd
   (package
     (name "megacmd")
-- 
2.34.0