From c9c23197e074062ae5e25cc6b6c2e9f5ac50f064 Mon Sep 17 00:00:00 2001 From: Derek Homeier Date: Mon, 26 Dec 2022 15:44:36 +0100 Subject: [PATCH] Fix all rpath names; use Fink install-info and add gcc11 patch to build on Ventura --- .../finkinfo/languages/gcc11-ventura.patch | 58 +++++++++++++++++++ .../stable/main/finkinfo/languages/gcc11.info | 26 ++++++--- .../stable/main/finkinfo/languages/gcc12.info | 21 ++++--- 3 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 10.9-libcxx/stable/main/finkinfo/languages/gcc11-ventura.patch diff --git a/10.9-libcxx/stable/main/finkinfo/languages/gcc11-ventura.patch b/10.9-libcxx/stable/main/finkinfo/languages/gcc11-ventura.patch new file mode 100644 index 00000000000..a8565575552 --- /dev/null +++ b/10.9-libcxx/stable/main/finkinfo/languages/gcc11-ventura.patch @@ -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],, diff --git a/10.9-libcxx/stable/main/finkinfo/languages/gcc11.info b/10.9-libcxx/stable/main/finkinfo/languages/gcc11.info index 875f473973e..990263f40c6 100644 --- a/10.9-libcxx/stable/main/finkinfo/languages/gcc11.info +++ b/10.9-libcxx/stable/main/finkinfo/languages/gcc11.info @@ -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' << @@ -40,6 +43,7 @@ BuildDepends: << fink-package-precedence, gettext-tools, gmp5 (>= 6.0.0a-3), + install-info, isl22, libgettext8-dev, libiconv-dev, @@ -185,13 +189,14 @@ 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 @@ -200,12 +205,17 @@ InstallScript: << 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 << SplitOff: << Package: %N-shlibs @@ -294,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-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 diff --git a/10.9-libcxx/stable/main/finkinfo/languages/gcc12.info b/10.9-libcxx/stable/main/finkinfo/languages/gcc12.info index 58864fde34f..1f235dcdd67 100644 --- a/10.9-libcxx/stable/main/finkinfo/languages/gcc12.info +++ b/10.9-libcxx/stable/main/finkinfo/languages/gcc12.info @@ -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) @@ -44,6 +44,7 @@ BuildDepends: << fink-package-precedence, gettext-tools, gmp5 (>= 6.1.2-1), + install-info, isl22, libgettext8-dev, libiconv-dev, @@ -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 @@ -205,11 +206,15 @@ InstallScript: << 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 << SplitOff: << Package: %N-shlibs @@ -298,10 +303,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