1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Stefan Handschuh <handschuh.stefan@googlemail.com>
3 ;;; Copyright © 2015 Kai-Chung Yan <seamlikok@gmail.com>
4 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
5 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
6 ;;; Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
7 ;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
8 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
11 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages android)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system android-ndk)
34 #:use-module (guix build-system python)
35 #:use-module (guix build-system trivial)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages docker)
41 #:use-module (gnu packages gcc)
42 #:use-module (gnu packages gnupg)
43 #:use-module (gnu packages java)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages pcre)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-crypto)
48 #:use-module (gnu packages python-web)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages selinux)
51 #:use-module (gnu packages serialization)
52 #:use-module (gnu packages ssh)
53 #:use-module (gnu packages tls)
54 #:use-module (gnu packages version-control)
55 #:use-module (gnu packages virtualization)
56 #:use-module (gnu packages xdisorg)
57 #:use-module (gnu packages xml))
59 (define-public android-make-stub
61 (name "android-make-stub")
67 (url "https://github.com/daym/android-make-stub.git")
68 (commit (string-append "v" version))))
69 (file-name (string-append "android-make-stub-"
73 "0y1b2x96d37n6f1bp6dcx08bn08zac0cylmbfsx6mf2nahc02fhc"))))
74 (build-system gnu-build-system)
76 `(#:tests? #f ; None exist.
78 (modify-phases %standard-phases
82 (lambda* (#:key outputs #:allow-other-keys)
83 (let* ((out (assoc-ref outputs "out")))
84 (invoke "make" (string-append "prefix=" out) "install")
86 (home-page "https://github.com/daym/android-make-stub")
87 (synopsis "Stubs for the @command{make} system of the Android platform")
88 (description "@code{android-make-stub} provides stubs for the
89 @command{make} system of the Android platform. This allows us to
90 use their packages mostly unmodified in our Android NDK build system.")
91 (license license:asl2.0)))
93 (define-public android-googletest
94 (package (inherit googletest)
95 (name "android-googletest")
101 (url "https://github.com/google/googletest.git")
102 (commit (string-append "release-" version))))
103 (file-name (git-file-name name version))
106 "0bjlljmbf8glnd9qjabx73w6pd7ibv43yiyngqvmvgxsabzr8399"))))
108 `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
110 (modify-phases %standard-phases
111 (add-after 'install 'install-host-libraries
112 (lambda* (#:key outputs #:allow-other-keys)
113 (let* ((out (assoc-ref outputs "out"))
114 (lib (string-append out "/lib")))
115 (symlink "libgtest.so"
116 (string-append lib "/libgtest_host.so"))
117 (symlink "libgmock.so"
118 (string-append lib "/libgmock_host.so"))
121 ;; The Makefiles that we add are largely based on the Debian
122 ;; packages. They are licensed under GPL-2 and have copyright:
123 ;; 2012, Stefan Handschuh <handschuh.stefan@googlemail.com>
124 ;; 2015, Kai-Chung Yan <seamlikok@gmail.com>
125 ;; Big thanks to them for laying the groundwork.
127 ;; The version tag is consistent between all repositories.
128 (define (android-platform-version) "7.1.2_r36")
130 (define (android-platform-system-core version)
134 (url "https://android.googlesource.com/platform/system/core")
135 (commit (string-append "android-" version))))
136 (file-name (string-append "android-platform-system-core-"
137 version "-checkout"))
140 "1krnc2b9zfkzpdgs1dcbji59nszlx2qr723pg89m52622czc06hg"))
142 (search-patches "libbase-use-own-logging.patch"
143 "libbase-fix-includes.patch"
144 "libutils-remove-damaging-includes.patch"
145 "libutils-add-includes.patch"
146 "adb-add-libraries.patch"
147 "libziparchive-add-includes.patch"))))
149 (define (android-platform-system-extras version)
153 (url "https://android.googlesource.com/platform/system/extras")
154 (commit (string-append "android-" version))))
155 (file-name (string-append "android-platform-system-extras-"
156 version "-checkout"))
159 "18130c23ybqcpgjc5v6f8kdbv2xn39hyiaj17dzldjb9rlwzcyy9"))))
161 (define (android-platform-bionic version)
165 (url "https://android.googlesource.com/platform/bionic")
166 (commit (string-append "android-" version))))
167 (file-name (string-append "android-platform-bionic-"
168 version "-checkout"))
171 "15r4s20d7vw022f8vrc3jbghmqwdcqzprl7i2bfvdkz8z76wc1ps"))))
173 (define (android-platform-external version subdirectory checksum)
178 (string-append "https://android.googlesource.com/platform/external/"
180 (commit (string-append "android-" version))))
181 (file-name (string-append "android-platform-system-external-" subdirectory "-"
182 version "-checkout"))
187 (define android-liblog
189 (name "android-liblog")
190 (version (android-platform-version))
191 (source (android-platform-system-core version))
192 (build-system android-ndk-build-system)
194 `(#:make-flags '("LDLIBS=-lpthread")
196 (modify-phases %standard-phases
197 (add-after 'unpack 'enter-source
198 (lambda _ (chdir "liblog") #t))
199 (add-after 'install 'ldconfig
200 (lambda* (#:key outputs #:allow-other-keys)
201 (let ((out (assoc-ref outputs "out")))
202 (symlink "liblog.so.0" (string-append out "/lib/liblog.so"))
204 (home-page "https://developer.android.com/")
205 (synopsis "Logging library from the Android platform.")
206 (description "@code{liblog} represents an interface to the volatile Android
207 Logging system for NDK (Native) applications and libraries and contain
208 interfaces for either writing or reading logs. The log buffers are divided up
209 in Main, System, Radio and Events sub-logs.")
210 (license license:asl2.0)))
212 (define android-libbase
214 (name "android-libbase")
215 (version (android-platform-version))
216 (source (android-platform-system-core version))
217 (build-system android-ndk-build-system)
219 `(#:tests? #f ; Test failure: logging.UNIMPLEMENTED
221 (modify-phases %standard-phases
222 (add-after 'unpack 'enter-source
223 (lambda _ (chdir "base") #t)))))
224 (inputs `(("android-liblog" ,android-liblog)))
225 (home-page "https://developer.android.com/")
226 (synopsis "Android platform base library")
227 (description "@code{libbase} is a library in common use by the
228 various Android core host applications.")
229 (license license:asl2.0)))
231 (define android-libcutils
233 (name "android-libcutils")
234 (version (android-platform-version))
235 (source (android-platform-system-core version))
236 (build-system gnu-build-system)
238 `(#:tests? #f ; TODO.
240 (modify-phases %standard-phases
241 (add-after 'unpack 'enter-source
242 (lambda _ (chdir "libcutils") #t))
243 (add-after 'enter-source 'create-Makefile
245 ;; No useful makefile is shipped, so we create one.
246 (with-output-to-file "Makefile"
251 "SOURCES = load_file.o socket_local_client_unix.o"
252 " socket_loopback_client_unix.o socket_network_client_unix.o"
253 " socket_loopback_server_unix.o socket_local_server_unix.o"
254 " sockets_unix.o socket_inaddr_any_server_unix.o"
259 "CXXFLAGS += -fPIC\n"
260 "CPPFLAGS += -Iinclude -I../include\n"
261 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
263 "build: $(SOURCES)\n"
264 " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
269 (lambda* (#:key outputs #:allow-other-keys)
270 (let* ((out (assoc-ref outputs "out"))
271 (lib (string-append out "/lib"))
272 (include (string-append out "/include")))
273 (install-file "libcutils.so.0" lib)
274 (with-directory-excursion lib
275 (symlink "libcutils.so.0" "libcutils.so"))
276 (copy-recursively "../include/cutils"
277 (string-append include "/cutils"))
279 (home-page "https://developer.android.com/")
280 (synopsis "Android platform c utils library")
281 (description "@code{libcutils} is a library in common use by the
282 various Android core host applications.")
283 (license license:asl2.0)))
285 (define-public android-libsparse
287 (name "android-libsparse")
288 (version (android-platform-version))
289 (source (android-platform-system-core version))
290 (build-system android-ndk-build-system)
292 `(#:make-flags '("CFLAGS=-Wno-error"
293 "CXXFLAGS=-fpermissive -Wno-error")
295 (modify-phases %standard-phases
296 (add-after 'unpack 'enter-source
297 (lambda _ (chdir "libsparse") #t)))))
300 (home-page "https://developer.android.com/")
301 (synopsis "Android platform sparse library")
302 (description "@code{android-libsparse} is a library in common use by the
303 various Android core host applications.")
304 (license license:asl2.0)))
306 (define-public android-libziparchive
308 (name "android-libziparchive")
309 (version (android-platform-version))
310 (source (android-platform-system-core version))
311 (build-system android-ndk-build-system)
313 `(#:make-flags '("CFLAGS=-Wno-error"
314 "CXXFLAGS=-fpermissive -Wno-error")
316 (modify-phases %standard-phases
317 (add-after 'unpack 'enter-source
318 (lambda _ (chdir "libziparchive") #t))
319 (add-before 'check 'setenv
321 (setenv "ziparchive_tests_host_PARAMS" "--test_data_dir=testdata")
323 (add-after 'install 'install-headers
324 (lambda* (#:key inputs outputs #:allow-other-keys)
325 (let ((out (assoc-ref outputs "out")))
326 (copy-recursively "../include/ziparchive"
327 (string-append out "/include/ziparchive"))
332 `(("android-libbase" ,android-libbase)
333 ("android-libutils" ,android-libutils)
334 ("android-liblog" ,android-liblog)))
335 (home-page "https://developer.android.com/")
336 (synopsis "Android platform ZIP library")
337 (description "@code{android-libziparchive} is a library in common use by the
338 various Android core host applications.")
339 (license license:asl2.0)))
344 (version (android-platform-version))
345 (source (android-platform-system-core version))
346 (build-system android-ndk-build-system)
348 `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
350 (list "CFLAGS=-Wno-error"
351 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
352 (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
353 "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
355 (modify-phases %standard-phases
356 (add-after 'unpack 'enter-source
357 (lambda _ (chdir "adb") #t))
358 (add-after 'enter-source 'glibc-compat
360 ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
361 (substitute* "usb_linux.cpp"
362 (("#include <sys/types.h>" all)
363 (string-append all "\n#include <sys/sysmacros.h>\n")))
365 (add-after 'enter-source 'make-libs-available
366 (lambda* (#:key inputs outputs #:allow-other-keys)
367 (substitute* "Android.mk"
368 (("libcrypto_static") "libcrypto"))
370 (add-after 'install 'install-headers
371 (lambda* (#:key inputs outputs #:allow-other-keys)
372 (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
375 `(("android-libbase" ,android-libbase)
376 ("android-libcutils" ,android-libcutils)
377 ("android-liblog" ,android-liblog)
378 ("openssl" ,openssl-1.0)))
379 (home-page "https://developer.android.com/studio/command-line/adb.html")
380 (synopsis "Android Debug Bridge")
382 "@command{adb} is a versatile command line tool that lets you communicate
383 with an emulator instance or connected Android device. It facilitates a variety
384 of device actions, such as installing and debugging apps, and it provides access
385 to a Unix shell that can run commands on the connected device or emulator.")
386 (license license:asl2.0)))
388 (define-public mkbootimg
391 (version (android-platform-version))
393 (inherit (android-platform-system-core version))))
394 (build-system python-build-system)
398 (modify-phases %standard-phases
399 (add-after 'unpack 'enter-source
400 (lambda _ (chdir "mkbootimg") #t))
404 (lambda* (#:key outputs #:allow-other-keys)
405 (let* ((out (assoc-ref outputs "out"))
406 (bin (string-append out "/bin"))
407 (include (string-append out "/include")))
408 (install-file "mkbootimg" bin)
409 (install-file "bootimg.h" include)
411 (home-page "https://developer.android.com/studio/command-line/adb.html")
412 (synopsis "Tool to create Android boot images")
413 (description "This package provides a tool to create Android Boot
415 (license license:asl2.0)))
417 (define-public android-safe-iop
419 (name "android-safe-iop")
420 (version (android-platform-version))
421 (source (android-platform-external version "safe-iop"
422 "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw"))
423 (build-system android-ndk-build-system)
425 `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error")
427 (modify-phases %standard-phases
428 (add-before 'build 'patch-host
430 ;; TODO: Cross-compile.
431 (substitute* "Android.mk"
432 (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY"))
434 (home-page "https://developer.android.com/")
435 (synopsis "Safe integers in C")
436 (description "@code{android-safe-iop} provides a set of functions for
437 performing and checking safe integer operations. Ensure that integer
438 operations do not result in silent overflow.")
439 (license license:bsd-2)))
441 (define-public android-bionic-uapi
443 (name "android-bionic-uapi")
444 (version (android-platform-version))
445 (source (android-platform-bionic version))
446 (build-system android-ndk-build-system)
449 (modify-phases %standard-phases
450 (add-after 'unpack 'enter-source
451 (lambda _ (chdir "libc") #t))
457 (lambda* (#:key outputs #:allow-other-keys)
458 (let* ((out (assoc-ref outputs "out"))
459 (out-sys (string-append out "/include/sys")))
461 (install-file "include/sys/system_properties.h" out-sys)
462 (install-file "include/sys/_system_properties.h" out-sys)
463 (copy-recursively "kernel/uapi" (string-append out "/include"))
465 (home-page "https://developer.android.com/")
466 (synopsis "Android Linux API that is safe for user space")
467 (description "@code{android-bionic-uapi} provides the part of the Linux API
468 that is safe to use for user space. It also includes
469 @code{system_properties.h} and @code{_system_properties.h}.")
470 (license license:asl2.0)))
472 (define-public android-libselinux
474 (name "android-libselinux")
475 (version (android-platform-version))
477 (android-platform-external version "libselinux"
478 "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
479 (build-system android-ndk-build-system)
481 ;; See logd/Android.mk for the *_LOG_TAG values.
482 `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
484 "-I core/libpackagelistparser/include "
485 "-DAUDITD_LOG_TAG=1003 "
486 "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
487 "LDFLAGS=-L . -lpcre")
489 (modify-phases %standard-phases
490 (add-after 'unpack-core 'patch-HOST
492 ;; gettid duplicates otherwise.
493 (substitute* "src/procattr.c"
494 (("#ifdef HOST") "#ifdef XXX"))
497 `(("openssl" ,openssl)))
499 `(("android-bionic-uapi" ,android-bionic-uapi)
500 ;; pcre is inlined by our package.
502 (home-page "https://developer.android.com/")
503 (synopsis (package-synopsis libselinux))
504 (description (package-description libselinux))
505 (license (package-license libselinux))))
507 (define-public android-ext4-utils
509 (name "android-ext4-utils")
510 (version (android-platform-version))
511 (source (android-platform-system-extras version))
512 (build-system android-ndk-build-system)
515 (list (string-append "CPPFLAGS="
518 (assoc-ref %build-inputs "android-libselinux")
520 "-I " (assoc-ref %build-inputs "android-libsparse")
522 "-I " (assoc-ref %build-inputs "android-libcutils")
524 "-I " (assoc-ref %build-inputs "android-liblog") "/include "
525 "-I ../core/include")
527 "install-libext4_utils_host.a"
528 (string-append "prefix=" (assoc-ref %outputs "out")))
530 (modify-phases %standard-phases
531 (add-after 'unpack 'unpack-core
532 (lambda* (#:key inputs #:allow-other-keys)
534 (with-directory-excursion "core"
535 (invoke "tar" "axf" (assoc-ref inputs "android-core")
536 "--strip-components=1"))
538 (add-after 'unpack-core 'enter-source
539 (lambda _ (chdir "ext4_utils") #t))
541 (lambda* (#:key inputs outputs #:allow-other-keys)
542 (let ((out (assoc-ref outputs "out")))
543 (copy-recursively "." (string-append out "/include")))
546 `(("android-libcutils" ,android-libcutils)
547 ("android-liblog" ,android-liblog)
548 ("android-libselinux" ,android-libselinux)
549 ("android-libsparse" ,android-libsparse)
552 `(("android-core" ,(android-platform-system-core version))))
553 (home-page "https://developer.android.com/")
554 (synopsis "Android ext4 file system utilities")
555 (description "@code{android-ext4-utils} is a library in common use by the
557 (license license:asl2.0)))
559 (define-public android-f2fs-utils
561 (name "android-f2fs-utils")
562 (version (android-platform-version))
563 (source (android-platform-system-extras version))
564 (build-system android-ndk-build-system)
567 (modify-phases %standard-phases
568 (add-after 'unpack 'enter-source
569 (lambda _ (chdir "f2fs_utils") #t))
570 (add-after 'install 'install-headers
571 (lambda* (#:key inputs outputs #:allow-other-keys)
572 (copy-recursively "." (string-append (assoc-ref outputs "out")
575 (add-after 'install 'install-shell-scripts
576 (lambda* (#:key outputs #:allow-other-keys)
577 (let* ((out (assoc-ref outputs "out"))
578 (bin (string-append out "/bin")))
579 (patch-shebang "mkf2fsuserimg.sh")
580 (substitute* "mkf2fsuserimg.sh"
581 (("make_f2fs") (string-append bin "/make_f2fs")))
582 (install-file "mkf2fsuserimg.sh" bin)
585 `(("f2fs-tools" ,f2fs-tools-1.7)
586 ("android-libselinux" ,android-libselinux)
587 ("android-libsparse" ,android-libsparse)
588 ("android-libcutils" ,android-libcutils)
590 (home-page "https://developer.android.com/")
591 (synopsis "Android f2fs utils")
592 (description "@code{android-f2fs-utils} is a library in common use by the
593 Android core. It allows the user to create images for the @code{f2fs} Flash
595 (license license:asl2.0)))
597 (define-public android-libutils
599 (name "android-libutils")
600 (version (android-platform-version))
601 (source (android-platform-system-core version))
602 (build-system android-ndk-build-system)
605 #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
607 (modify-phases %standard-phases
608 (add-after 'unpack 'enter-source
609 (lambda _ (chdir "libutils") #t))
611 (add-after 'install 'install-headers
612 (lambda* (#:key inputs outputs #:allow-other-keys)
613 (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
615 `(("android-safe-iop" ,android-safe-iop)
616 ("android-libcutils" ,android-libcutils)))
618 `(("android-bionic-uapi" ,android-bionic-uapi)
619 ("android-liblog" ,android-liblog)
620 ("gcc" ,gcc-5))) ; XXX: fails to build with GCC 7
621 (home-page "https://developer.android.com/")
622 (synopsis "Android utility library")
623 (description "@code{android-libutils} provides utilities for Android NDK developers.")
624 (license license:asl2.0)))
626 (define-public fastboot
629 (version (android-platform-version))
630 (source (android-platform-system-core version))
631 (build-system android-ndk-build-system)
634 (modify-phases %standard-phases
635 (add-after 'unpack 'enter-source
639 (add-after 'enter-source 'patch-source
641 (substitute* "Android.mk"
642 (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
645 (lambda* (#:key outputs #:allow-other-keys)
646 (let* ((out (assoc-ref outputs "out"))
647 (lib (string-append out "/lib"))
648 (bin (string-append out "/bin")))
649 (install-file "fastboot" bin)
653 ("android-safe-iop" ,android-safe-iop)
654 ("android-ext4-utils" ,android-ext4-utils)
655 ("android-f2fs-utils" ,android-f2fs-utils)
656 ("android-libbase" ,android-libbase)
657 ("android-libcutils" ,android-libcutils)
658 ("android-liblog" ,android-liblog)
659 ("android-libutils" ,android-libutils)
660 ("android-libsparse" ,android-libsparse)
661 ("android-libziparchive" ,android-libziparchive)
662 ("android-libselinux" ,android-libselinux)
664 ("mkbootimg" ,mkbootimg)
668 (home-page "https://developer.android.com/studio/command-line/")
669 (synopsis "Android image flasher")
671 "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
672 (license license:asl2.0)))
674 (define-public android-udev-rules
676 (name "android-udev-rules")
682 (url "https://github.com/M0Rf30/android-udev-rules")
684 (file-name (string-append name "-" version "-checkout"))
686 (base32 "13gj79nnd04szqlrrzzkdr6wi1fky08pi7x8xfbg0jj3d3v0giah"))))
687 (build-system trivial-build-system)
688 (native-inputs `(("source" ,source)))
690 '(#:modules ((guix build utils))
693 (use-modules (guix build utils))
694 (let ((source (assoc-ref %build-inputs "source")))
695 (install-file (string-append source "/51-android.rules")
696 (string-append %output "/lib/udev/rules.d"))
698 (home-page "https://github.com/M0Rf30/android-udev-rules")
699 (synopsis "udev rules for Android devices")
700 (description "Provides a set of udev rules to allow using Android devices
701 with tools such as @command{adb} and @command{fastboot} without root
702 privileges. This package is intended to be added as a rule to the
703 @code{udev-service-type} in your @code{operating-system} configuration.
704 Additionally, an @code{adbusers} group must be defined and your user added to
707 @emph{Simply installing this package will not have any effect.} It is meant
708 to be passed to the @code{udev} service.")
709 (license license:gpl3+)))
711 (define-public git-repo
719 (url "https://gerrit.googlesource.com/git-repo")
720 (commit (string-append "v" version))))
721 (file-name (string-append "git-repo-" version "-checkout"))
723 (base32 "0qp7jqhblv7xblfgpcq4n18dyjdv8shz7r60c3vnjxx2fngkj2jd"))))
724 (build-system python-build-system)
726 `(#:python ,python-2 ; code says: "Python 3 support is … experimental."
728 (modify-phases %standard-phases
729 (add-before 'build 'set-executable-paths
730 (lambda* (#:key inputs outputs #:allow-other-keys)
731 (let* ((out (assoc-ref outputs "out"))
732 (git (assoc-ref inputs "git"))
733 (gpg (assoc-ref inputs "gnupg"))
734 (ssh (assoc-ref inputs "ssh")))
735 (substitute* '("repo" "git_command.py")
737 (string-append "GIT = '" git "/bin/git' ")))
739 ((" cmd = \\['gpg',")
740 (string-append " cmd = ['" gpg "/bin/gpg',")))
741 (substitute* "git_config.py"
742 ((" command_base = \\['ssh',")
743 (string-append " command_base = ['" ssh "/bin/ssh',")))
745 (add-before 'build 'do-not-clone-this-source
746 (lambda* (#:key outputs #:allow-other-keys)
747 (let* ((out (assoc-ref outputs "out"))
748 (repo-dir (string-append out "/share/" ,name)))
750 (("^def _FindRepo\\(\\):.*")
753 '''Look for a repo installation, starting at the current directory.'''
754 # Use the installed version of git-repo.
755 repo_main = '~a/main.py'
758 while curdir != '/' and curdir != olddir:
759 dot_repo = os.path.join(curdir, repodir)
760 if os.path.isdir(dot_repo):
761 return (repo_main, dot_repo)
764 curdir = os.path.dirname(curdir)
767 # The remaining of this function is dead code. It was used to
768 # find a git-checked-out version in the local project.\n" repo-dir))
769 ;; Neither clone, check out, nor verify the git repository
770 (("(^\\s+)_Clone\\(.*\\)") "")
771 (("(^\\s+)_Checkout\\(.*\\)") "")
772 ((" rev = _Verify\\(.*\\)") " rev = None"))
774 (delete 'build) ; nothing to build
777 (invoke "python" "-m" "nose")))
779 (lambda* (#:key outputs #:allow-other-keys)
780 (let* ((out (assoc-ref outputs "out"))
781 (bin-dir (string-append out "/bin"))
782 (repo-dir (string-append out "/share/" ,name)))
785 (copy-recursively "." repo-dir)
786 (delete-file-recursively (string-append repo-dir "/tests"))
787 (symlink (string-append repo-dir "/repo")
788 (string-append bin-dir "/repo"))
791 ;; TODO: Add git-remote-persistent-https once it is available in guix
796 `(("nose" ,python2-nose)))
797 (home-page "https://code.google.com/p/git-repo/")
798 (synopsis "Helps to manage many Git repositories.")
799 (description "Repo is a tool built on top of Git. Repo helps manage many
800 Git repositories, does the uploads to revision control systems, and automates
801 parts of the development workflow. Repo is not meant to replace Git, only to
802 make it easier to work with Git. The repo command is an executable Python
803 script that you can put anywhere in your path.")
804 (license license:asl2.0)))
806 (define-public abootimg
813 (uri (string-append "http://http.debian.net/debian/pool/main/a/abootimg/"
814 "abootimg_" version ".orig.tar.gz"))
816 (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba"))))
817 (build-system gnu-build-system)
821 (modify-phases %standard-phases
827 (lambda* (#:key outputs #:allow-other-keys)
828 (let* ((out (assoc-ref outputs "out"))
829 (bin (string-append out "/bin")))
830 (install-file "abootimg" bin)
833 `(("libblkid" ,util-linux)))
834 (home-page "https://ac100.grandou.net/abootimg")
835 (synopsis "Tool for manipulating Android Boot Images")
836 (description "This package provides a tool for manipulating old Android
837 Boot Images. @code{abootimg} can work directly on block devices, or, the
838 safest way, on a file image.")
839 (license license:gpl2+)))
841 (define-public python-androguard
843 (name "python-androguard")
847 ;; The pypi release doesn't have the tests, but the tests use
848 ;; packaged binaries, so we skip them.
850 (uri (pypi-uri "androguard" version))
853 "0ndsw00pkyda4i2s3wi5ap8gbk6a9d23xhhxpdbk02padv8sxkfv"))))
854 (build-system python-build-system)
857 (modify-phases %standard-phases
859 ;; Adapted from .travis.yml
861 (invoke "nosetests" "--with-coverage" "--with-timer"
862 "--timer-top-n" "50"))))))
864 `(("python-codecov" ,python-codecov)
865 ("python-coverage" ,python-coverage)
866 ("python-mock" ,python-mock)
867 ("python-nose" ,python-nose)
868 ("python-nose-timer" ,python-nose-timer)))
870 `(("python-asn1crypto" ,python-asn1crypto)
871 ("python-colorama" ,python-colorama)
872 ("python-future" ,python-future)
873 ("python-ipython" ,python-ipython)
874 ("python-lxml" ,python-lxml)
875 ("python-matplotlib" ,python-matplotlib)
876 ("python-networkx" ,python-networkx)
877 ("python-pygments" ,python-pygments)
878 ("python-pyperclip" ,python-pyperclip)))
879 (home-page "https://github.com/androguard/androguard")
880 (synopsis "Python tool to play with Android files")
882 "Androguard is a full Python tool to manipulate Android files. It is
883 useful for reverse engineering, analysis of Android applications and more.")
884 (license license:asl2.0)))
886 (define-public fdroidserver
888 (name "fdroidserver")
893 (uri (pypi-uri "fdroidserver" version))
896 "0fp7q8faicx6i6wxm717qqaham3jpilb23mvynpz6v73z7hm6wcg"))))
897 (build-system python-build-system)
900 (modify-phases %standard-phases
901 (add-after 'unpack 'fix-versioning
903 (substitute* "setup.py"
904 (("0.2.1") ,(package-version python-pyasn1-modules)))
907 `(("python-androguard" ,python-androguard)
908 ("python-apache-libcloud" ,python-apache-libcloud)
909 ("python-clint" ,python-clint)
910 ("python-defusedxml" ,python-defusedxml)
911 ("python-docker-py" ,python-docker-py)
912 ("python-gitpython" ,python-gitpython)
913 ("python-mwclient" ,python-mwclient)
914 ("python-paramiko" ,python-paramiko)
915 ("python-pillow" ,python-pillow)
916 ("python-pyasn1" ,python-pyasn1)
917 ("python-pyasn1-modules" ,python-pyasn1-modules)
918 ("python-pyyaml" ,python-pyyaml)
919 ("python-qrcode" ,python-qrcode)
920 ("python-ruamel.yaml" ,python-ruamel.yaml)
921 ("python-requests" ,python-requests)
922 ("python-vagrant" ,python-vagrant)))
924 `(("python-babel" ,python-babel)
925 ("python-bcrypt" ,python-bcrypt)
926 ("python-docker-pycreds" ,python-docker-pycreds)
927 ("python-pynacl" ,python-pynacl)
928 ("python-websocket-client" ,python-websocket-client)))
929 (home-page "https://f-droid.org")
930 (synopsis "F-Droid server tools")
932 "The F-Droid server tools provide various scripts and tools that are used
933 to maintain F-Droid, the repository of free Android applications. You can use
934 these same tools to create your own additional or alternative repository for
935 publishing, or to assist in creating, testing and submitting metadata to the
937 (license license:agpl3+)))
939 (define-public enjarify
943 (home-page "https://github.com/Storyyeller/enjarify")
950 (file-name (git-file-name name version))
952 (search-patches "enjarify-setup-py.patch"))
955 "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk"))))
956 (build-system python-build-system)
959 (modify-phases %standard-phases
960 (add-after 'unpack 'enjarify-wrapper-inherit-pythonpath
961 ;; enjarify sets PYTHONPATH from a shell script, overwriting
962 ;; PYTHONPATH set from guix. Comment out this line.
964 (substitute* "enjarify.sh"
965 (("export PYTHONPATH") "# export PYTHONPATH"))
967 (add-before 'check 'fixup-expected-test-results
968 ;; Upstream adjusted this test in commit:
969 ;; 3ae884a6485af82d300515813f537685b08dd800
971 (substitute* "tests/test2/expected.txt"
974 (add-before 'check 'drop-java-xss-argument
975 ;; Upstream removed this argument in order to support 32-bit
976 ;; architectures. commit: 4be0111d879aa95fdc0d9f24fe529f8c664d4093
978 (substitute* "enjarify/runtests.py"
979 (("java -Xss515m") "java "))
981 (add-after 'install 'install-enjarify-wrapper
982 (lambda* (#:key outputs #:allow-other-keys)
983 (let* ((out (assoc-ref outputs "out")))
984 (mkdir-p (string-append out "/bin/"))
985 (copy-file "enjarify.sh" (string-append out "/bin/enjarify"))
987 (native-inputs `(("openjdk" ,openjdk12)))
988 (synopsis "Translate Dalvik bytecode to equivalent Java bytecode")
989 (description "Android applications are Java programs that run on a
990 customized virtual machine, which is part of the Android operating system, the
991 Dalvik VM. Their bytecode differs from the bytecode of normal Java
992 applications. Enjarify can translate the Dalvik bytecode back to equivalent
993 Java bytecode, which simplifies the analysis of Android applications.")
994 (license license:asl2.0)))