From 436515cdb8a2b0c8d8310c6f780b1a35bfb5e7da Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Thu, 26 Apr 2018 02:15:56 +0200 Subject: build: Add the Android NDK build-system. * guix/build-system/android-ndk.scm: New file. * guix/build/android-ndk-build-system.scm: New file. * Makefile.am: Add them. --- guix/build-system/android-ndk.scm | 126 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 guix/build-system/android-ndk.scm (limited to 'guix/build-system') 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 +;;; +;;; 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 . + +(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))) -- cgit v1.3 From 9ed36cd3d6a4146f5f314b79a6fd6ada93d03164 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Thu, 10 May 2018 00:05:58 +0200 Subject: build-system: android-ndk: Support unit tests. * guix/build-system/android-ndk.scm (android-ndk-build): Add googletest. * guix/build/android-ndk-build-system.scm (check): Check whether tests are enabled. Run root-level tests as well. --- guix/build-system/android-ndk.scm | 1 + guix/build/android-ndk-build-system.scm | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'guix/build-system') diff --git a/guix/build-system/android-ndk.scm b/guix/build-system/android-ndk.scm index 842d983a6..891fc6e04 100644 --- a/guix/build-system/android-ndk.scm +++ b/guix/build-system/android-ndk.scm @@ -113,6 +113,7 @@ ;; 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)) + ("googletest" ,(module-ref (resolve-interface '(gnu packages check)) 'googletest)) ,@native-inputs)) (outputs outputs) (build android-ndk-build) diff --git a/guix/build/android-ndk-build-system.scm b/guix/build/android-ndk-build-system.scm index b5d4b36d3..86d085848 100644 --- a/guix/build/android-ndk-build-system.scm +++ b/guix/build/android-ndk-build-system.scm @@ -68,11 +68,15 @@ (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* (check #:key target inputs outputs (tests? (not target)) (make-flags '()) #:allow-other-keys) + (if tests? + (begin + (apply invoke "make" "check" make-flags) + (when (and (file-exists? "tests") tests?) + (with-directory-excursion "tests" + (apply invoke "make" "check" make-flags)))) + (format #t "test suite not run~%")) + #t) (define %standard-phases (modify-phases gnu:%standard-phases -- cgit v1.3 From c6ee92c41bfc0bc3b5634651bfa62bf35f2f11b5 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Thu, 10 May 2018 01:51:08 +0200 Subject: gnu: Add android-googletest. * gnu/packages/android.scm (android-googletest): New variable. * guix/build-system/android-ndk.scm (android-ndk-build): Use it. --- gnu/packages/android.scm | 17 +++++++++++++++++ guix/build-system/android-ndk.scm | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'guix/build-system') diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm index 4c4750537..eda243314 100644 --- a/gnu/packages/android.scm +++ b/gnu/packages/android.scm @@ -77,6 +77,23 @@ use their packages mostly unmodified in our Android NDK build system.") (license license:asl2.0))) +(define-public android-googletest + (package (inherit googletest) + (name "android-googletest") + (arguments + `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON") + #:phases + (modify-phases %standard-phases + (add-after 'install 'install-host-libraries + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lib (string-append out "/lib"))) + (symlink "libgtest.so" + (string-append lib "/libgtest_host.so")) + (symlink "libgmock.so" + (string-append lib "/libgmock_host.so")) + #t)))))))) + ;; The Makefiles that we add are largely based on the Debian ;; packages. They are licensed under GPL-2 and have copyright: ;; 2012, Stefan Handschuh diff --git a/guix/build-system/android-ndk.scm b/guix/build-system/android-ndk.scm index 891fc6e04..029f654bb 100644 --- a/guix/build-system/android-ndk.scm +++ b/guix/build-system/android-ndk.scm @@ -113,7 +113,7 @@ ;; 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)) - ("googletest" ,(module-ref (resolve-interface '(gnu packages check)) 'googletest)) + ("android-googletest" ,(module-ref (resolve-interface '(gnu packages android)) 'android-googletest)) ,@native-inputs)) (outputs outputs) (build android-ndk-build) -- cgit v1.3 From b87fc9ab9d619e83947c5a281b682338df136fc6 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Thu, 10 May 2018 15:31:43 +0200 Subject: gnu: android-make-stub: Update to 0.6.0. * gnu/packages/android.scm (android-make-stub): Update to 0.6.0. * guix/build-system/android-ndk.scm (android-ndk-build): Modify. (lower): Modify. --- gnu/packages/android.scm | 4 ++-- guix/build-system/android-ndk.scm | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'guix/build-system') diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm index 763be4874..d42a7aef1 100644 --- a/gnu/packages/android.scm +++ b/gnu/packages/android.scm @@ -46,7 +46,7 @@ (define-public android-make-stub (package (name "android-make-stub") - (version "0.5.5") + (version "0.6.0") (source (origin (method git-fetch) @@ -57,7 +57,7 @@ version "-checkout")) (sha256 (base32 - "0shm4xvc2v6dn6pxydy6yn64qrrpcvx8ssmym9053wk0w5s9wp9q")))) + "0y1b2x96d37n6f1bp6dcx08bn08zac0cylmbfsx6mf2nahc02fhc")))) (build-system gnu-build-system) (arguments `(#:tests? #f ; None exist. diff --git a/guix/build-system/android-ndk.scm b/guix/build-system/android-ndk.scm index 029f654bb..dbfa626a1 100644 --- a/guix/build-system/android-ndk.scm +++ b/guix/build-system/android-ndk.scm @@ -67,8 +67,8 @@ #:make-flags (cons* "-f" ,(string-append (derivation->output-path - (car (assoc-ref inputs "android-make-stub"))) - "/share/android-make-stub/Makefile") + (car (assoc-ref inputs "android-build"))) + "/share/android/build/core/main.mk") ,make-flags) #:outputs %outputs #:search-paths ',(map search-path-specification->sexp @@ -112,7 +112,7 @@ ;; 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)) + (build-inputs `(("android-build" ,(module-ref (resolve-interface '(gnu packages android)) 'android-make-stub)) ("android-googletest" ,(module-ref (resolve-interface '(gnu packages android)) 'android-googletest)) ,@native-inputs)) (outputs outputs) -- cgit v1.3 From 0ebef06dbe5e53025670a76ff98f05e8c093f013 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Tue, 5 Jun 2018 09:57:05 +0200 Subject: build-system/r: Update to Bioconductor 3.7. This is a follow-up to 41f17554d88795bf35fbfc3e05301a6d2f64cca0. * guix/build-system/r.scm (bioconductor-uri): Update to version 3.7. --- guix/build-system/r.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix/build-system') diff --git a/guix/build-system/r.scm b/guix/build-system/r.scm index 6bdb7061e..d20f66e1a 100644 --- a/guix/build-system/r.scm +++ b/guix/build-system/r.scm @@ -53,7 +53,7 @@ release corresponding to NAME and VERSION." (list (string-append "https://bioconductor.org/packages/release/bioc/src/contrib/" name "_" version ".tar.gz") ;; TODO: use %bioconductor-version from (guix import cran) - (string-append "https://bioconductor.org/packages/3.6/bioc/src/contrib/Archive/" + (string-append "https://bioconductor.org/packages/3.7/bioc/src/contrib/Archive/" name "_" version ".tar.gz"))) (define %r-build-system-modules -- cgit v1.3