Commit | Line | Data |
---|---|---|
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 DM |
46 | (define-public android-make-stub |
47 | (let ((commit "v0.1") | |
48 | (revision "21")) | |
49 | (package | |
50 | (name "android-make-stub") | |
51 | (version "0.1") | |
52 | (source | |
53 | (origin | |
54 | (method git-fetch) | |
55 | (uri (git-reference | |
56 | (url "https://github.com/daym/android-make-stub.git") | |
57 | (commit commit))) | |
58 | (file-name (string-append "android-make-stub-" | |
59 | version "-checkout")) | |
60 | (sha256 | |
61 | (base32 | |
62 | "1ni4szpcx2clf3lpzrybabwk7bgvsl6ynng7xxfc49y4jkdkk4sh")))) | |
63 | (build-system gnu-build-system) | |
64 | (arguments | |
65 | `(#:tests? #f ; None exist. | |
66 | #:phases | |
67 | (modify-phases %standard-phases | |
68 | (delete 'configure) | |
69 | (delete 'build) | |
70 | (replace 'install | |
71 | (lambda* (#:key outputs #:allow-other-keys) | |
72 | (let* ((out (assoc-ref outputs "out"))) | |
73 | (invoke "make" (string-append "prefix=" out) "install") | |
74 | #t)))))) | |
75 | (home-page "https://github.com/daym/android-make-stub") | |
76 | (synopsis "Stubs for the @command{make} system of the Android platform") | |
77 | (description "@code{android-make-stub} provides stubs for the | |
78 | @command{make} system of the Android platform. This allows us to | |
79 | use their packages mostly unmodified in our Android NDK build system.") | |
80 | (license license:asl2.0)))) | |
81 | ||
5315fcfd JL |
82 | ;; The Makefiles that we add are largely based on the Debian |
83 | ;; packages. They are licensed under GPL-2 and have copyright: | |
84 | ;; 2012, Stefan Handschuh <handschuh.stefan@googlemail.com> | |
85 | ;; 2015, Kai-Chung Yan <seamlikok@gmail.com> | |
86 | ;; Big thanks to them for laying the groundwork. | |
87 | ||
88 | ;; The version tag is consistent between all repositories. | |
89 | (define (android-platform-version) "7.1.2_r6") | |
90 | ||
91 | (define (android-platform-system-core version) | |
92 | (origin | |
93 | (method git-fetch) | |
94 | (uri (git-reference | |
95 | (url "https://android.googlesource.com/platform/system/core") | |
96 | (commit (string-append "android-" version)))) | |
97 | (file-name (string-append "android-platform-system-core-" | |
98 | version "-checkout")) | |
99 | (sha256 | |
100 | (base32 | |
b98d4478 DM |
101 | "0xc2n7jxrf1iw9cc278pijdfjix2fkiig5ws27f6rwp40zg5mrgg")) |
102 | (patches | |
103 | (search-patches "libbase-use-own-logging.patch" | |
104 | "libbase-fix-includes.patch" | |
16c2be0b DM |
105 | "adb-add-libraries.patch" |
106 | "libziparchive-add-includes.patch")))) | |
5315fcfd | 107 | |
cc39d592 DM |
108 | (define (android-platform-bionic version) |
109 | (origin | |
110 | (method git-fetch) | |
111 | (uri (git-reference | |
112 | (url "https://android.googlesource.com/platform/bionic") | |
113 | (commit (string-append "android-" version)))) | |
114 | (file-name (string-append "android-platform-bionic-" | |
115 | version "-checkout")) | |
116 | (sha256 | |
117 | (base32 | |
118 | "0n9wkz3ynqw39if1ss9n32m66iga14nndf29hpm7g1aqn4wvvgzk")))) | |
119 | ||
7b592cfb DM |
120 | (define (android-platform-external version subdirectory checksum) |
121 | (origin | |
122 | (method git-fetch) | |
123 | (uri (git-reference | |
124 | (url | |
125 | (string-append "https://android.googlesource.com/platform/external/" | |
126 | subdirectory)) | |
127 | (commit (string-append "android-" version)))) | |
128 | (file-name (string-append "android-platform-system-external-" subdirectory "-" | |
129 | version "-checkout")) | |
130 | (sha256 | |
131 | (base32 | |
132 | checksum)))) | |
133 | ||
5315fcfd JL |
134 | (define liblog |
135 | (package | |
136 | (name "liblog") | |
137 | (version (android-platform-version)) | |
138 | (source (android-platform-system-core version)) | |
116c69d9 | 139 | (build-system android-ndk-build-system) |
5315fcfd JL |
140 | (arguments |
141 | `(#:tests? #f ; TODO. | |
142 | #:make-flags '("CC=gcc") | |
143 | #:phases | |
144 | (modify-phases %standard-phases | |
145 | (add-after 'unpack 'enter-source | |
116c69d9 | 146 | (lambda _ (chdir "liblog") #t))))) |
5315fcfd JL |
147 | (home-page "https://developer.android.com/") |
148 | (synopsis "Logging library from the Android platform.") | |
149 | (description "@code{liblog} represents an interface to the volatile Android | |
150 | Logging system for NDK (Native) applications and libraries and contain | |
151 | interfaces for either writing or reading logs. The log buffers are divided up | |
152 | in Main, System, Radio and Events sub-logs.") | |
153 | (license license:asl2.0))) | |
154 | ||
155 | (define libbase | |
156 | (package | |
157 | (name "libbase") | |
158 | (version (android-platform-version)) | |
b98d4478 | 159 | (source (android-platform-system-core version)) |
11cb109b | 160 | (build-system android-ndk-build-system) |
5315fcfd JL |
161 | (arguments |
162 | `(#:tests? #f ; TODO. | |
11cb109b | 163 | #:make-flags '("CXXFLAGS=-std=gnu++11") |
5315fcfd JL |
164 | #:phases |
165 | (modify-phases %standard-phases | |
166 | (add-after 'unpack 'enter-source | |
11cb109b | 167 | (lambda _ (chdir "base") #t))))) |
5315fcfd JL |
168 | (inputs `(("liblog" ,liblog))) |
169 | (home-page "https://developer.android.com/") | |
170 | (synopsis "Android platform base library") | |
171 | (description "@code{libbase} is a library in common use by the | |
172 | various Android core host applications.") | |
173 | (license license:asl2.0))) | |
174 | ||
175 | (define libcutils | |
176 | (package | |
177 | (name "libcutils") | |
178 | (version (android-platform-version)) | |
179 | (source (android-platform-system-core version)) | |
180 | (build-system gnu-build-system) | |
181 | (arguments | |
182 | `(#:tests? #f ; TODO. | |
183 | #:phases | |
184 | (modify-phases %standard-phases | |
185 | (add-after 'unpack 'enter-source | |
186 | (lambda _ (chdir "libcutils") #t)) | |
187 | (add-after 'enter-source 'create-Makefile | |
188 | (lambda _ | |
189 | ;; No useful makefile is shipped, so we create one. | |
190 | (with-output-to-file "Makefile" | |
191 | (lambda _ | |
192 | (display | |
193 | (string-append | |
194 | "NAME = libcutils\n" | |
195 | "SOURCES = load_file.o socket_local_client_unix.o" | |
196 | " socket_loopback_client_unix.o socket_network_client_unix.o" | |
197 | " socket_loopback_server_unix.o socket_local_server_unix.o" | |
198 | " sockets_unix.o socket_inaddr_any_server_unix.o" | |
199 | " sockets.o\n" | |
200 | "CC = gcc\n" | |
201 | ||
202 | "CFLAGS += -fPIC\n" | |
203 | "CXXFLAGS += -std=gnu++11 -fPIC\n" | |
204 | "CPPFLAGS += -Iinclude -I../include\n" | |
205 | "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n" | |
206 | ||
207 | "build: $(SOURCES)\n" | |
208 | " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)" | |
209 | " $(LDFLAGS)\n")) | |
210 | #t)))) | |
211 | (delete 'configure) | |
212 | (replace 'install | |
213 | (lambda* (#:key outputs #:allow-other-keys) | |
214 | (let* ((out (assoc-ref outputs "out")) | |
cbf83e00 DM |
215 | (lib (string-append out "/lib")) |
216 | (include (string-append out "/include"))) | |
5315fcfd JL |
217 | (install-file "libcutils.so.0" lib) |
218 | (with-directory-excursion lib | |
219 | (symlink "libcutils.so.0" "libcutils.so")) | |
cbf83e00 DM |
220 | (copy-recursively "../include/cutils" |
221 | (string-append include "/cutils")) | |
5315fcfd JL |
222 | #t)))))) |
223 | (home-page "https://developer.android.com/") | |
224 | (synopsis "Android platform c utils library") | |
225 | (description "@code{libcutils} is a library in common use by the | |
226 | various Android core host applications.") | |
227 | (license license:asl2.0))) | |
228 | ||
092f88a6 DM |
229 | (define-public android-libsparse |
230 | (package | |
231 | (name "android-libsparse") | |
232 | (version (android-platform-version)) | |
233 | (source (android-platform-system-core version)) | |
234 | (build-system android-ndk-build-system) | |
235 | (arguments | |
236 | `(#:tests? #f ; TODO. | |
237 | #:make-flags '("CFLAGS=-Wno-error" | |
238 | "CXXFLAGS=-fpermissive -Wno-error") | |
239 | #:phases | |
240 | (modify-phases %standard-phases | |
241 | (add-after 'unpack 'enter-source | |
242 | (lambda _ (chdir "libsparse") #t))))) | |
243 | (inputs | |
244 | `(("zlib" ,zlib))) | |
245 | (home-page "https://developer.android.com/") | |
246 | (synopsis "Android platform sparse library") | |
247 | (description "@code{android-libsparse} is a library in common use by the | |
248 | various Android core host applications.") | |
249 | (license license:asl2.0))) | |
250 | ||
16c2be0b DM |
251 | (define-public android-libziparchive |
252 | (package | |
253 | (name "android-libziparchive") | |
254 | (version (android-platform-version)) | |
255 | (source (android-platform-system-core version)) | |
256 | (build-system android-ndk-build-system) | |
257 | (arguments | |
258 | `(#:tests? #f ; TODO. | |
259 | #:make-flags '("CFLAGS=-Wno-error" | |
260 | "CXXFLAGS=-fpermissive -Wno-error -std=gnu++11") | |
261 | #:phases | |
262 | (modify-phases %standard-phases | |
263 | (add-after 'unpack 'enter-source | |
264 | (lambda _ (chdir "libziparchive") #t)) | |
265 | (add-after 'install 'install-headers | |
266 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
267 | (let ((out (assoc-ref outputs "out"))) | |
268 | (copy-recursively "../include/ziparchive" | |
269 | (string-append out "/include/ziparchive")) | |
270 | #t)))))) | |
271 | (inputs | |
272 | `(("zlib" ,zlib))) | |
273 | (home-page "https://developer.android.com/") | |
274 | (synopsis "Android platform ZIP library") | |
275 | (description "@code{android-libziparchive} is a library in common use by the | |
276 | various Android core host applications.") | |
277 | (license license:asl2.0))) | |
278 | ||
5315fcfd JL |
279 | (define-public adb |
280 | (package | |
281 | (name "adb") | |
282 | (version (android-platform-version)) | |
b98d4478 | 283 | (source (android-platform-system-core version)) |
f6e75b0d | 284 | (build-system android-ndk-build-system) |
5315fcfd | 285 | (arguments |
f6e75b0d DM |
286 | `(#:tests? #f ; TODO. |
287 | #:make-flags | |
288 | (list "CFLAGS=-Wno-error" | |
289 | "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ." | |
290 | (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib " | |
291 | "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L .")) | |
292 | #:phases | |
5315fcfd JL |
293 | (modify-phases %standard-phases |
294 | (add-after 'unpack 'enter-source | |
295 | (lambda _ (chdir "adb") #t)) | |
f6e75b0d DM |
296 | (add-after 'enter-source 'make-libs-available |
297 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
298 | (substitute* "Android.mk" | |
299 | (("libcrypto_static") "libcrypto")) | |
5315fcfd | 300 | #t)) |
f6e75b0d DM |
301 | (add-after 'install 'install-headers |
302 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
303 | (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include")) | |
304 | #t))))) | |
5315fcfd JL |
305 | (inputs |
306 | `(("libbase" ,libbase) | |
307 | ("libcutils" ,libcutils) | |
f6e75b0d | 308 | ("liblog" ,liblog) |
5315fcfd JL |
309 | ("openssl" ,openssl))) |
310 | (home-page "https://developer.android.com/studio/command-line/adb.html") | |
311 | (synopsis "Android Debug Bridge") | |
312 | (description | |
313 | "@command{adb} is a versatile command line tool that lets you communicate | |
314 | with an emulator instance or connected Android device. It facilitates a variety | |
315 | of device actions, such as installing and debugging apps, and it provides access | |
316 | to a Unix shell that can run commands on the connected device or emulator.") | |
317 | (license license:asl2.0))) | |
c1151ecf | 318 | |
7175abaa DM |
319 | (define-public mkbootimg |
320 | (package | |
321 | (name "mkbootimg") | |
322 | (version (android-platform-version)) | |
323 | (source (origin | |
324 | (inherit (android-platform-system-core version)))) | |
325 | (build-system python-build-system) | |
326 | (arguments | |
327 | `(#:tests? #f | |
328 | #:phases | |
329 | (modify-phases %standard-phases | |
330 | (add-after 'unpack 'enter-source | |
331 | (lambda _ (chdir "mkbootimg") #t)) | |
332 | (delete 'configure) | |
333 | (delete 'build) | |
334 | (replace 'install | |
335 | (lambda* (#:key outputs #:allow-other-keys) | |
336 | (let* ((out (assoc-ref outputs "out")) | |
3724d375 DM |
337 | (bin (string-append out "/bin")) |
338 | (include (string-append out "/include"))) | |
7175abaa | 339 | (install-file "mkbootimg" bin) |
3724d375 | 340 | (install-file "bootimg.h" include) |
7175abaa DM |
341 | #t)))))) |
342 | (home-page "https://developer.android.com/studio/command-line/adb.html") | |
343 | (synopsis "Tool to create Android boot images") | |
344 | (description "This package provides a tool to create Android Boot | |
345 | Images.") | |
346 | (license license:asl2.0))) | |
347 | ||
7b592cfb DM |
348 | (define-public android-safe-iop |
349 | (package | |
350 | (name "android-safe-iop") | |
351 | (version (android-platform-version)) | |
352 | (source (android-platform-external version "safe-iop" | |
353 | "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw")) | |
354 | (build-system android-ndk-build-system) | |
355 | (arguments | |
356 | `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error") | |
357 | #:phases | |
358 | (modify-phases %standard-phases | |
359 | (add-before 'build 'patch-host | |
360 | (lambda _ | |
361 | ;; TODO: Cross-compile. | |
362 | (substitute* "Android.mk" | |
363 | (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY")) | |
364 | #t))))) | |
365 | (home-page "https://developer.android.com/") | |
366 | (synopsis "Safe integers in C") | |
367 | (description "@code{android-safe-iop} provides a set of functions for | |
368 | performing and checking safe integer operations. Ensure that integer | |
369 | operations do not result in silent overflow.") | |
370 | (license license:bsd-2))) | |
371 | ||
cc39d592 DM |
372 | (define-public android-bionic-uapi |
373 | (package | |
374 | (name "android-bionic-uapi") | |
375 | (version (android-platform-version)) | |
376 | (source (android-platform-bionic version)) | |
377 | (build-system android-ndk-build-system) | |
378 | (arguments | |
379 | `(#:phases | |
380 | (modify-phases %standard-phases | |
381 | (add-after 'unpack 'enter-source | |
382 | (lambda _ (chdir "libc") #t)) | |
383 | (replace 'check | |
384 | (const #t)) | |
385 | (replace 'build | |
386 | (const #t)) | |
387 | (replace 'install | |
388 | (lambda* (#:key outputs #:allow-other-keys) | |
389 | (let* ((out (assoc-ref outputs "out")) | |
390 | (out-sys (string-append out "/include/sys"))) | |
391 | (mkdir-p out-sys) | |
392 | (install-file "include/sys/system_properties.h" out-sys) | |
393 | (install-file "include/sys/_system_properties.h" out-sys) | |
394 | (copy-recursively "kernel/uapi" (string-append out "/include")) | |
395 | #t)))))) | |
396 | (home-page "https://developer.android.com/") | |
397 | (synopsis "Android Linux API that is safe for user space") | |
398 | (description "@code{android-bionic-uapi} provides the part of the Linux API | |
399 | that is safe to use for user space. It also includes | |
400 | @code{system_properties.h} and @code{_system_properties.h}.") | |
401 | (license license:asl2.0))) | |
402 | ||
c87ca40f DM |
403 | (define-public android-libselinux |
404 | (package | |
405 | (name "android-libselinux") | |
406 | (version (android-platform-version)) | |
407 | (source | |
408 | (android-platform-external version "libselinux" | |
409 | "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7")) | |
410 | (build-system android-ndk-build-system) | |
411 | (arguments | |
412 | ;; See logd/Android.mk for the *_LOG_TAG values. | |
413 | `(#:make-flags (list (string-append "CFLAGS=-Wno-error " | |
414 | "-I core/include " | |
415 | "-I core/libpackagelistparser/include " | |
416 | "-DAUDITD_LOG_TAG=1003 " | |
417 | "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE") | |
418 | "LDFLAGS=-L . -lpcre") | |
419 | #:phases | |
420 | (modify-phases %standard-phases | |
421 | (add-after 'unpack 'unpack-core | |
422 | (lambda* (#:key inputs #:allow-other-keys) | |
423 | (mkdir-p "core") | |
424 | (with-directory-excursion "core" | |
425 | (invoke "tar" "axf" (assoc-ref inputs "core") "--strip-components=1")) | |
426 | #t)) | |
427 | (add-after 'unpack-core 'patch-HOST | |
428 | (lambda _ | |
429 | ;; gettid duplicates otherwise. | |
430 | (substitute* "src/procattr.c" | |
431 | (("#ifdef HOST") "#ifdef XXX")) | |
432 | #t))))) | |
433 | (inputs | |
434 | `(("openssl" ,openssl))) | |
435 | (native-inputs | |
436 | `(("android-bionic-uapi" ,android-bionic-uapi) | |
437 | ("core" ,(android-platform-system-core version)))) | |
438 | (propagated-inputs | |
439 | `(("pcre" ,pcre))) | |
440 | (home-page "https://developer.android.com/") | |
441 | (synopsis (package-synopsis libselinux)) | |
442 | (description (package-description libselinux)) | |
443 | (license (package-license libselinux)))) | |
444 | ||
0ad03eae MC |
445 | (define-public android-udev-rules |
446 | (package | |
447 | (name "android-udev-rules") | |
b45bfc9c | 448 | (version "20180112") |
0ad03eae MC |
449 | (source |
450 | (origin | |
451 | (method git-fetch) | |
452 | (uri (git-reference | |
453 | (url "https://github.com/M0Rf30/android-udev-rules") | |
454 | (commit version))) | |
455 | (file-name (string-append name "-" version "-checkout")) | |
456 | (sha256 | |
b45bfc9c | 457 | (base32 "13gj79nnd04szqlrrzzkdr6wi1fky08pi7x8xfbg0jj3d3v0giah")))) |
0ad03eae MC |
458 | (build-system trivial-build-system) |
459 | (native-inputs `(("source" ,source))) | |
460 | (arguments | |
461 | '(#:modules ((guix build utils)) | |
462 | #:builder | |
463 | (begin | |
464 | (use-modules (guix build utils)) | |
465 | (let ((source (assoc-ref %build-inputs "source"))) | |
466 | (install-file (string-append source "/51-android.rules") | |
467 | (string-append %output "/lib/udev/rules.d")))))) | |
468 | (home-page "https://github.com/M0Rf30/android-udev-rules") | |
469 | (synopsis "udev rules for Android devices") | |
470 | (description "Provides a set of udev rules to allow using Android devices | |
471 | with tools such as @command{adb} and @command{fastboot} without root | |
472 | privileges. This package is intended to be added as a rule to the | |
473 | @code{udev-service-type} in your @code{operating-system} configuration. | |
474 | Additionally, an @code{adbusers} group must be defined and your user added to | |
475 | it. | |
476 | ||
477 | @emph{Simply installing this package will not have any effect.} It is meant | |
478 | to be passed to the @code{udev} service.") | |
479 | (license license:gpl3+))) | |
480 | ||
c1151ecf HG |
481 | (define-public git-repo |
482 | (package | |
483 | (name "git-repo") | |
484 | (version "1.12.37") | |
485 | (source | |
486 | (origin | |
487 | (method git-fetch) | |
488 | (uri (git-reference | |
489 | (url "https://gerrit.googlesource.com/git-repo") | |
490 | (commit (string-append "v" version)))) | |
491 | (file-name (string-append "git-repo-" version "-checkout")) | |
492 | (sha256 | |
493 | (base32 "0qp7jqhblv7xblfgpcq4n18dyjdv8shz7r60c3vnjxx2fngkj2jd")))) | |
494 | (build-system python-build-system) | |
495 | (arguments | |
496 | `(#:python ,python-2 ; code says: "Python 3 support is … experimental." | |
497 | #:phases | |
498 | (modify-phases %standard-phases | |
499 | (add-before 'build 'set-executable-paths | |
500 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
501 | (let* ((out (assoc-ref outputs "out")) | |
502 | (git (assoc-ref inputs "git")) | |
503 | (gpg (assoc-ref inputs "gnupg")) | |
504 | (ssh (assoc-ref inputs "ssh"))) | |
505 | (substitute* '("repo" "git_command.py") | |
506 | (("^GIT = 'git' ") | |
507 | (string-append "GIT = '" git "/bin/git' "))) | |
508 | (substitute* "repo" | |
509 | ((" cmd = \\['gpg',") | |
510 | (string-append " cmd = ['" gpg "/bin/gpg',"))) | |
511 | (substitute* "git_config.py" | |
512 | ((" command_base = \\['ssh',") | |
513 | (string-append " command_base = ['" ssh "/bin/ssh',"))) | |
514 | #t))) | |
515 | (add-before 'build 'do-not-clone-this-source | |
516 | (lambda* (#:key outputs #:allow-other-keys) | |
517 | (let* ((out (assoc-ref outputs "out")) | |
518 | (repo-dir (string-append out "/share/" ,name))) | |
519 | (substitute* "repo" | |
520 | (("^def _FindRepo\\(\\):.*") | |
521 | (format #f " | |
522 | def _FindRepo(): | |
523 | '''Look for a repo installation, starting at the current directory.''' | |
524 | # Use the installed version of git-repo. | |
525 | repo_main = '~a/main.py' | |
526 | curdir = os.getcwd() | |
527 | olddir = None | |
528 | while curdir != '/' and curdir != olddir: | |
529 | dot_repo = os.path.join(curdir, repodir) | |
530 | if os.path.isdir(dot_repo): | |
531 | return (repo_main, dot_repo) | |
532 | else: | |
533 | olddir = curdir | |
534 | curdir = os.path.dirname(curdir) | |
535 | return None, '' | |
536 | ||
537 | # The remaining of this function is dead code. It was used to | |
538 | # find a git-checked-out version in the local project.\n" repo-dir)) | |
539 | ;; Neither clone, check out, nor verify the git repository | |
540 | (("(^\\s+)_Clone\\(.*\\)") "") | |
541 | (("(^\\s+)_Checkout\\(.*\\)") "") | |
542 | ((" rev = _Verify\\(.*\\)") " rev = None")) | |
543 | #t))) | |
544 | (delete 'build) ; nothing to build | |
545 | (replace 'check | |
546 | (lambda _ | |
547 | (zero? (system* "python" "-m" "nose")))) | |
548 | (replace 'install | |
549 | (lambda* (#:key outputs #:allow-other-keys) | |
550 | (let* ((out (assoc-ref outputs "out")) | |
551 | (bin-dir (string-append out "/bin")) | |
552 | (repo-dir (string-append out "/share/" ,name))) | |
553 | (mkdir-p bin-dir) | |
554 | (mkdir-p repo-dir) | |
555 | (copy-recursively "." repo-dir) | |
556 | (delete-file-recursively (string-append repo-dir "/tests")) | |
557 | (symlink (string-append repo-dir "/repo") | |
558 | (string-append bin-dir "/repo")) | |
559 | #t)))))) | |
560 | (inputs | |
561 | ;; TODO: Add git-remote-persistent-https once it is available in guix | |
562 | `(("git" ,git) | |
563 | ("gnupg" ,gnupg) | |
c695fb76 | 564 | ("ssh" ,openssh))) |
c1151ecf HG |
565 | (native-inputs |
566 | `(("nose" ,python2-nose))) | |
567 | (home-page "https://code.google.com/p/git-repo/") | |
568 | (synopsis "Helps to manage many Git repositories.") | |
569 | (description "Repo is a tool built on top of Git. Repo helps manage many | |
570 | Git repositories, does the uploads to revision control systems, and automates | |
571 | parts of the development workflow. Repo is not meant to replace Git, only to | |
572 | make it easier to work with Git. The repo command is an executable Python | |
573 | script that you can put anywhere in your path.") | |
574 | (license license:asl2.0))) | |
6ef5162d DM |
575 | |
576 | (define-public abootimg | |
577 | (package | |
578 | (name "abootimg") | |
579 | (version "0.6") | |
580 | (source | |
581 | (origin | |
582 | (method url-fetch) | |
583 | (uri (string-append "http://http.debian.net/debian/pool/main/a/abootimg/" | |
584 | "abootimg_" version ".orig.tar.gz")) | |
585 | (sha256 | |
586 | (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba")))) | |
587 | (build-system gnu-build-system) | |
588 | (arguments | |
589 | `(#:tests? #f | |
590 | #:phases | |
591 | (modify-phases %standard-phases | |
592 | (replace 'configure | |
593 | (lambda _ | |
594 | (setenv "CC" "gcc") | |
595 | #t)) | |
596 | (replace 'install | |
597 | (lambda* (#:key outputs #:allow-other-keys) | |
598 | (let* ((out (assoc-ref outputs "out")) | |
599 | (bin (string-append out "/bin"))) | |
600 | (install-file "abootimg" bin) | |
601 | #t)))))) | |
602 | (inputs | |
603 | `(("libblkid" ,util-linux))) | |
604 | (home-page "https://ac100.grandou.net/abootimg") | |
605 | (synopsis "Tool for manipulating Android Boot Images") | |
606 | (description "This package provides a tool for manipulating old Android | |
607 | Boot Images. @code{abootimg} can work directly on block devices, or, the | |
608 | safest way, on a file image.") | |
609 | (license license:gpl2+))) |