From 38f08e51226a30e669ad614a36e514560babd550 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 15 Dec 2022 18:19:58 -0500 Subject: [PATCH] 11.3.1-4.1 Work around --with-gxx-include-dir Resolves: #2149650 --- gcc.spec | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gcc.spec b/gcc.spec index 6813bb4..49b1e69 100644 --- a/gcc.spec +++ b/gcc.spec @@ -1501,6 +1501,18 @@ for crossarch in %{cross_targets}; do # Temporarily replace DEV-PHASE. cp -p ../../gcc/DEV-PHASE{.cross,} + # --with-gxx-include-dir= doesn't prefix its argument with $(DESTDIR) + # and you can't install things into /usr unless you're root. + mkdir scratch + scratchdir=`pwd`/scratch + cd $crossarch/libstdc++-v3 + for i in `find . -name Makefile`; do + cp -a $i $i.save + sed -i -e 's?^gxx_include_dir = .*$?gxx_include_dir = '$scratchdir'?' $i + touch -r $i.save $i + done + cd ../.. + # Use -j1, because build-many-glibcs says: # Parallel "make install" for GCC has race conditions that can # cause it to fail; see @@ -1518,6 +1530,15 @@ for crossarch in %{cross_targets}; do # Restore DEV-PHASE. cp -p ../../gcc/DEV-PHASE{.native,} + # Restore Makefiles with the old gxx_include_dir. + cd $crossarch/libstdc++-v3 + for i in `find . -name Makefile`; do + mv -f $i.save $i + done + cd ../.. + # We're not shipping C++ headers; nuke 'em. + rm -rf $scratchdir + # Move libgomp.spec to where it belongs for %files. mv $crossarch/libgomp/libgomp.spec $CROSS_LIBPATH