all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: 31265@debbugs.gnu.org
Subject: [bug#31265] [PATCH 5/6] gnu: adb: Use android-ndk-build-system.
Date: Thu, 26 Apr 2018 02:15:59 +0200	[thread overview]
Message-ID: <20180426001600.28974-5-dannym@scratchpost.org> (raw)
In-Reply-To: <20180426001600.28974-1-dannym@scratchpost.org>

* 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 \

  parent reply	other threads:[~2018-04-26  0:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26  0:13 [bug#31265] [PATCH 0/6] Add Android NDK build system Danny Milosavljevic
2018-04-26  0:15 ` [bug#31265] [PATCH 1/6] gnu: Add f2fs-tools@1.7.0 Danny Milosavljevic
2018-04-26  0:15   ` [bug#31265] [PATCH 2/6] build: Add the Android NDK build-system Danny Milosavljevic
2018-04-26  0:15   ` [bug#31265] [PATCH 3/6] gnu: liblog: Use android-ndk-build-system Danny Milosavljevic
2018-04-26  0:15   ` [bug#31265] [PATCH 4/6] gnu: libbase: " Danny Milosavljevic
2018-04-26  0:15   ` Danny Milosavljevic [this message]
2018-04-26  0:16   ` [bug#31265] [PATCH 6/6] gnu: mkbootimg: Install "bootimg.h" Danny Milosavljevic
2018-05-01 10:27 ` [bug#31265] Add Android NDK build system Julien Lepiller
2018-05-09 17:34   ` bug#31265: " Danny Milosavljevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180426001600.28974-5-dannym@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=31265@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.