From 89dacfd0002bcee778664a8108054fdb4972b37d Mon Sep 17 00:00:00 2001 From: marino Date: Sun, 8 Jul 2012 19:57:10 +0000 Subject: compiler.mk/gcc.mk: Add support for USE_LANGUAGES+= ada All recent packages featuring Ada code have a hard dependency on the lang/gnat-aux compiler package. The valid values for USE_LANGUAGES are c, c99, c++, fortran, fortran77, java, objc, so specifying a specific compiler was necessary up into now. One problem with lang/gnat-aux is that it is installed at ${LOCALBASE} where the lang/gccXX compilers are installed at ${LOCALBASE}/gccXX. The latter compilers have no possibility of sharing conflicting files unlike lang/gnat-aux. Rather than fundamentally update the GCC 4.6-based lang/gnat-aux to avoid these conflicts, a new Ada-capable compiler based on GCC 4.7 was created with the intent of being supported by mk/compiler.mk and mk/compiler/gcc.mk. The Ada packages will be effectively migrated from lang/gnat-aux to the new lang/gcc-aux compiler, but lang/gcc-aux will remain as a standalone package as it is the only GCC 4.6-based compiler that builds on DragonFly and serves it as a world and kernel compile option. In addition to the current language wrappers, lang/gcc-aux adds wrappers for "ada" (unique to gcc-aux, hardlinked to gcc driver), and the gnat, gnatmake, gnatbind, gnatlink, gnatchop, gnatprep, and gnatls programs. Supporting all of these allows the wrapper system to be used with Ada packages; currently wrappers are mostly disabled on them. The lang/gcc47 implicitly adds support for the "objc-c++" language by adding it to the USE_LANGUAGES list, but it wasn't really supported. An attempt was made to better support objc-c++, but this new enumeration probably still needs work or needs to be removed completely. Logic for Ada support: 1) All lang/gccXX compilers have version numbers ranging from 2.8.1 to 9. 2) lang/gcc-aux uses the release date as its version number in the form of YYYYMMDD with a minimum value of 20120614, so there is no version overlap. 3) When at least one element of USE_LANGUAGES is "ada", the value of 20120614 is added to the set of GCC_REQD which selects lang/gcc-aux. 4) The _NEED_NEWER_GCC check is disabled. It fails and isn't relevant; unless a package sets GCC_REQD over 20120614, the only way to select lang/gcc-aux is to specify the Ada language and only one compiler known to gcc.mk can support it. --- mk/compiler/gcc.mk | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 2 deletions(-) (limited to 'mk/compiler') diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk index ccedd899875..342d8eac2e9 100644 --- a/mk/compiler/gcc.mk +++ b/mk/compiler/gcc.mk @@ -1,4 +1,4 @@ -# $NetBSD: gcc.mk,v 1.121 2012/06/26 15:48:53 jperkin Exp $ +# $NetBSD: gcc.mk,v 1.122 2012/07/08 19:57:10 marino Exp $ # # This is the compiler definition for the GNU Compiler Collection. # @@ -50,9 +50,11 @@ _SYS_VARS.gcc= CC_VERSION CC_VERSION_STRING LANGUAGES.gcc _DEF_VARS.gcc= \ CCPATH CPPPATH CXXPATH \ F77PATH FCPATH \ + ADAPATH GMKPATH GLKPATH GDBPATH CHPPATH GLSPATH GNTPATH PRPPATH \ IMAKEOPTS \ LDFLAGS \ PKG_CC PKG_CPP PKG_CXX PKG_FC \ + PKG_ADA PKG_GMK PKG_GLK PKG_GDB PKG_CHP PKG_GLK PKG_GNT PKG_PRP \ _CC _COMPILER_RPATH_FLAG _COMPILER_STRIP_VARS \ _GCCBINDIR _GCC_ARCHDIR _GCC_BIN_PREFIX _GCC_CC \ _GCC_CPP _GCC_CXX _GCC_DEPENDENCY _GCC_DEPENDS \ @@ -61,6 +63,7 @@ _DEF_VARS.gcc= \ _GCC_PREFIX _GCC_REQD _GCC_STRICTEST_REQD _GCC_SUBPREFIX \ _GCC_TEST_DEPENDS _GCC_NEEDS_A_FORTRAN _GCC_VARS _GCC_VERSION \ _GCC_VERSION_STRING \ + _GCC_ADA _GCC_GMK _GCC_GLK _GCC_GDB _GCC_CHP _GCC_GLS _GCC_GNT _GCC_PRP \ _IGNORE_GCC _IGNORE_GCC3CXX _IGNORE_GCC3F77 _IGNORE_GCC3OBJC \ _IS_BUILTIN_GCC \ _LANGUAGES.gcc \ @@ -82,6 +85,12 @@ GCC_REQD+= 2.8.0 GCC_REQD+= 3.0 .endif +# Only one compiler defined here supports Ada: lang/gcc-aux +# If the Ada language is requested, force lang/gcc-aux to be selected +.if !empty(USE_LANGUAGES:Mada) +GCC_REQD+= 20120614 +.endif + # _GCC_DIST_VERSION is the highest version of GCC installed by the pkgsrc # without the PKGREVISIONs. # @@ -111,6 +120,9 @@ _GCC46_PATTERNS= 4.6 4.6.* # _GCC46_PATTERNS matches N s.t. 4.7 <= N. _GCC47_PATTERNS= 4.[7-9] 4.[7-9].* 4.[1-9][0-9]* [4-9]* +# _GCC_AUX_PATTERNS matches 8-digit date YYYYMMDD* +_GCC_AUX_PATTERNS= 20[1-2][0-9][0-1][0-9][0-3][0-9]* + # _CC is the full path to the compiler named by ${CC} if it can be found. .if !defined(_CC) _CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} @@ -233,10 +245,16 @@ _NEED_GCC46= yes _NEED_GCC47= yes . endif .endfor +.for _pattern_ in ${_GCC_AUX_PATTERNS} +. if !empty(_GCC_REQD:M${_pattern_}) +_NEED_GCC_AUX= yes +_NEED_NEWER_GCC=NO +. endif +.endfor .if !empty(_NEED_GCC2:M[nN][oO]) && !empty(_NEED_GCC3:M[nN][oO]) && \ !empty(_NEED_GCC34:M[nN][oO]) && !empty(_NEED_GCC44:M[nN][oO]) && \ !empty(_NEED_GCC45:M[nN][oO]) && !empty(_NEED_GCC46:M[nN][oO]) && \ - !empty(_NEED_GCC47:M[nN][oO]) + !empty(_NEED_GCC47:M[nN][oO]) && !empty(_NEED_GCC_AUX:M[nN][oO]) _NEED_GCC47= yes .endif @@ -256,6 +274,8 @@ LANGUAGES.gcc= c c++ fortran fortran77 java objc LANGUAGES.gcc= c c++ fortran fortran77 java objc .elif !empty(_NEED_GCC47:M[yY][eE][sS]) LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++ +.elif !empty(_NEED_GCC_AUX:M[yY][eE][sS]) +LANGUAGES.gcc= c c++ fortran fortran77 objc ada .endif _LANGUAGES.gcc= # empty .for _lang_ in ${USE_LANGUAGES} @@ -405,6 +425,26 @@ _GCC_DEPENDENCY= gcc47>=${_GCC_REQD}:../../lang/gcc47 _USE_GCC_SHLIB?= yes . endif . endif +.elif !empty(_NEED_GCC_AUX:M[yY][eE][sS]) +# +# We require Ada-capable compiler in the lang/gcc-aux directory. +# +_GCC_PKGBASE= gcc-aux +. if !empty(PKGPATH:Mlang/gcc-aux) +_IGNORE_GCC= yes +MAKEFLAGS+= _IGNORE_GCC=yes +. endif +. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) +_GCC_PKGSRCDIR= ../../lang/gcc-aux +_GCC_DEPENDENCY= gcc-aux>=${_GCC_REQD}:../../lang/gcc-aux +. if !empty(_LANGUAGES.gcc:Mc++) || \ + !empty(_LANGUAGES.gcc:Mfortran) || \ + !empty(_LANGUAGES.gcc:Mfortran77) || \ + !empty(_LANGUAGES.gcc:Mada) || \ + !empty(_LANGUAGES.gcc:Mobjc) +_USE_GCC_SHLIB?= yes +. endif +. endif .endif _GCC_DEPENDS= ${_GCC_PKGBASE}>=${_GCC_REQD} @@ -600,6 +640,49 @@ F77PATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gfortran PKG_FC:= ${_GCC_FC} PKGSRC_FORTRAN?= gfortran .endif +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}ada) +_GCC_VARS+= ADA GMK GLK GBD CHP PRP GLS GNT +_GCC_ADA= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}ada +_GCC_GMK= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatmake +_GCC_GLK= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatlink +_GCC_GBD= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatbind +_GCC_CHP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatchop +_GCC_PRP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatprep +_GCC_GLS= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatls +_GCC_GNT= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnat +_ALIASES.ADA= ada +_ALIASES.GMK= gnatmake +_ALIASES.GLK= gnatlink +_ALIASES.GBD= gnatbind +_ALIASES.CHP= gnatchop +_ALIASES.PRP= gnatprep +_ALIASES.GLS= gnatls +_ALIASES.GNT= gnat +ADAPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}ada +GMKPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatmake +GLKPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatlink +GBDPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatbind +CHPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatchop +PRPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatprep +GLSPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatls +GNTPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnat +PKG_ADA:= ${_GCC_ADA} +PKG_GMK:= ${_GCC_GMK} +PKG_GLK:= ${_GCC_GLK} +PKG_GBD:= ${_GCC_GBD} +PKG_CHP:= ${_GCC_CHP} +PKG_PRP:= ${_GCC_PRP} +PKG_GLS:= ${_GCC_GLS} +PKG_GNT:= ${_GCC_GNT} +PKGSRC_ADA?= ada +PKGSRC_GMK?= gnatmake +PKGSRC_GLK?= gnatlink +PKGSRC_GBD?= gnatbind +PKGSRC_CHP?= gnatchop +PKGSRC_PRP?= gnatprep +PKGSRC_GLS?= gnatls +PKGSRC_GNT?= gnat +.endif _COMPILER_STRIP_VARS+= ${_GCC_VARS} # Pass the required flags to imake to tell it we're using gcc on Solaris. -- cgit v1.2.3