gnu: Add gromacs.
[jackhill/guix/guix.git] / gnu / packages / android.scm
index d09cd63..17f5f41 100644 (file)
@@ -5,7 +5,11 @@
 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (gnu packages)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages docker)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-crypto)
+  #:use-module (gnu packages python-web)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages selinux)
+  #:use-module (gnu packages serialization)
   #:use-module (gnu packages ssh)
-  #:use-module (gnu packages version-control)
   #:use-module (gnu packages tls)
-  #:use-module (gnu packages linux))
+  #:use-module (gnu packages version-control)
+  #:use-module (gnu packages virtualization)
+  #:use-module (gnu packages xdisorg)
+  #:use-module (gnu packages xml))
 
 (define-public android-make-stub
   (package
     (name "android-make-stub")
-    (version "0.5.5")
+    (version "0.6.0")
     (source
      (origin
       (method git-fetch)
@@ -57,7 +71,7 @@
                                 version "-checkout"))
       (sha256
        (base32
-        "0shm4xvc2v6dn6pxydy6yn64qrrpcvx8ssmym9053wk0w5s9wp9q"))))
+        "0y1b2x96d37n6f1bp6dcx08bn08zac0cylmbfsx6mf2nahc02fhc"))))
       (build-system gnu-build-system)
       (arguments
        `(#:tests? #f ; None exist.
@@ -80,6 +94,17 @@ use their packages mostly unmodified in our Android NDK build system.")
 (define-public android-googletest
   (package (inherit googletest)
     (name "android-googletest")
+    (version "1.8.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+              (url "https://github.com/google/googletest.git")
+              (commit (string-append "release-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0bjlljmbf8glnd9qjabx73w6pd7ibv43yiyngqvmvgxsabzr8399"))))
     (arguments
      `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
        #:phases
@@ -101,7 +126,7 @@ use their packages mostly unmodified in our Android NDK build system.")
 ;; Big thanks to them for laying the groundwork.
 
 ;; The version tag is consistent between all repositories.
-(define (android-platform-version) "7.1.2_r6")
+(define (android-platform-version) "7.1.2_r36")
 
 (define (android-platform-system-core version)
   (origin
@@ -113,7 +138,7 @@ use their packages mostly unmodified in our Android NDK build system.")
                               version "-checkout"))
     (sha256
      (base32
-      "0xc2n7jxrf1iw9cc278pijdfjix2fkiig5ws27f6rwp40zg5mrgg"))
+      "1krnc2b9zfkzpdgs1dcbji59nszlx2qr723pg89m52622czc06hg"))
     (patches
      (search-patches "libbase-use-own-logging.patch"
                      "libbase-fix-includes.patch"
@@ -144,7 +169,7 @@ use their packages mostly unmodified in our Android NDK build system.")
                               version "-checkout"))
     (sha256
      (base32
-      "0n9wkz3ynqw39if1ss9n32m66iga14nndf29hpm7g1aqn4wvvgzk"))))
+      "15r4s20d7vw022f8vrc3jbghmqwdcqzprl7i2bfvdkz8z76wc1ps"))))
 
 (define (android-platform-external version subdirectory checksum)
   (origin
@@ -193,7 +218,6 @@ in Main, System, Radio and Events sub-logs.")
     (build-system android-ndk-build-system)
     (arguments
      `(#:tests? #f ; Test failure: logging.UNIMPLEMENTED
-       #:make-flags '("CXXFLAGS=-std=gnu++11")
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'enter-source
@@ -233,7 +257,7 @@ various Android core host applications.")
                    "CC = gcc\n"
 
                    "CFLAGS += -fPIC\n"
-                   "CXXFLAGS += -std=gnu++11 -fPIC\n"
+                   "CXXFLAGS += -fPIC\n"
                    "CPPFLAGS += -Iinclude -I../include\n"
                    "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
 
@@ -288,7 +312,7 @@ various Android core host applications.")
     (build-system android-ndk-build-system)
     (arguments
      `(#:make-flags '("CFLAGS=-Wno-error"
-                      "CXXFLAGS=-fpermissive -Wno-error -std=gnu++11")
+                      "CXXFLAGS=-fpermissive -Wno-error")
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'enter-source
@@ -332,6 +356,13 @@ various Android core host applications.")
        (modify-phases %standard-phases
          (add-after 'unpack 'enter-source
            (lambda _ (chdir "adb") #t))
+         (add-after 'enter-source 'glibc-compat
+           (lambda _
+             ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
+             (substitute* "usb_linux.cpp"
+               (("#include <sys/types.h>" all)
+                (string-append all "\n#include <sys/sysmacros.h>\n")))
+             #t))
          (add-after 'enter-source 'make-libs-available
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (substitute* "Android.mk"
@@ -345,7 +376,7 @@ various Android core host applications.")
      `(("android-libbase" ,android-libbase)
        ("android-libcutils" ,android-libcutils)
        ("android-liblog" ,android-liblog)
-       ("openssl" ,openssl)))
+       ("openssl" ,openssl-1.0)))
     (home-page "https://developer.android.com/studio/command-line/adb.html")
     (synopsis "Android Debug Bridge")
     (description
@@ -470,9 +501,14 @@ that is safe to use for user space.  It also includes
        ;; pcre is inlined by our package.
        ("pcre" ,pcre)))
     (home-page "https://developer.android.com/")
-    (synopsis (package-synopsis libselinux))
-    (description (package-description libselinux))
-    (license (package-license libselinux))))
+    (synopsis "Android version of the SELinux libraries and utilities")
+    (description
+     "The libselinux library provides an API for SELinux applications to get
+and set process and file security contexts, and to obtain security policy
+decisions.  It is required for any applications that use the SELinux API, and
+used by all applications that are SELinux-aware.  This package also includes
+the core SELinux management utilities.")
+    (license license:public-domain)))
 
 (define-public android-ext4-utils
   (package
@@ -521,7 +557,7 @@ that is safe to use for user space.  It also includes
     (native-inputs
      `(("android-core" ,(android-platform-system-core version))))
     (home-page "https://developer.android.com/")
-    (synopsis "Android ext4 filesystem utils")
+    (synopsis "Android ext4 file system utilities")
     (description "@code{android-ext4-utils} is a library in common use by the
 Android core.")
     (license license:asl2.0)))
@@ -541,7 +577,16 @@ Android core.")
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (copy-recursively "." (string-append (assoc-ref outputs "out")
                                                   "/include"))
-             #t)))))
+             #t))
+         (add-after 'install 'install-shell-scripts
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin")))
+               (patch-shebang "mkf2fsuserimg.sh")
+               (substitute* "mkf2fsuserimg.sh"
+                (("make_f2fs") (string-append bin "/make_f2fs")))
+               (install-file "mkf2fsuserimg.sh" bin)
+               #t))))))
     (inputs
      `(("f2fs-tools" ,f2fs-tools-1.7)
        ("android-libselinux" ,android-libselinux)
@@ -549,9 +594,10 @@ Android core.")
        ("android-libcutils" ,android-libcutils)
        ("zlib" ,zlib)))
     (home-page "https://developer.android.com/")
-    (synopsis "Android ext4 utils")
-    (description "@code{android-ext4-utils} is a library in common use by the
-Android core.")
+    (synopsis "Android f2fs utils")
+    (description "@code{android-f2fs-utils} is a library in common use by the
+Android core.  It allows the user to create images for the @code{f2fs} Flash
+file system.")
     (license license:asl2.0)))
 
 (define-public android-libutils
@@ -576,7 +622,8 @@ Android core.")
        ("android-libcutils" ,android-libcutils)))
     (native-inputs
      `(("android-bionic-uapi" ,android-bionic-uapi)
-       ("android-liblog" ,android-liblog)))
+       ("android-liblog" ,android-liblog)
+       ("gcc" ,gcc-5))) ; XXX: fails to build with GCC 7
     (home-page "https://developer.android.com/")
     (synopsis "Android utility library")
     (description "@code{android-libutils} provides utilities for Android NDK developers.")
@@ -589,8 +636,7 @@ Android core.")
     (source (android-platform-system-core version))
     (build-system android-ndk-build-system)
     (arguments
-     `(#:make-flags (list "CXXFLAGS=-std=gnu++11")
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'enter-source
            (lambda _
@@ -634,16 +680,16 @@ Android core.")
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")
-    (version "20180112")
+    (version "20191103")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/M0Rf30/android-udev-rules")
              (commit version)))
-       (file-name (string-append name "-" version "-checkout"))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "13gj79nnd04szqlrrzzkdr6wi1fky08pi7x8xfbg0jj3d3v0giah"))))
+        (base32 "0x2f2sv0x0ry7kccp47s0hlxps3hbpg37dj3xjjgpdm5hmn2cjq3"))))
     (build-system trivial-build-system)
     (native-inputs `(("source" ,source)))
     (arguments
@@ -653,7 +699,8 @@ Android core.")
          (use-modules (guix build utils))
          (let ((source (assoc-ref %build-inputs "source")))
            (install-file (string-append source "/51-android.rules")
-                         (string-append %output "/lib/udev/rules.d"))))))
+                         (string-append %output "/lib/udev/rules.d"))
+           #t))))
     (home-page "https://github.com/M0Rf30/android-udev-rules")
     (synopsis "udev rules for Android devices")
     (description "Provides a set of udev rules to allow using Android devices
@@ -670,7 +717,7 @@ to be passed to the @code{udev} service.")
 (define-public git-repo
   (package
     (name "git-repo")
-    (version "1.12.37")
+    (version "2.4.1")
     (source
      (origin
        (method git-fetch)
@@ -679,61 +726,66 @@ to be passed to the @code{udev} service.")
              (commit (string-append "v" version))))
        (file-name (string-append "git-repo-" version "-checkout"))
        (sha256
-        (base32 "0qp7jqhblv7xblfgpcq4n18dyjdv8shz7r60c3vnjxx2fngkj2jd"))))
+        (base32 "0khg1731927gvin73dcbw1657kbfq4k7agla5rpzqcnwkk5agzg3"))))
     (build-system python-build-system)
     (arguments
-     `(#:python ,python-2 ; code says: "Python 3 support is … experimental."
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-before 'build 'set-executable-paths
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (git (assoc-ref inputs "git"))
-                    (gpg (assoc-ref inputs "gnupg"))
                     (ssh (assoc-ref inputs "ssh")))
                (substitute* '("repo" "git_command.py")
-                 (("^GIT = 'git' ")
-                  (string-append "GIT = '" git "/bin/git' ")))
-               (substitute* "repo"
-                 ((" cmd = \\['gpg',")
-                  (string-append " cmd = ['" gpg "/bin/gpg',")))
+                 (("^GIT = 'git'")
+                  (string-append "GIT = '" git "/bin/git'")))
                (substitute* "git_config.py"
                  ((" command_base = \\['ssh',")
                   (string-append " command_base = ['" ssh "/bin/ssh',")))
                #t)))
-         (add-before 'build 'do-not-clone-this-source
+         (add-before 'build 'do-not-self-update
            (lambda* (#:key outputs #:allow-other-keys)
+             ;; Setting the REPO_MAIN variable to an absolute file name is
+             ;; enough to have _FindRepo return the store main.py file.  The
+             ;; self update mechanism is activated with the call to _Init() in
+             ;; main(), so we bypass it.
+
+             ;; Ticket requesting upstream to provide a mean to disable the
+             ;; self update mechanism:
+             ;; https://bugs.chromium.org/p/gerrit/issues/detail?id=12407.
              (let* ((out (assoc-ref outputs "out"))
-                    (repo-dir (string-append out "/share/" ,name)))
+                    (repo-main (string-append out "/share/git-repo/main.py")))
                (substitute* "repo"
-                 (("^def _FindRepo\\(\\):.*")
-                  (format #f "
-def _FindRepo():
-  '''Look for a repo installation, starting at the current directory.'''
-  # Use the installed version of git-repo.
-  repo_main = '~a/main.py'
-  curdir = os.getcwd()
-  olddir = None
-  while curdir != '/' and curdir != olddir:
-    dot_repo = os.path.join(curdir, repodir)
-    if os.path.isdir(dot_repo):
-      return (repo_main, dot_repo)
-    else:
-      olddir = curdir
-      curdir = os.path.dirname(curdir)
-  return None, ''
-
-  # The remaining of this function is dead code.  It was used to
-  # find a git-checked-out version in the local project.\n" repo-dir))
-                 ;; Neither clone, check out, nor verify the git repository
-                 (("(^\\s+)_Clone\\(.*\\)") "")
-                 (("(^\\s+)_Checkout\\(.*\\)") "")
-                 ((" rev = _Verify\\(.*\\)") " rev = None"))
-               #t)))
+                 (("^REPO_MAIN = .*")
+                  (format #f "REPO_MAIN = ~s~%" repo-main))
+                 ((" _Init\\(args, gitc_init=\\(cmd ==.*" all)
+                  (string-append "True #" all)))
+               ;; Prevent repo from trying to git describe its version from
+               ;; the (disabled) self updated copy.
+               (substitute* "git_command.py"
+                 (("ver = getattr\\(RepoSourceVersion.*")
+                  (format #f "ver = ~s~%" ,version)))
+               (substitute* "subcmds/version.py"
+                 (("rp_ver = .*")
+                  (format #f "rp_ver = ~s~%" ,version)))
+               ;; Prevent repo from adding its (disabled) self update copy to
+               ;; the list of projects to fetch when using 'repo sync'.
+               (substitute* "subcmds/sync.py"
+                 (("to_fetch\\.extend\\(all_projects\\).*" all)
+                  (string-append "#" all))
+                 (("self\\._Fetch\\(to_fetch")
+                  "self._Fetch(all_projects")
+                 (("_PostRepoFetch\\(rp, opt\\.repo_verify).*" all)
+                  (string-append "#" all))))))
          (delete 'build) ; nothing to build
+         (add-before 'check 'configure-git
+           (lambda _
+             (setenv "HOME" (getcwd))
+             (invoke "git" "config" "--global" "user.email" "you@example.com")
+             (invoke "git" "config" "--global" "user.name" "Your Name")))
          (replace 'check
            (lambda _
-             (zero? (system* "python" "-m" "nose"))))
+             (invoke "./run_tests")))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -749,10 +801,9 @@ def _FindRepo():
     (inputs
      ;; TODO: Add git-remote-persistent-https once it is available in guix
      `(("git" ,git)
-       ("gnupg" ,gnupg)
        ("ssh" ,openssh)))
     (native-inputs
-     `(("nose" ,python2-nose)))
+     `(("pytest" ,python-pytest)))
     (home-page "https://code.google.com/p/git-repo/")
     (synopsis "Helps to manage many Git repositories.")
     (description "Repo is a tool built on top of Git.  Repo helps manage many
@@ -796,3 +847,158 @@ script that you can put anywhere in your path.")
 Boot Images.  @code{abootimg} can work directly on block devices, or, the
 safest way, on a file image.")
     (license license:gpl2+)))
+
+(define-public python-androguard
+  (package
+    (name "python-androguard")
+    (version "3.2.1")
+    (source
+      (origin
+        ;; The pypi release doesn't have the tests, but the tests use
+        ;; packaged binaries, so we skip them.
+        (method url-fetch)
+        (uri (pypi-uri "androguard" version))
+        (sha256
+         (base32
+          "0ndsw00pkyda4i2s3wi5ap8gbk6a9d23xhhxpdbk02padv8sxkfv"))))
+    (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           ;; Adapted from .travis.yml
+           (lambda _
+             (invoke "nosetests" "--with-coverage" "--with-timer"
+                     "--timer-top-n" "50"))))))
+    (native-inputs
+     `(("python-codecov" ,python-codecov)
+       ("python-coverage" ,python-coverage)
+       ("python-mock" ,python-mock)
+       ("python-nose" ,python-nose)
+       ("python-nose-timer" ,python-nose-timer)))
+    (propagated-inputs
+     `(("python-asn1crypto" ,python-asn1crypto)
+       ("python-colorama" ,python-colorama)
+       ("python-future" ,python-future)
+       ("python-ipython" ,python-ipython)
+       ("python-lxml" ,python-lxml)
+       ("python-matplotlib" ,python-matplotlib)
+       ("python-networkx" ,python-networkx)
+       ("python-pygments" ,python-pygments)
+       ("python-pyperclip" ,python-pyperclip)))
+    (home-page "https://github.com/androguard/androguard")
+    (synopsis "Python tool to play with Android files")
+    (description
+     "Androguard is a full Python tool to manipulate Android files.  It is
+useful for reverse engineering, analysis of Android applications and more.")
+    (license license:asl2.0)))
+
+(define-public fdroidserver
+  (package
+    (name "fdroidserver")
+    (version "1.1.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "fdroidserver" version))
+        (sha256
+         (base32
+          "0fp7q8faicx6i6wxm717qqaham3jpilb23mvynpz6v73z7hm6wcg"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-versioning
+           (lambda _
+             (substitute* "setup.py"
+               (("0.2.1") ,(package-version python-pyasn1-modules)))
+             #t)))))
+    (propagated-inputs
+     `(("python-androguard" ,python-androguard)
+       ("python-apache-libcloud" ,python-apache-libcloud)
+       ("python-clint" ,python-clint)
+       ("python-defusedxml" ,python-defusedxml)
+       ("python-docker-py" ,python-docker-py)
+       ("python-gitpython" ,python-gitpython)
+       ("python-mwclient" ,python-mwclient)
+       ("python-paramiko" ,python-paramiko)
+       ("python-pillow" ,python-pillow)
+       ("python-pyasn1" ,python-pyasn1)
+       ("python-pyasn1-modules" ,python-pyasn1-modules)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-qrcode" ,python-qrcode)
+       ("python-ruamel.yaml" ,python-ruamel.yaml)
+       ("python-requests" ,python-requests)
+       ("python-vagrant" ,python-vagrant)))
+    (native-inputs
+     `(("python-babel" ,python-babel)
+       ("python-bcrypt" ,python-bcrypt)
+       ("python-docker-pycreds" ,python-docker-pycreds)
+       ("python-pynacl" ,python-pynacl)
+       ("python-websocket-client" ,python-websocket-client)))
+    (home-page "https://f-droid.org")
+    (synopsis "F-Droid server tools")
+    (description
+     "The F-Droid server tools provide various scripts and tools that are used
+to maintain F-Droid, the repository of free Android applications.  You can use
+these same tools to create your own additional or alternative repository for
+publishing, or to assist in creating, testing and submitting metadata to the
+main repository.")
+    (license license:agpl3+)))
+
+(define-public enjarify
+  (package
+    (name "enjarify")
+    (version "1.0.3")
+    (home-page "https://github.com/Storyyeller/enjarify")
+    (source
+     (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url home-page)
+            (commit version)))
+      (file-name (git-file-name name version))
+      (patches
+       (search-patches "enjarify-setup-py.patch"))
+      (sha256
+       (base32
+        "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'enjarify-wrapper-inherit-pythonpath
+           ;; enjarify sets PYTHONPATH from a shell script, overwriting
+           ;; PYTHONPATH set from guix. Comment out this line.
+           (lambda _
+             (substitute* "enjarify.sh"
+               (("export PYTHONPATH") "# export PYTHONPATH"))
+             #t))
+         (add-before 'check 'fixup-expected-test-results
+           ;; Upstream adjusted this test in commit:
+           ;; 3ae884a6485af82d300515813f537685b08dd800
+           (lambda _
+             (substitute* "tests/test2/expected.txt"
+               (("^20") "0"))
+             #t))
+         (add-before 'check 'drop-java-xss-argument
+           ;; Upstream removed this argument in order to support 32-bit
+           ;; architectures.  commit: 4be0111d879aa95fdc0d9f24fe529f8c664d4093
+           (lambda _
+             (substitute* "enjarify/runtests.py"
+               (("java -Xss515m") "java "))
+             #t))
+         (add-after 'install 'install-enjarify-wrapper
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out")))
+                 (mkdir-p (string-append out "/bin/"))
+                 (copy-file "enjarify.sh" (string-append out "/bin/enjarify"))
+                 #t))))))
+    (native-inputs `(("openjdk" ,openjdk12)))
+    (synopsis "Translate Dalvik bytecode to equivalent Java bytecode")
+    (description "Android applications are Java programs that run on a
+customized virtual machine, which is part of the Android operating system, the
+Dalvik VM.  Their bytecode differs from the bytecode of normal Java
+applications.  Enjarify can translate the Dalvik bytecode back to equivalent
+Java bytecode, which simplifies the analysis of Android applications.")
+    (license license:asl2.0)))