Skip to content

Commit

Permalink
Fix all rpath names; use Fink install-info and add gcc11 patch to bui…
Browse files Browse the repository at this point in the history
…ld on Ventura
  • Loading branch information
dhomeier committed Dec 26, 2022
1 parent 8178dd2 commit 1e337fe
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 16 deletions.
58 changes: 58 additions & 0 deletions 10.9-libcxx/stable/main/finkinfo/languages/gcc11-ventura.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff -pur gcc-11.3.0/gcc/config/darwin-driver.c gcc-11.3.0-patched/gcc/config/darwin-driver.c
--- gcc-11.3.0/gcc/config/darwin-driver.c 2022-04-21 09:58:52
+++ gcc-11.3.0-patched/gcc/config/darwin-driver.c 2022-12-12 12:19:08
@@ -64,7 +64,8 @@ validate_macosx_version_min (const char *version_str)

major = strtoul (version_str, &end, 10);

- if (major < 10 || major > 12 ) /* macOS 10, 11, and 12 are known. */
+ /* macOS 10, 11, and 12 are known. clang accepts up to 99. */
+ if (major < 10 || major > 99)
return NULL;

/* Skip a separating period, if there's one. */
diff -pur gcc-11.3.0/gcc/config.gcc gcc-11.3.0-patched/gcc/config.gcc
--- gcc-11.3.0/gcc/config.gcc 2022-04-21 09:58:52
+++ gcc-11.3.0-patched/gcc/config.gcc 2022-12-12 12:20:01
@@ -1872,7 +1872,7 @@ hppa[12]*-*-hpux11*)
dwarf2=no
fi
;;
-i[34567]86-*-darwin1[89]*)
+i[34567]86-*-darwin1[89]* | i[34567]86-*-darwin2*)
echo "Error: 32bit target is not supported after Darwin17" 1>&2
;;
i[34567]86-*-darwin*)
@@ -1882,7 +1882,7 @@ i[34567]86-*-darwin*)
tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch t-slibgcc"
tm_file="${tm_file} ${cpu_type}/darwin32-biarch.h"
;;
-x86_64-*-darwin1[89]* | x86_64-*-darwin2[01]*)
+x86_64-*-darwin1[89]* | x86_64-*-darwin2*)
# Only 64b from now
with_cpu=${with_cpu:-core2}
tmake_file="${tmake_file} t-slibgcc"
diff -pur gcc-11.3.0/gcc/configure gcc-11.3.0-patched/gcc/configure
--- gcc-11.3.0/gcc/configure 2022-04-21 09:59:35
+++ gcc-11.3.0-patched/gcc/configure 2022-12-12 12:19:08
@@ -27016,7 +27016,7 @@ $as_echo "$as_me: WARNING: LTO for $target requires bi
;;
esac
case $target_os in
- darwin2[0-9]* | darwin19*)
+ darwin2* | darwin19*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for llvm assembler x86-pad-for-align option" >&5
$as_echo_n "checking assembler for llvm assembler x86-pad-for-align option... " >&6; }
if ${gcc_cv_as_mllvm_x86_pad_for_align+:} false; then :
diff -pur gcc-11.3.0/gcc/configure.ac gcc-11.3.0-patched/gcc/configure.ac
--- gcc-11.3.0/gcc/configure.ac 2022-04-21 09:58:53
+++ gcc-11.3.0-patched/gcc/configure.ac 2022-12-12 12:19:08
@@ -4772,7 +4772,7 @@ foo: nop
;;
esac
case $target_os in
- darwin2[[0-9]]* | darwin19*)
+ darwin2* | darwin19*)
gcc_GAS_CHECK_FEATURE([llvm assembler x86-pad-for-align option],
gcc_cv_as_mllvm_x86_pad_for_align,,
[-mllvm -x86-pad-for-align=false], [.text],,
29 changes: 21 additions & 8 deletions 10.9-libcxx/stable/main/finkinfo/languages/gcc11.info
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
Info2: <<
Package: gcc11
Version: 11.3.0
Revision: 2
Revision: 3
Type: gccver (11)
Source: mirror:gnu:gcc/gcc-%v/gcc-%v.tar.xz
Source-Checksum: SHA256(b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39)
PatchFile: %n-arm.patch
PatchFile-MD5: 9988f59fbeb6d88b1d45d7ab7d243389
PatchFile2: %n-ventura.patch
PatchFile2-MD5: 2961dece6a860f8952addf52798e9e72
PatchScript: <<
#!/bin/sh -ev
patch -p1 < %{PatchFile}
patch -p1 < %{PatchFile2}
# don't update live infodoc dir
find . -name Makefile.in | xargs perl -pi -e 's/install-info --version/false/g'
<<
Expand Down Expand Up @@ -40,6 +43,7 @@ BuildDepends: <<
fink-package-precedence,
gettext-tools,
gmp5 (>= 6.0.0a-3),
install-info,
isl22,
libgettext8-dev,
libiconv-dev,
Expand Down Expand Up @@ -185,27 +189,34 @@ InstallScript: <<
for infofile in $(find %i/lib/gcc%type_num[gccver]/info -name '*.info*'); do
infobase=$(basename $infofile)
case $infofile in
*info) /usr/bin/install-info --infodir=%i/lib/gcc%type_num[gccver]/info ${infofile} ;;
*info) %p/bin/install-info --infodir=%i/lib/gcc%type_num[gccver]/info ${infofile} ;;
esac
ln -s %p/lib/gcc%type_num[gccver]/info/$infobase %i/share/info/$infobase
done

# remove build path from .la files
perl -pi -e "s, \-L[^ ']*/%n-%v-%r/darwin_objdir/[^ ']*,,g" `find %i/lib/gcc%type_num[gccver]/lib -name '*.la'`

if [ "%m" = "arm" ]; then
arch=aarch64
else
arch=%m
perl -pi -e "s, /[^ ']*/%n-%v-%r/darwin_objdir/[^ ']*,,g" `find %i/lib/gcc%type_num[gccver]/lib -name 'libasan.la'`
perl -pi -e "s, /[^ ']*/%n-%v-%r/darwin_objdir/[^ ']*,,g" `find %i/lib/gcc%type_num[gccver]/lib -name 'libubsan.la'`
fi
cp %b/gcc/config/darwin-sections.def %i/lib/gcc%type_num[gccver]/lib/gcc/${arch}-apple-darwin${darwinvers}/%v/plugin/include/config

# @rpath install_names are required for aarch64 build, but break some linked binaries
# - enforce actual install path here
# - enforce actual install paths here; take care to update the cross-referenced dylibs.
cd %d
for dylib in .%p/lib/gcc%type_num[gccver]/lib/lib*.[0-9].dylib; do
install_name_tool -id ${dylib#.} $dylib
install_name_tool -change @rpath/libgcc_s.1.1.dylib %p/lib/libgcc_s.1.1.dylib \
-change @rpath/libstdc++.6.dylib %p/lib/libstdc++.6.dylib \
-change @rpath/libquadmath.0.dylib %p/lib/libquadmath.0.dylib $dylib
done
otool -L .%p/lib/gcc%type_num[gccver]/lib/lib*.[0-9].dylib | grep '@rpath' && exit 2

cp %b/gcc/config/darwin-sections.def %i/lib/gcc%type_num[gccver]/lib/gcc/${arch}-apple-darwin${darwinvers}/%v/plugin/include/config
<<
SplitOff: <<
Package: %N-shlibs
Expand Down Expand Up @@ -294,10 +305,12 @@ DescPackaging: <<
need to add it's own -isysroot flag.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885

Homebrew patches for arm/aarch64 build from
https://github.com/Homebrew/formula-patches/blob/master/gcc/gcc-11.3.0-arm.diff
- libasan.* and libsubsan.* currently not built on that arch.
There are both 1 and 1.1 versions of libgcc_s.dylib now, but only 1 on arm.
Homebrew patches for arm/aarch64 build and macOS 13 from
https://github.com/Homebrew/formula-patches/blob/master/gcc/gcc-%v-{arm,ventura}.diff
- libasan.* and libsubsan.* currently not built on arm.
There are both "1" and "1.1" versions of libgcc_s.dylib now, but only "1" on arm.
Manual fixes of @rpath install_names required for aarch64 build to maintain downstream
package compatibility.
<<
Homepage: http://gcc.gnu.org/
Maintainer: None <[email protected]>
Expand Down
24 changes: 16 additions & 8 deletions 10.9-libcxx/stable/main/finkinfo/languages/gcc12.info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Info2: <<
Package: gcc12
Version: 12.2.0
Revision: 2
Revision: 3
Type: gccver (12)
Source: mirror:gnu:gcc/gcc-%v/gcc-%v.tar.xz
Source-Checksum: SHA256(e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff)
Expand Down Expand Up @@ -44,6 +44,7 @@ BuildDepends: <<
fink-package-precedence,
gettext-tools,
gmp5 (>= 6.1.2-1),
install-info,
isl22,
libgettext8-dev,
libiconv-dev,
Expand Down Expand Up @@ -188,7 +189,7 @@ InstallScript: <<
for infofile in $(find %i/lib/gcc%type_num[gccver]/info -name '*.info*'); do
infobase=$(basename $infofile)
case $infofile in
*info) /usr/bin/install-info --infodir=%i/lib/gcc%type_num[gccver]/info ${infofile} ;;
*info) %p/bin/install-info --infodir=%i/lib/gcc%type_num[gccver]/info ${infofile} ;;
esac
ln -s %p/lib/gcc%type_num[gccver]/info/$infobase %i/share/info/$infobase
done
Expand All @@ -202,14 +203,19 @@ InstallScript: <<
perl -pi -e "s, /[^ ']*/%n-%v-%r/darwin_objdir/[^ ']*,,g" `find %i/lib/gcc%type_num[gccver]/lib -name 'libasan.la'`
perl -pi -e "s, /[^ ']*/%n-%v-%r/darwin_objdir/[^ ']*,,g" `find %i/lib/gcc%type_num[gccver]/lib -name 'libubsan.la'`
fi
cp %b/gcc/config/darwin-sections.def %i/lib/gcc%type_num[gccver]/lib/gcc/${arch}-apple-darwin${darwinvers}/%v/plugin/include/config

# @rpath install_names are required for aarch64 build, but break some linked binaries
# - enforce actual install path here
# - enforce actual install paths here; take care to update the cross-referenced dylibs.
cd %d
for dylib in .%p/lib/gcc%type_num[gccver]/lib/lib*.[0-9].dylib; do
install_name_tool -id ${dylib#.} $dylib
install_name_tool -change @rpath/libgcc_s.1.1.dylib %p/lib/libgcc_s.1.1.dylib \
-change @rpath/libstdc++.6.dylib %p/lib/libstdc++.6.dylib \
-change @rpath/libquadmath.0.dylib %p/lib/libquadmath.0.dylib $dylib
done
otool -L .%p/lib/gcc%type_num[gccver]/lib/lib*.[0-9].dylib | grep '@rpath' && exit 2

cp %b/gcc/config/darwin-sections.def %i/lib/gcc%type_num[gccver]/lib/gcc/${arch}-apple-darwin${darwinvers}/%v/plugin/include/config
<<
SplitOff: <<
Package: %N-shlibs
Expand Down Expand Up @@ -298,10 +304,12 @@ DescPackaging: <<
need to add it's own -isysroot flag.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885

Homebrew patches for arm/aarch64 build from
https://github.com/Homebrew/formula-patches/blob/master/gcc/gcc-%v-arm.diff
- libasan.* and libsubsan.* currently not built on that arch.
There are both 1 and 1.1 versions of libgcc_s.dylib now, but only 1 on arm.
Homebrew patches for arm/aarch64 build and macOS 13 from
https://github.com/Homebrew/formula-patches/blob/master/gcc/gcc-%v-{arm,ventura}.diff
- libasan.* and libsubsan.* currently not built on arm.
There are both "1" and "1.1" versions of libgcc_s.dylib now, but only "1" on arm.
Manual fixes of @rpath install_names required for aarch64 build to maintain downstream
package compatibility.
<<
Homepage: http://gcc.gnu.org/
Maintainer: None <[email protected]>
Expand Down

0 comments on commit 1e337fe

Please sign in to comment.