gccNGPackages: Force regular dirs (#427189)

Changed files
+463 -219
pkgs
build-support
cc-wrapper
development
+1 -6
pkgs/build-support/cc-wrapper/default.nix
···
''
# GCC NG friendly libc++
+ optionalString (libcxx != null && libcxx.isGNU or false) ''
-
for dir in ${getDev libcxx}/include/c++/*; do
-
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
-
done
-
for dir in ${getDev libcxx}/include/c++/*/${targetPlatform.config}; do
-
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
-
done
+
echo "-isystem ${getDev libcxx}/include" >> $out/nix-support/libcxx-cxxflags
''
##
-162
pkgs/development/compilers/gcc/ng/15/gcc/custom-threading-model.patch
···
-
From 46280d27a5c96b2efa7a61f49ee8dc14f7e10d0c Mon Sep 17 00:00:00 2001
-
From: John Ericson <git@JohnEricson.me>
-
Date: Sun, 22 Aug 2021 01:14:22 -0400
-
Subject: [PATCH] Factor out thread model detection with `GCC_AC_THREAD_MODEL`
-
MIME-Version: 1.0
-
Content-Type: text/plain; charset=UTF-8
-
Content-Transfer-Encoding: 8bit
-
-
This macro deduplicates the
-
-
$CC -v 2>&1 | sed -n 's/^Thread model: //p'
-
-
check that was occurring in various runtime libs.
-
-
Additionally, as a bit of an Easter egg, this also allows overriding
-
what the compiler would return by setting the
-
`gcc_cv_target_thread_file` cache variable first. I admit that it is in
-
fact this Easter egg that led me to write the patch. The use-case for it
-
is for making multilib builds where the library sets do not all share
-
the same thread model easier. See also `THREAD_MODEL_SPEC` for more
-
about the varying thread models use-case.
-
-
Arguably one could could try to define on `THREAD_MODEL_SPEC` on more
-
platforms (besides e.g. AIX) but the ramifications of this are a bit
-
unclear. Setting `gcc_cv_target_thread_file` directly is a "low tech"
-
solution that will work for now for sure. Of course, since setting a
-
cache variable like this a hacky trick, I will not expect this to be at
-
all stable/guaranteed to work, going forward.
-
-
Thanks to Arsen who on IRC discussed these things with me, including in
-
particular making it a cache var not `--with-model` flag, to not
-
prematurely foster expectations that this is stable.
-
-
Suggested-by: Arsen Arsenović <arsen@aarsen.me>
-
---
-
config/gthr.m4 | 23 +++++++++++++++++++++++
-
libatomic/configure.ac | 4 +---
-
libgcc/configure.ac | 4 +---
-
libphobos/m4/druntime/os.m4 | 2 +-
-
libstdc++-v3/acinclude.m4 | 8 +++-----
-
5 files changed, 29 insertions(+), 12 deletions(-)
-
-
diff --git a/config/gthr.m4 b/config/gthr.m4
-
index 11996247f15..e8fac4a5721 100644
-
--- a/config/gthr.m4
-
+++ b/config/gthr.m4
-
@@ -5,6 +5,26 @@ dnl Public License, this file may be distributed as part of a program
-
dnl that contains a configuration script generated by Autoconf, under
-
dnl the same distribution terms as the rest of that program.
-
-
+dnl Define thread model
-
+
-
+dnl usage: GCC_AC_THREAD_MODEL
-
+AC_DEFUN([GCC_AC_THREAD_MODEL],
-
+[
-
+# Specify the threading model for this GCC runtime library
-
+# Pass with no value to take from compiler's metadata
-
+# Pass with a value to specify a thread package
-
+# 'single' means single threaded -- without threads.
-
+AC_CACHE_CHECK([for the threading model used by GCC], [gcc_cv_target_thread_file], [
-
+ # Set new cache variable
-
+ gcc_cv_target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
-
+])
-
+# Set variable name (not prefixed enough to be a good cache variable
-
+# name) traditionally used for this purpose, to avoid having to change
-
+# a bunch of configure scripts.
-
+target_thread_file="$gcc_cv_target_thread_file"
-
+])
-
+
-
+
-
dnl Define header location by thread model
-
-
dnl usage: GCC_AC_THREAD_HEADER([thread_model])
-
@@ -23,6 +43,9 @@ case $1 in
-
vxworks) thread_header=config/gthr-vxworks.h ;;
-
win32) thread_header=config/i386/gthr-win32.h ;;
-
mcf) thread_header=config/i386/gthr-mcf.h ;;
-
+ *)
-
+ AC_MSG_ERROR([No known header for threading model '$1'.])
-
+ ;;
-
esac
-
AC_SUBST(thread_header)
-
])
-
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
-
index aafae71028d..a1aa3bdf69f 100644
-
--- a/libatomic/configure.ac
-
+++ b/libatomic/configure.ac
-
@@ -162,9 +162,7 @@ libtool_VERSION=3:0:2
-
AC_SUBST(libtool_VERSION)
-
-
# Check for used threading-model
-
-AC_MSG_CHECKING([for thread model used by GCC])
-
-target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
-
-AC_MSG_RESULT([$target_thread_file])
-
+GCC_AC_THREAD_MODEL
-
-
case "$target" in
-
*aarch64*)
-
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
-
index 85e4f1bc48b..d44493f9653 100644
-
--- a/libgcc/configure.ac
-
+++ b/libgcc/configure.ac
-
@@ -305,9 +305,7 @@ AC_SUBST([use_tm_clone_registry])
-
-
AC_LIB_PROG_LD_GNU
-
-
-AC_MSG_CHECKING([for thread model used by GCC])
-
-target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
-
-AC_MSG_RESULT([$target_thread_file])
-
+GCC_AC_THREAD_MODEL
-
-
# Check for assembler CFI support.
-
AC_CACHE_CHECK([whether assembler supports CFI directives], [libgcc_cv_cfi],
-
diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4
-
index ef8ca434407..7bb91362dbe 100644
-
--- a/libphobos/m4/druntime/os.m4
-
+++ b/libphobos/m4/druntime/os.m4
-
@@ -32,7 +32,7 @@ case $1 in
-
# TODO: These targets need porting.
-
dce|mipssde|rtems|tpf|vxworks)
-
DCFG_THREAD_MODEL="Single" ;;
-
- *) as_fn_error "Thread implementation '$1' not recognised" "$LINENO" 5 ;;
-
+ *) AC_MSG_ERROR([Thread implementation '$1' not recognised]) ;;
-
esac
-
AC_SUBST(DCFG_THREAD_MODEL)
-
])
-
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
-
index a0094c2dd95..66fc3abe4fd 100644
-
--- a/libstdc++-v3/acinclude.m4
-
+++ b/libstdc++-v3/acinclude.m4
-
@@ -4345,9 +4345,7 @@ dnl Substs:
-
dnl thread_header
-
dnl
-
AC_DEFUN([GLIBCXX_ENABLE_THREADS], [
-
- AC_MSG_CHECKING([for thread model used by GCC])
-
- target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
-
- AC_MSG_RESULT([$target_thread_file])
-
+ GCC_AC_THREAD_MODEL
-
GCC_AC_THREAD_HEADER([$target_thread_file])
-
])
-
-
@@ -4357,7 +4355,8 @@ dnl Check if gthread implementation defines the types and functions
-
dnl required by the c++0x thread library. Conforming gthread
-
dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
-
dnl
-
-dnl GLIBCXX_ENABLE_SYMVERS must be done before this.
-
+dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_ENABLE_THREADS must be done
-
+dnl before this.
-
dnl
-
AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
-
GLIBCXX_ENABLE(libstdcxx-threads,auto,,[enable C++11 threads support])
-
@@ -4372,7 +4371,6 @@ AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
-
CXXFLAGS="$CXXFLAGS -fno-exceptions \
-
-I${toplevel_srcdir}/libgcc -I${toplevel_builddir}/libgcc"
-
-
- target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
-
case $target_thread_file in
-
posix)
-
CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS"
-
--
-
2.47.2
-
+49
pkgs/development/compilers/gcc/ng/15/libgcc/force-regular-dirs.patch
···
+
From bb3277895d3bd77bcacb7c489ebb1390478bbc12 Mon Sep 17 00:00:00 2001
+
From: John Ericson <John.Ericson@Obsidian.Systems>
+
Date: Thu, 17 Jul 2025 11:00:07 -0400
+
Subject: [PATCH 2/2] Force regular dirs
+
+
Override directories in libgcc so they are normal $out/lib and
+
$dev/include. This is not suitable for upstreaming, but is done on top
+
of a different patch which is, and which makes this smaller.
+
+
---
+
libgcc/Makefile.in | 6 +++---
+
libgcc/configure.ac | 3 ---
+
2 files changed, 3 insertions(+), 6 deletions(-)
+
+
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
+
index 4661c36703d..986cd035148 100644
+
--- a/libgcc/Makefile.in
+
+++ b/libgcc/Makefile.in
+
@@ -202,10 +202,10 @@ STRIP = @STRIP@
+
STRIP_FOR_TARGET = $(STRIP)
+
+
# Used to install the shared libgcc.
+
-slibdir = @slibdir@
+
+slibdir = $(libdir)
+
# Maybe used for DLLs on Windows targets.
+
-toolexecdir = @toolexecdir@
+
-toolexeclibdir = @toolexeclibdir@
+
+toolexecdir = $(bindir)
+
+toolexeclibdir = $(libdir)
+
+
export AR_FOR_TARGET
+
export AR_CREATE_FOR_TARGET
+
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
+
index 5fdac5d95f2..89044cb65c9 100644
+
--- a/libgcc/configure.ac
+
+++ b/libgcc/configure.ac
+
@@ -479,9 +479,6 @@ if test x"$enable_as_accelerator_for" != x; then
+
accel_dir_suffix=/accel/${target_noncanonical}
+
real_host_noncanonical=${enable_as_accelerator_for}
+
fi
+
-# Directory in which the compiler finds libraries etc.
+
-libdir=${orig_libdir}/gcc/${real_host_noncanonical}/'$(version)'${accel_dir_suffix}
+
-includedir=${libdir}/include
+
+
if test x"$enable_offload_targets" != x; then
+
extra_parts="${extra_parts} crtoffloadbegin.o crtoffloadend.o"
+
--
+
2.47.2
+
+53
pkgs/development/compilers/gcc/ng/15/libgfortran/force-regular-dirs.patch
···
+
From 7a0c8ca8872a73c6886940448ba9b3203b13268d Mon Sep 17 00:00:00 2001
+
From: John Ericson <git@JohnEricson.me>
+
Date: Mon, 21 Jul 2025 11:42:13 -0400
+
Subject: [PATCH] libgfortran: Force regular include/lib dir
+
+
---
+
libgfortran/Makefile.am | 13 +++++--------
+
1 file changed, 5 insertions(+), 8 deletions(-)
+
+
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
+
index 21b35c76a06..3d38cde5b42 100644
+
--- a/libgfortran/Makefile.am
+
+++ b/libgfortran/Makefile.am
+
@@ -42,14 +42,13 @@ extra_darwin_ldflags_libgfortran += -Wc,-nodefaultrpaths
+
extra_darwin_ldflags_libgfortran += -Wl,-rpath,@loader_path
+
endif
+
+
-gfor_c_HEADERS = ISO_Fortran_binding.h
+
-gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+
+include_HEADERS = ISO_Fortran_binding.h
+
+
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
+
$(lt_host_flags)
+
+
-toolexeclib_LTLIBRARIES = libgfortran.la
+
-toolexeclib_DATA = libgfortran.spec
+
+lib_LTLIBRARIES = libgfortran.la
+
+toolexeclib_DATA = libgfortran.spec # needs "exec" in name
+
libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
+
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
+
@@ -58,16 +57,14 @@ libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+
$(version_arg) -Wc,-shared-libgcc
+
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
+
+
-cafexeclib_LTLIBRARIES = libcaf_single.la
+
-cafexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
+
+lib_LTLIBRARIES += libcaf_single.la
+
libcaf_single_la_SOURCES = caf/single.c
+
libcaf_single_la_LDFLAGS = -static
+
libcaf_single_la_DEPENDENCIES = caf/libcaf.h
+
libcaf_single_la_LINK = $(LINK) $(libcaf_single_la_LDFLAGS)
+
+
if IEEE_SUPPORT
+
-fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)/finclude
+
-nodist_finclude_HEADERS = ieee_arithmetic.mod ieee_exceptions.mod ieee_features.mod
+
+nodist_include_HEADERS = ieee_arithmetic.mod ieee_exceptions.mod ieee_features.mod
+
endif
+
+
## io.h conflicts with a system header on some platforms, so
+
--
+
2.47.2
+
+30
pkgs/development/compilers/gcc/ng/15/libssp/force-regular-dirs.patch
···
+
From e7dac0e90f3e4363d858a6f147d7cc4f62815dd6 Mon Sep 17 00:00:00 2001
+
From: John Ericson <John.Ericson@Obsidian.Systems>
+
Date: Fri, 18 Jul 2025 16:54:17 -0400
+
Subject: [PATCH 3/3] Force regular dirs
+
+
Override directories in libssp so they are normal $out/lib and
+
$dev/include. This is not suitable for upstreaming, but is done on top
+
of a different patch which is, and which makes this smaller.
+
---
+
libssp/configure.ac | 4 ----
+
1 file changed, 4 deletions(-)
+
+
diff --git a/libssp/configure.ac b/libssp/configure.ac
+
index 5b9fa4fbecc..f1723dc33ce 100644
+
--- a/libssp/configure.ac
+
+++ b/libssp/configure.ac
+
@@ -207,10 +207,6 @@ esac
+
AC_SUBST(toolexecdir)
+
AC_SUBST(toolexeclibdir)
+
+
-# Directory in which the compiler finds libraries etc.
+
-libdir='$(toolexeclibdir)'
+
-includedir=${orig_libdir}/gcc/${host_noncanonical}/'$(version)/include'
+
-
+
if test ${multilib} = yes; then
+
multilib_arg="--enable-multilib"
+
else
+
--
+
2.47.2
+
+120
pkgs/development/compilers/gcc/ng/15/libstdcxx/force-regular-dirs.patch
···
+
From db427c55334dd2edc11397d3a92d55dc9c06d1c3 Mon Sep 17 00:00:00 2001
+
From: John Ericson <git@JohnEricson.me>
+
Date: Sun, 20 Jul 2025 14:20:00 -0400
+
Subject: [PATCH] libstdc++: Force regular include/lib dir
+
+
Delete a bunch of unneeded logic to do this.
+
---
+
libstdc++-v3/acinclude.m4 | 80 ++------------------------------
+
libstdc++-v3/include/Makefile.am | 2 +-
+
2 files changed, 4 insertions(+), 78 deletions(-)
+
+
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
+
index a0094c2dd95..a0718dff394 100644
+
--- a/libstdc++-v3/acinclude.m4
+
+++ b/libstdc++-v3/acinclude.m4
+
@@ -727,85 +727,11 @@ dnl
+
dnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir.
+
dnl config/gxx-include-dir.m4 must be kept consistant with this as well.
+
AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
+
- glibcxx_toolexecdir=no
+
- glibcxx_toolexeclibdir=no
+
+ glibcxx_toolexecdir='$(libdir)'
+
+ glibcxx_toolexeclibdir='$(libdir)'
+
+ gxx_include_dir='$(includedir)'
+
glibcxx_prefixdir=$prefix
+
+
- AC_MSG_CHECKING([for gxx-include-dir])
+
- AC_ARG_WITH([gxx-include-dir],
+
- AC_HELP_STRING([--with-gxx-include-dir=DIR],
+
- [installation directory for include files]),
+
- [case "$withval" in
+
- yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
+
- no) gxx_include_dir=no ;;
+
- *) gxx_include_dir=$withval ;;
+
- esac],
+
- [gxx_include_dir=no])
+
- AC_MSG_RESULT($gxx_include_dir)
+
-
+
- AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+
- AC_ARG_ENABLE([version-specific-runtime-libs],
+
- AC_HELP_STRING([--enable-version-specific-runtime-libs],
+
- [Specify that runtime libraries should be installed in a compiler-specific directory]),
+
- [case "$enableval" in
+
- yes) version_specific_libs=yes ;;
+
- no) version_specific_libs=no ;;
+
- *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
+
- esac],
+
- [version_specific_libs=no])
+
- AC_MSG_RESULT($version_specific_libs)
+
-
+
- GCC_WITH_TOOLEXECLIBDIR
+
-
+
- # Default case for install directory for include files.
+
- if test $version_specific_libs = no && test $gxx_include_dir = no; then
+
- gxx_include_dir='include/c++/${gcc_version}'
+
- if test -n "$with_cross_host" &&
+
- test x"$with_cross_host" != x"no"; then
+
- gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir"
+
- else
+
- gxx_include_dir='${prefix}/'"$gxx_include_dir"
+
- fi
+
- fi
+
-
+
- # Version-specific runtime libs processing.
+
- if test $version_specific_libs = yes; then
+
- # Need the gcc compiler version to know where to install libraries
+
- # and header files if --enable-version-specific-runtime-libs option
+
- # is selected. FIXME: these variables are misnamed, there are
+
- # no executables installed in _toolexecdir or _toolexeclibdir.
+
- if test x"$gxx_include_dir" = x"no"; then
+
- gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++'
+
- fi
+
- glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
+
- glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)'
+
- fi
+
-
+
- # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
+
- # Install a library built with a cross compiler in tooldir, not libdir.
+
- if test x"$glibcxx_toolexecdir" = x"no"; then
+
- if test -n "$with_cross_host" &&
+
- test x"$with_cross_host" != x"no"; then
+
- glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
+
- case ${with_toolexeclibdir} in
+
- no)
+
- glibcxx_toolexeclibdir='${toolexecdir}/lib'
+
- ;;
+
- *)
+
- glibcxx_toolexeclibdir=${with_toolexeclibdir}
+
- ;;
+
- esac
+
- else
+
- glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
+
- glibcxx_toolexeclibdir='${libdir}'
+
- fi
+
- multi_os_directory=`$CXX -print-multi-os-directory`
+
- case $multi_os_directory in
+
- .) ;; # Avoid trailing /.
+
- *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
+
- esac
+
- fi
+
-
+
AC_MSG_CHECKING([for install location])
+
AC_MSG_RESULT($gxx_include_dir)
+
+
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
+
index 537774c2668..c0bfeb43b44 100644
+
--- a/libstdc++-v3/include/Makefile.am
+
+++ b/libstdc++-v3/include/Makefile.am
+
@@ -1048,7 +1048,7 @@ endif
+
+
host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
+
host_builddir = ./${host_alias}/bits
+
-host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits
+
+host_installdir = ${gxx_include_dir}/bits
+
host_headers = \
+
${host_srcdir}/ctype_base.h \
+
${host_srcdir}/ctype_inline.h \
+
--
+
2.47.2
+
+55 -9
pkgs/development/compilers/gcc/ng/common/libatomic/default.nix
···
release_version,
version,
getVersionFile,
+
monorepoSrc ? null,
+
fetchpatch,
autoreconfHook269,
-
monorepoSrc ? null,
runCommand,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libatomic";
inherit version;
-
src = monorepoSrc;
+
src = runCommand "libatomic-src-${version}" { src = monorepoSrc; } ''
+
runPhase unpackPhase
+
+
mkdir -p "$out/gcc"
+
cp gcc/BASE-VER "$out/gcc"
+
cp gcc/DATESTAMP "$out/gcc"
+
+
cp -r libatomic "$out"
+
+
cp -r config "$out"
+
cp -r multilib.am "$out"
+
cp -r libtool.m4 "$out"
+
+
cp config.guess "$out"
+
cp config.rpath "$out"
+
cp config.sub "$out"
+
cp config-ml.in "$out"
+
cp ltmain.sh "$out"
+
cp install-sh "$out"
+
cp mkinstalldirs "$out"
+
+
[[ -f MD5SUMS ]]; cp MD5SUMS "$out"
+
'';
patches = [
-
(getVersionFile "gcc/custom-threading-model.patch")
+
(fetchpatch {
+
name = "custom-threading-model.patch";
+
url = "https://inbox.sourceware.org/gcc-patches/20250716204545.1063669-1-git@JohnEricson.me/raw";
+
hash = "sha256-kxNntY2r4i/+XHQSpf9bYV2Jg+FD/pD5TiMn5hd4ckk=";
+
includes = [
+
"config/*"
+
"libatomic/*"
+
];
+
})
];
+
postUnpack = ''
+
mkdir -p ./build
+
buildRoot=$(readlink -e "./build")
+
'';
+
+
preAutoreconf = ''
+
sourceRoot=$(readlink -e "./libatomic")
+
cd $sourceRoot
+
'';
+
enableParallelBuilding = true;
nativeBuildInputs = [
autoreconfHook269
];
-
postPatch = ''
-
sourceRoot=$(readlink -e "./libatomic")
-
'';
+
configurePlatforms = [
+
"build"
+
"host"
+
];
+
+
configureFlags = [
+
"--disable-dependency-tracking"
+
"cross_compiling=true"
+
"--disable-multilib"
+
];
preConfigure = ''
-
mkdir ../build
-
cd ../build
+
cd "$buildRoot"
configureScript=$sourceRoot/configure
-
chmod +x "$configureScript"
'';
doCheck = true;
+28 -7
pkgs/development/compilers/gcc/ng/common/libgcc/default.nix
···
version,
getVersionFile,
monorepoSrc ? null,
+
fetchpatch,
autoreconfHook269,
buildGccPackages,
buildPackages,
···
];
patches = [
-
(getVersionFile "gcc/custom-threading-model.patch")
+
(fetchpatch {
+
name = "delete-MACHMODE_H.patch";
+
url = "https://github.com/gcc-mirror/gcc/commit/493aae4b034d62054d5e7e54dc06cd9a8be54e29.diff";
+
hash = "sha256-oEk0lnI96RlpALWpb7J+GnrtgQsFVqDO57I/zjiqqTk=";
+
})
+
(fetchpatch {
+
name = "custom-threading-model.patch";
+
url = "https://inbox.sourceware.org/gcc-patches/20250716204545.1063669-1-git@JohnEricson.me/raw";
+
hash = "sha256-NgiC4cFeFInXXg27me1XpSeImPaL0WHs50Tf1YHz4ps=";
+
})
+
(fetchpatch {
+
name = "libgcc.mvars-less-0.patch";
+
url = "https://inbox.sourceware.org/gcc-patches/20250716234028.1153560-1-John.Ericson@Obsidian.Systems/raw";
+
hash = "sha256-NEcieDCsy+7IRU3qQKVD3i57OuwGZKB/rmNF8X2I1n0=";
+
})
+
(fetchpatch {
+
name = "libgcc.mvars-less-1.patch";
+
url = "https://inbox.sourceware.org/gcc-patches/20250716234028.1153560-2-John.Ericson@Obsidian.Systems/raw";
+
hash = "sha256-nfRC4f6m3kHDro4+6E4y1ZPs+prxBQmn0H2rzIjaMWM=";
+
})
+
(fetchpatch {
+
name = "regular-libdir-includedir.patch";
+
url = "https://inbox.sourceware.org/gcc-patches/20250717174911.1536129-1-git@JohnEricson.me/raw";
+
hash = "sha256-Cn7rvg1FI7H/26GzSe4pv5VW/gvwbwGqivAqEeawkwk=";
+
})
+
(getVersionFile "libgcc/force-regular-dirs.patch")
];
autoreconfFlags = "--install --force --verbose . libgcc";
···
tm.h \
options.h \
insn-constants.h \
-
insn-modes.h \
version.h
)
mkdir -p "$buildRoot/gcc/include"
···
makeFlags = [ "MULTIBUILDTOP:=../" ];
postInstall = ''
-
cp gthr-default.h "$out/lib/gcc/${stdenv.hostPlatform.config}/${version}/include"
-
moveToOutput "lib/gcc/${stdenv.hostPlatform.config}/${version}/include" "$dev"
-
mkdir -p "$out/lib" "$dev/include"
-
ln -s "$out/lib/gcc/${stdenv.hostPlatform.config}/${version}"/* "$out/lib"
-
ln -s "$dev/lib/gcc/${stdenv.hostPlatform.config}/${version}/include"/* "$dev/include/"
+
install -c -m 644 gthr-default.h "$dev/include"
'';
doCheck = true;
+7 -8
pkgs/development/compilers/gcc/ng/common/libgfortran/default.nix
···
gcc_meta,
release_version,
version,
+
getVersionFile,
monorepoSrc ? null,
-
buildPackages,
autoreconfHook269,
libiberty,
+
buildPackages,
libgcc,
libbacktrace,
}:
···
autoreconfHook269
libiberty
gfortran
+
];
+
+
patches = [
+
(getVersionFile "libgfortran/force-regular-dirs.patch")
];
autoreconfFlags = "--install --force --verbose . libgfortran";
···
"gcc_cv_target_thread_file=single"
# $CC cannot link binaries, let alone run then
"cross_compiling=true"
+
"--with-toolexeclibdir=${builtins.placeholder "dev"}/lib"
];
# Set the variable back the way it was, see corresponding code in
···
'';
makeFlags = [ "MULTIBUILDTOP:=../" ];
-
-
postInstall = ''
-
moveToOutput "lib/gcc/${stdenv.hostPlatform.config}/${version}/include" "$dev"
-
mkdir -p "$out/lib" "$dev/include"
-
ln -s "$out/lib/gcc/${stdenv.hostPlatform.config}/${version}"/* "$out/lib"
-
ln -s "$dev/lib/gcc/${stdenv.hostPlatform.config}/${version}/include"/* "$dev/include/"
-
'';
doCheck = true;
+38 -5
pkgs/development/compilers/gcc/ng/common/libssp/default.nix
···
gcc_meta,
release_version,
version,
+
getVersionFile,
monorepoSrc ? null,
+
fetchpatch,
+
autoreconfHook269,
runCommand,
}:
stdenv.mkDerivation (finalAttrs: {
···
cp gcc/DATESTAMP "$out/gcc"
cp -r libssp "$out"
+
+
cp -r config "$out"
+
cp -r multilib.am "$out"
cp config.guess "$out"
cp config.rpath "$out"
···
[[ -f MD5SUMS ]]; cp MD5SUMS "$out"
'';
-
sourceRoot = "${finalAttrs.src.name}/libssp";
+
outputs = [
+
"out"
+
"dev"
+
];
+
+
patches = [
+
(fetchpatch {
+
name = "regular-libdir-includedir.patch";
+
url = "https://inbox.sourceware.org/gcc-patches/20250720172933.2404828-1-git@JohnEricson.me/raw";
+
hash = "sha256-W7dcy1Tm3O2reK7kx83DRv8W97qUfaqDbKLiLXIegRw=";
+
})
+
(getVersionFile "libssp/force-regular-dirs.patch")
+
];
+
+
postUnpack = ''
+
mkdir -p ./build
+
buildRoot=$(readlink -e "./build")
+
'';
+
+
preAutoreconf = ''
+
sourceRoot=$(readlink -e "./libssp")
+
cd $sourceRoot
+
'';
+
+
enableParallelBuilding = true;
+
+
nativeBuildInputs = [
+
autoreconfHook269
+
];
configurePlatforms = [
"build"
"host"
];
+
configureFlags = [
"--disable-dependency-tracking"
-
"--with-toolexeclibdir=${builtins.placeholder "out" + "/lib"}"
"cross_compiling=true"
"--disable-multilib"
];
preConfigure = ''
-
mkdir ../../build
-
cd ../../build
-
configureScript=../$sourceRoot/configure
+
cd "$buildRoot"
+
configureScript=$sourceRoot/configure
'';
hardeningDisable = [
+59 -19
pkgs/development/compilers/gcc/ng/common/libstdcxx/default.nix
···
version,
getVersionFile,
monorepoSrc ? null,
+
fetchpatch,
+
autoreconfHook269,
runCommand,
-
autoreconfHook269,
gettext,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libstdcxx";
inherit version;
-
src = monorepoSrc;
+
src = runCommand "libstdcxx-src-${version}" { src = monorepoSrc; } ''
+
runPhase unpackPhase
+
+
mkdir -p "$out/gcc"
+
cp gcc/BASE-VER "$out/gcc"
+
cp gcc/DATESTAMP "$out/gcc"
+
+
mkdir -p "$out/libgcc"
+
cp libgcc/gthr*.h "$out/libgcc"
+
cp libgcc/unwind-pe.h "$out/libgcc"
+
+
cp -r libstdc++-v3 "$out"
+
+
cp -r libiberty "$out"
+
cp -r include "$out"
+
cp -r contrib "$out"
+
+
cp -r config "$out"
+
cp -r multilib.am "$out"
+
+
cp config.guess "$out"
+
cp config.rpath "$out"
+
cp config.sub "$out"
+
cp config-ml.in "$out"
+
cp ltmain.sh "$out"
+
cp install-sh "$out"
+
cp mkinstalldirs "$out"
-
enableParallelBuilding = true;
+
[[ -f MD5SUMS ]]; cp MD5SUMS "$out"
+
'';
-
nativeBuildInputs = [
-
autoreconfHook269
-
gettext
+
outputs = [
+
"out"
+
"dev"
];
patches = [
-
(getVersionFile "gcc/custom-threading-model.patch")
+
(fetchpatch {
+
name = "custom-threading-model.patch";
+
url = "https://inbox.sourceware.org/gcc-patches/20250716204545.1063669-1-git@JohnEricson.me/raw";
+
hash = "sha256-jPP0+MoPLtCwWcW6doO6KHCppwAYK40qNVyriLXcGOg=";
+
includes = [
+
"config/*"
+
"libstdc++-v3/*"
+
];
+
})
+
(getVersionFile "libstdcxx/force-regular-dirs.patch")
];
postUnpack = ''
···
cd $sourceRoot
'';
-
postPatch = ''
-
sed -i \
-
-e 's/AM_ENABLE_MULTILIB(/AM_ENABLE_MULTILIB(NOPE/' \
-
-e 's#glibcxx_toolexeclibdir=no#glibcxx_toolexeclibdir=${builtins.placeholder "out"}/libexec#' \
-
configure.ac
-
'';
+
enableParallelBuilding = true;
+
+
nativeBuildInputs = [
+
autoreconfHook269
+
gettext
+
];
preConfigure = ''
cd "$buildRoot"
···
chmod +x "$configureScript"
'';
+
configurePlatforms = [
+
"build"
+
"host"
+
];
+
configureFlags = [
"--disable-dependency-tracking"
-
"--with-toolexeclibdir=${builtins.placeholder "out"}/lib"
"gcc_cv_target_thread_file=posix"
"cross_compiling=true"
"--disable-multilib"
···
"--with-default-libstdcxx-abi=new"
];
-
outputs = [
-
"out"
-
"dev"
-
];
-
hardeningDisable = [
# PATH_MAX
"fortify"
];
+
+
postInstall = ''
+
moveToOutput lib/libstdc++.modules.json "$dev"
+
'';
doCheck = true;
+23 -3
pkgs/development/compilers/gcc/ng/common/patches.nix
···
}
];
-
# Submitted: https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689429.html
-
# In Git: https://github.com/Ericson2314/gcc/tree/libgcc-custom-threading-model-15
-
"gcc/custom-threading-model.patch" = [
+
# In Git: https://github.com/Ericson2314/gcc/tree/regular-dirs-in-libgcc-15
+
"libgcc/force-regular-dirs.patch" = [
+
{
+
after = "15";
+
path = ../15;
+
}
+
];
+
# In Git: https://github.com/Ericson2314/gcc/tree/regular-dirs-in-libssp-15
+
"libssp/force-regular-dirs.patch" = [
+
{
+
after = "15";
+
path = ../15;
+
}
+
];
+
# In Git: https://github.com/Ericson2314/gcc/tree/libstdcxx-force-regular-dirs-15
+
"libstdcxx/force-regular-dirs.patch" = [
+
{
+
after = "15";
+
path = ../15;
+
}
+
];
+
# In Git: https://github.com/Ericson2314/gcc/tree/libgfortran-force-regular-dirs-15
+
"libgfortran/force-regular-dirs.patch" = [
{
after = "15";
path = ../15;