pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk start of improved compiler handling, mostly derived...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5b8f6c30f2eb
branches:  trunk
changeset: 461189:5b8f6c30f2eb
user:      grant <grant%pkgsrc.org@localhost>
date:      Fri Sep 12 13:03:38 2003 +0000

description:
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:

 lang/gcc/buildlink2.mk  |  20 +--------
 lang/gcc3/buildlink2.mk |  16 +------
 mk/bsd.pkg.mk           |  22 +---------
 mk/compiler.mk          |  97 +++++++++++++++++++++++++++++++++++++++++++++++++
 mk/gcc.buildlink2.mk    |  20 ----------
 5 files changed, 106 insertions(+), 69 deletions(-)

diffs (256 lines):

diff -r fb43a5a1c350 -r 5b8f6c30f2eb lang/gcc/buildlink2.mk
--- a/lang/gcc/buildlink2.mk    Fri Sep 12 13:00:26 2003 +0000
+++ b/lang/gcc/buildlink2.mk    Fri Sep 12 13:03:38 2003 +0000
@@ -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_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 -r fb43a5a1c350 -r 5b8f6c30f2eb lang/gcc3/buildlink2.mk
--- a/lang/gcc3/buildlink2.mk   Fri Sep 12 13:00:26 2003 +0000
+++ b/lang/gcc3/buildlink2.mk   Fri Sep 12 13:03:38 2003 +0000
@@ -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_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 -r fb43a5a1c350 -r 5b8f6c30f2eb mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Fri Sep 12 13:00:26 2003 +0000
+++ b/mk/bsd.pkg.mk     Fri Sep 12 13:03:38 2003 +0000
@@ -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 @@
 
 DISTINFO_FILE?=                ${.CURDIR}/distinfo
 
+.include "../../mk/compiler.mk"
+
 FIX_RPATH+=            LIBS
 .if defined(USE_X11)
 X11_LDFLAGS=           # empty
@@ -422,24 +424,6 @@
 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 -r fb43a5a1c350 -r 5b8f6c30f2eb mk/compiler.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/compiler.mk    Fri Sep 12 13:03:38 2003 +0000
@@ -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 -r fb43a5a1c350 -r 5b8f6c30f2eb mk/gcc.buildlink2.mk
--- a/mk/gcc.buildlink2.mk      Fri Sep 12 13:00:26 2003 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -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



Home | Main Index | Thread Index | Old Index