* gnu/packages/prolog.scm (swi-prolog)[arguments]<#:configure-flags>: Set PROG_SWIPL and SWIPL_NATIVE_FRIEND when cross-compiling and make this a G-expression. (swi-prolog)[native-inputs]: Add 'this-package' when cross-compiling. --- gnu/packages/prolog.scm | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/gnu/packages/prolog.scm b/gnu/packages/prolog.scm index 3eaec533d7..00f09b49cc 100644 --- a/gnu/packages/prolog.scm +++ b/gnu/packages/prolog.scm @@ -22,11 +22,13 @@ (define-module (gnu packages prolog) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) + #:use-module (guix utils) #:use-module (gnu packages backup) #:use-module (gnu packages bash) #:use-module (gnu packages compression) @@ -100,16 +102,23 @@ manner. It also features an interactive interpreter.") (arguments `(#:parallel-build? #t #:configure-flags - (list ,@(if (%current-target-system) - ;; Set this manually, otherwise CMake would need to - ;; run a cross-compiled binary, which it can't do. - ;; These values were found on a Linux system. - '("-DBSD_SIGNALS=1" "-DQSORT_R_GNU=1" + ,#~(list + #$@(if (%current-target-system) + ;; Set this manually, otherwise CMake would need to + ;; run a cross-compiled binary, which it can't do. + ;; These values were found on a Linux system. + #~("-DBSD_SIGNALS=1" "-DQSORT_R_GNU=1" ;; If absent, the non-existent 'cc' is used. "-DCMAKE_HOST_CC=gcc" - '()) - "-DINSTALL_DOCUMENTATION=ON" - "-DSWIPL_INSTALL_IN_LIB=OFF") ; FIXME: Breaks RUNPATH validation. + ;; swi-prolog needs a native copy of itself for + ;; cross-compilation. + "-DSWIPL_NATIVE_FRIEND=/nowhere" + (string-append "-DPROG_SWIPL=" + #+(this-package-native-input "swi-prolog") + "/bin/swipl")) + #~()) + "-DINSTALL_DOCUMENTATION=ON" + "-DSWIPL_INSTALL_IN_LIB=OFF") ; FIXME: Breaks RUNPATH validation. #:phases (modify-phases %standard-phases ;; XXX: Delete the test phase that attempts to write to the @@ -125,7 +134,15 @@ manner. It also features an interactive interpreter.") '("save"))) #t))))) (native-inputs - `(("texinfo" ,texinfo) + `(,@(if (%current-target-system) + (begin + (unless (equal? (target-64bit?) + (target-64bit? (%current-system))) + (error "swi-prolog requires --system and --target to have \ +the same word size")) + `(("swi-prolog" ,this-package))) + '()) + ("texinfo" ,texinfo) ("perl" ,perl) ("pkg-config" ,pkg-config))) (inputs -- 2.30.2