Skip to content

Commit 4051225

Browse files
committed
gcc-13.2.0 package with untested libsanitizer build, disabled on Ventura
1 parent d11a3f9 commit 4051225

File tree

3 files changed

+12234
-0
lines changed

3 files changed

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

0 commit comments

Comments
 (0)