pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk/compiler



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Wed Oct 18 08:48:51 UTC 2023

Modified Files:
        pkgsrc/mk/compiler: clang.mk

Log Message:
mk/compiler: Improve clang CC_VERSION setting.

Use -dumpversion, supported in all modern versions, rather than digging out the
version with sed.  Allow CC_VERSION to be preset by the user, and set the
obsolete CC_VERSION_STRING variable to be the same as CC_VERSION rather than
setting it to the verbose version output.

Default to "clang-0" rather than just "clang" if CCPATH is not available so
that matching elsewhere can be more uniform.

With CC_VERSION preset this improves speed of 'make pbulk-index' in simple
packages by around 30%, and reduces system time by 50%.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 pkgsrc/mk/compiler/clang.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/compiler/clang.mk
diff -u pkgsrc/mk/compiler/clang.mk:1.41 pkgsrc/mk/compiler/clang.mk:1.42
--- pkgsrc/mk/compiler/clang.mk:1.41    Sat Jul 29 17:55:47 2023
+++ pkgsrc/mk/compiler/clang.mk Wed Oct 18 08:48:51 2023
@@ -1,4 +1,4 @@
-# $NetBSD: clang.mk,v 1.41 2023/07/29 17:55:47 nia Exp $
+# $NetBSD: clang.mk,v 1.42 2023/10/18 08:48:51 jperkin Exp $
 #
 # This is the compiler definition for the clang compiler.
 #
@@ -39,14 +39,20 @@ CPPPATH=            ${CLANGBASE}/bin/clang-cpp
 PKG_CPP:=              ${CPPPATH}
 .endif
 
-.if exists(${CCPATH})
-CC_VERSION_STRING!=    ${CCPATH} -v 2>&1
-CC_VERSION!=           ${CCPATH} --version 2>&1 | ${SED} -n "s/^.* version /clang-/p"
-.else
-CC_VERSION_STRING?=    ${CC_VERSION}
-CC_VERSION?=           clang
+.if !defined(CC_VERSION)
+.  if exists(${CCPATH})
+CLANG_VERSION!=                ${CCPATH} -dumpversion 2>&1 || ${ECHO} 0
+.  else
+CLANG_VERSION=         0
+.  endif
+CC_VERSION=            clang-${CLANG_VERSION}
 .endif
 
+#
+# TODO: CC_VERSION_STRING is obsolete and should be removed at some point.
+#
+CC_VERSION_STRING=     ${CC_VERSION}
+
 _COMPILER_ABI_FLAG.32= -m32
 _COMPILER_ABI_FLAG.64= -m64
 



Home | Main Index | Thread Index | Old Index