* gnu/packages/prolog.scm (swi-prolog)[arguments]<#:configure-flags>: Set PROG_SWIPL and SWIPL_NATIVE_FRIEND when cross-compiling. (swi-prolog)[native-inputs]: Add 'this-package' when cross-compiling. --- gnu/packages/prolog.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/prolog.scm b/gnu/packages/prolog.scm index 3eaec533d7..7a5ac04a0c 100644 --- a/gnu/packages/prolog.scm +++ b/gnu/packages/prolog.scm @@ -27,6 +27,7 @@ #: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) @@ -107,6 +108,12 @@ manner. It also features an interactive interpreter.") '("-DBSD_SIGNALS=1" "-DQSORT_R_GNU=1" ;; If absent, the non-existent 'cc' is used. "-DCMAKE_HOST_CC=gcc" + ;; swi-prolog needs a native copy of itself for + ;; cross-compilation. + "-DSWIPL_NATIVE_FRIEND=/nowhere" + (string-append "-DPROG_SWIPL=" + (assoc-ref %build-host-inputs "swi-prolog") + "/bin/swipl")) '()) "-DINSTALL_DOCUMENTATION=ON" "-DSWIPL_INSTALL_IN_LIB=OFF") ; FIXME: Breaks RUNPATH validation. @@ -125,7 +132,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.33.0