Skip to content

Commit 29cb0bf

Browse files
committed
New gcc-11.4.0 patches; build on Ventura without libsanitizer
1 parent c47a560 commit 29cb0bf

File tree

3 files changed

+1202
-4823
lines changed

3 files changed

+1202
-4823
lines changed
Lines changed: 314 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,314 @@
1+
Info2: <<
2+
Package: gcc11
3+
Version: 11.4.0
4+
Revision: 2
5+
Type: gccver (11)
6+
Distribution: 13.0
7+
Source: mirror:gnu:gcc/gcc-%v/gcc-%v.tar.xz
8+
Source-Checksum: SHA256(3f2db222b007e8a4a23cd5ba56726ef08e8b1f1eb2055ee72c1402cea73a8dd9)
9+
PatchFile: %n-arm.patch
10+
PatchFile-MD5: 5114fba28067ab381fe923c92db9dc38
11+
PatchScript: <<
12+
#!/bin/sh -ev
13+
patch -p1 < %{PatchFile}
14+
# don't update live infodoc dir
15+
find . -name Makefile.in | xargs perl -pi -e 's/install-info --version/false/g'
16+
<<
17+
NoSetCPPFLAGS: True
18+
NoSetLDFLAGS: True
19+
UseMaxBuildJobs: True
20+
Conflicts: <<
21+
gcc5, gcc6, gcc7, gcc8,
22+
gcc9,
23+
gcc10,
24+
gcc11,
25+
gcc12,
26+
gcc13
27+
<<
28+
Replaces: <<
29+
gcc5, gcc6, gcc7, gcc8,
30+
gcc9,
31+
gcc10,
32+
gcc11,
33+
gcc12,
34+
gcc13
35+
<<
36+
Depends: <<
37+
%N-compiler (= %v-%r)
38+
<<
39+
BuildDepends: <<
40+
fink (>= 0.32),
41+
fink-package-precedence,
42+
gettext-tools,
43+
gmp5 (>= 6.0.0a-3),
44+
install-info,
45+
isl22,
46+
libgettext8-dev,
47+
libiconv-dev,
48+
libmpc3 (>= 1.0.3-1),
49+
libmpfr6,
50+
x11-dev
51+
<<
52+
ConfigureParams: <<
53+
--prefix=%p/lib/gcc%type_num[gccver] \
54+
--mandir=%p/share/man \
55+
--infodir=%p/lib/gcc%type_num[gccver]/info \
56+
--enable-languages=c,c++,fortran,lto,objc,obj-c++ \
57+
--with-gmp=%p \
58+
--with-libiconv-prefix=%p \
59+
--with-isl=%p \
60+
--with-mpc=%p \
61+
--with-system-zlib \
62+
--program-suffix=-fsf-%type_num[gccver] \
63+
--disable-multilib \
64+
--enable-stage1-checking \
65+
${USE_SYSROOT} \
66+
--with-pkgversion="Fink %n %v-%r" \
67+
--with-bugurl="https://github.com/fink/fink-distributions/issues"
68+
<<
69+
InfoTest: <<
70+
TestDepends: <<
71+
autogen,
72+
dejagnu,
73+
( "%m" != "arm64" ) apple-gdb
74+
<<
75+
TestScript: <<
76+
#!/bin/bash -ev
77+
if [ "%m" = "arm64" ]; then
78+
echo "The gcc testsuite requires Apple's gdb, which is not available on this architecture."
79+
exit 0
80+
elif [ $UID = 0 ]; then
81+
if [ -e /usr/bin/csrutil && `csrutil status | grep -c disabled` ]; then
82+
cd ../darwin_objdir; make -k check RUNTESTFLAGS="--target_board=unix'{-m64}'" || :
83+
else
84+
echo "The gcc testsuite must be run with SIP disabled or package installed."
85+
exit 0
86+
fi
87+
else
88+
echo "The gcc testsuite must be run as root due to its use of gdb."
89+
exit 0
90+
fi
91+
<<
92+
<<
93+
InfoDocs: gcc.info gfortran.info cpp.info gccinstall.info libgomp.info cppinternals.info gccint.info
94+
CompileScript: <<
95+
#!/bin/bash -ev
96+
set +x
97+
if [ -e /usr/local/lib/libgmp.a ] || [ -e /usr/local/lib/libgmp.dylib ]; then
98+
echo "-----WARNING-----WARNING-----WARNING-----"
99+
echo "You seem to have GMP installed in /usr/local."
100+
echo "This is known to cause %N to fail to build."
101+
echo "Please move aside /usr/local and try again."
102+
echo "-----WARNING-----WARNING-----WARNING-----"
103+
exit 1
104+
else
105+
echo "Good, /usr/local/lib/libgmp* not present."
106+
fi
107+
set -x
108+
ulimit -s `ulimit -s`
109+
mkdir ../darwin_objdir
110+
cd ../darwin_objdir
111+
# build doesn't play well with GNU-make
112+
# unsupported option '-static-libgcc'
113+
export MAKE=/usr/bin/make
114+
# Only need sysroot on 10.14+ because /usr/include has been removed
115+
OSX_MAJOR_VERSION=`sw_vers -productVersion | cut -d. -f1-2`
116+
if dpkg --compare-versions "$OSX_MAJOR_VERSION" ge "10.14"; then
117+
# Get the unversioned SDK path
118+
SDK_PATH=`dirname $(xcrun --sdk macosx --show-sdk-path)`/MacOSX.sdk
119+
# This should really be --with-build-sysroot but that's not getting propagated through the entire build process.
120+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885
121+
export USE_SYSROOT="--with-sysroot=${SDK_PATH}"
122+
fi
123+
# check for incompatible clang ( 6.0 << bad-clang << 7.2)
124+
clangvers=`clang --version | cut -d\ -f4`
125+
$(`dpkg --compare-versions $clangvers '>>' 6.0`) && $(`dpkg --compare-versions $clangvers '<<' 7.2`) && clangcheck='y'
126+
if [ "$clangcheck" = "y" ]; then
127+
../gcc-%v/configure %c --with-build-config=bootstrap-debug
128+
else
129+
../gcc-%v/configure %c
130+
fi
131+
# Use bootstrap-lean to reduce disk usage.
132+
# Note that this causes plugin testsuite failures
133+
# since the plugin headers must come from prev-gcc.
134+
# make bootstrap-lean
135+
make bootstrap
136+
fink-package-precedence --prohibit-bdep=%n .
137+
<<
138+
InstallScript: <<
139+
#!/bin/sh -ev
140+
darwinvers=`uname -r`
141+
cd ../darwin_objdir
142+
make -j 1 install DESTDIR=%d
143+
mkdir -p %i/bin
144+
145+
# Add symlinks to recreate previous naming of executables in %p/bin
146+
# as well as %p/lib/gcc%type_num[gccver]/bin and new -fsf-%type_num[gccver] naming in %p/bin.
147+
binfiles="gcc g++ c++ cpp gcov"
148+
for binfile in $binfiles ; do
149+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/lib/gcc%type_num[gccver]/bin/$binfile-%type_num[gccver]
150+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/bin/$binfile-%type_num[gccver]
151+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/bin/$binfile-fsf-%type_num[gccver]
152+
done
153+
binfiles="gfortran"
154+
for binfile in $binfiles ; do
155+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/lib/gcc%type_num[gccver]/bin/$binfile
156+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/bin/$binfile
157+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/bin/$binfile-fsf-%type_num[gccver]
158+
done
159+
160+
# Remove unsupported executables
161+
binfiles="gcc-ar gcc-nm gcc-ranlib"
162+
for binfile in $binfiles ; do
163+
rm -f %i/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/lib/gcc%type_num[gccver]/bin/*-apple-darwin${darwinvers}-$binfile-fsf-%type_num[gccver]
164+
done
165+
166+
# Add symlinks for manpages under old names.
167+
man1files="cpp g++ gcc gcov"
168+
for man1file in $man1files ; do
169+
ln -s $man1file-fsf-%type_num[gccver].1 %i/share/man/man1/$man1file-%type_num[gccver].1
170+
done
171+
man1files="gfortran"
172+
for man1file in $man1files ; do
173+
ln -s $man1file-fsf-%type_num[gccver].1 %i/share/man/man1/$man1file.1
174+
done
175+
176+
# Rename manpages with -fsf-%type_num[gccver] suffix and create symlinks to old names.
177+
man7files="fsf-funding gfdl gpl"
178+
for man7file in $man7files ; do
179+
mv %i/share/man/man7/$man7file.7 %i/share/man/man7/$man7file-fsf-%type_num[gccver].7
180+
ln -s $man7file-fsf-%type_num[gccver].7 %i/share/man/man7/$man7file.7
181+
done
182+
183+
# Add dir for installed info files, and link them to %i/share/info.
184+
# the %i/lib/gcc%type_num[gccver]/info/* files will go into the -compiler package
185+
# and the files in %i/share/info go into the main package, this allows
186+
# the info files for specific compiler versions to be accessed with
187+
# e.g. `info -d /fink_install_dir/lib/gcc%type_num[gccver]/info gcc', but the "main" info files will
188+
# be available for the install gccXX package in %p/share/info, as usual
189+
install -d -m 755 %i/share/info
190+
for infofile in $(find %i/lib/gcc%type_num[gccver]/info -name '*.info*'); do
191+
infobase=$(basename $infofile)
192+
case $infofile in
193+
*info) %p/bin/install-info --infodir=%i/lib/gcc%type_num[gccver]/info ${infofile} ;;
194+
esac
195+
ln -s %p/lib/gcc%type_num[gccver]/info/$infobase %i/share/info/$infobase
196+
done
197+
198+
# remove build path from .la files
199+
perl -pi -e "s, \-L[^ ']*/%n-%v-%r/darwin_objdir/[^ ']*,,g" `find %i/lib/gcc%type_num[gccver]/lib -name '*.la'`
200+
201+
if [ "%m" = "arm64" ]; then
202+
arch=aarch64
203+
else
204+
arch=%m
205+
fi
206+
207+
# @rpath install_names are required for aarch64 build, but break some linked binaries
208+
# - enforce actual install paths here; take care to update the cross-referenced dylibs.
209+
cd %d
210+
for dylib in .%p/lib/gcc%type_num[gccver]/lib/lib*.[0-9].dylib; do
211+
install_name_tool -id ${dylib#.} $dylib
212+
install_name_tool -change @rpath/libgcc_s.1.1.dylib %p/lib/gcc%type_num[gccver]/lib/libgcc_s.1.1.dylib \
213+
-change @rpath/libstdc++.6.dylib %p/lib/gcc%type_num[gccver]/lib/libstdc++.6.dylib \
214+
-change @rpath/libquadmath.0.dylib %p/lib/gcc%type_num[gccver]/lib/libquadmath.0.dylib $dylib
215+
done
216+
otool -L .%p/lib/gcc%type_num[gccver]/lib/lib*.[0-9].dylib | grep '@rpath' && exit 2
217+
218+
cp %b/gcc/config/darwin-sections.def %i/lib/gcc%type_num[gccver]/lib/gcc/${arch}-apple-darwin${darwinvers}/%v/plugin/include/config
219+
<<
220+
SplitOff: <<
221+
Package: %N-shlibs
222+
Replaces: <<
223+
gcc4 (<= 20050130-4),
224+
gfortran-shlibs
225+
<<
226+
Provides: <<
227+
gfortran-shlibs
228+
<<
229+
Description: Shared libraries for %N
230+
DocFiles: gcc/COPYING gcc/COPYING.LIB
231+
Files: <<
232+
lib/gcc%type_num[gccver]/lib/libgfortran.5*.dylib
233+
lib/gcc%type_num[gccver]/lib/libstdc++.6*.dylib
234+
lib/gcc%type_num[gccver]/lib/libgcc_s.1*.dylib
235+
lib/gcc%type_num[gccver]/lib/libitm.1*.dylib
236+
lib/gcc%type_num[gccver]/lib/libssp.0*.dylib
237+
lib/gcc%type_num[gccver]/lib/libobjc-gnu.4*.dylib
238+
lib/gcc%type_num[gccver]/lib/libgomp.1*.dylib
239+
lib/gcc%type_num[gccver]/lib/libquadmath.0*.dylib
240+
lib/gcc%type_num[gccver]/lib/libatomic.1*.dylib
241+
<<
242+
Shlibs: <<
243+
%p/lib/gcc%type_num[gccver]/lib/libgfortran.5.dylib 6.0.0 %n (>= 11.0.0-1)
244+
%p/lib/gcc%type_num[gccver]/lib/libstdc++.6.dylib 7.0.0 %n (>= 11.0.0-1)
245+
( "%m" = "arm64" ) %p/lib/gcc%type_num[gccver]/lib/libgcc_s.1.1.dylib 1.0.0 %n (>= 11.0.0-1)
246+
( "%m" != "arm64" ) %p/lib/gcc%type_num[gccver]/lib/libgcc_s.1.dylib 1.0.0 %n (>= 11.0.0-1)
247+
( "%m" != "arm64" ) !%p/lib/gcc%type_num[gccver]/lib/libgcc_s.1.1.dylib
248+
%p/lib/gcc%type_num[gccver]/lib/libitm.1.dylib 2.0.0 %n (>= 11.0.0-1)
249+
%p/lib/gcc%type_num[gccver]/lib/libssp.0.dylib 1.0.0 %n (>= 11.0.0-1)
250+
%p/lib/gcc%type_num[gccver]/lib/libobjc-gnu.4.dylib 5.0.0 %n (>= 11.0.0-1)
251+
%p/lib/gcc%type_num[gccver]/lib/libgomp.1.dylib 2.0.0 %n (>= 11.0.0-1)
252+
%p/lib/gcc%type_num[gccver]/lib/libquadmath.0.dylib 1.0.0 %n (>= 11.0.0-1)
253+
%p/lib/gcc%type_num[gccver]/lib/libatomic.1.dylib 4.0.0 %n (>= 11.0.0-1)
254+
<<
255+
<<
256+
SplitOff2: <<
257+
Package: %N-compiler
258+
Depends: <<
259+
gmp5-shlibs (>= 6.0.0a-3),
260+
isl22-shlibs,
261+
libgettext8-shlibs,
262+
libgmpxx5-shlibs (>= 6.0.0a-3),
263+
libiconv,
264+
libmpc3-shlibs (>= 1.0.3-1),
265+
libmpfr6-shlibs,
266+
%N-shlibs (= %v-%r)
267+
<<
268+
BuildDependsOnly: False
269+
Description: Compiler Binaries for gcc%type_num[gccver]
270+
DocFiles: gcc/COPYING gcc/COPYING.LIB gcc/ChangeLog gcc/ABOUT-GCC-NLS gcc/README.Portability
271+
Files: <<
272+
bin/*-fsf-%type_num[gccver]
273+
lib/gcc%type_num[gccver]
274+
share/man/man1/*-fsf-%type_num[gccver].1
275+
share/man/man7/*-fsf-%type_num[gccver].7
276+
<<
277+
<<
278+
License: GPL
279+
Description: GNU Compiler Collection Version %type_num[gccver]
280+
DescDetail: <<
281+
GCC, the GNU Compiler Collection, includes front ends for
282+
C, C++, Objective-C, Objective-C++, Fortran and Ada.
283+
.
284+
C, C++, Objective C and Fortran are included in this package.
285+
.
286+
The C and C++ compilers are named gcc-11 and g++-11 to avoid
287+
conflicts with gcc and g++ installed by the Apple Developer Tools.
288+
<<
289+
DescPackaging: <<
290+
Build with -fsf-%type_num[gccver] suffix and place non-overlapping files into new gcc%type_num[gccver]-compiler
291+
package which can co-exist with other gccXX-compiler packages. Overlapping files
292+
are left in main gcc%type_num[gccver] package which still conflicts with other gccXX packages.
293+
294+
macOS10.14 no longer supports building 32bit libraries, so must disable multilib.
295+
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87030
296+
297+
We use --with-sysroot to find the hidden system-headers in case /usr/include is not
298+
populated. Ideally want --with-build-sysroot because we only need the headers to build
299+
gcc and that should not impact the end product, but then anything using gccX will
300+
need to add it's own -isysroot flag.
301+
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885
302+
303+
Homebrew patches for arm64/aarch64 build and macOS 13 from
304+
https://github.com/Homebrew/formula-patches/blob/master/gcc/gcc-%v.diff
305+
- libasan.* and libsubsan.* currently not built on darwin22+ - see
306+
https://github.com/iains/gcc-darwin-arm64/commit/e722a1f4
307+
and missing from the 13.0 package until resolved.
308+
There are both "1" and "1.1" versions of libgcc_s.dylib now, but only "1" on arm64.
309+
Manual fixes of @rpath install_names required for aarch64 build to maintain downstream
310+
package compatibility.
311+
<<
312+
Homepage: http://gcc.gnu.org/
313+
Maintainer: None <[email protected]>
314+
<<

0 commit comments

Comments
 (0)