summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-05-25 20:12:26 +0200
committerLudovic Courtès <ludo@gnu.org>2013-05-25 20:16:45 +0200
commitf755aa3f7ac7a413d8fcc35b1264aff813cd9313 (patch)
tree466149e6c017412618b71e34059ddab5981e47b9
parent089b06348e8129980660c69f8122015c1ad6ae9c (diff)
downloadguix-f755aa3f7ac7a413d8fcc35b1264aff813cd9313.tar.gz
gnu: ncurses, readline: Allow cross-compilation.
* gnu/packages/ncurses.scm (ncurses): Add `cross-pre-install-phase'.
  Use different phases when (%current-target-system) is true.
* gnu/packages/readline.scm (readline): Use %standard-cross-phases as
  the base when (%current-target-system) is true.
-rw-r--r--gnu/packages/ncurses.scm41
-rw-r--r--gnu/packages/readline.scm4
2 files changed, 34 insertions, 11 deletions
diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
index 5199ec7c23..c1badae8a3 100644
--- a/gnu/packages/ncurses.scm
+++ b/gnu/packages/ncurses.scm
@@ -42,7 +42,16 @@
                             (string-append "CONFIG_SHELL=" bash)
                             (string-append "--prefix=" out)
                             configure-flags)))))
+        (cross-pre-install-phase
+         '(lambda _
+            ;; Run the native `tic' program, not the cross-built one.
+            (substitute* "misc/run_tic.sh"
+              (("\\{TIC_PATH:=.*\\}")
+               "{TIC_PATH:=true}")
+              (("cross_compiling:=no")
+               "cross_compiling:=yes"))))
         (post-install-phase
+         ;; FIXME: The `tic' binary lacks a RUNPATH; fix it.
          '(lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               ;; When building a wide-character (Unicode) build, create backward
@@ -97,16 +106,28 @@
                  '("--without-cxx-binding")
                  '()))
         #:tests? #f                               ; no "check" target
-        #:phases (alist-cons-after
-                  'install 'post-install ,post-install-phase
-                  (alist-cons-before
-                   'configure 'patch-makefile-SHELL
-                   ,patch-makefile-phase
-                   (alist-replace
-                    'configure
-                    ,configure-phase
-                    %standard-phases)))))
-     (self-native-input? #t)
+        #:phases ,(if (%current-target-system)
+
+                      `(alist-cons-before         ; cross build
+                        'configure 'patch-makefile-SHELL
+                        ,patch-makefile-phase
+                        (alist-cons-before
+                         'install 'pre-install
+                         ,cross-pre-install-phase
+                         (alist-cons-after
+                          'install 'post-install ,post-install-phase
+                          %standard-cross-phases)))
+
+                      `(alist-cons-after          ; native build
+                        'install 'post-install ,post-install-phase
+                        (alist-cons-before
+                         'configure 'patch-makefile-SHELL
+                         ,patch-makefile-phase
+                         (alist-replace
+                          'configure
+                          ,configure-phase
+                          %standard-phases))))))
+     (self-native-input? #t)                      ; for `tic'
      (synopsis "Terminal emulation (termcap, terminfo) library")
      (description
       "The Ncurses (new curses) library is a free software emulation of curses
diff --git a/gnu/packages/readline.scm b/gnu/packages/readline.scm
index 8857666fcc..1fb4376971 100644
--- a/gnu/packages/readline.scm
+++ b/gnu/packages/readline.scm
@@ -61,7 +61,9 @@
                    #:phases (alist-cons-after
                              'install 'post-install
                              ,post-install-phase
-                             %standard-phases)))
+                             ,(if (%current-target-system)
+                                  '%standard-cross-phases
+                                  '%standard-phases))))
       (synopsis "Edit command lines while typing, with history support")
       (description
        "The GNU Readline library provides a set of functions for use by