diff options
author | jlam <jlam@pkgsrc.org> | 2005-01-12 15:31:58 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2005-01-12 15:31:58 +0000 |
commit | b6b853727dc16c84fba65c5d610f333d83e309ff (patch) | |
tree | c0c77d22dc6d7622e4196a9cf79e6fc77ed93ceb /mk | |
parent | 98d6a371a10bb43601330b19f60f71ceb54ac6d2 (diff) | |
download | pkgsrc-b6b853727dc16c84fba65c5d610f333d83e309ff.tar.gz |
Nuke USE_FORTRAN and bring the f2c handling within the mk/compiler
framework. The list of changes include:
* Modify compiler.mk so that "c" is always prepended to USE_LANGUAGES,
so we no longer need to say it in package Makefiles. Packages
should now append to USE_LANGUAGES instead of setting it.
* Create mk/compiler/f2c.mk which implements another pseudo-compiler
"f2c" that may be used with any C compiler backend, e.g.
PKGSRC_COMPILER= f2c ccache gcc
* Teach the various "real" compiler files, e.g., sunpro.mk, mipspro.mk,
etc., to use f2c if the native Fortran compiler isn't present.
Packages that use Fortran should now simply include the line:
USE_LANGUAGES+= fortran
in the package Makefile.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.mk | 40 | ||||
-rw-r--r-- | mk/compiler.mk | 23 | ||||
-rw-r--r-- | mk/compiler/ccc.mk | 12 | ||||
-rw-r--r-- | mk/compiler/f2c.mk | 93 | ||||
-rw-r--r-- | mk/compiler/gcc.mk | 19 | ||||
-rw-r--r-- | mk/compiler/mipspro.mk | 12 | ||||
-rw-r--r-- | mk/compiler/sunpro.mk | 12 | ||||
-rw-r--r-- | mk/compiler/xlc.mk | 12 |
8 files changed, 179 insertions, 44 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 095ee320003..ccc1ec26c69 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1556 2005/01/11 20:09:14 jmmv Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1557 2005/01/12 15:32:01 jlam Exp $ # # This file is in the public domain. # @@ -341,34 +341,6 @@ MAKEFLAGS+= PERL5_ARCHLIB=${PERL5_ARCHLIB:Q} . endif # !defined(PERL5_*) .endif # USE_PERL5 == run -.if defined(USE_FORTRAN) -. if !exists(/usr/bin/f77) -PKG_FC?= f2c-f77 -. endif -# it is anticipated that once /usr/bin/f77 is more stable that the following -# default will be changed to f77. However, in the case where there is no -# /usr/bin/f77, the default will remain as f2c-f77. -.for __tmp__ in 1.[5-9]* [2-9].* -. if ${MACHINE_PLATFORM:MNetBSD-${__tmp__}-*} != "" -PKG_FC?= f77 -. endif # MACHINE_PLATFORM -.endfor # __tmp__ -PKG_FC?= f2c-f77 -. if (${PKG_FC} == "f2c-f77") -# this is a DEPENDS not BUILD_DEPENDS because of the -# shared Fortran libs -. if !empty(USE_BUILDLINK3:M[yY][eE][sS]) -. include "../../lang/f2c/buildlink3.mk" -. else -DEPENDS+= f2c>=20001205nb3:../../lang/f2c -. endif -. endif -FC= ${PKG_FC} -F77= ${PKG_FC} -MAKE_ENV+= F77="${F77}" -MAKE_ENV+= FC="${FC}" -.endif - # Automatically increase process limit where necessary for building. _ULIMIT_CMD= .if defined(UNLIMIT_RESOURCES) @@ -407,12 +379,12 @@ _SHLIBTOOL?= ${PKG_SHLIBTOOL} LIBTOOL?= ${PKG_LIBTOOL} SHLIBTOOL?= ${PKG_SHLIBTOOL} .if defined(USE_LIBTOOL) -. if defined(USE_FORTRAN) +. if defined(USE_LANGUAGES) && !empty(USE_LANGUAGES:Mfortran) LIBTOOL_REQD?= 1.5.10nb7 BUILD_DEPENDS+= libtool-base>=${LIBTOOL_REQD}:../../devel/libtool-base . else LIBTOOL_REQD?= 1.5.10nb1 -BUILD_DEPENDS+= libtool-base>=${_OPSYS_LIBTOOL_REQD:U${LIBTOOL_REQD}}:../../devel/libtool-base +BUILD_DEPENDS+= libtool-base>=${_OPSYS_LIBTOOL_REQD}:../../devel/libtool-base . endif CONFIGURE_ENV+= LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}" MAKE_ENV+= LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}" @@ -487,6 +459,12 @@ MAKE_ENV+= CPP="${CPP}" .if defined(CXXFLAGS) MAKE_ENV+= CXXFLAGS="${CXXFLAGS}" .endif +.if defined(F77) +MAKE_ENV+= F77="${F77}" +.endif +.if defined(FC) +MAKE_ENV+= FC="${FC}" +.endif TOUCH_FLAGS?= -f diff --git a/mk/compiler.mk b/mk/compiler.mk index 342694b4798..08854fae6bf 100644 --- a/mk/compiler.mk +++ b/mk/compiler.mk @@ -1,4 +1,4 @@ -# $NetBSD: compiler.mk,v 1.42 2005/01/10 09:05:01 jlam Exp $ +# $NetBSD: compiler.mk,v 1.43 2005/01/12 15:32:01 jlam Exp $ # # This Makefile fragment implements handling for supported C/C++/Fortran # compilers. @@ -13,6 +13,7 @@ # ccc Compaq C Compilers (Tru64) # ccache compiler cache (chainable) # distcc distributed C/C++ (chainable) +# f2c Fortran 77 to C compiler (chainable) # gcc GNU # mipspro Silicon Graphics, Inc. MIPSpro (n32/n64) # mipspro-ucode Silicon Graphics, Inc. MIPSpro (o32) @@ -20,10 +21,12 @@ # ONE Studio # xlc IBM's XL C/C++ compiler suite # -# 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. This should only -# be set in /etc/mk.conf. +# The default is "gcc". You can use ccache and/or distcc with +# an appropriate PKGSRC_COMPILER setting, e.g. "ccache distcc +# gcc". You can also use "f2c" to overlay the lang/f2c package +# over the C compiler instead of using the system Fortran +# 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 @@ -45,7 +48,7 @@ # 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". +# is "c" ("c" is actually _always_ implicitly in this list). # # The following variables are defined, and available for testing in # package Makefiles: @@ -65,20 +68,24 @@ BSD_COMPILER_MK= defined .include "../../mk/bsd.prefs.mk" -# By default, assume that the package requires a C compiler. +# Always require a C compiler for proper compiler detection. USE_LANGUAGES?= c +.if empty(USE_LANGUAGES:Mc) +USE_LANGUAGES:= c ${USE_LANGUAGES} +.endif # Default to using gcc. PKGSRC_COMPILER?= gcc # For environments where there is an external gcc too, but pkgsrc # should use the pkgsrc one for consistency. +# .if defined(USE_PKGSRC_GCC) _USE_PKGSRC_GCC= yes .endif _COMPILERS= ccc gcc mipspro mipspro-ucode sunpro xlc -_PSEUDO_COMPILERS= ccache distcc +_PSEUDO_COMPILERS= ccache distcc f2c .if defined(NOT_FOR_COMPILER) && !empty(NOT_FOR_COMPILER) . for _compiler_ in ${_COMPILERS} diff --git a/mk/compiler/ccc.mk b/mk/compiler/ccc.mk index 395e74f9cec..7ae44d3d3a2 100644 --- a/mk/compiler/ccc.mk +++ b/mk/compiler/ccc.mk @@ -1,4 +1,4 @@ -# $NetBSD: ccc.mk,v 1.6 2004/11/30 14:50:37 jlam Exp $ +# $NetBSD: ccc.mk,v 1.7 2005/01/12 15:32:01 jlam Exp $ .if !defined(COMPILER_CCC_MK) COMPILER_CCC_MK= defined @@ -84,4 +84,14 @@ ${_CCC_${_var_}}: . endif .endfor +# Force the use of f2c-f77 for compiling Fortran. +_CCC_USE_F2C= no +FCPATH= /nonexistent +.if !exists(${FCPATH}) +_CCC_USE_F2C= yes +.endif +.if !empty(_CCC_USE_F2C:M[yY][eE][sS]) +. include "../../mk/compiler/f2c.mk" +.endif + .endif # COMPILER_CCC_MK diff --git a/mk/compiler/f2c.mk b/mk/compiler/f2c.mk new file mode 100644 index 00000000000..72228eb3bbf --- /dev/null +++ b/mk/compiler/f2c.mk @@ -0,0 +1,93 @@ +# $NetBSD: f2c.mk,v 1.1 2005/01/12 15:32:01 jlam Exp $ + +.if !defined(COMPILER_F2C_MK) +COMPILER_F2C_MK= defined + +.include "../../mk/bsd.prefs.mk" + +.if !empty(PKGPATH:Mlang/f2c) || !empty(PKGPATH:Mdevel/patch) || \ + !empty(PKGPATH:Mdevel/libtool-base) +IGNORE_F2C= yes +MAKEFLAGS+= IGNORE_F2C=yes +.endif + +.if defined(IGNORE_F2C) +_USE_F2C= 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.f2c= fortran +_LANGUAGES.f2c= # empty +.for _lang_ in ${USE_LANGUAGES} +_LANGUAGES.f2c+= ${LANGUAGES.f2c:M${_lang_}} +.endfor +.if empty(_LANGUAGES.f2c) +_USE_F2C= NO +.endif + +.if !defined(_USE_F2C) +_USE_F2C= YES +.endif + +.if !empty(_USE_F2C:M[yY][eE][sS]) +EVAL_PREFIX+= _F2CBASE=f2c +_F2CBASE_DEFAULT= ${LOCALBASE} +_F2CBASE?= ${LOCALBASE} + +_F2C_DIR= ${WRKDIR}/.f2c +_F2C_VARS= # empty +. if !empty(_LANGUAGES.f2c:Mfortran) +PKG_FC?= ${FC} +_F2C_VARS+= FC +_F2C_FC:= ${_F2C_DIR}/bin/${PKG_FC:T} +_ALIASES.FC+= f77 f2c-f77 +FCPATH= ${_F2CBASE}/bin/f2c-f77 +PKG_FC:= ${_F2C_FC} +# +# The f2c-f77 shell script invokes the C compiler, so ensure that it finds +# the cc wrapper for proper transformations. +# +# XXX This shouldn't really be leaking into here, as it breaks encapsulation. +# XXX It should really be handled within the wrapper framework. +# +_WRAP_ENV.FC= PATH="${WRAPPER_BINDIR}:${_WRAP_PATH}"; export PATH +. endif + +# Prepend the path the to the compiler to the PATH +. if !empty(_LANGUAGES.f2c) +PREPEND_PATH+= ${_F2C_DIR}/bin +. endif + +# Add the dependency on f2c. +. if !empty(USE_BUILDLINK3:M[yY][eE][sS]) +. include "../../lang/f2c/buildlink3.mk" +. else +DEPENDS+= f2c>=20001205nb3:../../lang/f2c +. endif + +. if defined(F2C_DIR) && !empty(F2C_DIR) +BUILD_ENV+= F2C_DIR=${F2C_DIR:Q} +. endif + +# Create symlinks for the compiler into ${WRKDIR}. +. for _var_ in ${_F2C_VARS} +. if !target(${_F2C_${_var_}}) +override-tools: ${_F2C_${_var_}} +${_F2C_${_var_}}: + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${LN} -fs ${_F2CBASE}/bin/f2c-f77 ${.TARGET} +. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//} + ${_PKG_SILENT}${_PKG_DEBUG} \ + if [ ! -x "${_alias_}" ]; then \ + ${LN} -fs ${_F2CBASE}/bin/f2c-f77 ${_alias_}; \ + fi +. endfor +. endif +. endfor +.endif # _USE_F2C == "yes" + +.endif # COMPILER_F2C_MK diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk index 4099063f6bf..8939db1e9f5 100644 --- a/mk/compiler/gcc.mk +++ b/mk/compiler/gcc.mk @@ -1,4 +1,4 @@ -# $NetBSD: gcc.mk,v 1.77 2004/11/30 14:50:37 jlam Exp $ +# $NetBSD: gcc.mk,v 1.78 2005/01/12 15:32:01 jlam Exp $ .if !defined(COMPILER_GCC_MK) COMPILER_GCC_MK= defined @@ -436,4 +436,21 @@ ${_GCC_${_var_}}: . endif .endfor +# On older NetBSD systems and where the Fortran compiler doesn't exist, +# force the use of f2c-f77. +# +_GCC_USE_F2C= no +.if !exists(${FCPATH}) +_GCC_USE_F2C= yes +.else +. for _pattern_ in 0.* 1.[0-4] 1.[0-4].* +. if !empty(MACHINE_PLATFORM:MNetBSD-${_pattern_}-*) +_GCC_USE_F2C= yes +. endif +. endfor +.endif +.if !empty(_GCC_USE_F2C:M[yY][eE][sS]) +. include "../../mk/compiler/f2c.mk" +.endif + .endif # COMPILER_GCC_MK diff --git a/mk/compiler/mipspro.mk b/mk/compiler/mipspro.mk index 694a66c7544..1a483cc80a5 100644 --- a/mk/compiler/mipspro.mk +++ b/mk/compiler/mipspro.mk @@ -1,4 +1,4 @@ -# $NetBSD: mipspro.mk,v 1.29 2004/11/30 14:50:37 jlam Exp $ +# $NetBSD: mipspro.mk,v 1.30 2005/01/12 15:32:01 jlam Exp $ .if !defined(COMPILER_MIPSPRO_MK) COMPILER_MIPSPRO_MK= defined @@ -95,4 +95,14 @@ CFLAGS+= ${MABIFLAG} LDFLAGS+= ${MABIFLAG} .endif +# Force the use of f2c-f77 for compiling Fortran. +_MIPSPRO_USE_F2C= no +FCPATH= /nonexistent +.if !exists(${FCPATH}) +_MIPSPRO_USE_F2C= yes +.endif +.if !empty(_MIPSPRO_USE_F2C:M[yY][eE][sS]) +. include "../../mk/compiler/f2c.mk" +.endif + .endif # COMPILER_MIPSPRO_MK diff --git a/mk/compiler/sunpro.mk b/mk/compiler/sunpro.mk index 85b0a0306d7..f979b6cb6c9 100644 --- a/mk/compiler/sunpro.mk +++ b/mk/compiler/sunpro.mk @@ -1,4 +1,4 @@ -# $NetBSD: sunpro.mk,v 1.25 2004/11/30 14:50:37 jlam Exp $ +# $NetBSD: sunpro.mk,v 1.26 2005/01/12 15:32:01 jlam Exp $ .if !defined(COMPILER_SUNPRO_MK) COMPILER_SUNPRO_MK= defined @@ -83,4 +83,14 @@ ${_SUNPRO_${_var_}}: . endif .endfor +# Force the use of f2c-f77 for compiling Fortran. +_SUNPRO_USE_F2C= no +FCPATH= /nonexistent +.if !exists(${FCPATH}) +_SUNPRO_USE_F2C= yes +.endif +.if !empty(_SUNPRO_USE_F2C:M[yY][eE][sS]) +. include "../../mk/compiler/f2c.mk" +.endif + .endif # COMPILER_SUNPRO_MK diff --git a/mk/compiler/xlc.mk b/mk/compiler/xlc.mk index f23546f8606..9b0aa91f277 100644 --- a/mk/compiler/xlc.mk +++ b/mk/compiler/xlc.mk @@ -1,4 +1,4 @@ -# $NetBSD: xlc.mk,v 1.7 2004/11/30 14:50:37 jlam Exp $ +# $NetBSD: xlc.mk,v 1.8 2005/01/12 15:32:01 jlam Exp $ .if !defined(COMPILER_XLC_MK) COMPILER_XLC_MK= defined @@ -78,4 +78,14 @@ ${_XLC_${_var_}}: . endif .endfor +# Force the use of f2c-f77 for compiling Fortran. +_XLC_USE_F2C= no +FCPATH= /nonexistent +.if !exists(${FCPATH}) +_XLC_USE_F2C= yes +.endif +.if !empty(_XLC_USE_F2C:M[yY][eE][sS]) +. include "../../mk/compiler/f2c.mk" +.endif + .endif # COMPILER_XLC_MK |