Skip to content

Instantly share code, notes, and snippets.

@ndowens
Created November 28, 2018 02:31
Show Gist options
  • Select an option

  • Save ndowens/8f9b332e7d330d4ef07c03fbfa3e86d5 to your computer and use it in GitHub Desktop.

Select an option

Save ndowens/8f9b332e7d330d4ef07c03fbfa3e86d5 to your computer and use it in GitHub Desktop.
Index: lang/gcc5/Makefile
===================================================================
--- lang/gcc5/Makefile (revision 485842)
+++ lang/gcc5/Makefile (working copy)
@@ -3,7 +3,7 @@
PORTNAME= gcc
PORTVERSION= 5.5.0
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= lang
MASTER_SITES= GCC
PKGNAMESUFFIX= ${SUFFIX}
@@ -15,7 +15,6 @@
LICENSE_COMB= multi
DEPRECATED= Unsupported by upstream. Use GCC 7 or newer instead.
-ONLY_FOR_ARCHS= aarch64 amd64 arm armv6 i386 powerpc powerpc64 powerpcspe sparc64
BROKEN_sparc64= Does not build: bootstrap comparison failure
LIB_DEPENDS= libgmp.so:math/gmp \
@@ -39,6 +38,8 @@
OPTIONS_DEFINE= BOOTSTRAP
OPTIONS_DEFAULT= BOOTSTRAP
+OPTIONS_SUB= yes
+
BOOTSTRAP_DESC= Build using a full bootstrap
.if exists(/usr/lib32/libc.so)
@@ -52,7 +53,31 @@
.include <bsd.port.pre.mk>
-.if ${ARCH} == amd64
+.if ${ARCH} == mips
+CONFIGURE_ARGS+=--disable-decimal-float --disable-libatomic --disable-libgcj \
+ --disable-libgomp --disable-libitm --disable-libquadmath \
+ --disable-libquadmath-support --disable-libsanitizer --disable-libssp \
+ --disable-libunwind-exceptions --disable-libvtv --disable-multilib \
+ --disable-shared --disable-threads --disable-werror --enable-lto \
+ --enable-plugin --disable-libstdcxx-pch
+CXXFLAGS+= -fpermissive -mips32
+CFLAGS+= -Wno-error -mips32
+EXTRA_PATCHES= ${PATCHDIR}/mips-patch-configure ${PATCHDIR}/mips-patch-libgcc \
+ ${PATCHDIR}/mips-patch-Makefile
+
+.elif ${ARCH} == mips64
+CONFIGURE_ARGS+=--disable-decimal-float --disable-libatomic --disable-libgcj \
+ --disable-libgomp --disable-libitm --disable-libquadmath \
+ --disable-libquadmath-support --disable-libsanitizer --disable-libssp \
+ --disable-libunwind-exceptions --disable-libvtv --disable-multilib \
+ --disable-shared --disable-threads --disable-werror --enable-lto \
+ --enable-plugin --disable-libstdcxx-pch
+CXXFLAGS+= -fpermissive -mips3
+CFLAGS+= -Wno-error -mips3
+EXTRA_PATCHES= ${PATCHDIR}/mips-patch-configure ${PATCHDIR}/mips-patch-libgcc \
+ ${PATCHDIR}/mips-patch-Makefile
+
+.elif ${ARCH} == amd64
CONFIGURE_TARGET= x86_64-portbld-${OPSYS:tl}${OSREL}
.elif ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7
@@ -80,8 +105,12 @@
CONFIGURE_ARGS+=--disable-bootstrap
.else
CONFIGURE_ARGS+=--with-build-config=bootstrap-debug
+.if ${ARCH} == mips || ${ARCH} == mips64
+ALL_TARGET= stage1-bubble
+.else
ALL_TARGET= bootstrap-lean
.endif
+.endif
INSTALL_TARGET= install-strip
.if ${UID} != 0
BINMODE= 755
@@ -118,6 +147,12 @@
CONFIGURE_ARGS+=--enable-languages=${LANGUAGES}
+.if ${ARCH} == mips || ${ARCH} == mips64
+PLIST_SUB+= FORTRAN="@comment "
+.else
+PLIST_SUB+= FORTRAN=""
+.endif
+
pre-everything::
@${ECHO_MSG} "Making GCC ${PORTVERSION} for ${CONFIGURE_TARGET} [${LANGUAGES}]"
Index: lang/gcc5/files/mips-patch-Makefile
===================================================================
--- lang/gcc5/files/mips-patch-Makefile (nonexistent)
+++ lang/gcc5/files/mips-patch-Makefile (working copy)
@@ -0,0 +1,123 @@
+--- Makefile.in.orig 2018-11-26 23:01:59 UTC
++++ Makefile.in
+@@ -2625,7 +2625,6 @@ install-strip-host: \
+ maybe-install-strip-dejagnu \
+ maybe-install-strip-etc \
+ maybe-install-strip-fastjar \
+- maybe-install-strip-fixincludes \
+ maybe-install-strip-flex \
+ maybe-install-strip-gas \
+ maybe-install-strip-gcc \
+@@ -2661,7 +2660,6 @@ install-strip-host: \
+ maybe-install-strip-utils \
+ maybe-install-strip-gnattools \
+ maybe-install-strip-lto-plugin \
+- maybe-install-strip-libcc1 \
+ maybe-install-strip-gotools
+
+ .PHONY: install-strip-target
+@@ -2677,8 +2675,6 @@ install-strip-target: \
+ maybe-install-strip-target-libgcc \
+ maybe-install-strip-target-libbacktrace \
+ maybe-install-strip-target-libquadmath \
+- maybe-install-strip-target-libgfortran \
+- maybe-install-strip-target-libobjc \
+ maybe-install-strip-target-libgo \
+ maybe-install-strip-target-libtermcap \
+ maybe-install-strip-target-winsup \
+@@ -8505,21 +8501,7 @@ install-fixincludes: installdirs
+
+ @endif fixincludes
+
+-.PHONY: install-strip-fixincludes maybe-install-strip-fixincludes
+-maybe-install-strip-fixincludes:
+-@if fixincludes
+-maybe-install-strip-fixincludes: install-strip-fixincludes
+
+-install-strip-fixincludes: installdirs
+- @: $(MAKE); $(unstage)
+- @r=`${PWD_COMMAND}`; export r; \
+- s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+- $(HOST_EXPORTS) \
+- (cd $(HOST_SUBDIR)/fixincludes && \
+- $(MAKE) $(FLAGS_TO_PASS) install-strip)
+-
+-@endif fixincludes
+-
+ # Other targets (info, dvi, pdf, etc.)
+
+ .PHONY: maybe-info-fixincludes info-fixincludes
+@@ -31525,21 +31507,7 @@ install-libcc1: installdirs
+
+ @endif libcc1
+
+-.PHONY: install-strip-libcc1 maybe-install-strip-libcc1
+-maybe-install-strip-libcc1:
+-@if libcc1
+-maybe-install-strip-libcc1: install-strip-libcc1
+
+-install-strip-libcc1: installdirs
+- @: $(MAKE); $(unstage)
+- @r=`${PWD_COMMAND}`; export r; \
+- s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+- $(HOST_EXPORTS) \
+- (cd $(HOST_SUBDIR)/libcc1 && \
+- $(MAKE) $(FLAGS_TO_PASS) install-strip)
+-
+-@endif libcc1
+-
+ # Other targets (info, dvi, pdf, etc.)
+
+ .PHONY: maybe-info-libcc1 info-libcc1
+@@ -40052,21 +40020,6 @@ install-target-libgfortran: installdirs
+
+ @endif target-libgfortran
+
+-.PHONY: install-strip-target-libgfortran maybe-install-strip-target-libgfortran
+-maybe-install-strip-target-libgfortran:
+-@if target-libgfortran
+-maybe-install-strip-target-libgfortran: install-strip-target-libgfortran
+-
+-install-strip-target-libgfortran: installdirs
+- @: $(MAKE); $(unstage)
+- @r=`${PWD_COMMAND}`; export r; \
+- s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+- $(NORMAL_TARGET_EXPORTS) \
+- (cd $(TARGET_SUBDIR)/libgfortran && \
+- $(MAKE) $(TARGET_FLAGS_TO_PASS) install-strip)
+-
+-@endif target-libgfortran
+-
+ # Other targets (info, dvi, pdf, etc.)
+
+ .PHONY: maybe-info-target-libgfortran info-target-libgfortran
+@@ -40510,21 +40463,7 @@ install-target-libobjc: installdirs
+
+ @endif target-libobjc
+
+-.PHONY: install-strip-target-libobjc maybe-install-strip-target-libobjc
+-maybe-install-strip-target-libobjc:
+-@if target-libobjc
+-maybe-install-strip-target-libobjc: install-strip-target-libobjc
+
+-install-strip-target-libobjc: installdirs
+- @: $(MAKE); $(unstage)
+- @r=`${PWD_COMMAND}`; export r; \
+- s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+- $(NORMAL_TARGET_EXPORTS) \
+- (cd $(TARGET_SUBDIR)/libobjc && \
+- $(MAKE) $(TARGET_FLAGS_TO_PASS) install-strip)
+-
+-@endif target-libobjc
+-
+ # Other targets (info, dvi, pdf, etc.)
+
+ .PHONY: maybe-info-target-libobjc info-target-libobjc
+@@ -49832,7 +49771,6 @@ html-stageprofile-gcc: maybe-all-build-libiberty
+ html-stagefeedback-gcc: maybe-all-build-libiberty
+ install-gcc: maybe-install-fixincludes
+ install-gcc: maybe-install-lto-plugin
+-install-strip-gcc: maybe-install-strip-fixincludes
+ install-strip-gcc: maybe-install-strip-lto-plugin
+ configure-libcpp: configure-libiberty
+
Property changes on: lang/gcc5/files/mips-patch-Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: lang/gcc5/files/mips-patch-configure
===================================================================
--- lang/gcc5/files/mips-patch-configure (nonexistent)
+++ lang/gcc5/files/mips-patch-configure (working copy)
@@ -0,0 +1,74 @@
+--- configure.orig 2018-11-26 01:09:15 UTC
++++ configure
+@@ -5068,51 +5068,7 @@ if test -z "$LD"; then
+ fi
+ fi
+
+-# Check whether -static-libstdc++ -static-libgcc is supported.
+-have_static_libs=no
+-if test "$GCC" = yes; then
+- saved_LDFLAGS="$LDFLAGS"
+
+- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -static-libstdc++ -static-libgcc" >&5
+-$as_echo_n "checking whether g++ accepts -static-libstdc++ -static-libgcc... " >&6; }
+- ac_ext=cpp
+-ac_cpp='$CXXCPP $CPPFLAGS'
+-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+-
+-
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-
+-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+-#error -static-libstdc++ not implemented
+-#endif
+-int main() {}
+-_ACEOF
+-if ac_fn_cxx_try_link "$LINENO"; then :
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-$as_echo "yes" >&6; }; have_static_libs=yes
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+- conftest$ac_exeext conftest.$ac_ext
+- ac_ext=c
+-ac_cpp='$CPP $CPPFLAGS'
+-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+-
+-
+- LDFLAGS="$saved_LDFLAGS"
+-fi
+-
+-
+-
+-
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}gnatbind; ac_word=$2
+@@ -5868,9 +5824,6 @@ else
+ # In stage 1, default to linking libstdc++ and libgcc statically with GCC
+ # if supported. But if the user explicitly specified the libraries to use,
+ # trust that they are doing what they want.
+- if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
+- stage1_ldflags="-static-libstdc++ -static-libgcc"
+- fi
+ fi
+
+
+@@ -5905,9 +5858,6 @@ else
+ # In stages 2 and 3, default to linking libstdc++ and libgcc
+ # statically. But if the user explicitly specified the libraries to
+ # use, trust that they are doing what they want.
+- if test "$poststage1_libs" = ""; then
+- poststage1_ldflags="-static-libstdc++ -static-libgcc"
+- fi
+ fi
+
+
Property changes on: lang/gcc5/files/mips-patch-configure
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: lang/gcc5/files/mips-patch-libgcc
===================================================================
--- lang/gcc5/files/mips-patch-libgcc (nonexistent)
+++ lang/gcc5/files/mips-patch-libgcc (working copy)
@@ -0,0 +1,24 @@
+--- libgcc/config.host.orig 2018-11-25 03:55:18 UTC
++++ libgcc/config.host
+@@ -143,11 +143,7 @@ mips*-*-*)
+ # All MIPS targets provide a full set of FP routines.
+ cpu_type=mips
+ tmake_file="mips/t-mips"
+- if test "${libgcc_cv_mips_hard_float}" = yes; then
+- tmake_file="${tmake_file} t-hardfp-sfdf t-hardfp"
+- else
+- tmake_file="${tmake_file} t-softfp-sfdf"
+- fi
++ tmake_file="${tmake_file} t-softfp-sfdf"
+ if test "${ac_cv_sizeof_long_double}" = 16; then
+ tmake_file="${tmake_file} mips/t-softfp-tf"
+ fi
+@@ -839,7 +835,7 @@ microblaze*-*-rtems*)
+ tmake_file="${tmake_file} microblaze/t-microblaze t-fdpbit"
+ extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o crti.o crtn.o"
+ ;;
+-mips*-*-netbsd*) # NetBSD/mips, either endian.
++mips*-*-freebsd*)
+ ;;
+ mips*-*-linux*) # Linux MIPS, either endian.
+ extra_parts="$extra_parts crtfastmath.o"
Property changes on: lang/gcc5/files/mips-patch-libgcc
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: lang/gcc5/files/patch-armv7-support
===================================================================
--- lang/gcc5/files/patch-armv7-support (revision 485842)
+++ lang/gcc5/files/patch-armv7-support (working copy)
@@ -1,28 +1,28 @@
---- UTC
---- gcc/config.gcc.orig 2017-01-09 22:01:26.582656000 +0100
-+++ gcc/config.gcc 2017-10-07 17:27:59.564810000 +0200
-@@ -1072,6 +1072,10 @@
- tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1"
- fi
- ;;
-+ armv7*-*-freebsd*)
-+ tm_defines="${tm_defines} TARGET_FREEBSD_ARMv7=1"
-+ tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1"
-+ ;;
- esac
- with_tls=${with_tls:-gnu}
+--- gcc/config.gcc.orig 2017-01-09 21:06:20 UTC
++++ gcc/config.gcc
+@@ -1996,10 +1996,12 @@ microblaze*-*-elf)
+ cxx_target_objs="${cxx_target_objs} microblaze-c.o"
+ tmake_file="${tmake_file} microblaze/t-microblaze"
+ ;;
+-mips*-*-netbsd*) # NetBSD/mips, either endian.
++mips*-*-freebsd*)
+ target_cpu_default="MASK_ABICALLS"
+- tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h"
+- extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ tm_file="elfos.h ${tm_file} mips/elf.h ${fbsd_tm_file}"
++ extra_options="${extra_options} freebsd.opt"
++ gnu_ld=yes
++ gas=yes
;;
---- gcc/config/arm/freebsd.h.orig 2016-06-15 21:17:15.860618000 +0200
-+++ gcc/config/arm/freebsd.h 2017-10-09 21:38:03.395632000 +0200
-@@ -112,7 +112,10 @@
- #undef WCHAR_TYPE_SIZE
- #define WCHAR_TYPE_SIZE BITS_PER_WORD
-
--#if defined (TARGET_FREEBSD_ARMv6)
-+#if defined (TARGET_FREEBSD_ARMv7)
-+#undef SUBTARGET_CPU_DEFAULT
-+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_genericv7a
-+#elif defined (TARGET_FREEBSD_ARMv6)
- #undef SUBTARGET_CPU_DEFAULT
- #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm1176jzs
- #else
+ mips*-img-linux*)
+ tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h mips/mti-linux.h"
+@@ -2298,6 +2300,9 @@ powerpc*-*-freebsd*)
+ tm_file="${tm_file} rs6000/default64.h rs6000/freebsd64.h"
+ tmake_file="${tmake_file} rs6000/t-freebsd64"
+ extra_options="${extra_options} rs6000/linux64.opt"
++ ;;
++ powerpcspe-*)
++ tm_file="${tm_file} rs6000/freebsd.h rs6000/linuxspe.h rs6000/e500.h"
+ ;;
+ *)
+ tm_file="${tm_file} rs6000/freebsd.h"
Index: lang/gcc5/files/patch-spe-config
===================================================================
--- lang/gcc5/files/patch-spe-config (revision 485842)
+++ lang/gcc5/files/patch-spe-config (nonexistent)
@@ -1,15 +0,0 @@
---- UTC
-Index: gcc/config.gcc
-===================================================================
---- gcc/config.gcc.old 2017-04-05 17:48:03.045750000 -0500
-+++ gcc/config.gcc 2017-04-05 17:49:22.143572000 -0500
-@@ -2285,6 +2285,9 @@
- tmake_file="${tmake_file} rs6000/t-freebsd64"
- extra_options="${extra_options} rs6000/linux64.opt"
- ;;
-+ powerpcspe-*)
-+ tm_file="${tm_file} rs6000/freebsd.h rs6000/linuxspe.h rs6000/e500.h"
-+ ;;
- *)
- tm_file="${tm_file} rs6000/freebsd.h"
- ;;
Property changes on: lang/gcc5/files/patch-spe-config
___________________________________________________________________
Deleted: fbsd:nokeywords
## -1 +0,0 ##
-yes
\ No newline at end of property
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: lang/gcc5/pkg-plist
===================================================================
--- lang/gcc5/pkg-plist (revision 485842)
+++ lang/gcc5/pkg-plist (working copy)
@@ -5,7 +5,7 @@
bin/%%GNU_HOST%%-gcc-ar%%SUFFIX%%
bin/%%GNU_HOST%%-gcc-nm%%SUFFIX%%
bin/%%GNU_HOST%%-gcc-ranlib%%SUFFIX%%
-bin/%%GNU_HOST%%-gfortran%%SUFFIX%%
+%%FORTRAN%%bin/%%GNU_HOST%%-gfortran%%SUFFIX%%
bin/c++%%SUFFIX%%
bin/cpp%%SUFFIX%%
bin/g++%%SUFFIX%%
@@ -16,7 +16,7 @@
bin/gcov%%SUFFIX%%
bin/gcov-dump%%SUFFIX%%
bin/gcov-tool%%SUFFIX%%
-bin/gfortran%%SUFFIX%%
+%%FORTRAN%%bin/gfortran%%SUFFIX%%
man/man1/cpp%%SUFFIX%%.1.gz
man/man1/g++%%SUFFIX%%.1.gz
man/man1/gcc%%SUFFIX%%.1.gz
@@ -23,7 +23,7 @@
man/man1/gcov%%SUFFIX%%.1.gz
man/man1/gcov-dump%%SUFFIX%%.1.gz
man/man1/gcov-tool%%SUFFIX%%.1.gz
-man/man1/gfortran%%SUFFIX%%.1.gz
+%%FORTRAN%%man/man1/gfortran%%SUFFIX%%.1.gz
share/gcc-%%GCC_VERSION%%/python/libstdcxx/__init__.py
share/gcc-%%GCC_VERSION%%/python/libstdcxx/v6/__init__.py
share/gcc-%%GCC_VERSION%%/python/libstdcxx/v6/printers.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment