summaryrefslogtreecommitdiff
path: root/mk/compiler
diff options
context:
space:
mode:
authorgutteridge <gutteridge@pkgsrc.org>2022-05-28 02:31:47 +0000
committergutteridge <gutteridge@pkgsrc.org>2022-05-28 02:31:47 +0000
commita230f1debf22bfcc4149e7ec6303e0cd5c8ac753 (patch)
treeaaf1b4db7913676c1c7df3941d336aa49e6abf38 /mk/compiler
parent4a4530d4026690c87c72be36a53081dd66ba8647 (diff)
downloadpkgsrc-a230f1debf22bfcc4149e7ec6303e0cd5c8ac753.tar.gz
gcc.mk: restore GCC 6 handling
This is partly intended as a workaround to fix behaviour on NetBSD 8.x where GCC 7 was being pulled in universally after the prior commits here. Now it behaves as expected. There is an unaddressed issue in this code that needs to be examined further. (This has been discussed in more than one recent thread on teck-pkg@, including John Klos's report of this issue.) In any case, GCC 6 has also seen build improvements by nia@, who noted it's safe to simply revert part of the original change set, in one of those discussions on tech-pkg. (We can't use the hack introduced in the prior revisions for GCC 6, though, or this same broken dependency pattern occurs and will universally force GCC 6 instead of 7 on NetBSD 8.x.) Tested on NetBSD 8.2_STABLE and 9.2_STABLE with various packages, including tcsh, the original reported issue.
Diffstat (limited to 'mk/compiler')
-rw-r--r--mk/compiler/gcc.mk57
1 files changed, 49 insertions, 8 deletions
diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk
index cdf663ca7ea..b82ad5d8228 100644
--- a/mk/compiler/gcc.mk
+++ b/mk/compiler/gcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.241 2022/05/21 09:26:50 nia Exp $
+# $NetBSD: gcc.mk,v 1.242 2022/05/28 02:31:47 gutteridge Exp $
#
# This is the compiler definition for the GNU Compiler Collection.
#
@@ -94,7 +94,7 @@ _DEF_VARS.gcc= \
_IS_BUILTIN_GCC \
_LANGUAGES.gcc \
_LINKER_RPATH_FLAG \
- _NEED_GCC7 _NEED_GCC8 _NEED_GCC9 \
+ _NEED_GCC6 _NEED_GCC7 _NEED_GCC8 _NEED_GCC9 \
_NEED_GCC10 \
_NEED_GCC_AUX _NEED_NEWER_GCC \
_PKGSRC_GCC_VERSION \
@@ -125,7 +125,7 @@ _USE_VARS.gcc= \
_PKGSRC_USE_FORTIFY _PKGSRC_USE_RELRO _PKGSRC_USE_STACK_CHECK \
_OPSYS_INCLUDE_DIRS _OPSYS_LIB_DIRS
_IGN_VARS.gcc= \
- _GCC7_PATTERNS _GCC8_PATTERNS _GCC9_PATTERNS \
+ _GCC6_PATTERNS _GCC7_PATTERNS _GCC8_PATTERNS _GCC9_PATTERNS \
_GCC10_PATTERNS _GCC_AUX_PATTERNS
_LISTED_VARS.gcc= \
MAKEFLAGS IMAKEOPTS LDFLAGS PREPEND_PATH
@@ -154,8 +154,11 @@ _GCC_DIST_NAME:= gcc10
.include "../../lang/${_GCC_DIST_NAME}/version.mk"
_GCC_DIST_VERSION:= ${${_GCC_DIST_NAME:tu}_DIST_VERSION}
+# _GCC6_PATTERNS matches N s.t. N < 7.
+_GCC6_PATTERNS= 5 6 [0-6].*
+
# _GCC7_PATTERNS matches N s.t. 7.0 <= N < 8.
-_GCC7_PATTERNS= 5 6 [0-6].* 7 7.*
+_GCC7_PATTERNS= 7 7.*
# _GCC8_PATTERNS matches N s.t. 8.0 <= N < 9.
_GCC8_PATTERNS= 8 8.*
@@ -269,6 +272,18 @@ _GCC_STRICTEST_REQD= ${_version_}
_GCC_REQD= ${_GCC_STRICTEST_REQD}
# Determine which GCC version is required by examining _GCC_REQD.
+_NEED_GCC6?= no
+.for _pattern_ in ${_GCC6_PATTERNS}
+. if !empty(_GCC_REQD:M${_pattern_})
+# XXX this won't work without adjustments elsewhere because of how
+# _GCC_REQD is processed.
+#. if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} < 089937
+#USE_PKGSRC_GCC= yes
+#USE_PKGSRC_GCC_RUNTIME= yes
+#. endif
+_NEED_GCC6= yes
+. endif
+.endfor
_NEED_GCC7?= no
.for _pattern_ in ${_GCC7_PATTERNS}
. if !empty(_GCC_REQD:M${_pattern_})
@@ -316,7 +331,7 @@ _NEED_GCC_AUX= yes
_NEED_NEWER_GCC=NO
. endif
.endfor
-.if !empty(_NEED_GCC7:M[nN][oO]) && \
+.if !empty(_NEED_GCC6:M[nN][oO]) && !empty(_NEED_GCC7:M[nN][oO]) && \
!empty(_NEED_GCC8:M[nN][oO]) && !empty(_NEED_GCC9:M[nN][oO]) && \
!empty(_NEED_GCC10:M[nN][oO]) && \
!empty(_NEED_GCC_AUX:M[nN][oO])
@@ -327,6 +342,7 @@ _NEED_GCC8= yes
.if !empty(MACHINE_PLATFORM:MNetBSD-*-earm*) && \
${OPSYS_VERSION} < 099900 && \
(${_NEED_GCC8:tl} == "yes" || ${_NEED_GCC9:tl} == "yes")
+_NEED_GCC6= no
_NEED_GCC7= no
_NEED_GCC8= no
_NEED_GCC9= no
@@ -335,7 +351,9 @@ _NEED_GCC10= yes
# Assume by default that GCC will only provide a C compiler.
LANGUAGES.gcc?= c
-.if !empty(_NEED_GCC7:M[yY][eE][sS])
+.if !empty(_NEED_GCC6:M[yY][eE][sS])
+LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++
+.elif !empty(_NEED_GCC7:M[yY][eE][sS])
LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++
.elif !empty(_NEED_GCC8:M[yY][eE][sS])
LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++
@@ -430,7 +448,28 @@ CFLAGS+= -Wno-import
CFLAGS+= ${_GCC_CFLAGS}
FCFLAGS+= ${_GCC_FCFLAGS}
-.if !empty(_NEED_GCC7:M[yY][eE][sS])
+.if !empty(_NEED_GCC6:M[yY][eE][sS])
+#
+# We require gcc-6.x in the lang/gcc6-* directory.
+#
+_GCC_PKGBASE= gcc6
+. if ${PKGPATH} == lang/gcc6
+_IGNORE_GCC= yes
+MAKEFLAGS+= _IGNORE_GCC=yes
+. endif
+. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
+_GCC_PKGSRCDIR= ../../lang/gcc6
+_GCC_DEPENDENCY= gcc6>=${_GCC_REQD}:../../lang/gcc6
+. if !empty(_LANGUAGES.gcc:Mc++) || \
+ !empty(_LANGUAGES.gcc:Mfortran) || \
+ !empty(_LANGUAGES.gcc:Mfortran77) || \
+ !empty(_LANGUAGES.gcc:Mgo) || \
+ !empty(_LANGUAGES.gcc:Mobjc) || \
+ !empty(_LANGUAGES.gcc:Mobj-c++)
+_USE_GCC_SHLIB?= yes
+. endif
+. endif
+.elif !empty(_NEED_GCC7:M[yY][eE][sS])
#
# We require gcc-7.x in the lang/gcc7-* directory.
#
@@ -829,7 +868,9 @@ PREPEND_PATH+= ${_GCC_DIR}/bin
. if ${PKGPATH} != devel/libtool-base && ${PKGPATH} != devel/binutils && \
empty(PKGPATH:Mlang/gcc4?) && empty(PKGPATH:Mlang/gcc[5-9]) && \
empty(PKGPATH:Mlang/gcc10)
-. if !empty(_GCC_PKGBASE:Mgcc7)
+. if !empty(_GCC_PKGBASE:Mgcc6)
+. include "../../lang/gcc6-libs/buildlink3.mk"
+. elif !empty(_GCC_PKGBASE:Mgcc7)
. include "../../lang/gcc7-libs/buildlink3.mk"
. elif !empty(_GCC_PKGBASE:Mgcc8)
. include "../../lang/gcc8-libs/buildlink3.mk"