gnu: Add wl-clipboard.
[jackhill/guix/guix.git] / gnu / packages / android.scm
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 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages android)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system android-ndk)
32 #:use-module (guix build-system python)
33 #:use-module (guix build-system trivial)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages docker)
39 #:use-module (gnu packages gnupg)
40 #:use-module (gnu packages pcre)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages python-crypto)
43 #:use-module (gnu packages python-web)
44 #:use-module (gnu packages selinux)
45 #:use-module (gnu packages serialization)
46 #:use-module (gnu packages ssh)
47 #:use-module (gnu packages tls)
48 #:use-module (gnu packages version-control)
49 #:use-module (gnu packages virtualization)
50 #:use-module (gnu packages xdisorg)
51 #:use-module (gnu packages linux))
52
53 (define-public android-make-stub
54 (package
55 (name "android-make-stub")
56 (version "0.6.0")
57 (source
58 (origin
59 (method git-fetch)
60 (uri (git-reference
61 (url "https://github.com/daym/android-make-stub.git")
62 (commit (string-append "v" version))))
63 (file-name (string-append "android-make-stub-"
64 version "-checkout"))
65 (sha256
66 (base32
67 "0y1b2x96d37n6f1bp6dcx08bn08zac0cylmbfsx6mf2nahc02fhc"))))
68 (build-system gnu-build-system)
69 (arguments
70 `(#:tests? #f ; None exist.
71 #:phases
72 (modify-phases %standard-phases
73 (delete 'configure)
74 (delete 'build)
75 (replace 'install
76 (lambda* (#:key outputs #:allow-other-keys)
77 (let* ((out (assoc-ref outputs "out")))
78 (invoke "make" (string-append "prefix=" out) "install")
79 #t))))))
80 (home-page "https://github.com/daym/android-make-stub")
81 (synopsis "Stubs for the @command{make} system of the Android platform")
82 (description "@code{android-make-stub} provides stubs for the
83 @command{make} system of the Android platform. This allows us to
84 use their packages mostly unmodified in our Android NDK build system.")
85 (license license:asl2.0)))
86
87 (define-public android-googletest
88 (package (inherit googletest)
89 (name "android-googletest")
90 (arguments
91 `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
92 #:phases
93 (modify-phases %standard-phases
94 (add-after 'install 'install-host-libraries
95 (lambda* (#:key outputs #:allow-other-keys)
96 (let* ((out (assoc-ref outputs "out"))
97 (lib (string-append out "/lib")))
98 (symlink "libgtest.so"
99 (string-append lib "/libgtest_host.so"))
100 (symlink "libgmock.so"
101 (string-append lib "/libgmock_host.so"))
102 #t))))))))
103
104 ;; The Makefiles that we add are largely based on the Debian
105 ;; packages. They are licensed under GPL-2 and have copyright:
106 ;; 2012, Stefan Handschuh <handschuh.stefan@googlemail.com>
107 ;; 2015, Kai-Chung Yan <seamlikok@gmail.com>
108 ;; Big thanks to them for laying the groundwork.
109
110 ;; The version tag is consistent between all repositories.
111 (define (android-platform-version) "7.1.2_r36")
112
113 (define (android-platform-system-core version)
114 (origin
115 (method git-fetch)
116 (uri (git-reference
117 (url "https://android.googlesource.com/platform/system/core")
118 (commit (string-append "android-" version))))
119 (file-name (string-append "android-platform-system-core-"
120 version "-checkout"))
121 (sha256
122 (base32
123 "1krnc2b9zfkzpdgs1dcbji59nszlx2qr723pg89m52622czc06hg"))
124 (patches
125 (search-patches "libbase-use-own-logging.patch"
126 "libbase-fix-includes.patch"
127 "libutils-remove-damaging-includes.patch"
128 "libutils-add-includes.patch"
129 "adb-add-libraries.patch"
130 "libziparchive-add-includes.patch"))))
131
132 (define (android-platform-system-extras version)
133 (origin
134 (method git-fetch)
135 (uri (git-reference
136 (url "https://android.googlesource.com/platform/system/extras")
137 (commit (string-append "android-" version))))
138 (file-name (string-append "android-platform-system-extras-"
139 version "-checkout"))
140 (sha256
141 (base32
142 "18130c23ybqcpgjc5v6f8kdbv2xn39hyiaj17dzldjb9rlwzcyy9"))))
143
144 (define (android-platform-bionic version)
145 (origin
146 (method git-fetch)
147 (uri (git-reference
148 (url "https://android.googlesource.com/platform/bionic")
149 (commit (string-append "android-" version))))
150 (file-name (string-append "android-platform-bionic-"
151 version "-checkout"))
152 (sha256
153 (base32
154 "15r4s20d7vw022f8vrc3jbghmqwdcqzprl7i2bfvdkz8z76wc1ps"))))
155
156 (define (android-platform-external version subdirectory checksum)
157 (origin
158 (method git-fetch)
159 (uri (git-reference
160 (url
161 (string-append "https://android.googlesource.com/platform/external/"
162 subdirectory))
163 (commit (string-append "android-" version))))
164 (file-name (string-append "android-platform-system-external-" subdirectory "-"
165 version "-checkout"))
166 (sha256
167 (base32
168 checksum))))
169
170 (define android-liblog
171 (package
172 (name "android-liblog")
173 (version (android-platform-version))
174 (source (android-platform-system-core version))
175 (build-system android-ndk-build-system)
176 (arguments
177 `(#:make-flags '("LDLIBS=-lpthread")
178 #:phases
179 (modify-phases %standard-phases
180 (add-after 'unpack 'enter-source
181 (lambda _ (chdir "liblog") #t))
182 (add-after 'install 'ldconfig
183 (lambda* (#:key outputs #:allow-other-keys)
184 (let ((out (assoc-ref outputs "out")))
185 (symlink "liblog.so.0" (string-append out "/lib/liblog.so"))
186 #t))))))
187 (home-page "https://developer.android.com/")
188 (synopsis "Logging library from the Android platform.")
189 (description "@code{liblog} represents an interface to the volatile Android
190 Logging system for NDK (Native) applications and libraries and contain
191 interfaces for either writing or reading logs. The log buffers are divided up
192 in Main, System, Radio and Events sub-logs.")
193 (license license:asl2.0)))
194
195 (define android-libbase
196 (package
197 (name "android-libbase")
198 (version (android-platform-version))
199 (source (android-platform-system-core version))
200 (build-system android-ndk-build-system)
201 (arguments
202 `(#:tests? #f ; Test failure: logging.UNIMPLEMENTED
203 #:make-flags '("CXXFLAGS=-std=gnu++11")
204 #:phases
205 (modify-phases %standard-phases
206 (add-after 'unpack 'enter-source
207 (lambda _ (chdir "base") #t)))))
208 (inputs `(("android-liblog" ,android-liblog)))
209 (home-page "https://developer.android.com/")
210 (synopsis "Android platform base library")
211 (description "@code{libbase} is a library in common use by the
212 various Android core host applications.")
213 (license license:asl2.0)))
214
215 (define android-libcutils
216 (package
217 (name "android-libcutils")
218 (version (android-platform-version))
219 (source (android-platform-system-core version))
220 (build-system gnu-build-system)
221 (arguments
222 `(#:tests? #f ; TODO.
223 #:phases
224 (modify-phases %standard-phases
225 (add-after 'unpack 'enter-source
226 (lambda _ (chdir "libcutils") #t))
227 (add-after 'enter-source 'create-Makefile
228 (lambda _
229 ;; No useful makefile is shipped, so we create one.
230 (with-output-to-file "Makefile"
231 (lambda _
232 (display
233 (string-append
234 "NAME = libcutils\n"
235 "SOURCES = load_file.o socket_local_client_unix.o"
236 " socket_loopback_client_unix.o socket_network_client_unix.o"
237 " socket_loopback_server_unix.o socket_local_server_unix.o"
238 " sockets_unix.o socket_inaddr_any_server_unix.o"
239 " sockets.o\n"
240 "CC = gcc\n"
241
242 "CFLAGS += -fPIC\n"
243 "CXXFLAGS += -std=gnu++11 -fPIC\n"
244 "CPPFLAGS += -Iinclude -I../include\n"
245 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
246
247 "build: $(SOURCES)\n"
248 " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
249 " $(LDFLAGS)\n"))
250 #t))))
251 (delete 'configure)
252 (replace 'install
253 (lambda* (#:key outputs #:allow-other-keys)
254 (let* ((out (assoc-ref outputs "out"))
255 (lib (string-append out "/lib"))
256 (include (string-append out "/include")))
257 (install-file "libcutils.so.0" lib)
258 (with-directory-excursion lib
259 (symlink "libcutils.so.0" "libcutils.so"))
260 (copy-recursively "../include/cutils"
261 (string-append include "/cutils"))
262 #t))))))
263 (home-page "https://developer.android.com/")
264 (synopsis "Android platform c utils library")
265 (description "@code{libcutils} is a library in common use by the
266 various Android core host applications.")
267 (license license:asl2.0)))
268
269 (define-public android-libsparse
270 (package
271 (name "android-libsparse")
272 (version (android-platform-version))
273 (source (android-platform-system-core version))
274 (build-system android-ndk-build-system)
275 (arguments
276 `(#:make-flags '("CFLAGS=-Wno-error"
277 "CXXFLAGS=-fpermissive -Wno-error")
278 #:phases
279 (modify-phases %standard-phases
280 (add-after 'unpack 'enter-source
281 (lambda _ (chdir "libsparse") #t)))))
282 (inputs
283 `(("zlib" ,zlib)))
284 (home-page "https://developer.android.com/")
285 (synopsis "Android platform sparse library")
286 (description "@code{android-libsparse} is a library in common use by the
287 various Android core host applications.")
288 (license license:asl2.0)))
289
290 (define-public android-libziparchive
291 (package
292 (name "android-libziparchive")
293 (version (android-platform-version))
294 (source (android-platform-system-core version))
295 (build-system android-ndk-build-system)
296 (arguments
297 `(#:make-flags '("CFLAGS=-Wno-error"
298 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++11")
299 #:phases
300 (modify-phases %standard-phases
301 (add-after 'unpack 'enter-source
302 (lambda _ (chdir "libziparchive") #t))
303 (add-before 'check 'setenv
304 (lambda _
305 (setenv "ziparchive_tests_host_PARAMS" "--test_data_dir=testdata")
306 #t))
307 (add-after 'install 'install-headers
308 (lambda* (#:key inputs outputs #:allow-other-keys)
309 (let ((out (assoc-ref outputs "out")))
310 (copy-recursively "../include/ziparchive"
311 (string-append out "/include/ziparchive"))
312 #t))))))
313 (inputs
314 `(("zlib" ,zlib)))
315 (native-inputs
316 `(("android-libbase" ,android-libbase)
317 ("android-libutils" ,android-libutils)
318 ("android-liblog" ,android-liblog)))
319 (home-page "https://developer.android.com/")
320 (synopsis "Android platform ZIP library")
321 (description "@code{android-libziparchive} is a library in common use by the
322 various Android core host applications.")
323 (license license:asl2.0)))
324
325 (define-public adb
326 (package
327 (name "adb")
328 (version (android-platform-version))
329 (source (android-platform-system-core version))
330 (build-system android-ndk-build-system)
331 (arguments
332 `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
333 #:make-flags
334 (list "CFLAGS=-Wno-error"
335 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
336 (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
337 "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
338 #:phases
339 (modify-phases %standard-phases
340 (add-after 'unpack 'enter-source
341 (lambda _ (chdir "adb") #t))
342 (add-after 'enter-source 'glibc-compat
343 (lambda _
344 ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
345 (substitute* "usb_linux.cpp"
346 (("#include <sys/types.h>" all)
347 (string-append all "\n#include <sys/sysmacros.h>\n")))
348 #t))
349 (add-after 'enter-source 'make-libs-available
350 (lambda* (#:key inputs outputs #:allow-other-keys)
351 (substitute* "Android.mk"
352 (("libcrypto_static") "libcrypto"))
353 #t))
354 (add-after 'install 'install-headers
355 (lambda* (#:key inputs outputs #:allow-other-keys)
356 (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
357 #t)))))
358 (inputs
359 `(("android-libbase" ,android-libbase)
360 ("android-libcutils" ,android-libcutils)
361 ("android-liblog" ,android-liblog)
362 ("openssl" ,openssl)))
363 (home-page "https://developer.android.com/studio/command-line/adb.html")
364 (synopsis "Android Debug Bridge")
365 (description
366 "@command{adb} is a versatile command line tool that lets you communicate
367 with an emulator instance or connected Android device. It facilitates a variety
368 of device actions, such as installing and debugging apps, and it provides access
369 to a Unix shell that can run commands on the connected device or emulator.")
370 (license license:asl2.0)))
371
372 (define-public mkbootimg
373 (package
374 (name "mkbootimg")
375 (version (android-platform-version))
376 (source (origin
377 (inherit (android-platform-system-core version))))
378 (build-system python-build-system)
379 (arguments
380 `(#:tests? #f
381 #:phases
382 (modify-phases %standard-phases
383 (add-after 'unpack 'enter-source
384 (lambda _ (chdir "mkbootimg") #t))
385 (delete 'configure)
386 (delete 'build)
387 (replace 'install
388 (lambda* (#:key outputs #:allow-other-keys)
389 (let* ((out (assoc-ref outputs "out"))
390 (bin (string-append out "/bin"))
391 (include (string-append out "/include")))
392 (install-file "mkbootimg" bin)
393 (install-file "bootimg.h" include)
394 #t))))))
395 (home-page "https://developer.android.com/studio/command-line/adb.html")
396 (synopsis "Tool to create Android boot images")
397 (description "This package provides a tool to create Android Boot
398 Images.")
399 (license license:asl2.0)))
400
401 (define-public android-safe-iop
402 (package
403 (name "android-safe-iop")
404 (version (android-platform-version))
405 (source (android-platform-external version "safe-iop"
406 "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw"))
407 (build-system android-ndk-build-system)
408 (arguments
409 `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error")
410 #:phases
411 (modify-phases %standard-phases
412 (add-before 'build 'patch-host
413 (lambda _
414 ;; TODO: Cross-compile.
415 (substitute* "Android.mk"
416 (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY"))
417 #t)))))
418 (home-page "https://developer.android.com/")
419 (synopsis "Safe integers in C")
420 (description "@code{android-safe-iop} provides a set of functions for
421 performing and checking safe integer operations. Ensure that integer
422 operations do not result in silent overflow.")
423 (license license:bsd-2)))
424
425 (define-public android-bionic-uapi
426 (package
427 (name "android-bionic-uapi")
428 (version (android-platform-version))
429 (source (android-platform-bionic version))
430 (build-system android-ndk-build-system)
431 (arguments
432 `(#:phases
433 (modify-phases %standard-phases
434 (add-after 'unpack 'enter-source
435 (lambda _ (chdir "libc") #t))
436 (replace 'check
437 (const #t))
438 (replace 'build
439 (const #t))
440 (replace 'install
441 (lambda* (#:key outputs #:allow-other-keys)
442 (let* ((out (assoc-ref outputs "out"))
443 (out-sys (string-append out "/include/sys")))
444 (mkdir-p out-sys)
445 (install-file "include/sys/system_properties.h" out-sys)
446 (install-file "include/sys/_system_properties.h" out-sys)
447 (copy-recursively "kernel/uapi" (string-append out "/include"))
448 #t))))))
449 (home-page "https://developer.android.com/")
450 (synopsis "Android Linux API that is safe for user space")
451 (description "@code{android-bionic-uapi} provides the part of the Linux API
452 that is safe to use for user space. It also includes
453 @code{system_properties.h} and @code{_system_properties.h}.")
454 (license license:asl2.0)))
455
456 (define-public android-libselinux
457 (package
458 (name "android-libselinux")
459 (version (android-platform-version))
460 (source
461 (android-platform-external version "libselinux"
462 "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
463 (build-system android-ndk-build-system)
464 (arguments
465 ;; See logd/Android.mk for the *_LOG_TAG values.
466 `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
467 "-I core/include "
468 "-I core/libpackagelistparser/include "
469 "-DAUDITD_LOG_TAG=1003 "
470 "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
471 "LDFLAGS=-L . -lpcre")
472 #:phases
473 (modify-phases %standard-phases
474 (add-after 'unpack-core 'patch-HOST
475 (lambda _
476 ;; gettid duplicates otherwise.
477 (substitute* "src/procattr.c"
478 (("#ifdef HOST") "#ifdef XXX"))
479 #t)))))
480 (inputs
481 `(("openssl" ,openssl)))
482 (native-inputs
483 `(("android-bionic-uapi" ,android-bionic-uapi)
484 ;; pcre is inlined by our package.
485 ("pcre" ,pcre)))
486 (home-page "https://developer.android.com/")
487 (synopsis (package-synopsis libselinux))
488 (description (package-description libselinux))
489 (license (package-license libselinux))))
490
491 (define-public android-ext4-utils
492 (package
493 (name "android-ext4-utils")
494 (version (android-platform-version))
495 (source (android-platform-system-extras version))
496 (build-system android-ndk-build-system)
497 (arguments
498 `(#:make-flags
499 (list (string-append "CPPFLAGS="
500 ;"-Wno-error "
501 "-I "
502 (assoc-ref %build-inputs "android-libselinux")
503 "/include "
504 "-I " (assoc-ref %build-inputs "android-libsparse")
505 "/include "
506 "-I " (assoc-ref %build-inputs "android-libcutils")
507 "/include "
508 "-I " (assoc-ref %build-inputs "android-liblog") "/include "
509 "-I ../core/include")
510 "CFLAGS=-Wno-error"
511 "install-libext4_utils_host.a"
512 (string-append "prefix=" (assoc-ref %outputs "out")))
513 #:phases
514 (modify-phases %standard-phases
515 (add-after 'unpack 'unpack-core
516 (lambda* (#:key inputs #:allow-other-keys)
517 (mkdir-p "core")
518 (with-directory-excursion "core"
519 (invoke "tar" "axf" (assoc-ref inputs "android-core")
520 "--strip-components=1"))
521 #t))
522 (add-after 'unpack-core 'enter-source
523 (lambda _ (chdir "ext4_utils") #t))
524 (replace 'install
525 (lambda* (#:key inputs outputs #:allow-other-keys)
526 (let ((out (assoc-ref outputs "out")))
527 (copy-recursively "." (string-append out "/include")))
528 #t)))))
529 (inputs
530 `(("android-libcutils" ,android-libcutils)
531 ("android-liblog" ,android-liblog)
532 ("android-libselinux" ,android-libselinux)
533 ("android-libsparse" ,android-libsparse)
534 ("zlib" ,zlib)))
535 (native-inputs
536 `(("android-core" ,(android-platform-system-core version))))
537 (home-page "https://developer.android.com/")
538 (synopsis "Android ext4 filesystem utils")
539 (description "@code{android-ext4-utils} is a library in common use by the
540 Android core.")
541 (license license:asl2.0)))
542
543 (define-public android-f2fs-utils
544 (package
545 (name "android-f2fs-utils")
546 (version (android-platform-version))
547 (source (android-platform-system-extras version))
548 (build-system android-ndk-build-system)
549 (arguments
550 `(#:phases
551 (modify-phases %standard-phases
552 (add-after 'unpack 'enter-source
553 (lambda _ (chdir "f2fs_utils") #t))
554 (add-after 'install 'install-headers
555 (lambda* (#:key inputs outputs #:allow-other-keys)
556 (copy-recursively "." (string-append (assoc-ref outputs "out")
557 "/include"))
558 #t))
559 (add-after 'install 'install-shell-scripts
560 (lambda* (#:key outputs #:allow-other-keys)
561 (let* ((out (assoc-ref outputs "out"))
562 (bin (string-append out "/bin")))
563 (patch-shebang "mkf2fsuserimg.sh")
564 (substitute* "mkf2fsuserimg.sh"
565 (("make_f2fs") (string-append bin "/make_f2fs")))
566 (install-file "mkf2fsuserimg.sh" bin)
567 #t))))))
568 (inputs
569 `(("f2fs-tools" ,f2fs-tools-1.7)
570 ("android-libselinux" ,android-libselinux)
571 ("android-libsparse" ,android-libsparse)
572 ("android-libcutils" ,android-libcutils)
573 ("zlib" ,zlib)))
574 (home-page "https://developer.android.com/")
575 (synopsis "Android f2fs utils")
576 (description "@code{android-f2fs-utils} is a library in common use by the
577 Android core. It allows the user to create images for the @code{f2fs} Flash
578 file system.")
579 (license license:asl2.0)))
580
581 (define-public android-libutils
582 (package
583 (name "android-libutils")
584 (version (android-platform-version))
585 (source (android-platform-system-core version))
586 (build-system android-ndk-build-system)
587 (arguments
588 `(#:tests? #f ; TODO
589 #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
590 #:phases
591 (modify-phases %standard-phases
592 (add-after 'unpack 'enter-source
593 (lambda _ (chdir "libutils") #t))
594
595 (add-after 'install 'install-headers
596 (lambda* (#:key inputs outputs #:allow-other-keys)
597 (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
598 (inputs
599 `(("android-safe-iop" ,android-safe-iop)
600 ("android-libcutils" ,android-libcutils)))
601 (native-inputs
602 `(("android-bionic-uapi" ,android-bionic-uapi)
603 ("android-liblog" ,android-liblog)))
604 (home-page "https://developer.android.com/")
605 (synopsis "Android utility library")
606 (description "@code{android-libutils} provides utilities for Android NDK developers.")
607 (license license:asl2.0)))
608
609 (define-public fastboot
610 (package
611 (name "fastboot")
612 (version (android-platform-version))
613 (source (android-platform-system-core version))
614 (build-system android-ndk-build-system)
615 (arguments
616 `(#:make-flags (list "CXXFLAGS=-std=gnu++11")
617 #:phases
618 (modify-phases %standard-phases
619 (add-after 'unpack 'enter-source
620 (lambda _
621 (chdir "fastboot")
622 #t))
623 (add-after 'enter-source 'patch-source
624 (lambda _
625 (substitute* "Android.mk"
626 (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
627 #t))
628 (replace 'install
629 (lambda* (#:key outputs #:allow-other-keys)
630 (let* ((out (assoc-ref outputs "out"))
631 (lib (string-append out "/lib"))
632 (bin (string-append out "/bin")))
633 (install-file "fastboot" bin)
634 #t))))))
635 (inputs
636 `(("adb" ,adb)
637 ("android-safe-iop" ,android-safe-iop)
638 ("android-ext4-utils" ,android-ext4-utils)
639 ("android-f2fs-utils" ,android-f2fs-utils)
640 ("android-libbase" ,android-libbase)
641 ("android-libcutils" ,android-libcutils)
642 ("android-liblog" ,android-liblog)
643 ("android-libutils" ,android-libutils)
644 ("android-libsparse" ,android-libsparse)
645 ("android-libziparchive" ,android-libziparchive)
646 ("android-libselinux" ,android-libselinux)
647 ("pcre" ,pcre)
648 ("mkbootimg" ,mkbootimg)
649 ("zlib" ,zlib)))
650 (native-inputs
651 `(("xz" ,xz)))
652 (home-page "https://developer.android.com/studio/command-line/")
653 (synopsis "Android image flasher")
654 (description
655 "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
656 (license license:asl2.0)))
657
658 (define-public android-udev-rules
659 (package
660 (name "android-udev-rules")
661 (version "20180112")
662 (source
663 (origin
664 (method git-fetch)
665 (uri (git-reference
666 (url "https://github.com/M0Rf30/android-udev-rules")
667 (commit version)))
668 (file-name (string-append name "-" version "-checkout"))
669 (sha256
670 (base32 "13gj79nnd04szqlrrzzkdr6wi1fky08pi7x8xfbg0jj3d3v0giah"))))
671 (build-system trivial-build-system)
672 (native-inputs `(("source" ,source)))
673 (arguments
674 '(#:modules ((guix build utils))
675 #:builder
676 (begin
677 (use-modules (guix build utils))
678 (let ((source (assoc-ref %build-inputs "source")))
679 (install-file (string-append source "/51-android.rules")
680 (string-append %output "/lib/udev/rules.d"))
681 #t))))
682 (home-page "https://github.com/M0Rf30/android-udev-rules")
683 (synopsis "udev rules for Android devices")
684 (description "Provides a set of udev rules to allow using Android devices
685 with tools such as @command{adb} and @command{fastboot} without root
686 privileges. This package is intended to be added as a rule to the
687 @code{udev-service-type} in your @code{operating-system} configuration.
688 Additionally, an @code{adbusers} group must be defined and your user added to
689 it.
690
691 @emph{Simply installing this package will not have any effect.} It is meant
692 to be passed to the @code{udev} service.")
693 (license license:gpl3+)))
694
695 (define-public git-repo
696 (package
697 (name "git-repo")
698 (version "1.12.37")
699 (source
700 (origin
701 (method git-fetch)
702 (uri (git-reference
703 (url "https://gerrit.googlesource.com/git-repo")
704 (commit (string-append "v" version))))
705 (file-name (string-append "git-repo-" version "-checkout"))
706 (sha256
707 (base32 "0qp7jqhblv7xblfgpcq4n18dyjdv8shz7r60c3vnjxx2fngkj2jd"))))
708 (build-system python-build-system)
709 (arguments
710 `(#:python ,python-2 ; code says: "Python 3 support is … experimental."
711 #:phases
712 (modify-phases %standard-phases
713 (add-before 'build 'set-executable-paths
714 (lambda* (#:key inputs outputs #:allow-other-keys)
715 (let* ((out (assoc-ref outputs "out"))
716 (git (assoc-ref inputs "git"))
717 (gpg (assoc-ref inputs "gnupg"))
718 (ssh (assoc-ref inputs "ssh")))
719 (substitute* '("repo" "git_command.py")
720 (("^GIT = 'git' ")
721 (string-append "GIT = '" git "/bin/git' ")))
722 (substitute* "repo"
723 ((" cmd = \\['gpg',")
724 (string-append " cmd = ['" gpg "/bin/gpg',")))
725 (substitute* "git_config.py"
726 ((" command_base = \\['ssh',")
727 (string-append " command_base = ['" ssh "/bin/ssh',")))
728 #t)))
729 (add-before 'build 'do-not-clone-this-source
730 (lambda* (#:key outputs #:allow-other-keys)
731 (let* ((out (assoc-ref outputs "out"))
732 (repo-dir (string-append out "/share/" ,name)))
733 (substitute* "repo"
734 (("^def _FindRepo\\(\\):.*")
735 (format #f "
736 def _FindRepo():
737 '''Look for a repo installation, starting at the current directory.'''
738 # Use the installed version of git-repo.
739 repo_main = '~a/main.py'
740 curdir = os.getcwd()
741 olddir = None
742 while curdir != '/' and curdir != olddir:
743 dot_repo = os.path.join(curdir, repodir)
744 if os.path.isdir(dot_repo):
745 return (repo_main, dot_repo)
746 else:
747 olddir = curdir
748 curdir = os.path.dirname(curdir)
749 return None, ''
750
751 # The remaining of this function is dead code. It was used to
752 # find a git-checked-out version in the local project.\n" repo-dir))
753 ;; Neither clone, check out, nor verify the git repository
754 (("(^\\s+)_Clone\\(.*\\)") "")
755 (("(^\\s+)_Checkout\\(.*\\)") "")
756 ((" rev = _Verify\\(.*\\)") " rev = None"))
757 #t)))
758 (delete 'build) ; nothing to build
759 (replace 'check
760 (lambda _
761 (zero? (system* "python" "-m" "nose"))))
762 (replace 'install
763 (lambda* (#:key outputs #:allow-other-keys)
764 (let* ((out (assoc-ref outputs "out"))
765 (bin-dir (string-append out "/bin"))
766 (repo-dir (string-append out "/share/" ,name)))
767 (mkdir-p bin-dir)
768 (mkdir-p repo-dir)
769 (copy-recursively "." repo-dir)
770 (delete-file-recursively (string-append repo-dir "/tests"))
771 (symlink (string-append repo-dir "/repo")
772 (string-append bin-dir "/repo"))
773 #t))))))
774 (inputs
775 ;; TODO: Add git-remote-persistent-https once it is available in guix
776 `(("git" ,git)
777 ("gnupg" ,gnupg)
778 ("ssh" ,openssh)))
779 (native-inputs
780 `(("nose" ,python2-nose)))
781 (home-page "https://code.google.com/p/git-repo/")
782 (synopsis "Helps to manage many Git repositories.")
783 (description "Repo is a tool built on top of Git. Repo helps manage many
784 Git repositories, does the uploads to revision control systems, and automates
785 parts of the development workflow. Repo is not meant to replace Git, only to
786 make it easier to work with Git. The repo command is an executable Python
787 script that you can put anywhere in your path.")
788 (license license:asl2.0)))
789
790 (define-public abootimg
791 (package
792 (name "abootimg")
793 (version "0.6")
794 (source
795 (origin
796 (method url-fetch)
797 (uri (string-append "http://http.debian.net/debian/pool/main/a/abootimg/"
798 "abootimg_" version ".orig.tar.gz"))
799 (sha256
800 (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba"))))
801 (build-system gnu-build-system)
802 (arguments
803 `(#:tests? #f
804 #:phases
805 (modify-phases %standard-phases
806 (replace 'configure
807 (lambda _
808 (setenv "CC" "gcc")
809 #t))
810 (replace 'install
811 (lambda* (#:key outputs #:allow-other-keys)
812 (let* ((out (assoc-ref outputs "out"))
813 (bin (string-append out "/bin")))
814 (install-file "abootimg" bin)
815 #t))))))
816 (inputs
817 `(("libblkid" ,util-linux)))
818 (home-page "https://ac100.grandou.net/abootimg")
819 (synopsis "Tool for manipulating Android Boot Images")
820 (description "This package provides a tool for manipulating old Android
821 Boot Images. @code{abootimg} can work directly on block devices, or, the
822 safest way, on a file image.")
823 (license license:gpl2+)))
824
825 (define-public python-androguard
826 (package
827 (name "python-androguard")
828 (version "3.2.1")
829 (source
830 (origin
831 ;; The pypi release doesn't have the tests, but the tests use
832 ;; packaged binaries, so we skip them.
833 (method url-fetch)
834 (uri (pypi-uri "androguard" version))
835 (sha256
836 (base32
837 "0ndsw00pkyda4i2s3wi5ap8gbk6a9d23xhhxpdbk02padv8sxkfv"))))
838 (build-system python-build-system)
839 (arguments
840 '(#:phases
841 (modify-phases %standard-phases
842 (replace 'check
843 ;; Adapted from .travis.yml
844 (lambda _
845 (invoke "nosetests" "--with-coverage" "--with-timer"
846 "--timer-top-n" "50"))))))
847 (native-inputs
848 `(("python-codecov" ,python-codecov)
849 ("python-coverage" ,python-coverage)
850 ("python-mock" ,python-mock)
851 ("python-nose" ,python-nose)
852 ("python-nose-timer" ,python-nose-timer)))
853 (propagated-inputs
854 `(("python-asn1crypto" ,python-asn1crypto)
855 ("python-colorama" ,python-colorama)
856 ("python-future" ,python-future)
857 ("python-ipython" ,python-ipython)
858 ("python-lxml" ,python-lxml)
859 ("python-matplotlib" ,python-matplotlib)
860 ("python-networkx" ,python-networkx)
861 ("python-pygments" ,python-pygments)
862 ("python-pyperclip" ,python-pyperclip)))
863 (home-page "https://github.com/androguard/androguard")
864 (synopsis "Python tool to play with Android files")
865 (description
866 "Androguard is a full Python tool to manipulate Android files. It is
867 useful for reverse engineering, analysis of Android applications and more.")
868 (license license:asl2.0)))
869
870 (define-public fdroidserver
871 (package
872 (name "fdroidserver")
873 (version "1.0.10")
874 (source
875 (origin
876 (method url-fetch)
877 (uri (pypi-uri "fdroidserver" version))
878 (sha256
879 (base32
880 "0n6kkby65qzqdx1jn72grfffvr1w1j1rby5pwm9z8rymmsh8s0pm"))))
881 (build-system python-build-system)
882 (arguments
883 `(#:phases
884 (modify-phases %standard-phases
885 (add-after 'unpack 'fix-versioning
886 (lambda _
887 (substitute* "setup.py"
888 (("0.2.1") ,(package-version python-pyasn1-modules)))
889 #t)))))
890 (propagated-inputs
891 `(("python-androguard" ,python-androguard)
892 ("python-apache-libcloud" ,python-apache-libcloud)
893 ("python-clint" ,python-clint)
894 ("python-docker-py" ,python-docker-py)
895 ("python-gitpython" ,python-gitpython)
896 ("python-mwclient" ,python-mwclient)
897 ("python-paramiko" ,python-paramiko)
898 ("python-pillow" ,python-pillow)
899 ("python-pyasn1" ,python-pyasn1)
900 ("python-pyasn1-modules" ,python-pyasn1-modules)
901 ("python-pyyaml" ,python-pyyaml)
902 ("python-qrcode" ,python-qrcode)
903 ("python-ruamel.yaml" ,python-ruamel.yaml)
904 ("python-requests" ,python-requests)
905 ("python-vagrant" ,python-vagrant)))
906 (native-inputs
907 `(("python-babel" ,python-babel)
908 ("python-bcrypt" ,python-bcrypt)
909 ("python-docker-pycreds" ,python-docker-pycreds)
910 ("python-pynacl" ,python-pynacl)
911 ("python-websocket-client" ,python-websocket-client)))
912 (home-page "https://f-droid.org")
913 (synopsis "F-Droid server tools")
914 (description
915 "The F-Droid server tools provide various scripts and tools that are used
916 to maintain F-Droid, the repository of free Android applications. You can use
917 these same tools to create your own additional or alternative repository for
918 publishing, or to assist in creating, testing and submitting metadata to the
919 main repository.")
920 (license license:agpl3+)))