GNU bug report logs - #31265
[PATCH 0/6] Add Android NDK build system.

Previous Next

Package: guix-patches;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Thu, 26 Apr 2018 00:14:02 UTC

Severity: normal

Tags: patch

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31265 in the body.
You can then email your comments to 31265 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#31265; Package guix-patches. (Thu, 26 Apr 2018 00:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 26 Apr 2018 00:14:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: guix-patches <at> gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH 0/6] Add Android NDK build system.
Date: Thu, 26 Apr 2018 02:13:19 +0200
Danny Milosavljevic (6):
  gnu: Add f2fs-tools <at> 1.7.0.
  build: Add the Android NDK build-system.
  gnu: liblog: Use android-ndk-build-system.
  gnu: libbase: Use android-ndk-build-system.
  gnu: adb: Use android-ndk-build-system.
  gnu: mkbootimg: Install "bootimg.h".

 Makefile.am                                  |   2 +
 gnu/local.mk                                 |   1 +
 gnu/packages/android.scm                     | 199 +++++++++------------------
 gnu/packages/linux.scm                       |  35 ++++-
 gnu/packages/patches/adb-add-libraries.patch |  19 +++
 guix/build-system/android-ndk.scm            | 126 +++++++++++++++++
 guix/build/android-ndk-build-system.scm      |  86 ++++++++++++
 7 files changed, 328 insertions(+), 140 deletions(-)
 create mode 100644 gnu/packages/patches/adb-add-libraries.patch
 create mode 100644 guix/build-system/android-ndk.scm
 create mode 100644 guix/build/android-ndk-build-system.scm





Information forwarded to guix-patches <at> gnu.org:
bug#31265; Package guix-patches. (Thu, 26 Apr 2018 00:17:01 GMT) Full text and rfc822 format available.

Message #8 received at 31265 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 31265 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH 1/6] gnu: Add f2fs-tools <at> 1.7.0.
Date: Thu, 26 Apr 2018 02:15:55 +0200
* gnu/packages/linux.scm (f2fs-tools-1.7): New variable.
---
 gnu/packages/linux.scm | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index c7c057b34..c81296b97 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -3252,10 +3252,10 @@ repair and easy administration.")
 from the btrfs-progs package.  It is meant to be used in initrds.")
     (license (package-license btrfs-progs))))
 
-(define-public f2fs-tools
+(define-public f2fs-tools-1.7
   (package
     (name "f2fs-tools")
-    (version "1.8.0")
+    (version "1.7.0")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -3263,21 +3263,30 @@ from the btrfs-progs package.  It is meant to be used in initrds.")
                     "/f2fs-tools.git/snapshot/" name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1bir9ladb58ijlcvrjrq1fb1xv5ys50zdjaq0yzliib0apsyrnyl"))))
+                "1m6bn1ibq0p53m0n97il91xqgjgn2pzlz74lb5bfzassx7159m1k"))))
+
     (build-system gnu-build-system)
     (arguments
      `(#:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'bootstrap
            (lambda _
-             (zero? (system* "autoreconf" "-vif")))))))
+             (zero? (system* "autoreconf" "-vif"))))
+         (add-after 'install 'install-headers
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (out-include (string-append out "/include")))
+               (install-file "include/f2fs_fs.h" out-include)
+               (install-file "mkfs/f2fs_format_utils.h" out-include)
+               #t))))))
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)
        ("libtool" ,libtool)
        ("pkg-config" ,pkg-config)))
     (inputs
-     `(("libuuid" ,util-linux)))
+     `(("libuuid" ,util-linux)
+       ("libselinux" ,libselinux)))
     (home-page "https://f2fs.wiki.kernel.org/")
     (synopsis "Userland tools for f2fs")
     (description
@@ -3288,6 +3297,22 @@ disks and SD cards.  This package provides the userland utilities.")
     ;; GPL2/LGPL2.1, everything else is GPL2 only. See 'COPYING'.
     (license (list license:gpl2 license:lgpl2.1))))
 
+(define-public f2fs-tools
+  (package
+    (inherit f2fs-tools-1.7)
+    (name "f2fs-tools")
+    (version "1.8.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://git.kernel.org/cgit/linux/kernel/git/jaegeuk"
+                    "/f2fs-tools.git/snapshot/" name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1bir9ladb58ijlcvrjrq1fb1xv5ys50zdjaq0yzliib0apsyrnyl"))))
+    (inputs
+     `(("libuuid" ,util-linux)))))
+
 (define-public freefall
   (package
     (name "freefall")




Information forwarded to guix-patches <at> gnu.org:
bug#31265; Package guix-patches. (Thu, 26 Apr 2018 00:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 31265 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 31265 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH 2/6] build: Add the Android NDK build-system.
Date: Thu, 26 Apr 2018 02:15:56 +0200
* guix/build-system/android-ndk.scm: New file.
* guix/build/android-ndk-build-system.scm: New file.
* Makefile.am: Add them.
* gnu/packages/android.scm (android-make-stub): New variable.
---
 Makefile.am                             |   2 +
 gnu/packages/android.scm                |  36 +++++++++
 guix/build-system/android-ndk.scm       | 126 ++++++++++++++++++++++++++++++++
 guix/build/android-ndk-build-system.scm |  86 ++++++++++++++++++++++
 4 files changed, 250 insertions(+)
 create mode 100644 guix/build-system/android-ndk.scm
 create mode 100644 guix/build/android-ndk-build-system.scm

diff --git a/Makefile.am b/Makefile.am
index 9f134c970..03fb870eb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,6 +96,7 @@ MODULES =					\
   guix/workers.scm				\
   guix/zlib.scm					\
   guix/build-system.scm				\
+  guix/build-system/android-ndk.scm		\
   guix/build-system/ant.scm			\
   guix/build-system/cargo.scm			\
   guix/build-system/cmake.scm			\
@@ -128,6 +129,7 @@ MODULES =					\
   guix/svn-download.scm				\
   guix/i18n.scm					\
   guix/ui.scm					\
+  guix/build/android-ndk-build-system.scm	\
   guix/build/ant-build-system.scm		\
   guix/build/download.scm			\
   guix/build/download-nar.scm			\
diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index 92de9736f..285a28515 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -39,6 +39,42 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages linux))
 
+(define-public android-make-stub
+  (let ((commit "v0.1")
+        (revision "21"))
+  (package
+    (name "android-make-stub")
+    (version "0.1")
+    (source
+     (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/daym/android-make-stub.git")
+            (commit commit)))
+      (file-name (string-append "android-make-stub-"
+                                version "-checkout"))
+      (sha256
+       (base32
+        "1ni4szpcx2clf3lpzrybabwk7bgvsl6ynng7xxfc49y4jkdkk4sh"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f ; None exist.
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (delete 'build)
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out")))
+                 (invoke "make" (string-append "prefix=" out) "install")
+                 #t))))))
+    (home-page "https://github.com/daym/android-make-stub")
+    (synopsis "Stubs for the @command{make} system of the Android platform")
+    (description "@code{android-make-stub} provides stubs for the
+@command{make} system of the Android platform.  This allows us to
+use their packages mostly unmodified in our Android NDK build system.")
+    (license license:asl2.0))))
+
 ;; The Makefiles that we add are largely based on the Debian
 ;; packages.  They are licensed under GPL-2 and have copyright:
 ;; 2012, Stefan Handschuh <handschuh.stefan <at> googlemail.com>
diff --git a/guix/build-system/android-ndk.scm b/guix/build-system/android-ndk.scm
new file mode 100644
index 000000000..842d983a6
--- /dev/null
+++ b/guix/build-system/android-ndk.scm
@@ -0,0 +1,126 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Danny Milosavljevic <dannym <at> scratchpost.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system android-ndk)
+  #:use-module (guix search-paths)
+  #:use-module (guix store)
+  #:use-module (guix utils)
+  #:use-module (guix derivations)
+  #:use-module (guix packages)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system gnu)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-26)
+  #:export (android-ndk-build-system))
+
+(define %android-ndk-build-system-modules
+  ;; Build-side modules imported by default.
+  `((guix build android-ndk-build-system)
+    (guix build syscalls)
+    ,@%gnu-build-system-modules))
+
+(define* (android-ndk-build store name inputs
+                      #:key
+                      (tests? #t)
+                      (test-target #f)
+                      (phases '(@ (guix build android-ndk-build-system)
+                                  %standard-phases))
+                      (outputs '("out"))
+                      (make-flags ''())
+                      (search-paths '())
+                      (system (%current-system))
+                      (guile #f)
+                      (imported-modules %android-ndk-build-system-modules)
+                      (modules '((guix build android-ndk-build-system)
+                                 (guix build utils))))
+  "Build SOURCE using Android NDK, and with INPUTS."
+  (define builder
+    `(begin
+       (use-modules ,@modules)
+       (android-ndk-build #:name ,name
+                    #:source ,(match (assoc-ref inputs "source")
+                                (((? derivation? source))
+                                 (derivation->output-path source))
+                                ((source)
+                                 source)
+                                (source
+                                 source))
+                    #:system ,system
+                    #:test-target ,test-target
+                    #:tests? ,tests?
+                    #:phases ,phases
+                    #:make-flags (cons* "-f"
+                                         ,(string-append
+                                          (derivation->output-path
+                                           (car (assoc-ref inputs "android-make-stub")))
+                                          "/share/android-make-stub/Makefile")
+                                         ,make-flags)
+                    #:outputs %outputs
+                    #:search-paths ',(map search-path-specification->sexp
+                                          search-paths)
+                    #:inputs %build-inputs)))
+
+  (define guile-for-build
+    (match guile
+      ((? package?)
+       (package-derivation store guile system #:graft? #f))
+      (#f                                         ; the default
+       (let* ((distro (resolve-interface '(gnu packages commencement)))
+              (guile  (module-ref distro 'guile-final)))
+         (package-derivation store guile system #:graft? #f)))))
+
+  (build-expression->derivation store name builder
+                                #:inputs inputs
+                                #:system system
+                                #:modules imported-modules
+                                #:outputs outputs
+                                #:guile-for-build guile-for-build))
+
+(define* (lower name
+                #:key source inputs native-inputs outputs system target
+                #:allow-other-keys
+                #:rest arguments)
+  "Return a bag for NAME."
+
+  (define private-keywords
+    '(#:source #:target #:inputs #:native-inputs #:outputs))
+
+  (and (not target) ;; TODO: support cross-compilation
+       (bag
+         (name name)
+         (system system)
+         (target target)
+         (host-inputs `(,@(if source
+                              `(("source" ,source))
+                              '())
+                        ,@inputs
+
+                        ;; Keep the standard inputs of 'gnu-build-system'
+                        ,@(standard-packages)))
+         (build-inputs `(("android-make-stub" ,(module-ref (resolve-interface '(gnu packages android)) 'android-make-stub))
+                         ,@native-inputs))
+         (outputs outputs)
+         (build android-ndk-build)
+         (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define android-ndk-build-system
+  (build-system
+    (name 'android-ndk)
+    (description
+     "Android NDK build system, to build Android NDK packages")
+    (lower lower)))
diff --git a/guix/build/android-ndk-build-system.scm b/guix/build/android-ndk-build-system.scm
new file mode 100644
index 000000000..b5d4b36d3
--- /dev/null
+++ b/guix/build/android-ndk-build-system.scm
@@ -0,0 +1,86 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Danny Milosavljevic <dannym <at> scratchpost.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build android-ndk-build-system)
+  #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+  #:use-module (guix build syscalls)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 popen)
+  #:use-module (ice-9 rdelim)
+  #:use-module (ice-9 ftw)
+  #:use-module (ice-9 format)
+  #:use-module (ice-9 match)
+  #:use-module (rnrs io ports)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases
+            android-ndk-build))
+
+;; Commentary:
+;;
+;; Builder-side code of the Android NDK build system.
+;;
+;; Code:
+
+(define* (configure #:key inputs outputs #:allow-other-keys)
+  (let ((library-directories (filter-map (match-lambda
+                                          ((name . path)
+                                           (if (eq? 'directory (stat:type (stat path)))
+                                               path
+                                               #f)))
+                                         inputs)))
+    (setenv "CC" "gcc")
+    (setenv "CXX" "g++")
+    (setenv "CPPFLAGS"
+     (string-join
+      (map (cut string-append "-I " <> "/include") library-directories)
+      " "))
+    (setenv "LDFLAGS"
+     (string-append "-L . "
+                    (string-join
+                     (map (lambda (x)
+                            (string-append "-L " x "/lib" " -Wl,-rpath=" x "/lib"))
+                          library-directories)
+                     " ")))
+    #t))
+
+(define* (install #:key inputs outputs (make-flags '()) #:allow-other-keys)
+  (let ((out (assoc-ref outputs "out")))
+    (apply invoke "make" "install"
+           (string-append "prefix=" out)
+           make-flags)
+    (if (file-exists? "include")
+        (copy-recursively "include" (string-append out "/include")))
+    #t))
+
+(define* (check #:key inputs outputs tests? (make-flags '()) #:allow-other-keys)
+  ;; TODO: Also handle root-level tests.
+  (when (and (file-exists? "tests") tests?)
+    (with-directory-excursion "tests"
+      (apply invoke "make" "check" make-flags))))
+
+(define %standard-phases
+  (modify-phases gnu:%standard-phases
+    (replace 'configure configure)
+    (replace 'install install)
+    (replace 'check check)))
+
+(define* (android-ndk-build #:key inputs (phases %standard-phases)
+                            #:allow-other-keys #:rest args)
+  "Build the given Android NDK package, applying all of PHASES in order."
+  (apply gnu:gnu-build #:inputs inputs #:phases phases args))




Information forwarded to guix-patches <at> gnu.org:
bug#31265; Package guix-patches. (Thu, 26 Apr 2018 00:17:02 GMT) Full text and rfc822 format available.

Message #14 received at 31265 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 31265 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH 4/6] gnu: libbase: Use android-ndk-build-system.
Date: Thu, 26 Apr 2018 02:15:58 +0200
* gnu/packages/android.scm (libbase)[build-system]: Switch to
android-ndk-build-system.
[arguments]<#:phases>[create-Makefile]: Delete phase.
[arguments]<#:make-flags]: Add CXXFLAGS.
---
 gnu/packages/android.scm | 35 +++--------------------------------
 1 file changed, 3 insertions(+), 32 deletions(-)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index 7c131e7e8..09426058e 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -127,43 +127,14 @@ in Main, System, Radio and Events sub-logs.")
               (patches
                (search-patches "libbase-use-own-logging.patch"
                                "libbase-fix-includes.patch"))))
-    (build-system gnu-build-system)
+    (build-system android-ndk-build-system)
     (arguments
      `(#:tests? #f ; TODO.
+       #:make-flags '("CXXFLAGS=-std=gnu++11")
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'enter-source
-           (lambda _ (chdir "base") #t))
-         (add-after 'enter-source 'create-Makefile
-           (lambda _
-             ;; No useful makefile is shipped, so we create one.
-             (with-output-to-file "Makefile"
-               (lambda _
-                 (display
-                  (string-append
-                   "NAME = libbase\n"
-                   "SOURCES = file.cpp logging.cpp parsenetaddress.cpp"
-                   " stringprintf.cpp strings.cpp errors_unix.cpp\n"
-
-                   "CXXFLAGS += -std=gnu++11 -fPIC\n"
-                   "CPPFLAGS += -Iinclude -I../include\n"
-                   "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0"
-                   " -L.. -llog\n"
-
-                   "build: $(SOURCES)\n"
-                   "	$(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
-                   " $(LDFLAGS)\n"))
-                 #t))))
-         (delete 'configure)
-         (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (lib (string-append out "/lib")))
-               (install-file "libbase.so.0" lib)
-               (with-directory-excursion lib
-                 (symlink "libbase.so.0" "libbase.so"))
-               (copy-recursively "include" out)
-               #t))))))
+           (lambda _ (chdir "base") #t)))))
     (inputs `(("liblog" ,liblog)))
     (home-page "https://developer.android.com/")
     (synopsis "Android platform base library")




Information forwarded to guix-patches <at> gnu.org:
bug#31265; Package guix-patches. (Thu, 26 Apr 2018 00:17:03 GMT) Full text and rfc822 format available.

Message #17 received at 31265 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 31265 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH 3/6] gnu: liblog: Use android-ndk-build-system.
Date: Thu, 26 Apr 2018 02:15:57 +0200
* gnu/packages/android.scm (liblog)[build-system]: Switch to
android-ndk-build-system.
[arguments]<#:phases>[create-Makefile]: Delete phase.
---
 gnu/packages/android.scm | 37 +++----------------------------------
 1 file changed, 3 insertions(+), 34 deletions(-)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index 285a28515..7c131e7e8 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -27,6 +27,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system android-ndk)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module ((guix licenses) #:prefix license:)
@@ -101,46 +102,14 @@ use their packages mostly unmodified in our Android NDK build system.")
     (name "liblog")
     (version (android-platform-version))
     (source (android-platform-system-core version))
-    (build-system gnu-build-system)
+    (build-system android-ndk-build-system)
     (arguments
      `(#:tests? #f ; TODO.
        #:make-flags '("CC=gcc")
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'enter-source
-           (lambda _ (chdir "liblog") #t))
-         (add-after 'enter-source 'create-Makefile
-           (lambda _
-             ;; No useful makefile is shipped, so we create one.
-             (with-output-to-file "Makefile"
-               (lambda _
-                 (display
-                  (string-append
-                   "NAME = liblog\n"
-                   "SOURCES = log_event_list.c log_event_write.c"
-                   " logger_write.c config_write.c logger_name.c"
-                   " logger_lock.c fake_log_device.c fake_writer.c"
-                   " event_tag_map.c\n"
-
-                   "CFLAGS += -fvisibility=hidden -fPIC\n"
-                   "CPPFLAGS += -I../include -DFAKE_LOG_DEVICE=1"
-                   ;; Keep these two in sync with "liblog/Android.bp".
-                   " -DLIBLOG_LOG_TAG=1005"
-                   " -DSNET_EVENT_LOG_TAG=1397638484\n"
-                   "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread\n"
-
-                   "build: $(SOURCES)\n"
-                   "	$(CC) $^ -o $(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)\n"))
-                 #t))))
-         (delete 'configure)
-         (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (lib (string-append out "/lib")))
-               (install-file "liblog.so.0" lib)
-               (with-directory-excursion lib
-                 (symlink "liblog.so.0" "liblog.so"))
-               #t))))))
+           (lambda _ (chdir "liblog") #t)))))
     (home-page "https://developer.android.com/")
     (synopsis "Logging library from the Android platform.")
     (description "@code{liblog} represents an interface to the volatile Android




Information forwarded to guix-patches <at> gnu.org:
bug#31265; Package guix-patches. (Thu, 26 Apr 2018 00:17:03 GMT) Full text and rfc822 format available.

Message #20 received at 31265 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 31265 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH 6/6] gnu: mkbootimg: Install "bootimg.h".
Date: Thu, 26 Apr 2018 02:16:00 +0200
* gnu/packages/android.scm (mkbootimg)[arguments]<#:phases>[install]: Install
"bootimg.h".
---
 gnu/packages/android.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index 085bf41ae..53b0183f9 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -256,8 +256,10 @@ to a Unix shell that can run commands on the connected device or emulator.")
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
-                    (bin (string-append out "/bin")))
+                    (bin (string-append out "/bin"))
+                    (include (string-append out "/include")))
                (install-file "mkbootimg" bin)
+               (install-file "bootimg.h" include)
                #t))))))
     (home-page "https://developer.android.com/studio/command-line/adb.html")
     (synopsis "Tool to create Android boot images")




Information forwarded to guix-patches <at> gnu.org:
bug#31265; Package guix-patches. (Thu, 26 Apr 2018 00:17:04 GMT) Full text and rfc822 format available.

Message #23 received at 31265 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 31265 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH 5/6] gnu: adb: Use android-ndk-build-system.
Date: Thu, 26 Apr 2018 02:15:59 +0200
* gnu/packages/android.scm (adb)[build-system]: Switch to
android-ndk-build-system.
[arguments]<#:tests?>: Disable.
[arguments]<#:phases>[create-Makefile]: Delete phase.
[arguments]<#:phases>[fix-clang]: Delete phase.
[arguments]<#:phases>[fix-main]: Delete phase.
[arguments]<#:phases>[make-libs-available]: New phase.
[arguments]<#:phases>[install-headers]: New phase.
[arguments]<#:make-flags]: Add CFLAGS, CXXFLAGS.
[inputs]: Add liblog.
[source]: Add patch "adb-add-libraries.patch".
* gnu/packages/patches/adb-add-libraries.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                 |  1 +
 gnu/packages/android.scm                     | 87 ++++++----------------------
 gnu/packages/patches/adb-add-libraries.patch | 19 ++++++
 3 files changed, 39 insertions(+), 68 deletions(-)
 create mode 100644 gnu/packages/patches/adb-add-libraries.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 639dd943d..352e3ad9b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -551,6 +551,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/abiword-black-drawing-with-gtk322.patch	\
   %D%/packages/patches/acl-fix-perl-regex.patch		\
   %D%/packages/patches/acl-hurd-path-max.patch			\
+  %D%/packages/patches/adb-add-libraries.patch			\
   %D%/packages/patches/aegis-constness-error.patch         	\
   %D%/packages/patches/aegis-perl-tempdir1.patch           	\
   %D%/packages/patches/aegis-perl-tempdir2.patch           	\
diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index 09426058e..085bf41ae 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -201,82 +201,33 @@ various Android core host applications.")
               (inherit (android-platform-system-core version))
               (patches
                (search-patches "libbase-use-own-logging.patch"
-                               "libbase-fix-includes.patch"))))
-    (build-system gnu-build-system)
+                               "libbase-fix-includes.patch"
+                               "adb-add-libraries.patch"))))
+    (build-system android-ndk-build-system)
     (arguments
-     `(#:phases
+     `(#:tests? #f ; TODO.
+       #:make-flags
+       (list "CFLAGS=-Wno-error"
+             "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
+             (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
+                            "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'enter-source
            (lambda _ (chdir "adb") #t))
-         (add-before 'build 'fix-clang
-           (lambda _
-             ;; adb_client.h contains _Nonnull and _Nullable attributes, that
-             ;; are not understood by gcc.
-             (substitute* "adb_client.h"
-                   (("_Nonnull") "")
-                   (("_Nullable") ""))
-             #t))
-         (add-before 'build 'fix-main
-           (lambda _
-             ;; main.cpp used to be adb_main.cpp in the current directory
-             ;; rather than in its own subdirectory, but it was not fixed.
-             ;; This leads to some header files not being found anymore.
-             (copy-file "client/main.cpp" "adb_main.cpp")
+         (add-after 'enter-source 'make-libs-available
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (substitute* "Android.mk"
+              (("libcrypto_static") "libcrypto"))
              #t))
-         (add-after 'enter-source 'create-Makefile
-           (lambda* (#:key outputs #:allow-other-keys)
-             ;; No useful makefile is shipped, so we create one.
-             (with-output-to-file "Makefile"
-               (lambda _
-                 (display
-                  (string-append
-                   ;; Common for all components.
-                   "CXXFLAGS += -std=gnu++14 -fpermissive\n"
-                   "CPPFLAGS += -I../include -I../base/include -I. -DADB_HOST=1 "
-                   "-DADB_REVISION='\"" ,version "\"' -fPIC\n"
-                   "LDFLAGS += -lcrypto -lpthread -lbase -lcutils -L. -ladb\n"
-
-                   ;; Libadb specifics.
-                   "LIBADB_SOURCES = adb.cpp adb_auth.cpp adb_io.cpp "
-                   "adb_listeners.cpp adb_trace.cpp adb_utils.cpp fdevent.cpp "
-                   "sockets.cpp transport.cpp transport_local.cpp transport_usb.cpp "
-                   "get_my_path_linux.cpp sysdeps_unix.cpp usb_linux.cpp "
-                   "adb_auth_host.cpp diagnose_usb.cpp services.cpp "
-                   "shell_service_protocol.cpp bugreport.cpp line_printer.cpp\n"
-
-                   "LIBADB_LDFLAGS += -shared -Wl,-soname,libadb.so.0 "
-                   "-lcrypto -lpthread -lbase\n"
-
-                   ;; Adb specifics.
-                   "ADB_SOURCES = adb_main.cpp console.cpp commandline.cpp "
-                   "adb_client.cpp file_sync_client.cpp\n"
-                   "ADB_LDFLAGS += -Wl,-rpath=" (assoc-ref outputs "out") "/lib\n"
-
-                   "build: libadb $(ADB_SOURCES)\n"
-                   "	$(CXX) $(ADB_SOURCES) -o adb $(CXXFLAGS) $(CPPFLAGS) "
-                   "$(ADB_LDFLAGS) $(LDFLAGS)\n"
-
-                   "libadb: $(LIBADB_SOURCES)\n"
-                   "	$(CXX) $^ -o libadb.so.0 $(CXXFLAGS) $(CPPFLAGS) "
-                   "$(LIBADB_LDFLAGS)\n"
-                   "	ln -sv libadb.so.0 libadb.so\n"))
-                 #t))))
-         (delete 'configure)
-         (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 "libadb.so.0" lib)
-               (install-file "adb" bin)
-               (with-directory-excursion lib
-                 (symlink "libadb.so.0" "libadb.so"))
-               #t))))
-       ;; Test suite must be run with attached devices
-       #:tests? #f))
+         (add-after 'install 'install-headers
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
+             #t)))))
     (inputs
      `(("libbase" ,libbase)
        ("libcutils" ,libcutils)
+       ("liblog" ,liblog)
        ("openssl" ,openssl)))
     (home-page "https://developer.android.com/studio/command-line/adb.html")
     (synopsis "Android Debug Bridge")
diff --git a/gnu/packages/patches/adb-add-libraries.patch b/gnu/packages/patches/adb-add-libraries.patch
new file mode 100644
index 000000000..06b3ec376
--- /dev/null
+++ b/gnu/packages/patches/adb-add-libraries.patch
@@ -0,0 +1,19 @@
+--- a/adb/Android.mk	2018-04-25 23:23:29.527198350 +0200
++++ b/adb/Android.mk	2018-04-25 23:24:25.558632573 +0200
+@@ -226,7 +226,7 @@
+ LOCAL_SRC_FILES := test_track_devices.cpp
+ LOCAL_SANITIZE := $(adb_host_sanitize)
+ LOCAL_SHARED_LIBRARIES := libbase
+-LOCAL_STATIC_LIBRARIES := libadb libcrypto_static libcutils
++LOCAL_STATIC_LIBRARIES := libadb libbase libcrypto_static libcutils
+ LOCAL_LDLIBS += -lrt -ldl -lpthread
+ include $(BUILD_HOST_EXECUTABLE)
+ endif
+@@ -278,6 +278,7 @@
+ LOCAL_SANITIZE := $(adb_host_sanitize)
+ LOCAL_STATIC_LIBRARIES := \
+     libadb \
++    libcutils \
+     libbase \
+     libcrypto_static \
+     libdiagnose_usb \




Information forwarded to guix-patches <at> gnu.org:
bug#31265; Package guix-patches. (Tue, 01 May 2018 10:28:01 GMT) Full text and rfc822 format available.

Message #26 received at 31265 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 31265 <at> debbugs.gnu.org
Subject: Re: Add Android NDK build system.
Date: Tue, 1 May 2018 12:27:14 +0200
Hi Danny,

this LGTM, but could you add android-make-stub in a separate patch?

Also, could you add a description of the new build system to the manual?

Thank you!




Reply sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
You have taken responsibility. (Wed, 09 May 2018 17:35:02 GMT) Full text and rfc822 format available.

Notification sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
bug acknowledged by developer. (Wed, 09 May 2018 17:35:02 GMT) Full text and rfc822 format available.

Message #31 received at 31265-done <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 31265-done <at> debbugs.gnu.org
Subject: Re: [bug#31265] Add Android NDK build system.
Date: Wed, 9 May 2018 19:34:08 +0200
[Message part 1 (text/plain, inline)]
Hi Julien,

thanks for the review!

On Tue, 1 May 2018 12:27:14 +0200
Julien Lepiller <julien <at> lepiller.eu> wrote:

> this LGTM, but could you add android-make-stub in a separate patch?

Sure, done.

> Also, could you add a description of the new build system to the manual?

Yeah, did that now.

I pushed to master as commits 72aa295e44d46f80a037bfdc68f831bee56efbab to
ad23a3fbabb3cdc4ad19b524f517ad312768b92c (inclusive).
[Message part 2 (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 07 Jun 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.