diff options
author | grant <grant@pkgsrc.org> | 2003-09-12 13:03:38 +0000 |
---|---|---|
committer | grant <grant@pkgsrc.org> | 2003-09-12 13:03:38 +0000 |
commit | c934b0c4e0919c4858477f0ac0b3cf15bddec388 (patch) | |
tree | 2f0b05f9cd70438408d65d8be6f1342ef5a57230 /mk | |
parent | 2083c8a0ce8f082fcf52005d391d539f77b83077 (diff) | |
download | pkgsrc-c934b0c4e0919c4858477f0ac0b3cf15bddec388.tar.gz |
start of improved compiler handling, mostly derived from the existing
gcc buildlink2.mk files and splitting the non-buildlink2.mk bits out
into compiler.mk.
this allows USE_GCC2 and USE_GCC3 to work with non-buildlink2 packages
again.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.mk | 22 | ||||
-rw-r--r-- | mk/compiler.mk | 97 | ||||
-rw-r--r-- | mk/gcc.buildlink2.mk | 20 |
3 files changed, 100 insertions, 39 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index ea50e10705f..48633de9128 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1272 2003/09/12 10:54:49 jlam Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1273 2003/09/12 13:03:38 grant Exp $ # # This file is in the public domain. # @@ -382,6 +382,8 @@ SHCOMMENT?= ${ECHO_MSG} >/dev/null '***' DISTINFO_FILE?= ${.CURDIR}/distinfo +.include "../../mk/compiler.mk" + FIX_RPATH+= LIBS .if defined(USE_X11) X11_LDFLAGS= # empty @@ -422,24 +424,6 @@ MAKE_ENV+= CXX="${CXX}" MAKE_ENV+= CPP="${CPP}" .endif -# Ensure the correct rpath is passed to the linker to enable packages -# to find shared libraries from gcc. Has no effect when pkgsrc gcc is -# not being used. -# -# Valid compilers are: -# -# USE_GCC2 - GNU Compiler Collection 2.x -# USE_GCC3 - GNU Compiler Collection 3.x -# USE_MIPSPRO - Silicon Graphics, Inc. MIPSpro Compiler -# USE_SUNPRO - Sun Microsystems, Inc. WorkShop/Forte/Sun ONE Studio -# Compiler Collection -# -.if !defined(USE_MIPSPRO) && !defined(USE_SUNPRO) -. if empty(USE_BUILDLINK2:M[nN][oO]) -. include "../../mk/gcc.buildlink2.mk" -. endif -.endif - # export the flags needed to compile and link pthreaded code MAKE_ENV+= PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" MAKE_ENV+= PTHREAD_LDFLAGS="${PTHREAD_LDFLAGS}" diff --git a/mk/compiler.mk b/mk/compiler.mk new file mode 100644 index 00000000000..bc6de51d4d1 --- /dev/null +++ b/mk/compiler.mk @@ -0,0 +1,97 @@ +# $NetBSD: compiler.mk,v 1.1 2003/09/12 13:03:38 grant Exp $ + +# This Makefile fragment implements handling for supported +# C/C++/fortran compilers. +# +# The following variables are used: +# +# USE_GCC2 +# Use pkgsrc gcc2 from lang/gcc. This is a user-only variable +# which must NOT be set in package Makefiles. +# +# USE_GCC3 +# use pkgsrc gcc3 from lang/gcc3. This is a user-only variable +# which must NOT be set in package Makefiles. +# +# USE_GCC_SHLIB +# Indicates that a package uses GCC shared libraries, so we +# register a runtime dependency on the compiler package. +# +# The following variables are reserved for future use: +# +# USE_MIPSPRO +# Use the Silicon Graphics, Inc. MIPSpro compiler. +# +# USE_SUNPRO +# Use the Sun Microsystems Inc. WorkShop/Forte/Sun ONE Studio +# compiler collection. +# + +.if !defined(COMPILER_MK) +COMPILER_MK= # defined + +.include "../../mk/bsd.prefs.mk" + +.if defined(USE_GCC2) && empty(PKGPATH:Mlang/gcc) && empty(_PKGSRC_DEPS:Mgcc-2*) +GCC_REQD?= 2.95.3 + +# we need to define these early, as they are used by gcc/buildlink2.mk. +_GCC_SUBPREFIX= gcc-2.95.3/ +_GCC_ARCHDIR= ${_GCC_PREFIX}${_GCC_ARCHSUBDIR} +_GCC_ARCHSUBDIR= lib/gcc-lib/${MACHINE_GNU_PLATFORM}/2.95.3 + +. if empty(USE_BUILDLINK2:M[nN][oO]) +. include "../lang/gcc/buildlink2.mk" +. else +_GCC_PREFIX= ${LOCALBASE}/${_GCC_SUBPREFIX} + +# Packages that link against gcc shared libraries need a full +# dependency. +. if defined(USE_GCC_SHLIB) +DEPENDS+= gcc>=${GCC_REQD}:../../lang/gcc +LDFLAGS+= -L${_GCC_ARCHDIR} -Wl,${RPATH_FLAG}${_GCC_ARCHDIR} -L${_GCC_PREFIX}lib -Wl,${RPATH_FLAG}${_GCC_PREFIX}lib +. else +BUILD_DEPENDS+= gcc>=${GCC_REQD}:../../lang/gcc +. endif +. endif +PATH:= ${_GCC_PREFIX}bin:${PATH} +CC= ${_GCC_PREFIX}bin/gcc +CPP= ${_GCC_PREFIX}bin/cpp +CXX= ${_GCC_PREFIX}bin/g++ +F77= ${_GCC_PREFIX}bin/g77 +PKG_FC= ${F77} + +.elif defined(USE_GCC3) && empty(PKGPATH:Mlang/gcc3) && empty(_PKGSRC_DEPS:Mgcc-3*) +GCC_REQD?= 3.3 + +# we need to define these early, as they are used by gcc3/buildlink2.mk. +_GCC_SUBPREFIX= gcc-3.3/ +_GCC_ARCHDIR= ${_GCC_PREFIX}${_GCC_ARCHSUBDIR} + +. if empty(USE_BUILDLINK2:M[nN][oO]) +. include "../lang/gcc3/buildlink2.mk" +. else +_GCC_PREFIX= ${LOCALBASE}/${_GCC_SUBPREFIX} +_GCC_LIBGCCDIR!= \ + dirname `${_GCC_PREFIX}bin/gcc --print-libgcc-file-name` +_GCC_ARCHSUBDIR= \ + ${_GCC_LIBGCCDIR:S|^${LOCALBASE}/${_GCC_SUBPREFIX}||} + +# Packages that link against gcc shared libraries need a full +# dependency. +. if defined(USE_GCC_SHLIB) +DEPENDS+= gcc3>=${GCC_REQD}:../../lang/gcc3 +LDFLAGS+= -L${_GCC_ARCHDIR} -Wl,${RPATH_FLAG}${_GCC_ARCHDIR} -L${_GCC_PREFIX}lib -Wl,${RPATH_FLAG}${_GCC_PREFIX}lib +. else +BUILD_DEPENDS+= gcc3>=${GCC_REQD}:../../lang/gcc3 +. endif +. endif +PATH:= ${_GCC_PREFIX}bin:${PATH} +CC= ${_GCC_PREFIX}bin/gcc +CPP= ${_GCC_PREFIX}bin/cpp +CXX= ${_GCC_PREFIX}bin/g++ +F77= ${_GCC_PREFIX}bin/g77 +PKG_FC= ${F77} +.endif # USE_GCC3 + +.endif # COMPILER_MK diff --git a/mk/gcc.buildlink2.mk b/mk/gcc.buildlink2.mk deleted file mode 100644 index 94f16ffcc43..00000000000 --- a/mk/gcc.buildlink2.mk +++ /dev/null @@ -1,20 +0,0 @@ -# $NetBSD: gcc.buildlink2.mk,v 1.6 2003/09/02 06:59:46 jlam Exp $ -# -# USE_GCC2 -# If defined, use gcc from lang/gcc. -# USE_GCC3 -# If defined, use gcc3 from lang/gcc3. -# - -.if !defined(GCC_BUILDLINK2_MK) -GCC_BUILDLINK2_MK= # defined - -.include "../../mk/bsd.prefs.mk" - -.if defined(USE_GCC3) && empty(PKGPATH:Mlang/gcc3) && empty(_PKGSRC_DEPS:Mgcc-3.*) -. include "../lang/gcc3/buildlink2.mk" -.elif defined(USE_GCC2) && empty(PKGPATH:Mlang/gcc) && empty(_PKGSRC_DEPS:Mgcc-2.*) -. include "../lang/gcc/buildlink2.mk" -.endif - -.endif # GCC_BUILDLINK2_MK |