unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#56536] [PATCH]: gnu: newt: Fix cross-compilationn
@ 2022-07-13 12:08 Jean Pierre De Jesus DIAZ via Guix-patches via
  2022-08-06 16:40 ` Mathieu Othacehe
  0 siblings, 1 reply; 5+ messages in thread
From: Jean Pierre De Jesus DIAZ via Guix-patches via @ 2022-07-13 12:08 UTC (permalink / raw)
  To: 56536

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

Updates the newt package to use G-Expressions and
adds support for cross-compilation in the process
by adding python3.9-config and python-config to
$PATH.

To test:

./pre-inst-env guix build newt \
                          --target=aarch64-linux-gnu

—
Jean-Pierre De Jesus DIAZ

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-newt-Fix-cross-compilation.patch --]
[-- Type: text/x-patch; name=0001-gnu-newt-Fix-cross-compilation.patch, Size: 4098 bytes --]

From 47dda376c0583aef2cf5c4ddd2a2223f357e4a98 Mon Sep 17 00:00:00 2001
Message-Id: <47dda376c0583aef2cf5c4ddd2a2223f357e4a98.1657713910.git.me@jeandudey.tech>
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Wed, 13 Jul 2022 14:02:30 +0200
Subject: [PATCH] gnu: newt: Fix cross-compilation.

* gnu/packages/slang.scm (newt): Fix-cross compilation.
  [arguments]: Use G-Expressions for `#:configure-flags',
  `#:make-flags' and `#:phases', also set correct path for
  `python-config'.
---
 gnu/packages/slang.scm | 50 ++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/slang.scm b/gnu/packages/slang.scm
index c8de04667f..ab13c874d2 100644
--- a/gnu/packages/slang.scm
+++ b/gnu/packages/slang.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages slang)
   #:use-module (guix download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix gexp)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages ncurses)
@@ -103,34 +104,41 @@ (define-public newt
     (inputs
      (list slang popt python fribidi))
     (arguments
-     `(#:tests? #f    ; no test suite
+     (list
+       #:tests? #f    ; no test suite
        #:configure-flags
        ;; Set the correct RUNPATH in binaries.
-       (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
+       #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
        #:make-flags
        ;; configure uses a hard-coded search of /usr/include/python* to set
        ;; this variable, and does not allow us to override it from the
        ;; command line.  Fortunately, the Makefile does, so provide it here.
-       (list (string-append "PYTHONVERS=python"
-                            ,(version-major+minor (package-version python))))
+       #~(list
+          (string-append "PYTHONVERS=python"
+                         #$(version-major+minor (package-version python))))
        #:phases
-       (modify-phases %standard-phases
-         (add-after
-          'unpack 'patch-/usr/bin/install
-          (lambda _
-            (substitute* "po/Makefile"
-              (("/usr/bin/install") "install"))
-            #t))
-         (add-after
-          'install 'move-python
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let ((out  (assoc-ref outputs "out"))
-                  (py   (assoc-ref outputs "python"))
-                  (ver ,(version-major+minor (package-version python))))
-              (mkdir-p (string-append py "/lib"))
-              (rename-file (string-append out "/lib/python" ver)
-                           (string-append py  "/lib/python" ver))
-              #t))))))
+       #~(modify-phases %standard-phases
+           (add-after 'unpack 'patch-/usr/bin/install
+             (lambda _
+               (substitute* "po/Makefile"
+                 (("/usr/bin/install") "install"))))
+           (add-before 'build 'add-python-config-to-path
+             (lambda* (#:key target #:allow-other-keys)
+               ;; When cross-compiling python-config is not present in $PATH.
+               ;;
+               ;; It is a shell script without dependencies on target binaries
+               ;; so it can be run on the host to allow cross-compilation.
+               (when target
+                 (let ((path (getenv "PATH"))
+                       (py (string-append #$python "/bin")))
+                   (setenv "PATH" (string-append path ":" py))))))
+           (add-after 'install 'move-python
+             (lambda* _
+               (let ((ver #$(version-major+minor (package-version python))))
+                 (mkdir-p (string-append #$output:python "/lib"))
+                 (rename-file
+                   (string-append #$output "/lib/python" ver)
+                   (string-append #$output:python  "/lib/python" ver))))))))
     (home-page "https://pagure.io/newt")
     (synopsis "Not Erik's Windowing Toolkit - text mode windowing with slang")
     (description
-- 
2.36.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#56536] [PATCH]: gnu: newt: Fix cross-compilationn
  2022-07-13 12:08 [bug#56536] [PATCH]: gnu: newt: Fix cross-compilationn Jean Pierre De Jesus DIAZ via Guix-patches via
@ 2022-08-06 16:40 ` Mathieu Othacehe
  2022-08-06 16:54   ` Jean Pierre De Jesus DIAZ via Guix-patches via
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2022-08-06 16:40 UTC (permalink / raw)
  To: Jean Pierre De Jesus DIAZ; +Cc: 56536


Hello,

> +           (add-before 'build 'add-python-config-to-path
> +             (lambda* (#:key target #:allow-other-keys)
> +               ;; When cross-compiling python-config is not present in $PATH.
> +               ;;
> +               ;; It is a shell script without dependencies on target binaries
> +               ;; so it can be run on the host to allow cross-compilation.

Why not moving python to the native-inputs instead?

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#56536] [PATCH]: gnu: newt: Fix cross-compilationn
  2022-08-06 16:40 ` Mathieu Othacehe
@ 2022-08-06 16:54   ` Jean Pierre De Jesus DIAZ via Guix-patches via
  2022-08-06 17:34     ` Mathieu Othacehe
  0 siblings, 1 reply; 5+ messages in thread
From: Jean Pierre De Jesus DIAZ via Guix-patches via @ 2022-08-06 16:54 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 56536

Hello,

> Why not moving python to the native-inputs instead?

Because `python-config' output differs for the host and the target I
believe.

Thanks,

—
Jean-Pierre De Jesus DIAZ


------- Original Message -------
On Saturday, August 6th, 2022 at 18:40, Mathieu Othacehe <othacehe@gnu.org> wrote:


> Hello,
>
> > + (add-before 'build 'add-python-config-to-path
> > + (lambda* (#:key target #:allow-other-keys)
> > + ;; When cross-compiling python-config is not present in $PATH.
> > + ;;
> > + ;; It is a shell script without dependencies on target binaries
> > + ;; so it can be run on the host to allow cross-compilation.
>
>

>
> Thanks,
>
> Mathieu




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#56536] [PATCH]: gnu: newt: Fix cross-compilationn
  2022-08-06 16:54   ` Jean Pierre De Jesus DIAZ via Guix-patches via
@ 2022-08-06 17:34     ` Mathieu Othacehe
  2022-08-07  9:41       ` bug#56536: " Mathieu Othacehe
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2022-08-06 17:34 UTC (permalink / raw)
  To: Jean Pierre De Jesus DIAZ; +Cc: 56536


Hey,

> Because `python-config' output differs for the host and the target I
> believe.

Right, however moving python to native-inputs I have:

--8<---------------cut here---------------start------------->8---
mathieu@meije ~/guix [env]$ file /gnu/store/ib2xkrh9i2ff2b5zj1llf2x58zrm4zn6-newt-0.52.21-python/lib/python3.9/site-packages/_snack.so
/gnu/store/ib2xkrh9i2ff2b5zj1llf2x58zrm4zn6-newt-0.52.21-python/lib/python3.9/site-packages/_snack.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, stripped
--8<---------------cut here---------------end--------------->8---

which seems fine. An issue could be that the headers it uses at compile
time are from the native Python so maybe we'd better take the one from
the target python.

All in all, I'll go with your original patch I guess.

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#56536: [PATCH]: gnu: newt: Fix cross-compilationn
  2022-08-06 17:34     ` Mathieu Othacehe
@ 2022-08-07  9:41       ` Mathieu Othacehe
  0 siblings, 0 replies; 5+ messages in thread
From: Mathieu Othacehe @ 2022-08-07  9:41 UTC (permalink / raw)
  To: Jean Pierre De Jesus DIAZ; +Cc: 56536-done


Pushed as c0e713f6e2232593739181c89a886b9fd7be3a6c.

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-07  9:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 12:08 [bug#56536] [PATCH]: gnu: newt: Fix cross-compilationn Jean Pierre De Jesus DIAZ via Guix-patches via
2022-08-06 16:40 ` Mathieu Othacehe
2022-08-06 16:54   ` Jean Pierre De Jesus DIAZ via Guix-patches via
2022-08-06 17:34     ` Mathieu Othacehe
2022-08-07  9:41       ` bug#56536: " Mathieu Othacehe

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).