summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-02-02 10:03:46 +0000
committerjlam <jlam@pkgsrc.org>2004-02-02 10:03:46 +0000
commit5fd456227c149e155d65e6fde2d654508d73e11b (patch)
treee2e3af98911ed47bc54396ea26ce2200bee342f5
parentd1ec981c1a4324fd2631673c2c3f637292e935ff (diff)
downloadpkgsrc-5fd456227c149e155d65e6fde2d654508d73e11b.tar.gz
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.
-rw-r--r--mk/compiler/bsd.compiler.mk13
-rw-r--r--mk/compiler/ccache.mk28
-rw-r--r--mk/compiler/distcc.mk27
-rw-r--r--mk/compiler/gcc.mk47
-rw-r--r--mk/compiler/mipspro.mk16
-rw-r--r--mk/compiler/sunpro.mk16
6 files changed, 118 insertions, 29 deletions
diff --git a/mk/compiler/bsd.compiler.mk b/mk/compiler/bsd.compiler.mk
index 01b6266b7b6..82f45347449 100644
--- a/mk/compiler/bsd.compiler.mk
+++ b/mk/compiler/bsd.compiler.mk
@@ -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 --git a/mk/compiler/ccache.mk b/mk/compiler/ccache.mk
index cd5cbd18412..b938321146f 100644
--- a/mk/compiler/ccache.mk
+++ b/mk/compiler/ccache.mk
@@ -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 @@ MAKEFLAGS+= IGNORE_CCACHE=yes
_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 @@ _CCACHEBASE?= ${LOCALBASE}
_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 --git a/mk/compiler/distcc.mk b/mk/compiler/distcc.mk
index f32af1ba352..dc44821b707 100644
--- a/mk/compiler/distcc.mk
+++ b/mk/compiler/distcc.mk
@@ -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 @@ MAKEFLAGS+= IGNORE_DISTCC=yes
_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 @@ _DISTCCBASE?= ${LOCALBASE}
_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 --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk
index 5c25d21a615..be3b9a7a52f 100644
--- a/mk/compiler/gcc.mk
+++ b/mk/compiler/gcc.mk
@@ -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 @@ _GCC2_REQD:= ${_GCC_REQD}
_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 @@ BUILD_DEPENDS+= ${_GCC_DEPENDENCY}
# 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 --git a/mk/compiler/mipspro.mk b/mk/compiler/mipspro.mk
index 13b21b3a3d7..b118dd7b311 100644
--- a/mk/compiler/mipspro.mk
+++ b/mk/compiler/mipspro.mk
@@ -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 @@ COMPILER_MIPSPRO_MK= defined
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 --git a/mk/compiler/sunpro.mk b/mk/compiler/sunpro.mk
index c34d0eefc7e..e7b9f839918 100644
--- a/mk/compiler/sunpro.mk
+++ b/mk/compiler/sunpro.mk
@@ -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 @@ COMPILER_SUNPRO_MK= defined
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
+.if !empty(_LANGUAGES.sunpro:Mc++)
CXX= ${SUNWSPROBASE}/bin/CC
+.endif
_COMPILER_LD_FLAG= # empty