pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk/compiler Support a new variable in package Makefiles:
details: https://anonhg.NetBSD.org/pkgsrc/rev/0c304c840cf9
branches: trunk
changeset: 467521:0c304c840cf9
user: jlam <jlam%pkgsrc.org@localhost>
date: Mon Feb 02 10:03:46 2004 +0000
description:
Support a new variable in package Makefiles:
USE_LANGUAGES
Lists the languages used in the source code of the package,
and is used to determine the correct compilers to install.
Valid values are: c, c++, fortran, java, objc. The default
is "c".
Packages that don't need any compilers and set this variable to an
empty value, e.g. "USE_LANGUAGES=".
This can probably be combined in some smart way with setting
USE_GCC_SHLIBS and USE_FORTRAN automatically.
diffstat:
mk/compiler/bsd.compiler.mk | 13 ++++++++++-
mk/compiler/ccache.mk | 28 ++++++++++++++++++++++---
mk/compiler/distcc.mk | 27 ++++++++++++++++++++++---
mk/compiler/gcc.mk | 47 ++++++++++++++++++++++++++++----------------
mk/compiler/mipspro.mk | 16 ++++++++++++++-
mk/compiler/sunpro.mk | 16 ++++++++++++++-
6 files changed, 118 insertions(+), 29 deletions(-)
diffs (truncated from 306 to 300 lines):
diff -r 71218be74615 -r 0c304c840cf9 mk/compiler/bsd.compiler.mk
--- a/mk/compiler/bsd.compiler.mk Mon Feb 02 09:30:15 2004 +0000
+++ b/mk/compiler/bsd.compiler.mk Mon Feb 02 10:03:46 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.compiler.mk,v 1.4 2004/02/01 11:14:04 jlam Exp $
+# $NetBSD: bsd.compiler.mk,v 1.5 2004/02/02 10:03:46 jlam Exp $
#
# This Makefile fragment implements handling for supported C/C++/Fortran
# compilers.
@@ -19,7 +19,8 @@
#
# The default is "gcc". You can use ccache and/or distcc with an
# appropriate PKGSRC_COMPILER setting, e.g. "ccache distcc gcc".
-# The chain should always end in a real compiler.
+# The chain should always end in a real compiler. This should only
+# be set in /etc/mk.conf.
#
# GCC_REQD
# A list of version numbers used to determine the minimum
@@ -39,6 +40,12 @@
# Indicates that a package uses GCC shared libraries, so we
# register a runtime dependency on the compiler package.
#
+# USE_LANGUAGES
+# Lists the languages used in the source code of the package,
+# and is used to determine the correct compilers to install.
+# Valid values are: c, c++, fortran, java, objc. The default
+# is "c".
+#
# The following variables are defined, and available for testing in
# package Makefiles:
#
@@ -58,6 +65,8 @@
.if !defined(BSD_COMPILER_MK)
BSD_COMPILER_MK= defined
+USE_LANGUAGES?= c
+
# Support some deprecated variables for a while. They'll be removed
# after the pkgsrc-2004Q1 branch is cut.
#
diff -r 71218be74615 -r 0c304c840cf9 mk/compiler/ccache.mk
--- a/mk/compiler/ccache.mk Mon Feb 02 09:30:15 2004 +0000
+++ b/mk/compiler/ccache.mk Mon Feb 02 10:03:46 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ccache.mk,v 1.2 2004/02/01 01:33:06 jlam Exp $
+# $NetBSD: ccache.mk,v 1.3 2004/02/02 10:03:46 jlam Exp $
.if !defined(COMPILER_CCACHE_MK)
COMPILER_CCACHE_MK= defined
@@ -12,6 +12,19 @@
_USE_CCACHE= NO
.endif
+# LANGUAGES.<compiler> is the list of supported languages by the compiler.
+# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones
+# requested by the package in USE_LANGUAGES.
+#
+LANGUAGES.ccache= c c++
+_LANGUAGES.ccache= # empty
+.for _lang_ in ${USE_LANGUAGES}
+_LANGUAGES.ccache= ${LANGUAGES.ccache:M${_lang_}}
+.endfor
+.if empty(_LANGUAGES.ccache)
+_USE_CCACHE= NO
+.endif
+
.if !defined(_USE_CCACHE)
_USE_CCACHE= YES
.endif
@@ -30,10 +43,17 @@
_CCACHE_DIR= ${WRKDIR}/.ccache
PATH:= ${_CCACHE_DIR}/bin:${PATH}
-CC:= ${_CCACHE_DIR}/bin/${CC:T}
-CXX:= ${_CCACHE_DIR}/bin/${CXX:T}
+_CCACHE_LINKS= # empty
+.if !empty(_LANGUAGES.ccache:Mc)
+CC:= ${_CCACHE_DIR}/bin/${CC:T}
+_CCACHE_LINKS+= CC
+.endif
+.if !empty(_LANGUAGES.ccache:Mc++)
+CXX:= ${_CCACHE_DIR}/bin/${CXX:T}
+_CCACHE_LINKS+= CXX
+.endif
-. for _target_ in CC CXX
+. for _target_ in ${_CCACHE_LINKS}
override-tools: ${${_target_}}
${${_target_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
diff -r 71218be74615 -r 0c304c840cf9 mk/compiler/distcc.mk
--- a/mk/compiler/distcc.mk Mon Feb 02 09:30:15 2004 +0000
+++ b/mk/compiler/distcc.mk Mon Feb 02 10:03:46 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: distcc.mk,v 1.2 2004/02/01 01:33:06 jlam Exp $
+# $NetBSD: distcc.mk,v 1.3 2004/02/02 10:03:46 jlam Exp $
.if !defined(COMPILER_DISTCC_MK)
COMPILER_DISTCC_MK= defined
@@ -12,6 +12,19 @@
_USE_DISTCC= NO
.endif
+# LANGUAGES.<compiler> is the list of supported languages by the compiler.
+# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones
+# requested by the package in USE_LANGUAGES.
+#
+LANGUAGES.distcc= c c++
+_LANGUAGES.distcc= # empty
+.for _lang_ in ${USE_LANGUAGES}
+_LANGUAGES.distcc= ${LANGUAGES.distcc:M${_lang_}}
+.endfor
+.if empty(_LANGUAGES.distcc)
+_USE_CCACHE= NO
+.endif
+
.if !defined(_USE_DISTCC)
_USE_DISTCC= YES
.endif
@@ -30,10 +43,16 @@
_DISTCC_DIR= ${WRKDIR}/.distcc
PATH:= ${_DISTCC_DIR}/bin:${PATH}
-CC:= ${_DISTCC_DIR}/bin/${CC:T}
-CXX:= ${_DISTCC_DIR}/bin/${CXX:T}
+.if !empty(_LANGUAGES:distcc:Mc)
+CC:= ${_DISTCC_DIR}/bin/${CC:T}
+_DISTCC_LINKS+= CC
+.endif
+.if !empty(_LANGUAGES:distcc:Mc++)
+CXX:= ${_DISTCC_DIR}/bin/${CXX:T}
+_DISTCC_LINKS+= CXX
+.endif
-. for _target_ in CC CXX
+. for _target_ in ${_DISTCC_LINKS}
override-tools: ${${_target_}}
${${_target_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
diff -r 71218be74615 -r 0c304c840cf9 mk/compiler/gcc.mk
--- a/mk/compiler/gcc.mk Mon Feb 02 09:30:15 2004 +0000
+++ b/mk/compiler/gcc.mk Mon Feb 02 10:03:46 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.7 2004/02/01 14:36:23 jlam Exp $
+# $NetBSD: gcc.mk,v 1.8 2004/02/02 10:03:46 jlam Exp $
.if !defined(COMPILER_GCC_MK)
COMPILER_GCC_MK= defined
@@ -76,43 +76,54 @@
_GCC3_REQD:= ${_GCC_REQD}
. endif
.endfor
+
.if defined(_GCC2_REQD)
+#
+# We require gcc-2.x in the lang/gcc directory.
+#
_GCC_REQD:= ${_GCC2_REQD}
_GCC_PKGBASE= gcc
+LANGUAGES.gcc= c c++ fortran objc
+_LANGUAGES.gcc= # empty
+. for _lang_ in ${USE_LANGUAGES}
+_LANGUAGES.gcc= ${LANGUAGES.gcc:M${_lang_}}
+. endfor
. if !empty(PKGPATH:Mlang/gcc)
_IGNORE_GCC= yes
MAKEFLAGS+= _IGNORE_GCC=yes
-. else
+. elif !empty(_LANGUAGES.gcc)
_GCC_PKGSRCDIR= ../../lang/gcc
_GCC_DEPENDENCY= gcc>=${_GCC_REQD}:../../lang/gcc
. endif
.elif defined(_GCC3_REQD)
+#
+# We require gcc-3.x in the lang/gcc3-* directories.
+#
_GCC_REQD:= ${_GCC3_REQD}
_GCC_PKGBASE= gcc3-c
+LANGUAGES.gcc= c c++ fortran java objc
+_LANGUAGES.gcc= # empty
+. for _lang_ in ${USE_LANGUAGES}
+_LANGUAGES.gcc= ${LANGUAGES.gcc:M${_lang_}}
+. endfor
. if !empty(PKGPATH:Mlang/gcc3-c)
_IGNORE_GCC3C= yes
MAKEFLAGS+= _IGNORE_GCC3C=yes
-. else
+. elif !empty(_LANGUAGES.gcc:Mc)
_GCC_PKGSRCDIR= ../../lang/gcc3-c
_GCC_DEPENDENCY= gcc3-c>=${_GCC_REQD}:../../lang/gcc3-c
. endif
-. if !empty(PKGPATH:Mlang/gcc3-c) || \
- !empty(PKGPATH:Mlang/gcc3-c++) || \
- !empty(PKGPATH:Mlang/gcc3-f77) || \
- !defined(USE_CXX)
+. if !empty(PKGPATH:Mlang/gcc3-c++)
_IGNORE_GCC3CXX= yes
MAKEFLAGS+= _IGNORE_GCC3CXX=yes
-. else
+. elif !empty(_LANGUAGES.gcc:Mc++)
_GCC_PKGSRCDIR+= ../../lang/gcc3-c++
_GCC_DEPENDENCY+= gcc3-c++>=${_GCC_REQD}:../../lang/gcc3-c++
. endif
-. if !empty(PKGPATH:Mlang/gcc3-c) || \
- !empty(PKGPATH:Mlang/gcc3-c++) || \
- !empty(PKGPATH:Mlang/gcc3-f77) || \
- !defined(USE_FORTRAN)
+. if !empty(PKGPATH:Mlang/gcc3-f77)
_IGNORE_GCC3F77= yes
MAKEFLAGS+= _IGNORE_GCC3F77=yes
-. else
+. elif !empty(_LANGUAGES.gcc:Mfortran)
_GCC_PKGSRCDIR+= ../../lang/gcc3-f77
_GCC_DEPENDENCY+= gcc3-f77>=${_GCC_REQD}:../../lang/gcc3-f77
. endif
@@ -218,17 +229,19 @@
# GCC executables.
#
.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
-. if exists(${_GCC_PREFIX}bin/gcc)
+. if exists(${_GCC_PREFIX}bin/gcc) && !empty(_LANGUAGES.gcc)
PATH:= ${_GCC_PREFIX}bin:${PATH}
+. endif
+. if exists(${_GCC_PREFIX}bin/gcc) && !empty(_LANGUAGES.gcc:Mc)
CC= ${_GCC_PREFIX}bin/gcc
. endif
-. if exists(${_GCC_PREFIX}bin/cpp)
+. if exists(${_GCC_PREFIX}bin/cpp) && !empty(_LANGUAGES.gcc:Mc)
CPP= ${_GCC_PREFIX}bin/cpp
. endif
-. if exists(${_GCC_PREFIX}bin/g++)
+. if exists(${_GCC_PREFIX}bin/g++) && !empty(_LANGUAGES.gcc:Mc++)
CXX= ${_GCC_PREFIX}bin/g++
. endif
-. if exists(${_GCC_PREFIX}bin/g77)
+. if exists(${_GCC_PREFIX}bin/g77) && !empty(_LANGUAGES.gcc:Mfortran)
F77= ${_GCC_PREFIX}bin/g77
PKG_FC:= ${F77}
. endif
diff -r 71218be74615 -r 0c304c840cf9 mk/compiler/mipspro.mk
--- a/mk/compiler/mipspro.mk Mon Feb 02 09:30:15 2004 +0000
+++ b/mk/compiler/mipspro.mk Mon Feb 02 10:03:46 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mipspro.mk,v 1.4 2004/02/01 01:03:22 jlam Exp $
+# $NetBSD: mipspro.mk,v 1.5 2004/02/02 10:03:46 jlam Exp $
.if !defined(COMPILER_MIPSPRO_MK)
COMPILER_MIPSPRO_MK= defined
@@ -6,9 +6,23 @@
MIPSPROBASE?= /usr
PATH:= ${MIPSPROBASE}/bin:${PATH}
+# LANGUAGES.<compiler> is the list of supported languages by the compiler.
+# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones
+# requested by the package in USE_LANGUAGES.
+#
+LANGUAGES.mipspro= c c++
+_LANGUAGES.mipspro= # empty
+.for _lang_ in ${USE_LANGUAGES}
+_LANGUAGES.mipspro= ${LANGUAGES.mipspro:M${_lang_}}
+.endfor
+
+.if !empty(_LANGUAGES.mipspro:Mc)
CC= ${MIPSPROBASE}/bin/cc
CPP= ${MIPSPROBASE}/bin/cc -E
+.endif
+.if !empty(_LANGUAGES.mipspro:Mc++)
CXX= ${MIPSPROBASE}/bin/CC
+.endif
CC_VERSION!= ${CC} -V 2>&1 | ${GREP} '^cc'
diff -r 71218be74615 -r 0c304c840cf9 mk/compiler/sunpro.mk
--- a/mk/compiler/sunpro.mk Mon Feb 02 09:30:15 2004 +0000
+++ b/mk/compiler/sunpro.mk Mon Feb 02 10:03:46 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: sunpro.mk,v 1.2 2004/02/01 00:57:26 jlam Exp $
+# $NetBSD: sunpro.mk,v 1.3 2004/02/02 10:03:46 jlam Exp $
.if !defined(COMPILER_SUNPRO_MK)
COMPILER_SUNPRO_MK= defined
@@ -6,9 +6,23 @@
SUNWSPROBASE?= /opt/SUNWspro
PATH:= ${SUNWSPROBASE}/bin:${PATH}
+# LANGUAGES.<compiler> is the list of supported languages by the compiler.
+# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones
+# requested by the package in USE_LANGUAGES.
+#
+LANGUAGES.sunpro= c c++
+_LANGUAGES.sunpro= # empty
+.for _lang_ in ${USE_LANGUAGES}
+_LANGUAGES.sunpro= ${LANGUAGES.sunpro:M${_lang_}}
+.endfor
+
+.if !empty(_LANGUAGES.sunpro:Mc)
CC= ${SUNWSPROBASE}/bin/cc
CPP= ${SUNWSPROBASE}/bin/cc -E
+.endif
Home |
Main Index |
Thread Index |
Old Index