summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2018-05-09 21:48:35 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2018-05-10 01:06:21 +0200
commit455b8fed7e0af287e433232f0edf59e26c6e5f4f (patch)
tree3f3dc2dbb959b83e749f3b21ff34da32083be246 /gnu
parentafc2bf53066975558676bc7f4957ad85d0ec170a (diff)
downloadguix-455b8fed7e0af287e433232f0edf59e26c6e5f4f.tar.gz
gnu: Add fastboot.
* gnu/packages/android.scm (fastboot): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/android.scm64
1 files changed, 64 insertions, 0 deletions
diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index 2e5f1d5933..c3beba6155 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -568,6 +568,70 @@ Android core.")
     (description "@code{android-libutils} provides utilities for Android NDK developers.")
     (license license:asl2.0)))
 
+(define-public fastboot
+  (package
+    (name "fastboot")
+    (version (android-platform-version))
+    (source #f)
+    (build-system android-ndk-build-system)
+    (arguments
+     `(#:make-flags (list "CXXFLAGS=-std=gnu++11")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'unpack
+           (lambda* (#:key inputs #:allow-other-keys)
+             (mkdir-p "core")
+             (with-directory-excursion "core"
+               (invoke "tar" "axf" (assoc-ref inputs "core") "--strip-components=1")
+               (substitute* "fastboot/Android.mk"
+                (("libext4_utils_host") "libext4_utils_host libselinux libpcre")))
+             (copy-recursively (assoc-ref inputs "extras") "extras"
+                               #:keep-mtime? #t)
+             #t))
+         (add-after 'unpack 'enter-source
+           (lambda _
+             (chdir "core/fastboot")
+             #t))
+         (add-after 'enter-source 'make-googletest-available
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((googletest (assoc-ref inputs "googletest")))
+               (symlink (string-append googletest "/lib/libgtest.so") "libgtest_host.so")
+               #t)))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib"))
+                    (bin (string-append out "/bin")))
+               (install-file "fastboot" bin)
+               #t))))
+       #:tests? #f)) ; Require network
+    (inputs
+     `(("adb" ,adb)
+       ("android-safe-iop" ,android-safe-iop)
+       ("android-ext4-utils" ,android-ext4-utils)
+       ("android-f2fs-utils" ,android-f2fs-utils)
+       ("googletest" ,googletest)
+       ("libbase" ,libbase)
+       ("libcutils" ,libcutils)
+       ("liblog" ,liblog)
+       ("android-libutils" ,android-libutils)
+       ("android-libsparse" ,android-libsparse)
+       ("android-libziparchive" ,android-libziparchive)
+       ("android-libselinux" ,android-libselinux)
+       ("pcre" ,pcre)
+       ("mkbootimg" ,mkbootimg)
+       ("openssl" ,openssl) ; FIXME remove
+       ("zlib" ,zlib)))
+    (native-inputs
+     `(("core" ,(android-platform-system-core version))
+       ("extras" ,(android-platform-system-extras version))
+       ("xz" ,xz)))
+    (home-page "https://developer.android.com/studio/command-line/")
+    (synopsis "Android image flasher")
+    (description
+     "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
+    (license license:asl2.0)))
+
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")