Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk mk/compiler.mk: check for too late GCC_REQD and USE...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/66264f3d5490
branches:  trunk
changeset: 433402:66264f3d5490
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Jun 02 06:58:13 2020 +0000

description:
mk/compiler.mk: check for too late GCC_REQD and USE_LANGUAGES

For USE_LANGUAGES there is already a pkglint warning, but for GCC_REQD it
is missing.  It's better to have this check directly in the
infrastructure since it is more reliable.

This check is disabled by default, to not cause any new breakage.
It should be enabled in bulk builds.

diffstat:

 mk/compiler.mk     |  18 +++++++++++++++++-
 mk/compiler/gcc.mk |   5 ++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r dd25a81295b3 -r 66264f3d5490 mk/compiler.mk
--- a/mk/compiler.mk    Tue Jun 02 06:45:26 2020 +0000
+++ b/mk/compiler.mk    Tue Jun 02 06:58:13 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: compiler.mk,v 1.94 2019/07/23 13:57:04 gdt Exp $
+# $NetBSD: compiler.mk,v 1.95 2020/06/02 06:58:13 rillig Exp $
 #
 # This Makefile fragment implements handling for supported C/C++/Fortran
 # compilers.
@@ -37,6 +37,10 @@
 #      If set to yes, use symlinks for the compiler drivers, otherwise
 #      shell scripts are created.  The default is yes.
 #
+# CHECK_COMPILER
+#      If set to yes, fail early if the compiler.mk variables are not
+#      set correctly.
+#
 # The following variables may be set by a package:
 #
 # USE_LANGUAGES
@@ -90,6 +94,9 @@
 .  endif
 .endfor
 
+#.READONLY: USE_LANGUAGES
+_USE_LANGUAGES_EFFECTIVE:=     ${USE_LANGUAGES}
+
 COMPILER_USE_SYMLINKS?=        yes
 
 _COMPILERS=            ccc clang gcc hp icc ido \
@@ -265,3 +272,12 @@
 .endif
 
 .endif # BSD_COMPILER_MK
+
+.if ${CHECK_COMPILER:Uno:tl} == yes
+.  if ${USE_LANGUAGES:O:u} != ${_USE_LANGUAGES_EFFECTIVE:O:u}
+.warning For ${PKGPATH}, only languages "${_USE_LANGUAGES_EFFECTIVE}" are used, the others in "${USE_LANGUAGES}" were defined too late.
+.  endif
+.  if ${GCC_REQD:U:O:u} != ${_GCC_REQD_EFFECTIVE:U:O:u}
+.warning For ${PKGPATH}, only GCC_REQD "${_GCC_REQD_EFFECTIVE}" are used, the others in "${GCC_REQD}" were defined too late.
+.  endif
+.endif
diff -r dd25a81295b3 -r 66264f3d5490 mk/compiler/gcc.mk
--- a/mk/compiler/gcc.mk        Tue Jun 02 06:45:26 2020 +0000
+++ b/mk/compiler/gcc.mk        Tue Jun 02 06:58:13 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.212 2020/05/31 00:00:13 sjmulder Exp $
+# $NetBSD: gcc.mk,v 1.213 2020/06/02 06:58:13 rillig Exp $
 #
 # This is the compiler definition for the GNU Compiler Collection.
 #
@@ -1070,4 +1070,7 @@
 COMPILER_LIB_DIRS=     ${_GCCBINDIR:H}/lib ${_OPSYS_LIB_DIRS}
 .endif
 
+#.READONLY: GCC_REQD
+_GCC_REQD_EFFECTIVE:=  ${GCC_REQD}
+
 .endif # COMPILER_GCC_MK



Home | Main Index | Thread Index | Old Index