all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Josselin Poiret via Guix-patches via <guix-patches@gnu.org>
To: 62307@debbugs.gnu.org, Josselin Poiret <dev@jpoiret.xyz>
Subject: [bug#62307] [PATCH core-updates 01/15] gnu: glibc/fix-for-hurd-cross: Add new variant.
Date: Mon, 20 Mar 2023 23:10:36 +0100	[thread overview]
Message-ID: <6a027350c8639d0c52cdda781abb9f7d304f64ed.1679349992.git.dev@jpoiret.xyz> (raw)
In-Reply-To: <cover.1679349992.git.dev@jpoiret.xyz>

* gnu/packages/base.scm (glibc/fix-for-hurd-cross): New variable.
(glibc/hurd-headers): Inherit it.
* gnu/packages/patches/glibc-hurd-add-freestanding-for-configure.patch:
* gnu/packages/patches/glibc-hurd-add-freestanding-to-cppflags.patch: New files
* gnu/local.mk (dist_patch_DATA): Register patches.
---
 gnu/local.mk                                  |  2 +
 gnu/packages/base.scm                         | 13 ++-
 ...-hurd-add-freestanding-for-configure.patch | 87 +++++++++++++++++++
 ...bc-hurd-add-freestanding-to-cppflags.patch | 72 +++++++++++++++
 4 files changed, 173 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/glibc-hurd-add-freestanding-for-configure.patch
 create mode 100644 gnu/packages/patches/glibc-hurd-add-freestanding-to-cppflags.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c7a37814d9..0b2c8538c4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1226,6 +1226,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/glibc-cross-objdump.patch		\
   %D%/packages/patches/glibc-dl-cache.patch			\
   %D%/packages/patches/glibc-hidden-visibility-ldconfig.patch	\
+  %D%/packages/patches/glibc-hurd-add-freestanding-to-cppflags.patch \
+  %D%/packages/patches/glibc-hurd-add-freestanding-for-configure.patch \
   %D%/packages/patches/glibc-hurd-clock_gettime_monotonic.patch	\
   %D%/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch	\
   %D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch	\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 041f16b4fc..ffb3f8ac52 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1376,8 +1376,19 @@ (define-public which
 command.")
     (license gpl3+))) ; some files are under GPLv2+
 
+;; We need this for now because otherwise the configure phase fails.  This
+;; will be fixed with glibc 2.37.
+(define-public glibc/fix-for-hurd-cross
+  (package/inherit glibc
+    (source
+     (origin
+       (inherit (package-source glibc))
+       (patches (append (origin-patches (package-source glibc))
+                        (search-patches "glibc-hurd-add-freestanding-for-configure.patch"
+                                        "glibc-hurd-add-freestanding-to-cppflags.patch")))))))
+
 (define-public glibc/hurd-headers
-  (package (inherit glibc)
+  (package (inherit glibc/fix-for-hurd-cross)
     (name "glibc-hurd-headers")
     (outputs '("out"))
     (propagated-inputs (list gnumach-headers hurd-headers))
diff --git a/gnu/packages/patches/glibc-hurd-add-freestanding-for-configure.patch b/gnu/packages/patches/glibc-hurd-add-freestanding-for-configure.patch
new file mode 100644
index 0000000000..4b5346f012
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-add-freestanding-for-configure.patch
@@ -0,0 +1,87 @@
+From 8b8c768e3c701ed1993789bb46acb8a12c7a93df Mon Sep 17 00:00:00 2001
+From: Flavio Cruz <flaviocruz@gmail.com>
+Date: Sun, 18 Dec 2022 19:46:15 -0500
+Subject: [PATCH] Force use of -ffreestanding when checking for gnumach headers
+
+Without this ./configure assumes that we are in a fully hosted
+environment, which might not be the case. After this patch, we can rely on
+the freestanding header files provided by GCC such as stdint.h.
+Message-Id: <Y5+0V9osFc/zXMq0@mars>
+---
+ sysdeps/mach/configure    | 8 +++++++-
+ sysdeps/mach/configure.ac | 6 ++++++
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/sysdeps/mach/configure b/sysdeps/mach/configure
+index 739f1028a46..36f556a6639 100644
+--- a/sysdeps/mach/configure
++++ b/sysdeps/mach/configure
+@@ -133,6 +133,8 @@ if test -n "$sysheaders"; then
+ fi
+ 
+ ### Sanity checks for Mach header installation
++old_CFLAGS=$CFLAGS
++CFLAGS="$CFLAGS -ffreestanding"
+ 
+ 
+ ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.h" "ac_cv_header_mach_mach_types_h"
+@@ -143,6 +145,7 @@ else
+ fi
+ 
+ 
++CFLAGS=$old_CFLAGS
+ ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.defs" "ac_cv_header_mach_mach_types_defs"
+ if test "x$ac_cv_header_mach_mach_types_defs" = xyes; then :
+ 
+@@ -216,7 +219,9 @@ $as_echo_n "checking for creation_time in task_basic_info... " >&6; }
+ if ${libc_cv_mach_task_creation_time+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++  old_CFLAGS=$CFLAGS
++CFLAGS="$CFLAGS -ffreestanding"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <mach/task_info.h>
+ int
+@@ -242,6 +247,7 @@ $as_echo "$libc_cv_mach_task_creation_time" >&6; }
+ if test $libc_cv_mach_task_creation_time = no; then
+   as_fn_error $? "you need Mach headers supporting task_info.creation_time" "$LINENO" 5
+ fi
++CFLAGS=$old_CFLAGS
+ 
+ mach_interface_list=
+ for ifc in mach mach4 gnumach \
+diff --git a/sysdeps/mach/configure.ac b/sysdeps/mach/configure.ac
+index 61b00d66b10..5816c3d4ad4 100644
+--- a/sysdeps/mach/configure.ac
++++ b/sysdeps/mach/configure.ac
+@@ -12,8 +12,11 @@ if test -n "$sysheaders"; then
+ fi
+ 
+ ### Sanity checks for Mach header installation
++old_CFLAGS=$CFLAGS
++CFLAGS="$CFLAGS -ffreestanding"
+ AC_CHECK_HEADER(mach/mach_types.h,,
+                 [AC_MSG_ERROR([cannot find Mach headers])], -)
++CFLAGS=$old_CFLAGS
+ AC_CHECK_HEADER(mach/mach_types.defs,, [dnl
+ AC_MSG_ERROR([cannot find Mach .defs files])], -)
+ 
+@@ -42,6 +45,8 @@ dnl The creation_time field is a GNU Mach addition the other variants lack.
+ dnl
+ AC_CACHE_CHECK(for creation_time in task_basic_info,
+ 	       libc_cv_mach_task_creation_time, [dnl
++old_CFLAGS=$CFLAGS
++CFLAGS="$CFLAGS -ffreestanding"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mach/task_info.h>]], [[
+ extern struct task_basic_info *i;
+ long s = i->creation_time.seconds;
+@@ -49,6 +54,7 @@ long s = i->creation_time.seconds;
+ if test $libc_cv_mach_task_creation_time = no; then
+   AC_MSG_ERROR([you need Mach headers supporting task_info.creation_time])
+ fi
++CFLAGS=$old_CFLAGS
+ 
+ dnl
+ dnl The Darwin variant no longer has <mach/mach.defs>
diff --git a/gnu/packages/patches/glibc-hurd-add-freestanding-to-cppflags.patch b/gnu/packages/patches/glibc-hurd-add-freestanding-to-cppflags.patch
new file mode 100644
index 0000000000..14ed3f2a78
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-add-freestanding-to-cppflags.patch
@@ -0,0 +1,72 @@
+From 7685630b98ca2a3f5de86eadf130993e6cf998a0 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date: Mon, 19 Dec 2022 02:34:55 +0100
+Subject: [PATCH] mach: Fix passing -ffreestanding when checking for gnumach
+ headers
+
+8b8c768e3c70 ("Force use of -ffreestanding when checking for gnumach
+headers") was passing -ffreestanding to CFLAGS only, but headers checks are
+performed with the preprocessor, so we rather need to pass it to CPPFLAGS.
+---
+ sysdeps/mach/configure    | 9 +++------
+ sysdeps/mach/configure.ac | 9 +++------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/sysdeps/mach/configure b/sysdeps/mach/configure
+index 36f556a663..ba6371cd3f 100644
+--- a/sysdeps/mach/configure
++++ b/sysdeps/mach/configure
+@@ -127,14 +127,13 @@ fi
+ config_vars="$config_vars
+ MIG = $MIG"
+ 
++OLD_CPPFLAGS=$CPPFLAGS
+ if test -n "$sysheaders"; then
+-  OLD_CPPFLAGS=$CPPFLAGS
+   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
+ fi
+ 
+ ### Sanity checks for Mach header installation
+-old_CFLAGS=$CFLAGS
+-CFLAGS="$CFLAGS -ffreestanding"
++CPPFLAGS="$CPPFLAGS -ffreestanding"
+ 
+ 
+ ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.h" "ac_cv_header_mach_mach_types_h"
+@@ -527,6 +526,4 @@ if test $hurd_cv_mig_retcode = yes; then
+ 
+ fi
+ 
+-if test -n "$sysheaders"; then
+-  CPPFLAGS=$OLD_CPPFLAGS
+-fi
++CPPFLAGS=$OLD_CPPFLAGS
+diff --git a/sysdeps/mach/configure.ac b/sysdeps/mach/configure.ac
+index 5816c3d4ad..900e5445c5 100644
+--- a/sysdeps/mach/configure.ac
++++ b/sysdeps/mach/configure.ac
+@@ -6,14 +6,13 @@ if test "x$MIG" = xMISSING; then
+ fi
+ LIBC_CONFIG_VAR([MIG], [$MIG])
+ 
++OLD_CPPFLAGS=$CPPFLAGS
+ if test -n "$sysheaders"; then
+-  OLD_CPPFLAGS=$CPPFLAGS
+   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
+ fi
+ 
+ ### Sanity checks for Mach header installation
+-old_CFLAGS=$CFLAGS
+-CFLAGS="$CFLAGS -ffreestanding"
++CPPFLAGS="$CPPFLAGS -ffreestanding"
+ AC_CHECK_HEADER(mach/mach_types.h,,
+                 [AC_MSG_ERROR([cannot find Mach headers])], -)
+ CFLAGS=$old_CFLAGS
+@@ -136,6 +135,4 @@ fi])
+ 
+ hurd_MIG_RETCODE
+ 
+-if test -n "$sysheaders"; then
+-  CPPFLAGS=$OLD_CPPFLAGS
+-fi
++CPPFLAGS=$OLD_CPPFLAGS
-- 
2.39.2





  reply	other threads:[~2023-03-20 22:12 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 22:07 [bug#62307] [PATCH core-updates 00/15] Update Hurd and fix build failures Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` Josselin Poiret via Guix-patches via [this message]
2023-03-22 14:54   ` Ludovic Courtès
2023-03-28 14:28     ` [bug#62307] [PATCH core-updates v2 00/20] " Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 01/20] gnu: glibc: Work around broken GNU Mach header detection Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 02/20] gnu: cross-base: Use gexps for 'cross-gcc-arguments' Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 03/20] gnu: gcc@11: Patch libpthread on GNU/Hurd Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 04/20] gnu: cross-base: Factor out cross-mig Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 05/20] gnu: cross-base: Add cross arguments to hurd derivatives Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 06/20] gnu: cross-base: Removed useless inputs to xhurd-core-headers Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 07/20] gnu: mig: Update to 1.8+git20220827 Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 08/20] gnu: gnumach: " Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 09/20] gnu: hurd: Update to 3ff7053 Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 10/20] gnu: hurd: Remove useless glibc/hurd-headers input Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 11/20] gnu: gnumach, hurd-headers, hurd: Switch to using cross-mig Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 12/20] gnu: hurd: Update DDE and use libdde_linux26 Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 13/20] gnu: mig/32-bit: Remove Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 14/20] system: hurd: Use shepherd-0.8 in the package list Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 15/20] gnu: linux-pam: Switch to gexps Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 16/20] gnu: linux-pam: Allow compilation on GNU/Hurd Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 17/20] gnu: guile-static: Switch to gexps Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 18/20] gnu: guile: " Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 19/20] gnu: guile-readline: " Ludovic Courtès
2023-03-28 14:28       ` [bug#62307] [PATCH core-updates v2 20/20] gnu: guile: Fix 'posix_spawn' usage for GNU/Hurd Ludovic Courtès
2023-03-28 17:07       ` [bug#62307] [PATCH core-updates v2 00/20] Update Hurd and fix build failures Josselin Poiret via Guix-patches via
2023-03-30 10:48         ` bug#62307: " Ludovic Courtès
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 02/15] gnu-build-system: Sneak fixed glibc when cross-building for Hurd Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 03/15] gcc-11: Patch libstdc++ libpthread issue for Hurd only Josselin Poiret via Guix-patches via
2023-03-22 16:28   ` [bug#62307] [PATCH core-updates 00/15] Update Hurd and fix build failures Ludovic Courtès
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 04/15] cross-base: Factor out cross-mig Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 05/15] cross-base: Add cross arguments to hurd derivatives Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 06/15] cross-base: Removed useless inputs to xhurd-core-headers Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 07/15] mig: Update to 1.8+git20220827 Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 08/15] gnumach: " Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 09/15] hurd: Update to 91a51672ff4cfe1f1a0712b4c542ded3081c825b Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 10/15] hurd: Remove useless glibc/hurd-headers input Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 11/15] gnumach, hurd-headers, hurd: Switch to using cross-mig Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 11/15] gnumach, " Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 12/15] hurd: Update DDE and use libdde_linux26 Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 13/15] mig/32-bit: Remove Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 14/15] system: hurd: Use shepherd-0.8 in the package list Josselin Poiret via Guix-patches via
2023-03-20 22:10 ` [bug#62307] [PATCH core-updates 15/15] system: pam: Only add linux-pam reference if on Linux Josselin Poiret via Guix-patches via
2023-03-22 16:30   ` [bug#62307] [PATCH core-updates 00/15] Update Hurd and fix build failures Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a027350c8639d0c52cdda781abb9f7d304f64ed.1679349992.git.dev@jpoiret.xyz \
    --to=guix-patches@gnu.org \
    --cc=62307@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.