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