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 | afefdfce085f9803623395bdfc2fef40571e3520 (patch) | |
tree | 2f0b05f9cd70438408d65d8be6f1342ef5a57230 | |
parent | 7bec32b3dde66d89cc79344d0ab49d10e4492adb (diff) | |
download | pkgsrc-afefdfce085f9803623395bdfc2fef40571e3520.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.
-rw-r--r-- | lang/gcc/buildlink2.mk | 20 | ||||
-rw-r--r-- | lang/gcc3/buildlink2.mk | 16 | ||||
-rw-r--r-- | mk/bsd.pkg.mk | 22 | ||||
-rw-r--r-- | mk/compiler.mk | 97 | ||||
-rw-r--r-- | mk/gcc.buildlink2.mk | 20 |
5 files changed, 106 insertions, 69 deletions
diff --git a/lang/gcc/buildlink2.mk b/lang/gcc/buildlink2.mk index cedbe114993..461642f9bac 100644 --- a/lang/gcc/buildlink2.mk +++ b/lang/gcc/buildlink2.mk @@ -1,16 +1,11 @@ -# $NetBSD: buildlink2.mk,v 1.13 2003/07/13 13:04:09 grant Exp $ +# $NetBSD: buildlink2.mk,v 1.14 2003/09/12 13:03:40 grant Exp $ -# do not directly include this file. .include "../../mk/gcc.buildlink2.mk" -# to ensure the correct gcc package is selected based on USE_GCC2 and -# USE_GCC3. +# Do not directly include this file in package Makefiles. It is +# automatically included when required based on USE_GCC2. .if !defined(GCC2_BUILDLINK2_MK) GCC2_BUILDLINK2_MK= # defined -# If you want to allow EGCS to satisfy the GCC requirement, then set -# GCC_REQD to "2.8.0". -# -GCC_REQD?= 2.95.3 BUILDLINK_DEPENDS.gcc?= gcc>=${GCC_REQD} BUILDLINK_PKGSRCDIR.gcc?= ../../lang/gcc @@ -25,20 +20,11 @@ BUILDLINK_DEPMETHOD.gcc?= build BUILDLINK_PREFIX.gcc= ${LOCALBASE} -_GCC_SUBPREFIX= gcc-2.95.3/ _GCC_PREFIX= ${BUILDLINK_PREFIX.gcc}/${_GCC_SUBPREFIX} -_GCC_ARCHSUBDIR= lib/gcc-lib/${MACHINE_GNU_PLATFORM}/2.95.3 -_GCC_ARCHDIR= ${_GCC_PREFIX}${_GCC_ARCHSUBDIR} BUILDLINK_LDFLAGS.gcc= -L${_GCC_ARCHDIR} -Wl,${RPATH_FLAG}${_GCC_ARCHDIR} -L${_GCC_PREFIX}lib -Wl,${RPATH_FLAG}${_GCC_PREFIX}lib BUILDLINK_PACKAGES+= gcc -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} .if defined(USE_GCC_SHLIB) LDFLAGS+= ${BUILDLINK_LDFLAGS.gcc} diff --git a/lang/gcc3/buildlink2.mk b/lang/gcc3/buildlink2.mk index aeebfc89c37..a2283afff19 100644 --- a/lang/gcc3/buildlink2.mk +++ b/lang/gcc3/buildlink2.mk @@ -1,13 +1,11 @@ -# $NetBSD: buildlink2.mk,v 1.6 2003/07/13 13:04:10 grant Exp $ +# $NetBSD: buildlink2.mk,v 1.7 2003/09/12 13:03:41 grant Exp $ -# do not directly include this file. .include "../../mk/gcc.buildlink2.mk" -# to ensure the correct gcc package is selected based on USE_GCC2 and -# USE_GCC3. +# Do not directly include this file in package Makefiles. It is +# automatically included when required based on USE_GCC3. .if !defined(GCC3_BUILDLINK2_MK) GCC3_BUILDLINK2_MK= # defined -GCC_REQD?= 3.3 BUILDLINK_DEPENDS.gcc?= gcc3>=${GCC_REQD} BUILDLINK_PKGSRCDIR.gcc?= ../../lang/gcc3 @@ -22,23 +20,15 @@ BUILDLINK_DEPMETHOD.gcc?= build BUILDLINK_PREFIX.gcc= ${LOCALBASE} -_GCC_SUBPREFIX= gcc-3.3/ _GCC_PREFIX= ${BUILDLINK_PREFIX.gcc}/${_GCC_SUBPREFIX} _GCC_LIBGCCDIR!= \ dirname `${_GCC_PREFIX}bin/gcc --print-libgcc-file-name` _GCC_ARCHSUBDIR= \ ${_GCC_LIBGCCDIR:S|^${BUILDLINK_PREFIX.gcc}/${_GCC_SUBPREFIX}||} -_GCC_ARCHDIR= ${_GCC_PREFIX}${_GCC_ARCHSUBDIR} BUILDLINK_LDFLAGS.gcc= -L${_GCC_ARCHDIR} -Wl,${RPATH_FLAG}${_GCC_ARCHDIR} -L${_GCC_PREFIX}lib -Wl,${RPATH_FLAG}${_GCC_PREFIX}lib BUILDLINK_PACKAGES+= gcc -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} .if defined(USE_GCC_SHLIB) LDFLAGS+= ${BUILDLINK_LDFLAGS.gcc} 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 |