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
220 #:make-flags '("CXXFLAGS=-std=gnu++11")
222 (modify-phases %standard-phases
223 (add-after 'unpack 'enter-source
224 (lambda _ (chdir "base") #t)))))
225 (inputs `(("android-liblog" ,android-liblog)))
226 (home-page "https://developer.android.com/")
227 (synopsis "Android platform base library")
228 (description "@code{libbase} is a library in common use by the
229 various Android core host applications.")
230 (license license:asl2.0)))
232 (define android-libcutils
234 (name "android-libcutils")
235 (version (android-platform-version))
236 (source (android-platform-system-core version))
237 (build-system gnu-build-system)
239 `(#:tests? #f ; TODO.
241 (modify-phases %standard-phases
242 (add-after 'unpack 'enter-source
243 (lambda _ (chdir "libcutils") #t))
244 (add-after 'enter-source 'create-Makefile
246 ;; No useful makefile is shipped, so we create one.
247 (with-output-to-file "Makefile"
252 "SOURCES = load_file.o socket_local_client_unix.o"
253 " socket_loopback_client_unix.o socket_network_client_unix.o"
254 " socket_loopback_server_unix.o socket_local_server_unix.o"
255 " sockets_unix.o socket_inaddr_any_server_unix.o"
260 "CXXFLAGS += -std=gnu++11 -fPIC\n"
261 "CPPFLAGS += -Iinclude -I../include\n"
262 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
264 "build: $(SOURCES)\n"
265 " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
270 (lambda* (#:key outputs #:allow-other-keys)
271 (let* ((out (assoc-ref outputs "out"))
272 (lib (string-append out "/lib"))
273 (include (string-append out "/include")))
274 (install-file "libcutils.so.0" lib)
275 (with-directory-excursion lib
276 (symlink "libcutils.so.0" "libcutils.so"))
277 (copy-recursively "../include/cutils"
278 (string-append include "/cutils"))
280 (home-page "https://developer.android.com/")
281 (synopsis "Android platform c utils library")
282 (description "@code{libcutils} is a library in common use by the
283 various Android core host applications.")
284 (license license:asl2.0)))
286 (define-public android-libsparse
288 (name "android-libsparse")
289 (version (android-platform-version))
290 (source (android-platform-system-core version))
291 (build-system android-ndk-build-system)
293 `(#:make-flags '("CFLAGS=-Wno-error"
294 "CXXFLAGS=-fpermissive -Wno-error")
296 (modify-phases %standard-phases
297 (add-after 'unpack 'enter-source
298 (lambda _ (chdir "libsparse") #t)))))
301 (home-page "https://developer.android.com/")
302 (synopsis "Android platform sparse library")
303 (description "@code{android-libsparse} is a library in common use by the
304 various Android core host applications.")
305 (license license:asl2.0)))
307 (define-public android-libziparchive
309 (name "android-libziparchive")
310 (version (android-platform-version))
311 (source (android-platform-system-core version))
312 (build-system android-ndk-build-system)
314 `(#:make-flags '("CFLAGS=-Wno-error"
315 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++11")
317 (modify-phases %standard-phases
318 (add-after 'unpack 'enter-source
319 (lambda _ (chdir "libziparchive") #t))
320 (add-before 'check 'setenv
322 (setenv "ziparchive_tests_host_PARAMS" "--test_data_dir=testdata")
324 (add-after 'install 'install-headers
325 (lambda* (#:key inputs outputs #:allow-other-keys)
326 (let ((out (assoc-ref outputs "out")))
327 (copy-recursively "../include/ziparchive"
328 (string-append out "/include/ziparchive"))
333 `(("android-libbase" ,android-libbase)
334 ("android-libutils" ,android-libutils)
335 ("android-liblog" ,android-liblog)))
336 (home-page "https://developer.android.com/")
337 (synopsis "Android platform ZIP library")
338 (description "@code{android-libziparchive} is a library in common use by the
339 various Android core host applications.")
340 (license license:asl2.0)))
345 (version (android-platform-version))
346 (source (android-platform-system-core version))
347 (build-system android-ndk-build-system)
349 `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
351 (list "CFLAGS=-Wno-error"
352 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
353 (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
354 "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
356 (modify-phases %standard-phases
357 (add-after 'unpack 'enter-source
358 (lambda _ (chdir "adb") #t))
359 (add-after 'enter-source 'glibc-compat
361 ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
362 (substitute* "usb_linux.cpp"
363 (("#include <sys/types.h>" all)
364 (string-append all "\n#include <sys/sysmacros.h>\n")))
366 (add-after 'enter-source 'make-libs-available
367 (lambda* (#:key inputs outputs #:allow-other-keys)
368 (substitute* "Android.mk"
369 (("libcrypto_static") "libcrypto"))
371 (add-after 'install 'install-headers
372 (lambda* (#:key inputs outputs #:allow-other-keys)
373 (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
376 `(("android-libbase" ,android-libbase)
377 ("android-libcutils" ,android-libcutils)
378 ("android-liblog" ,android-liblog)
379 ("openssl" ,openssl-1.0)))
380 (home-page "https://developer.android.com/studio/command-line/adb.html")
381 (synopsis "Android Debug Bridge")
383 "@command{adb} is a versatile command line tool that lets you communicate
384 with an emulator instance or connected Android device. It facilitates a variety
385 of device actions, such as installing and debugging apps, and it provides access
386 to a Unix shell that can run commands on the connected device or emulator.")
387 (license license:asl2.0)))
389 (define-public mkbootimg
392 (version (android-platform-version))
394 (inherit (android-platform-system-core version))))
395 (build-system python-build-system)
399 (modify-phases %standard-phases
400 (add-after 'unpack 'enter-source
401 (lambda _ (chdir "mkbootimg") #t))
405 (lambda* (#:key outputs #:allow-other-keys)
406 (let* ((out (assoc-ref outputs "out"))
407 (bin (string-append out "/bin"))
408 (include (string-append out "/include")))
409 (install-file "mkbootimg" bin)
410 (install-file "bootimg.h" include)
412 (home-page "https://developer.android.com/studio/command-line/adb.html")
413 (synopsis "Tool to create Android boot images")
414 (description "This package provides a tool to create Android Boot
416 (license license:asl2.0)))
418 (define-public android-safe-iop
420 (name "android-safe-iop")
421 (version (android-platform-version))
422 (source (android-platform-external version "safe-iop"
423 "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw"))
424 (build-system android-ndk-build-system)
426 `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error")
428 (modify-phases %standard-phases
429 (add-before 'build 'patch-host
431 ;; TODO: Cross-compile.
432 (substitute* "Android.mk"
433 (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY"))
435 (home-page "https://developer.android.com/")
436 (synopsis "Safe integers in C")
437 (description "@code{android-safe-iop} provides a set of functions for
438 performing and checking safe integer operations. Ensure that integer
439 operations do not result in silent overflow.")
440 (license license:bsd-2)))
442 (define-public android-bionic-uapi
444 (name "android-bionic-uapi")
445 (version (android-platform-version))
446 (source (android-platform-bionic version))
447 (build-system android-ndk-build-system)
450 (modify-phases %standard-phases
451 (add-after 'unpack 'enter-source
452 (lambda _ (chdir "libc") #t))
458 (lambda* (#:key outputs #:allow-other-keys)
459 (let* ((out (assoc-ref outputs "out"))
460 (out-sys (string-append out "/include/sys")))
462 (install-file "include/sys/system_properties.h" out-sys)
463 (install-file "include/sys/_system_properties.h" out-sys)
464 (copy-recursively "kernel/uapi" (string-append out "/include"))
466 (home-page "https://developer.android.com/")
467 (synopsis "Android Linux API that is safe for user space")
468 (description "@code{android-bionic-uapi} provides the part of the Linux API
469 that is safe to use for user space. It also includes
470 @code{system_properties.h} and @code{_system_properties.h}.")
471 (license license:asl2.0)))
473 (define-public android-libselinux
475 (name "android-libselinux")
476 (version (android-platform-version))
478 (android-platform-external version "libselinux"
479 "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
480 (build-system android-ndk-build-system)
482 ;; See logd/Android.mk for the *_LOG_TAG values.
483 `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
485 "-I core/libpackagelistparser/include "
486 "-DAUDITD_LOG_TAG=1003 "
487 "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
488 "LDFLAGS=-L . -lpcre")
490 (modify-phases %standard-phases
491 (add-after 'unpack-core 'patch-HOST
493 ;; gettid duplicates otherwise.
494 (substitute* "src/procattr.c"
495 (("#ifdef HOST") "#ifdef XXX"))
498 `(("openssl" ,openssl)))
500 `(("android-bionic-uapi" ,android-bionic-uapi)
501 ;; pcre is inlined by our package.
503 (home-page "https://developer.android.com/")
504 (synopsis (package-synopsis libselinux))
505 (description (package-description libselinux))
506 (license (package-license libselinux))))
508 (define-public android-ext4-utils
510 (name "android-ext4-utils")
511 (version (android-platform-version))
512 (source (android-platform-system-extras version))
513 (build-system android-ndk-build-system)
516 (list (string-append "CPPFLAGS="
519 (assoc-ref %build-inputs "android-libselinux")
521 "-I " (assoc-ref %build-inputs "android-libsparse")
523 "-I " (assoc-ref %build-inputs "android-libcutils")
525 "-I " (assoc-ref %build-inputs "android-liblog") "/include "
526 "-I ../core/include")
528 "install-libext4_utils_host.a"
529 (string-append "prefix=" (assoc-ref %outputs "out")))
531 (modify-phases %standard-phases
532 (add-after 'unpack 'unpack-core
533 (lambda* (#:key inputs #:allow-other-keys)
535 (with-directory-excursion "core"
536 (invoke "tar" "axf" (assoc-ref inputs "android-core")
537 "--strip-components=1"))
539 (add-after 'unpack-core 'enter-source
540 (lambda _ (chdir "ext4_utils") #t))
542 (lambda* (#:key inputs outputs #:allow-other-keys)
543 (let ((out (assoc-ref outputs "out")))
544 (copy-recursively "." (string-append out "/include")))
547 `(("android-libcutils" ,android-libcutils)
548 ("android-liblog" ,android-liblog)
549 ("android-libselinux" ,android-libselinux)
550 ("android-libsparse" ,android-libsparse)
553 `(("android-core" ,(android-platform-system-core version))))
554 (home-page "https://developer.android.com/")
555 (synopsis "Android ext4 file system utilities")
556 (description "@code{android-ext4-utils} is a library in common use by the
558 (license license:asl2.0)))
560 (define-public android-f2fs-utils
562 (name "android-f2fs-utils")
563 (version (android-platform-version))
564 (source (android-platform-system-extras version))
565 (build-system android-ndk-build-system)
568 (modify-phases %standard-phases
569 (add-after 'unpack 'enter-source
570 (lambda _ (chdir "f2fs_utils") #t))
571 (add-after 'install 'install-headers
572 (lambda* (#:key inputs outputs #:allow-other-keys)
573 (copy-recursively "." (string-append (assoc-ref outputs "out")
576 (add-after 'install 'install-shell-scripts
577 (lambda* (#:key outputs #:allow-other-keys)
578 (let* ((out (assoc-ref outputs "out"))
579 (bin (string-append out "/bin")))
580 (patch-shebang "mkf2fsuserimg.sh")
581 (substitute* "mkf2fsuserimg.sh"
582 (("make_f2fs") (string-append bin "/make_f2fs")))
583 (install-file "mkf2fsuserimg.sh" bin)
586 `(("f2fs-tools" ,f2fs-tools-1.7)
587 ("android-libselinux" ,android-libselinux)
588 ("android-libsparse" ,android-libsparse)
589 ("android-libcutils" ,android-libcutils)
591 (home-page "https://developer.android.com/")
592 (synopsis "Android f2fs utils")
593 (description "@code{android-f2fs-utils} is a library in common use by the
594 Android core. It allows the user to create images for the @code{f2fs} Flash
596 (license license:asl2.0)))
598 (define-public android-libutils
600 (name "android-libutils")
601 (version (android-platform-version))
602 (source (android-platform-system-core version))
603 (build-system android-ndk-build-system)
606 #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
608 (modify-phases %standard-phases
609 (add-after 'unpack 'enter-source
610 (lambda _ (chdir "libutils") #t))
612 (add-after 'install 'install-headers
613 (lambda* (#:key inputs outputs #:allow-other-keys)
614 (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
616 `(("android-safe-iop" ,android-safe-iop)
617 ("android-libcutils" ,android-libcutils)))
619 `(("android-bionic-uapi" ,android-bionic-uapi)
620 ("android-liblog" ,android-liblog)
621 ("gcc" ,gcc-5))) ; XXX: fails to build with GCC 7
622 (home-page "https://developer.android.com/")
623 (synopsis "Android utility library")
624 (description "@code{android-libutils} provides utilities for Android NDK developers.")
625 (license license:asl2.0)))
627 (define-public fastboot
630 (version (android-platform-version))
631 (source (android-platform-system-core version))
632 (build-system android-ndk-build-system)
634 `(#:make-flags (list "CXXFLAGS=-std=gnu++11")
636 (modify-phases %standard-phases
637 (add-after 'unpack 'enter-source
641 (add-after 'enter-source 'patch-source
643 (substitute* "Android.mk"
644 (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
647 (lambda* (#:key outputs #:allow-other-keys)
648 (let* ((out (assoc-ref outputs "out"))
649 (lib (string-append out "/lib"))
650 (bin (string-append out "/bin")))
651 (install-file "fastboot" bin)
655 ("android-safe-iop" ,android-safe-iop)
656 ("android-ext4-utils" ,android-ext4-utils)
657 ("android-f2fs-utils" ,android-f2fs-utils)
658 ("android-libbase" ,android-libbase)
659 ("android-libcutils" ,android-libcutils)
660 ("android-liblog" ,android-liblog)
661 ("android-libutils" ,android-libutils)
662 ("android-libsparse" ,android-libsparse)
663 ("android-libziparchive" ,android-libziparchive)
664 ("android-libselinux" ,android-libselinux)
666 ("mkbootimg" ,mkbootimg)
670 (home-page "https://developer.android.com/studio/command-line/")
671 (synopsis "Android image flasher")
673 "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
674 (license license:asl2.0)))
676 (define-public android-udev-rules
678 (name "android-udev-rules")
684 (url "https://github.com/M0Rf30/android-udev-rules")
686 (file-name (string-append name "-" version "-checkout"))
688 (base32 "13gj79nnd04szqlrrzzkdr6wi1fky08pi7x8xfbg0jj3d3v0giah"))))
689 (build-system trivial-build-system)
690 (native-inputs `(("source" ,source)))
692 '(#:modules ((guix build utils))
695 (use-modules (guix build utils))
696 (let ((source (assoc-ref %build-inputs "source")))
697 (install-file (string-append source "/51-android.rules")
698 (string-append %output "/lib/udev/rules.d"))
700 (home-page "https://github.com/M0Rf30/android-udev-rules")
701 (synopsis "udev rules for Android devices")
702 (description "Provides a set of udev rules to allow using Android devices
703 with tools such as @command{adb} and @command{fastboot} without root
704 privileges. This package is intended to be added as a rule to the
705 @code{udev-service-type} in your @code{operating-system} configuration.
706 Additionally, an @code{adbusers} group must be defined and your user added to
709 @emph{Simply installing this package will not have any effect.} It is meant
710 to be passed to the @code{udev} service.")
711 (license license:gpl3+)))
713 (define-public git-repo
721 (url "https://gerrit.googlesource.com/git-repo")
722 (commit (string-append "v" version))))
723 (file-name (string-append "git-repo-" version "-checkout"))
725 (base32 "0qp7jqhblv7xblfgpcq4n18dyjdv8shz7r60c3vnjxx2fngkj2jd"))))
726 (build-system python-build-system)
728 `(#:python ,python-2 ; code says: "Python 3 support is … experimental."
730 (modify-phases %standard-phases
731 (add-before 'build 'set-executable-paths
732 (lambda* (#:key inputs outputs #:allow-other-keys)
733 (let* ((out (assoc-ref outputs "out"))
734 (git (assoc-ref inputs "git"))
735 (gpg (assoc-ref inputs "gnupg"))
736 (ssh (assoc-ref inputs "ssh")))
737 (substitute* '("repo" "git_command.py")
739 (string-append "GIT = '" git "/bin/git' ")))
741 ((" cmd = \\['gpg',")
742 (string-append " cmd = ['" gpg "/bin/gpg',")))
743 (substitute* "git_config.py"
744 ((" command_base = \\['ssh',")
745 (string-append " command_base = ['" ssh "/bin/ssh',")))
747 (add-before 'build 'do-not-clone-this-source
748 (lambda* (#:key outputs #:allow-other-keys)
749 (let* ((out (assoc-ref outputs "out"))
750 (repo-dir (string-append out "/share/" ,name)))
752 (("^def _FindRepo\\(\\):.*")
755 '''Look for a repo installation, starting at the current directory.'''
756 # Use the installed version of git-repo.
757 repo_main = '~a/main.py'
760 while curdir != '/' and curdir != olddir:
761 dot_repo = os.path.join(curdir, repodir)
762 if os.path.isdir(dot_repo):
763 return (repo_main, dot_repo)
766 curdir = os.path.dirname(curdir)
769 # The remaining of this function is dead code. It was used to
770 # find a git-checked-out version in the local project.\n" repo-dir))
771 ;; Neither clone, check out, nor verify the git repository
772 (("(^\\s+)_Clone\\(.*\\)") "")
773 (("(^\\s+)_Checkout\\(.*\\)") "")
774 ((" rev = _Verify\\(.*\\)") " rev = None"))
776 (delete 'build) ; nothing to build
779 (invoke "python" "-m" "nose")))
781 (lambda* (#:key outputs #:allow-other-keys)
782 (let* ((out (assoc-ref outputs "out"))
783 (bin-dir (string-append out "/bin"))
784 (repo-dir (string-append out "/share/" ,name)))
787 (copy-recursively "." repo-dir)
788 (delete-file-recursively (string-append repo-dir "/tests"))
789 (symlink (string-append repo-dir "/repo")
790 (string-append bin-dir "/repo"))
793 ;; TODO: Add git-remote-persistent-https once it is available in guix
798 `(("nose" ,python2-nose)))
799 (home-page "https://code.google.com/p/git-repo/")
800 (synopsis "Helps to manage many Git repositories.")
801 (description "Repo is a tool built on top of Git. Repo helps manage many
802 Git repositories, does the uploads to revision control systems, and automates
803 parts of the development workflow. Repo is not meant to replace Git, only to
804 make it easier to work with Git. The repo command is an executable Python
805 script that you can put anywhere in your path.")
806 (license license:asl2.0)))
808 (define-public abootimg
815 (uri (string-append "http://http.debian.net/debian/pool/main/a/abootimg/"
816 "abootimg_" version ".orig.tar.gz"))
818 (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba"))))
819 (build-system gnu-build-system)
823 (modify-phases %standard-phases
829 (lambda* (#:key outputs #:allow-other-keys)
830 (let* ((out (assoc-ref outputs "out"))
831 (bin (string-append out "/bin")))
832 (install-file "abootimg" bin)
835 `(("libblkid" ,util-linux)))
836 (home-page "https://ac100.grandou.net/abootimg")
837 (synopsis "Tool for manipulating Android Boot Images")
838 (description "This package provides a tool for manipulating old Android
839 Boot Images. @code{abootimg} can work directly on block devices, or, the
840 safest way, on a file image.")
841 (license license:gpl2+)))
843 (define-public python-androguard
845 (name "python-androguard")
849 ;; The pypi release doesn't have the tests, but the tests use
850 ;; packaged binaries, so we skip them.
852 (uri (pypi-uri "androguard" version))
855 "0ndsw00pkyda4i2s3wi5ap8gbk6a9d23xhhxpdbk02padv8sxkfv"))))
856 (build-system python-build-system)
859 (modify-phases %standard-phases
861 ;; Adapted from .travis.yml
863 (invoke "nosetests" "--with-coverage" "--with-timer"
864 "--timer-top-n" "50"))))))
866 `(("python-codecov" ,python-codecov)
867 ("python-coverage" ,python-coverage)
868 ("python-mock" ,python-mock)
869 ("python-nose" ,python-nose)
870 ("python-nose-timer" ,python-nose-timer)))
872 `(("python-asn1crypto" ,python-asn1crypto)
873 ("python-colorama" ,python-colorama)
874 ("python-future" ,python-future)
875 ("python-ipython" ,python-ipython)
876 ("python-lxml" ,python-lxml)
877 ("python-matplotlib" ,python-matplotlib)
878 ("python-networkx" ,python-networkx)
879 ("python-pygments" ,python-pygments)
880 ("python-pyperclip" ,python-pyperclip)))
881 (home-page "https://github.com/androguard/androguard")
882 (synopsis "Python tool to play with Android files")
884 "Androguard is a full Python tool to manipulate Android files. It is
885 useful for reverse engineering, analysis of Android applications and more.")
886 (license license:asl2.0)))
888 (define-public fdroidserver
890 (name "fdroidserver")
895 (uri (pypi-uri "fdroidserver" version))
898 "0fp7q8faicx6i6wxm717qqaham3jpilb23mvynpz6v73z7hm6wcg"))))
899 (build-system python-build-system)
902 (modify-phases %standard-phases
903 (add-after 'unpack 'fix-versioning
905 (substitute* "setup.py"
906 (("0.2.1") ,(package-version python-pyasn1-modules)))
909 `(("python-androguard" ,python-androguard)
910 ("python-apache-libcloud" ,python-apache-libcloud)
911 ("python-clint" ,python-clint)
912 ("python-defusedxml" ,python-defusedxml)
913 ("python-docker-py" ,python-docker-py)
914 ("python-gitpython" ,python-gitpython)
915 ("python-mwclient" ,python-mwclient)
916 ("python-paramiko" ,python-paramiko)
917 ("python-pillow" ,python-pillow)
918 ("python-pyasn1" ,python-pyasn1)
919 ("python-pyasn1-modules" ,python-pyasn1-modules)
920 ("python-pyyaml" ,python-pyyaml)
921 ("python-qrcode" ,python-qrcode)
922 ("python-ruamel.yaml" ,python-ruamel.yaml)
923 ("python-requests" ,python-requests)
924 ("python-vagrant" ,python-vagrant)))
926 `(("python-babel" ,python-babel)
927 ("python-bcrypt" ,python-bcrypt)
928 ("python-docker-pycreds" ,python-docker-pycreds)
929 ("python-pynacl" ,python-pynacl)
930 ("python-websocket-client" ,python-websocket-client)))
931 (home-page "https://f-droid.org")
932 (synopsis "F-Droid server tools")
934 "The F-Droid server tools provide various scripts and tools that are used
935 to maintain F-Droid, the repository of free Android applications. You can use
936 these same tools to create your own additional or alternative repository for
937 publishing, or to assist in creating, testing and submitting metadata to the
939 (license license:agpl3+)))
941 (define-public enjarify
945 (home-page "https://github.com/Storyyeller/enjarify")
952 (file-name (git-file-name name version))
954 (search-patches "enjarify-setup-py.patch"))
957 "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk"))))
958 (build-system python-build-system)
961 (modify-phases %standard-phases
962 (add-after 'unpack 'enjarify-wrapper-inherit-pythonpath
963 ;; enjarify sets PYTHONPATH from a shell script, overwriting
964 ;; PYTHONPATH set from guix. Comment out this line.
966 (substitute* "enjarify.sh"
967 (("export PYTHONPATH") "# export PYTHONPATH"))
969 (add-before 'check 'fixup-expected-test-results
970 ;; Upstream adjusted this test in commit:
971 ;; 3ae884a6485af82d300515813f537685b08dd800
973 (substitute* "tests/test2/expected.txt"
976 (add-before 'check 'drop-java-xss-argument
977 ;; Upstream removed this argument in order to support 32-bit
978 ;; architectures. commit: 4be0111d879aa95fdc0d9f24fe529f8c664d4093
980 (substitute* "enjarify/runtests.py"
981 (("java -Xss515m") "java "))
983 (add-after 'install 'install-enjarify-wrapper
984 (lambda* (#:key outputs #:allow-other-keys)
985 (let* ((out (assoc-ref outputs "out")))
986 (mkdir-p (string-append out "/bin/"))
987 (copy-file "enjarify.sh" (string-append out "/bin/enjarify"))
989 (native-inputs `(("openjdk" ,openjdk12)))
990 (synopsis "Translate Dalvik bytecode to equivalent Java bytecode")
991 (description "Android applications are Java programs that run on a
992 customized virtual machine, which is part of the Android operating system, the
993 Dalvik VM. Their bytecode differs from the bytecode of normal Java
994 applications. Enjarify can translate the Dalvik bytecode back to equivalent
995 Java bytecode, which simplifies the analysis of Android applications.")
996 (license license:asl2.0)))