guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/06: gnu: disarchive: Fix build when cross-compiling.


From: guix-commits
Subject: 06/06: gnu: disarchive: Fix build when cross-compiling.
Date: Mon, 17 May 2021 23:32:47 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit 0ac95b4490f2b661370b29980f6f01d28d03db6a
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Mon May 17 22:33:57 2021 -0400

    gnu: disarchive: Fix build when cross-compiling.
    
    This follows commit 0b1f70d1a7, which inadvertently broke the build of Guix
    for i586-pc-gnu (Hurd).
    
    * gnu/packages/patches/disarchive-cross-compilation.patch: New patch.
    * gnu/local.mk (dist_patch_DATA): Register it.
    * gnu/packages/backup.scm (disarchive)[source]: Apply it.
    [phases]{delete-configure}: New phase.
    [native-inputs]: Add guile-3.0 and guile-gcrypt.
---
 gnu/local.mk                                       |  3 +-
 gnu/packages/backup.scm                            | 10 ++-
 .../patches/disarchive-cross-compilation.patch     | 77 ++++++++++++++++++++++
 3 files changed, 88 insertions(+), 2 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 0d3ab38..1dc1910 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -19,7 +19,7 @@
 # Copyright © 2018 Amirouche Boubekki <amirouche@hypermove.net>
 # Copyright © 2018, 2019, 2020, 2021 Oleg Pykhalov <go.wigust@gmail.com>
 # Copyright © 2018 Stefan Stefanović <stefanx2ovic@gmail.com>
-# Copyright © 2018, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+# Copyright © 2018, 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 # Copyright © 2019, 2020 Guillaume Le Vaillant <glv@posteo.net>
 # Copyright © 2019, 2020 John Soo <jsoo1@asu.edu>
 # Copyright © 2019 Jonathan Brielmaier <jonathan.brielmaier@web.de>
@@ -944,6 +944,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/desmume-gcc7-fixes.patch                        \
   %D%/packages/patches/dfu-programmer-fix-libusb.patch         \
   %D%/packages/patches/diffutils-gets-undeclared.patch         \
+  %D%/packages/patches/disarchive-cross-compilation.patch      \
   %D%/packages/patches/dkimproxy-add-ipv6-support.patch                \
   %D%/packages/patches/docbook-xsl-nonrecursive-string-subst.patch     \
   %D%/packages/patches/doc++-include-directives.patch          \
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index f3d51e9..5e00094 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -1103,12 +1103,20 @@ backup.")
                                   "disarchive-" version ".tar.gz"))
               (sha256
                (base32
-                "1jypk0gdwxqbqxiblww863nzq0kwnc676q68j32sprqd7ilnq02s"))))
+                "1jypk0gdwxqbqxiblww863nzq0kwnc676q68j32sprqd7ilnq02s"))
+              (patches (search-patches "disarchive-cross-compilation.patch"))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'delete-configure
+                    (lambda _
+                      (delete-file "configure"))))))
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)
        ("pkg-config" ,pkg-config)
+       ("guile" ,guile-3.0)             ;for cross-compilation
+       ("guile-gcrypt" ,guile-gcrypt)
        ("guile-quickcheck" ,guile-quickcheck)))
     (inputs
      `(("guile" ,guile-3.0)
diff --git a/gnu/packages/patches/disarchive-cross-compilation.patch 
b/gnu/packages/patches/disarchive-cross-compilation.patch
new file mode 100644
index 0000000..8061262
--- /dev/null
+++ b/gnu/packages/patches/disarchive-cross-compilation.patch
@@ -0,0 +1,77 @@
+From dc0f8f8bf8608c39da32e3c8ca1484b766fc7452 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Mon, 17 May 2021 16:47:19 -0400
+Subject: [PATCH] build: Fix cross-compilation.
+
+The cross-compilation issues corrected by this change were discovered
+when attempting to cross-compile disarchive for the i586-gnu target on
+GNU Guix.
+
+* configure.ac [O_NOFOLLOW]: Rewrite test using AC_COMPUTE_INT, which
+is supported even when cross-compiling.
+(GUILD_TARGET_OPTION): New computed variable.
+* build-aux/guile.am ($(AM_V_GUILEC)GUILE_AUTO_COMPILE): Use it.
+---
+ build-aux/guile.am |  6 +++---
+ configure.ac       | 24 +++++++++++++++---------
+ 2 files changed, 18 insertions(+), 12 deletions(-)
+
+diff --git a/build-aux/guile.am b/build-aux/guile.am
+index bec04ea..7745125 100644
+--- a/build-aux/guile.am
++++ b/build-aux/guile.am
+@@ -54,7 +54,7 @@ AM_V_GUILEC_0 = @echo "  GUILEC" $@;
+ SUFFIXES = .scm .go
+ 
+ .scm.go:
+-      $(AM_V_GUILEC)GUILE_AUTO_COMPILE=0      \
+-      $(top_builddir)/pre-inst-env            \
+-      $(GUILD) compile $(GUILE_WARNINGS)      \
++      $(AM_V_GUILEC)GUILE_AUTO_COMPILE=0                              \
++      $(top_builddir)/pre-inst-env                                    \
++      $(GUILD) compile $(GUILE_WARNINGS) $(GUILD_TARGET_OPTION)       \
+                -o "$@" "$<"
+diff --git a/configure.ac b/configure.ac
+index 99c5ac5..0cd0173 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -39,21 +39,27 @@ AS_IF([test "x$GUILD" = "x"],
+     [AC_MSG_ERROR(m4_normalize([
+       'guild' binary not found; please check your Guile installation.]))])])
+ 
++dnl This argument is passed to guild; it ensures cross-compiling uses
++dnl the right target.
++if test -n "$host_alias"; then
++   AC_SUBST([GUILD_TARGET_OPTION], [--target=$host_alias])
++fi
++
+ GUILE_MODULE_REQUIRED(gcrypt hash)
+ 
+ dnl Guile defines a handful of values from <fcntl.h>, but it is
+ dnl missing O_NOFOLLOW.
+ AC_ARG_VAR([O_NOFOLLOW], [value to use for O_NOFOLLOW (cf. <fcntl.h>)])
+ AS_IF([test "x$O_NOFOLLOW" = "x"],
+-  [AC_MSG_CHECKING([the value of O_NOFOLLOW])
+-   AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+-       #include <fcntl.h>
+-       #include <stdio.h>
+-     ]], [[
+-       printf("%d\n", O_NOFOLLOW)
+-     ]])],
+-     [O_NOFOLLOW=`./conftest$EXEEXT`],
+-     [AC_MSG_FAILURE([could find value for O_NOFOLLOW])])])
++  [AC_MSG_CHECKING([the value of O_NOFOLLOW])]
++  [AC_COMPUTE_INT([O_NOFOLLOW],
++      [O_NOFOLLOW],
++      [[
++        #include <fcntl.h>
++        #include <stdio.h>
++      ]],
++      [AC_MSG_FAILURE([could find value for O_NOFOLLOW])])]
++  [AC_MSG_RESULT([$O_NOFOLLOW])])
+ 
+ AC_ARG_VAR([TAR], [tar utility])
+ AS_IF([test "x$TAR" = "x"], [AC_PATH_PROG([TAR], [tar])])
+-- 
+2.31.1
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]