tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: First go at adding GCC_VERSIONS_ACCEPTED support



Perhaps I should have come up with a better subject line when I started this because here's my second attempt at *not* adding GCC_VERSIONS_ACCEPTED support, but instead just seeing if there are any gcc versions installed that are equal to or greater than GCC_REQD and if there is, it uses the highest version available.

At the moment I haven't considered GCC_VERSIONS_INCOMPATIBLE, but I would be able to extend this approach to work in that way. And also, I think this will always override the system GCC, which is wrong.

At this point I should point out that my coding is running quite delayed to the discussion so I know this approach is out dated already. I'll get onto the PKGSRC_GCC_MIN idea next; I'm still learning exactly how gcc.mk, etc works so I need to play about like this to learn.
$NetBSD$

--- gcc.mk.orig	2015-10-04 14:27:18.000000000 +0000
+++ gcc.mk
@@ -226,6 +226,31 @@ _GCC_STRICTEST_REQD=	${_version_}
 .endfor
 _GCC_REQD=	${_GCC_STRICTEST_REQD}
 
+
+#See if a gcc version greater than or equal to the required is available, if there is get the maximum
+_GCC_PKG_SATISFIES_DEP=     NO
+_GCC_PKG_VERSIONS_INSTALLED!= ${PKG_INFO} -I 'gcc*' | cut -f 1 -d " " | ${GREP} -E "^gcc[0-9]+-[0-9nb.]+"
+_GCC_PKG_VERSION= 1
+.for _gcc_pkg_version_ in ${_GCC_PKG_VERSIONS_INSTALLED}
+    _GCC_PKG_NUMBER!= ${ECHO} ${_gcc_pkg_version_} | ${SED} -e "s/gcc\([0-9][0-9]*\)\-.*/\1/"
+    _GCC_REQD_NUMBER!= ${ECHO} ${_GCC_REQD} | ${SED} -e "s/\\.//"
+    _GCC_PKG_SATISFIES_DEP!=    \
+		if [ ${_GCC_PKG_NUMBER} -ge ${_GCC_REQD_NUMBER} ] && [ ${_GCC_PKG_NUMBER} -gt ${_GCC_PKG_VERSION} ]; then \
+			${ECHO} "YES";                      \
+		else                                \
+			${ECHO} "NO";                       \
+		fi
+.   if !empty(_GCC_PKG_SATISFIES_DEP:M[yY][eE][sS])
+        _GCC_PKG_VERSION= ${_GCC_PKG_NUMBER}
+.   endif
+.endfor
+#Only override _GCC_REQD if we've found a match
+.if ${_GCC_PKG_VERSION} != 1
+    _GCC_REQD!= ${ECHO}  ${_GCC_PKG_VERSION} | ${SED} -e "s/\([0-9]\)\([0-9]\)/\1\.\2/"
+.endif
+
+
+
 # Determine whether we require GCC-2.x or GCC-3.x by examining _GCC_REQD.
 _NEED_GCC2?=	no
 .for _pattern_ in ${_GCC2_PATTERNS}


Home | Main Index | Thread Index | Old Index