summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-05-25 22:59:00 +0200
committerRicardo Wurmus <rekado@elephly.net>2017-05-30 16:52:55 +0200
commitd2ac5e297578dea1c872f77a26ef4d481d5dc7bd (patch)
tree0353933bbfde07353632e07d4274889b8d2fa006 /guix/build
parent8a9b08b503c209c020f7e7dab16b8818208003f6 (diff)
downloadgnu-guix-d2ac5e297578dea1c872f77a26ef4d481d5dc7bd.tar
gnu-guix-d2ac5e297578dea1c872f77a26ef4d481d5dc7bd.tar.gz
build-system/cmake: Add support for cross compilation.
Fixes <https://bugs.gnu.org/26897>. * guix/build-system/gnu.scm: Export standard-cross-packages. * guix/build-system/cmake.scm (cmake-cross-build): New procedure. (lower): Add support for cross-builds. * guix/build/cmake-build-system.scm (configure): Handle "target" argument.
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/cmake-build-system.scm11
1 files changed, 10 insertions, 1 deletions
diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
index 27f2b5c872..128ab28fe5 100644
--- a/guix/build/cmake-build-system.scm
+++ b/guix/build/cmake-build-system.scm
@@ -32,7 +32,7 @@
;; Code:
(define* (configure #:key outputs (configure-flags '()) (out-of-source? #t)
- build-type
+ build-type target
#:allow-other-keys)
"Configure the given package."
(let* ((out (assoc-ref outputs "out"))
@@ -59,6 +59,15 @@
,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib")
;; enable verbose output from builds
"-DCMAKE_VERBOSE_MAKEFILE=ON"
+
+ ;; Cross-build
+ ,@(if target
+ (list (string-append "-DCMAKE_C_COMPILER="
+ target "-gcc")
+ (if (string-contains target "mingw")
+ "-DCMAKE_SYSTEM_NAME=Windows"
+ "-DCMAKE_SYSTEM_NAME=Linux"))
+ '())
,@configure-flags)))
(format #t "running 'cmake' with arguments ~s~%" args)
(zero? (apply system* "cmake" args)))))