Subject: bug#49551: closed (Re: [bug#49551] [PATCH] gnu: mg: Enable cross-compilation.)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 14 Jul 2021 09:05:01 +0000

Your bug report

#49551: [PATCH] gnu: mg: Enable cross-compilation.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
49551: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=49551
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#49551] [PATCH] gnu: mg: Enable cross-compilation.
From: Pierre Langlois <[email-masked]>
To: Mathieu Othacehe <[email-masked]>
Cc: [email-masked], Pierre Langlois <[email-masked]>
Date: Wed, 14 Jul 2021 10:04:13 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Mathieu,

Mathieu Othacehe writes:

> Hey Pierre,
>
>> I was trying to revive my pinebook pro over the weekend, and realised we
>> needed to cross-compile mg in order to get an inital bare-bones image.
>
> Oops missed that when I added mg to the installation image. Your patch
> looks fine, please go ahead.

No worries!  Pushed with 681a0c75182e3f5cc5d8dba063451a96d64fa23c.

Thanks for the review,
Pierre

Subject: [PATCH] gnu: mg: Enable cross-compilation.
From: Pierre Langlois <[email-masked]>
To: Guix-patches <[email-masked]>
Date: Tue, 13 Jul 2021 20:51:28 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Guix!

I was trying to revive my pinebook pro over the weekend, and realised we
needed to cross-compile mg in order to get an inital bare-bones image.

OK to apply? I also removed the #t from the phases, hopefully that's OK,
I'm not sure if this sort of transition should be done incrementally or
all at once.

Thanks,
Pierre

>From 9bf02578c486cd4e65ab5faf30c86f972f05f300 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <[email-masked]>
Date: Tue, 13 Jul 2021 20:17:51 +0100
Subject: [PATCH] gnu: mg: Enable cross-compilation.

* gnu/packages/text-editors.scm (mg)[arguments]: Use cc-for-target.
Add phase to substitute pkg-config with the target's pkg-config.
---
 gnu/packages/text-editors.scm | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm
index 965ed6b9e7..11332fab0b 100644
--- a/gnu/packages/text-editors.scm
+++ b/gnu/packages/text-editors.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2020 Maxime Devos <[email-masked]>
 ;;; Copyright © 2021 aecepoglu <[email-masked]>
 ;;; Copyright © 2021 Leo Famulari <[email-masked]>
+;;; Copyright © 2021 Pierre Langlois <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -527,28 +528,32 @@ Wordstar-, EMACS-, Pico, Nedit or vi-like key bindings.  e3 can be used on
        ("ncurses" ,ncurses)))
     (arguments
      ;; No test suite available.
-     '(#:tests? #f
+     `(#:tests? #f
        #:make-flags (list (string-append "prefix=" %output)
-                          "CC=gcc")
+                          (string-append "CC=" ,(cc-for-target)))
        #:phases (modify-phases %standard-phases
                   (delete 'configure)   ; no configure script
                   (add-before 'build 'correct-location-of-difftool
                     (lambda _
                       (substitute* "buffer.c"
                         (("/usr/bin/diff")
-                         (which "diff")))
-                      #t))
+                         (which "diff")))))
+                  (add-before 'build 'pkg-config-for-cross-compiling-target
+                    (lambda _
+                      (substitute* "GNUmakefile"
+                        (("pkg-config")
+                         (or (which "pkg-config")
+                             (string-append ,(%current-target-system)
+                                            "-pkg-config"))))))
                   (add-before 'install 'patch-tutorial-location
                     (lambda* (#:key outputs #:allow-other-keys)
                       (substitute* "mg.1"
-                        (("/usr") (assoc-ref outputs "out")))
-                      #t))
+                        (("/usr") (assoc-ref outputs "out")))))
                   (add-after 'install 'install-tutorial
                     (lambda* (#:key outputs #:allow-other-keys)
                       (let* ((out (assoc-ref outputs "out"))
                              (doc (string-append out "/share/doc/mg")))
-                        (install-file "tutorial" doc)
-                        #t))))))
+                        (install-file "tutorial" doc)))))))
     (home-page "https://homepage.boetes.org/software/mg/")
     (synopsis "Microscopic GNU Emacs clone")
     (description
-- 
2.32.0