Skip to content

Commit d2cabb3

Browse files
committed
Add gcc14 packages at 14.2 with arm64 patches
1 parent 06d9b0a commit d2cabb3

File tree

5 files changed

+7176
-0
lines changed

5 files changed

+7176
-0
lines changed
Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
Info2: <<
2+
Package: gcc14
3+
Version: 14.2.0
4+
Revision: 1
5+
Type: gccver (14)
6+
Distribution: 13.0
7+
Source: mirror:gnu:gcc/gcc-%v/gcc-%v.tar.xz
8+
Source-Checksum: SHA256(a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9)
9+
PatchFile: %n.patch
10+
PatchFile-MD5: 1edfb5efb797b781869384c04ff96af6
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+
export target_configargs='--with-libiconv-prefix=%p'
117+
# Only need sysroot on 10.14+ because /usr/include has been removed
118+
OSX_MAJOR_VERSION=`sw_vers -productVersion | cut -d. -f1-2`
119+
if dpkg --compare-versions "$OSX_MAJOR_VERSION" ge "10.14"; then
120+
# Get the unversioned SDK path
121+
SDK_PATH=`dirname $(xcrun --sdk macosx --show-sdk-path)`/MacOSX.sdk
122+
# This should really be --with-build-sysroot but that's not getting propagated through the entire build process.
123+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885
124+
export USE_SYSROOT="--with-sysroot=${SDK_PATH}"
125+
fi
126+
# check for incompatible clang ( 6.0 << bad-clang << 7.2)
127+
clangvers=`clang --version | cut -d\ -f4`
128+
$(`dpkg --compare-versions $clangvers '>>' 6.0`) && $(`dpkg --compare-versions $clangvers '<<' 7.2`) && clangcheck='y'
129+
if [ "$clangcheck" = "y" ]; then
130+
../gcc-%v/configure %c --with-build-config=bootstrap-debug
131+
else
132+
../gcc-%v/configure %c
133+
fi
134+
# Use bootstrap-lean to reduce disk usage.
135+
# Note that this causes plugin testsuite failures
136+
# since the plugin headers must come from prev-gcc.
137+
# make bootstrap-lean
138+
make bootstrap
139+
fink-package-precedence --prohibit-bdep=%n .
140+
<<
141+
InstallScript: <<
142+
#!/bin/sh -ev
143+
darwinvers=`uname -r`
144+
cd ../darwin_objdir
145+
make -j 1 install DESTDIR=%d
146+
mkdir -p %i/bin
147+
148+
# Add symlinks to recreate previous naming of executables in %p/bin
149+
# as well as %p/lib/gcc%type_num[gccver]/bin and new -fsf-%type_num[gccver] naming in %p/bin.
150+
binfiles="gcc g++ c++ cpp gcov"
151+
for binfile in $binfiles ; do
152+
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]
153+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/bin/$binfile-%type_num[gccver]
154+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/bin/$binfile-fsf-%type_num[gccver]
155+
done
156+
binfiles="gfortran"
157+
for binfile in $binfiles ; do
158+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/lib/gcc%type_num[gccver]/bin/$binfile
159+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/bin/$binfile
160+
ln -s %p/lib/gcc%type_num[gccver]/bin/$binfile-fsf-%type_num[gccver] %i/bin/$binfile-fsf-%type_num[gccver]
161+
done
162+
163+
# Remove unsupported executables
164+
binfiles="gcc-ar gcc-nm gcc-ranlib"
165+
for binfile in $binfiles ; do
166+
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]
167+
done
168+
169+
# Add symlinks for manpages under old names.
170+
man1files="cpp g++ gcc gcov"
171+
for man1file in $man1files ; do
172+
ln -s $man1file-fsf-%type_num[gccver].1 %i/share/man/man1/$man1file-%type_num[gccver].1
173+
done
174+
man1files="gfortran"
175+
for man1file in $man1files ; do
176+
ln -s $man1file-fsf-%type_num[gccver].1 %i/share/man/man1/$man1file.1
177+
done
178+
179+
# Rename manpages with -fsf-%type_num[gccver] suffix and create symlinks to old names.
180+
man7files="fsf-funding gfdl gpl"
181+
for man7file in $man7files ; do
182+
mv %i/share/man/man7/$man7file.7 %i/share/man/man7/$man7file-fsf-%type_num[gccver].7
183+
ln -s $man7file-fsf-%type_num[gccver].7 %i/share/man/man7/$man7file.7
184+
done
185+
186+
# Add dir for installed info files, and link them to %i/share/info.
187+
# the %i/lib/gcc%type_num[gccver]/info/* files will go into the -compiler package
188+
# and the files in %i/share/info go into the main package, this allows
189+
# the info files for specific compiler versions to be accessed with
190+
# e.g. `info -d /fink_install_dir/lib/gcc%type_num[gccver]/info gcc', but the "main" info files will
191+
# be available for the install gccXX package in %p/share/info, as usual
192+
install -d -m 755 %i/share/info
193+
for infofile in $(find %i/lib/gcc%type_num[gccver]/info -name '*.info*'); do
194+
infobase=$(basename $infofile)
195+
case $infofile in
196+
*info) %p/bin/install-info --infodir=%i/lib/gcc%type_num[gccver]/info ${infofile} ;;
197+
esac
198+
ln -s %p/lib/gcc%type_num[gccver]/info/$infobase %i/share/info/$infobase
199+
done
200+
201+
# remove build path from .la files
202+
perl -pi -e "s, \-L[^ ']*/%n-%v-%r/darwin_objdir/[^ ']*,,g" `find %i/lib/gcc%type_num[gccver]/lib -name '*.la'`
203+
if [ "%m" = "arm64" ]; then
204+
arch=aarch64
205+
else
206+
arch=%m
207+
fi
208+
209+
# @rpath install_names are required for aarch64 build, but break some linked binaries
210+
# - enforce actual install paths here; take care to update the cross-referenced dylibs.
211+
cd %d
212+
for dylib in .%p/lib/gcc%type_num[gccver]/lib/lib*.[0-9].dylib; do
213+
install_name_tool -id ${dylib#.} $dylib
214+
install_name_tool -change @rpath/libgcc_s.1.1.dylib %p/lib/gcc%type_num[gccver]/lib/libgcc_s.1.1.dylib \
215+
-change @rpath/libstdc++.6.dylib %p/lib/gcc%type_num[gccver]/lib/libstdc++.6.dylib \
216+
-change @rpath/libquadmath.0.dylib %p/lib/gcc%type_num[gccver]/lib/libquadmath.0.dylib $dylib
217+
done
218+
otool -L .%p/lib/gcc%type_num[gccver]/lib/lib*.[0-9].dylib | grep '@rpath' && exit 2
219+
220+
cp %b/gcc/config/darwin-sections.def %i/lib/gcc%type_num[gccver]/lib/gcc/${arch}-apple-darwin${darwinvers}/%v/plugin/include/config
221+
<<
222+
SplitOff: <<
223+
Package: %N-shlibs
224+
Replaces: <<
225+
gcc4 (<= 20050130-4),
226+
gfortran-shlibs
227+
<<
228+
Provides: <<
229+
gfortran-shlibs
230+
<<
231+
Description: Shared libraries for %N
232+
DocFiles: gcc/COPYING gcc/COPYING.LIB
233+
Files: <<
234+
lib/gcc%type_num[gccver]/lib/libgfortran.5*.dylib
235+
lib/gcc%type_num[gccver]/lib/libstdc++.6*.dylib
236+
lib/gcc%type_num[gccver]/lib/libgcc_s.1*.dylib
237+
lib/gcc%type_num[gccver]/lib/libitm.1*.dylib
238+
lib/gcc%type_num[gccver]/lib/libssp.0*.dylib
239+
lib/gcc%type_num[gccver]/lib/libobjc-gnu.4*.dylib
240+
lib/gcc%type_num[gccver]/lib/libgomp.1*.dylib
241+
lib/gcc%type_num[gccver]/lib/libquadmath.0*.dylib
242+
lib/gcc%type_num[gccver]/lib/libatomic.1*.dylib
243+
<<
244+
Shlibs: <<
245+
%p/lib/gcc%type_num[gccver]/lib/libgfortran.5.dylib 6.0.0 %n (>= 14.1.0-1)
246+
%p/lib/gcc%type_num[gccver]/lib/libstdc++.6.dylib 7.0.0 %n (>= 14.1.0-1)
247+
( "%m" = "arm64" ) %p/lib/gcc%type_num[gccver]/lib/libgcc_s.1.1.dylib 1.0.0 %n (>= 14.1.0-1)
248+
( "%m" != "arm64" ) %p/lib/gcc%type_num[gccver]/lib/libgcc_s.1.dylib 1.0.0 %n (>= 14.1.0-1)
249+
( "%m" != "arm64" ) !%p/lib/gcc%type_num[gccver]/lib/libgcc_s.1.1.dylib
250+
%p/lib/gcc%type_num[gccver]/lib/libitm.1.dylib 2.0.0 %n (>= 14.1.0-1)
251+
%p/lib/gcc%type_num[gccver]/lib/libssp.0.dylib 1.0.0 %n (>= 14.1.0-1)
252+
%p/lib/gcc%type_num[gccver]/lib/libobjc-gnu.4.dylib 5.0.0 %n (>= 14.1.0-1)
253+
%p/lib/gcc%type_num[gccver]/lib/libgomp.1.dylib 2.0.0 %n (>= 14.1.0-1)
254+
%p/lib/gcc%type_num[gccver]/lib/libquadmath.0.dylib 1.0.0 %n (>= 14.1.0-1)
255+
%p/lib/gcc%type_num[gccver]/lib/libatomic.1.dylib 4.0.0 %n (>= 14.1.0-1)
256+
<<
257+
<<
258+
SplitOff2: <<
259+
Package: %N-compiler
260+
Depends: <<
261+
gmp5-shlibs (>= 6.1.2-1),
262+
isl22-shlibs,
263+
libgettext8-shlibs,
264+
libgmpxx5-shlibs (>= 6.1.2-1),
265+
libiconv,
266+
libmpc3-shlibs (>= 1.0.3-1),
267+
libmpfr6-shlibs,
268+
%N-shlibs (= %v-%r)
269+
<<
270+
BuildDependsOnly: False
271+
Description: Compiler Binaries for gcc%type_num[gccver]
272+
DocFiles: gcc/COPYING gcc/COPYING.LIB gcc/ChangeLog gcc/ABOUT-GCC-NLS gcc/README.Portability
273+
Files: <<
274+
bin/*-fsf-%type_num[gccver]
275+
lib/gcc%type_num[gccver]
276+
share/man/man1/*-fsf-%type_num[gccver].1
277+
share/man/man7/*-fsf-%type_num[gccver].7
278+
<<
279+
<<
280+
License: GPL
281+
Description: GNU Compiler Collection Version %type_num[gccver]
282+
DescDetail: <<
283+
GCC, the GNU Compiler Collection, includes front ends for
284+
C, C++, Objective-C, Objective-C++, Fortran and Ada.
285+
.
286+
C, C++, Objective C and Fortran are included in this package.
287+
.
288+
The C and C++ compilers are named gcc-14 and g++-14 to avoid
289+
conflicts with gcc and g++ installed by the Apple Developer Tools.
290+
<<
291+
DescPackaging: <<
292+
Build with -fsf-%type_num[gccver] suffix and place non-overlapping files into new gcc%type_num[gccver]-compiler
293+
package which can co-exist with other gccXX-compiler packages. Overlapping files
294+
are left in main gcc%type_num[gccver] package which still conflicts with other gccXX packages.
295+
296+
macOS10.14 no longer supports building 32bit libraries, so must disable multilib.
297+
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87030
298+
299+
We use --with-sysroot to find the hidden system-headers in case /usr/include is not
300+
populated. Ideally want --with-build-sysroot because we only need the headers to build
301+
gcc and that should not impact the end product, but then anything using gccX will
302+
need to add it's own -isysroot flag.
303+
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885
304+
305+
Homebrew patches for arm64/aarch64 build and macOS 13+ from
306+
https://github.com/Homebrew/formula-patches/blob/master/gcc/gcc-%v.diff
307+
- libasan.* and libsubsan.* currently not built on darwin22+ or arm64 - see
308+
https://github.com/iains/gcc-darwin-arm64/commit/e722a1f4
309+
and missing from the 13.0-15.0 packages until resolved.
310+
There are both "1" and "1.1" versions of libgcc_s.dylib now, but only "1.1" on arm64.
311+
Manual fixes of @rpath install_names required for aarch64 build to maintain downstream
312+
package compatibility.
313+
Added `target_configargs` variable since for some reason libiconv prefix is not passed
314+
down to libstdc++ config any more (https://github.com/iains/gcc-darwin-arm64/issues/129).
315+
<<
316+
Homepage: http://gcc.gnu.org/
317+
Maintainer: None <[email protected]>
318+
<<

0 commit comments

Comments
 (0)