Subject: Add heimdall

From: Julien Lepiller <[email-masked]>
Date: Tue, 29 Aug 2017 23:58:29 +0200

Hi,

this patch adds heimdall, a tool I just used to flash replicant on my
smartphone :)

>From 415b94e8fc61fba9353094a3eceb22bb2a6563b6 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <[email-masked]>
Date: Tue, 29 Aug 2017 23:54:16 +0200
Subject: [PATCH] gnu: Add heimdall.

* gnu/packages/android.scm (heimdall): New variable.
---
 gnu/packages/android.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index be3f50add..93c3281dd 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -23,12 +23,16 @@
 (define-module (gnu packages android)
   #:use-module (guix packages)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages libusb)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages tls))
@@ -399,3 +403,39 @@ parts of the development workflow.  Repo is not meant to replace Git, only to
 make it easier to work with Git.  The repo command is an executable Python
 script that you can put anywhere in your path.")
     (license license:asl2.0)))
+
+(define-public heimdall
+  (package
+    (name "heimdall")
+    (version "1.4.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/Benjamin-Dobell/Heimdall"
+                                  "/archive/v" version ".tar.gz"))
+              (sha256
+               (base32
+                "1y7gwg3lipyp2zcysm2vid1qg5nwin9bxbvgzs28lz2rya4fz6sq"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
+               (mkdir-p bin)
+               (copy-file "bin/heimdall" (string-append bin "/heimdall"))
+               (copy-file "bin/heimdall-frontend"
+                          (string-append bin "/heimdall-frontend"))))))))
+    (inputs
+     `(("libusb" ,libusb)
+       ("qt" ,qt)
+       ("zlib" ,zlib)))
+    (home-page "http://glassechidna.com.au/heimdall/")
+    (synopsis "Flash firmware onto Samsung mobile devices")
+    (description "Heimdall is a tool suite used to flash firmware (aka ROMs)
+onto Samsung mobile devices.  Heimdall connects to a mobile device over USB and
+interacts with low-level software running on the device, known as Loke.  Loke
+and Heimdall communicate via the custom Samsung-developed protocol typically
+referred to as the 'Odin 3 protocol'.")
+    (license license:expat)))
-- 
2.14.1