Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / android.scm
index 4838074..62a5466 100644 (file)
@@ -5,8 +5,10 @@
 ;;; 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>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #: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)
@@ -48,7 +54,7 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages virtualization)
   #:use-module (gnu packages xdisorg)
-  #:use-module (gnu packages linux))
+  #:use-module (gnu packages xml))
 
 (define-public android-make-stub
   (package
@@ -87,6 +93,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
@@ -200,7 +217,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
@@ -240,7 +256,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"
 
@@ -295,7 +311,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
@@ -359,7 +375,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
@@ -484,9 +500,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
@@ -535,7 +556,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)))
@@ -600,7 +621,8 @@ file system.")
        ("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.")
@@ -613,8 +635,7 @@ file system.")
     (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 _
@@ -658,16 +679,16 @@ file system.")
 (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
@@ -758,7 +779,7 @@ def _FindRepo():
          (delete 'build) ; nothing to build
          (replace 'check
            (lambda _
-             (zero? (system* "python" "-m" "nose"))))
+             (invoke "python" "-m" "nose")))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -814,7 +835,7 @@ script that you can put anywhere in your path.")
               (install-file "abootimg" bin)
               #t))))))
     (inputs
-     `(("libblkid" ,util-linux)))
+     `(("libblkid" ,util-linux "lib")))
     (home-page "https://ac100.grandou.net/abootimg")
     (synopsis "Tool for manipulating Android Boot Images")
     (description "This package provides a tool for manipulating old Android
@@ -870,14 +891,14 @@ useful for reverse engineering, analysis of Android applications and more.")
 (define-public fdroidserver
   (package
     (name "fdroidserver")
-    (version "1.0.10")
+    (version "1.1.1")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "fdroidserver" version))
         (sha256
          (base32
-          "0n6kkby65qzqdx1jn72grfffvr1w1j1rby5pwm9z8rymmsh8s0pm"))))
+          "0fp7q8faicx6i6wxm717qqaham3jpilb23mvynpz6v73z7hm6wcg"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -891,6 +912,7 @@ useful for reverse engineering, analysis of Android applications and more.")
      `(("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)
@@ -918,3 +940,60 @@ 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)))