gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / android.scm
index 30dd892..eb538f6 100644 (file)
@@ -1,14 +1,16 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012 Stefan Handschuh <handschuh.stefan@googlemail.com>
 ;;; Copyright © 2015 Kai-Chung Yan <seamlikok@gmail.com>
-;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; 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, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2019, 2020 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020 Sergey Trofimov <sarg@sarg.org.ru>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,8 +31,9 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
-  #:use-module (guix build-system gnu)
   #:use-module (guix build-system android-ndk)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system go)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module ((guix licenses) #:prefix license:)
@@ -40,6 +43,7 @@
   #:use-module (gnu packages docker)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages golang)
   #:use-module (gnu packages java)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages pcre)
@@ -64,7 +68,7 @@
      (origin
       (method git-fetch)
       (uri (git-reference
-            (url "https://github.com/daym/android-make-stub.git")
+            (url "https://github.com/daym/android-make-stub")
             (commit (string-append "v" version))))
       (file-name (string-append "android-make-stub-"
                                 version "-checkout"))
@@ -98,7 +102,7 @@ use their packages mostly unmodified in our Android NDK build system.")
      (origin
        (method git-fetch)
        (uri (git-reference
-              (url "https://github.com/google/googletest.git")
+              (url "https://github.com/google/googletest")
               (commit (string-append "release-" version))))
        (file-name (git-file-name name version))
        (sha256
@@ -125,9 +129,9 @@ 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_r36")
+(define-public (android-platform-version) "7.1.2_r36")
 
-(define (android-platform-system-core version)
+(define-public (android-platform-system-core version)
   (origin
     (method git-fetch)
     (uri (git-reference
@@ -184,7 +188,7 @@ use their packages mostly unmodified in our Android NDK build system.")
      (base32
       checksum))))
 
-(define android-liblog
+(define-public android-liblog
   (package
     (name "android-liblog")
     (version (android-platform-version))
@@ -200,7 +204,16 @@ use their packages mostly unmodified in our Android NDK build system.")
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
                (symlink "liblog.so.0" (string-append out "/lib/liblog.so"))
-               #t))))))
+               #t)))
+         (add-after 'install 'install-headers
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (copy-recursively
+                 "../include/log" (string-append out "/include/log"))
+               ;; For android/log.h, the only header in the android directory.
+               (copy-recursively
+                 "../include/android" (string-append out "/include/android")))
+             #t)))))
     (home-page "https://developer.android.com/")
     (synopsis "Logging library from the Android platform.")
     (description "@code{liblog} represents an interface to the volatile Android
@@ -228,7 +241,7 @@ in Main, System, Radio and Events sub-logs.")
 various Android core host applications.")
     (license license:asl2.0)))
 
-(define android-libcutils
+(define-public android-libcutils
   (package
     (name "android-libcutils")
     (version (android-platform-version))
@@ -610,9 +623,20 @@ file system.")
        #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
        #:phases
        (modify-phases %standard-phases
+         (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent it from
+             ;; shadowing the version of GCC provided in native-inputs.
+             (let ((gcc (assoc-ref inputs "gcc")))
+               (setenv "CPLUS_INCLUDE_PATH"
+                       (string-join
+                        (delete (string-append gcc "/include/c++")
+                                (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                              #\:))
+                        ":"))
+               #t)))
          (add-after 'unpack 'enter-source
            (lambda _ (chdir "libutils") #t))
-
          (add-after 'install 'install-headers
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
@@ -622,7 +646,7 @@ file system.")
     (native-inputs
      `(("android-bionic-uapi" ,android-bionic-uapi)
        ("android-liblog" ,android-liblog)
-       ("gcc" ,gcc-5))) ; XXX: fails to build with GCC 7
+       ("gcc@5" ,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.")
@@ -679,7 +703,7 @@ file system.")
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")
-    (version "20191103")
+    (version "20200613")
     (source
      (origin
        (method git-fetch)
@@ -688,7 +712,7 @@ file system.")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0x2f2sv0x0ry7kccp47s0hlxps3hbpg37dj3xjjgpdm5hmn2cjq3"))))
+        (base32 "0cf5br8x6iwxc1cifv0i1klw7skgs8hghdx6qlqby68kyqg81bb2"))))
     (build-system trivial-build-system)
     (native-inputs `(("source" ,source)))
     (arguments
@@ -716,7 +740,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)
@@ -725,61 +749,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 _
-             (invoke "python" "-m" "nose")))
+             (invoke "./run_tests")))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -795,10 +824,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
@@ -835,7 +863,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
@@ -891,14 +919,14 @@ useful for reverse engineering, analysis of Android applications and more.")
 (define-public fdroidserver
   (package
     (name "fdroidserver")
-    (version "1.1.1")
+    (version "1.1.9")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "fdroidserver" version))
         (sha256
          (base32
-          "0fp7q8faicx6i6wxm717qqaham3jpilb23mvynpz6v73z7hm6wcg"))))
+          "0m07f791z45w7r2dzx4yb6s54b3c3wykm3w9hn25p2jcyax082a2"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -906,14 +934,20 @@ useful for reverse engineering, analysis of Android applications and more.")
          (add-after 'unpack 'fix-versioning
            (lambda _
              (substitute* "setup.py"
-               (("0.2.1") ,(package-version python-pyasn1-modules)))
+               (("0.2.1") ,(package-version python-pyasn1-modules))
+               ;; The dependency on docker has been removed upstream by
+               ;; a fairly large patch:
+               ;; https://gitlab.com/fdroid/fdroidserver/-/commit/89614851250c79a05db84070feca6dea033af334
+               ;; that is not in a release yet. It appears we can compile with
+               ;; a newer version.
+               (("docker-py >= 1.9, < 2.0") "docker >= 1.9"))
              #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-docker" ,python-docker)
        ("python-gitpython" ,python-gitpython)
        ("python-mwclient" ,python-mwclient)
        ("python-paramiko" ,python-paramiko)
@@ -941,6 +975,36 @@ publishing, or to assist in creating, testing and submitting metadata to the
 main repository.")
     (license license:agpl3+)))
 
+(define-public fdroidcl
+  (package
+    (name "fdroidcl")
+    (version "0.5.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                     (url "https://github.com/mvdan/fdroidcl")
+                     (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "1rxcdyy2j34z0ql9d62w7ivsch9xihjnpb1z9kgy9q46vl8zhhy0"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "mvdan.cc/fdroidcl"
+       #:tests? #f  ; TODO: Inputs missing.
+       #:install-source? #f))
+    (inputs
+     `(("go-github-com-kr-pretty" ,go-github-com-kr-pretty)))
+    ;(native-inputs
+    ; `(("go-github-com-rogpeppe-go-internal-testscript"
+    ;    ,go-github-com-rogpeppe-go-internal-testscript)))
+    (synopsis "F-Droid desktop client")
+    (description
+     "While the Android client integrates with the system with regular update
+checks and notifications, this is a simple command line client that talks to
+connected devices via ADB.")
+    (home-page "https://github.com/mvdan/fdroidcl")
+    (license license:bsd-3)))
+
 (define-public enjarify
   (package
     (name "enjarify")