From ded3b5a006a7a889fbccedcd55d354d8c7450234 Mon Sep 17 00:00:00 2001 From: Gerald Pfeifer Date: Sun, 30 Mar 2003 23:55:35 +0000 Subject: [PATCH] Add support for the bounds-checking patch by Herman ten Brugge (which provides an -fbounds-checking command-line option). This is optional and built only if WITH_BOUNDSCHECKING is defined. PR: 50178 Submitted by: Dan Nelson --- lang/gcc32/Makefile | 26 +++++++++++++++++++++++++- lang/gcc32/distinfo | 1 + lang/gcc32/files/opt.patch-bc | 11 +++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 lang/gcc32/files/opt.patch-bc diff --git a/lang/gcc32/Makefile b/lang/gcc32/Makefile index 09fc818fc55e..45ac81da03f6 100644 --- a/lang/gcc32/Makefile +++ b/lang/gcc32/Makefile @@ -13,7 +13,8 @@ PORTNAME= gcc PORTVERSION= 3.2.2 PORTREVISION= ${SNAPVER} CATEGORIES= lang java -MASTER_SITES= ${MASTER_SITE_GCC} +MASTER_SITES= ${MASTER_SITE_GCC} \ + http://web.inter.NL.net/hcc/Haj.Ten.Brugge/:bc MASTER_SITE_SUBDIR= releases/gcc-${PORTVERSION} DISTFILES= gcc-core-${PORTVERSION}${EXTRACT_SUFX} \ gcc-testsuite-${PORTVERSION}${EXTRACT_SUFX} \ @@ -28,6 +29,14 @@ DISTFILES= gcc-core-${PORTVERSION}${EXTRACT_SUFX} \ MAINTAINER= gerald@FreeBSD.org COMMENT= GNU Compiler Collection 3.2.2 +.if defined (WITH_BOUNDSCHECKING) +# Fetch another file, but don't extract it. Also add another patchfile. +BCPATCH= bounds-checking-gcc-3.2.2-1.00.patch.bz2 +DISTFILES+= ${BCPATCH}:bc +EXTRACT_ONLY= ${DISTFILES:S/${BCPATCH}:bc//} +EXTRA_PATCHES= ${FILESDIR}/opt.patch-bc +.endif + LATEST_LINK= gcc32 USE_BZIP2= yes @@ -78,6 +87,11 @@ MAN7= fsf-funding.7 gfdl.7 gpl.7 pre-fetch: @${ECHO} "Making GCC ${DISTNAME:S/^gcc-//} for ${OPSYS} ${OSREL} ${PORTOBJFORMAT} target ${CONFIGURE_TARGET}" +.if !defined(WITH_BOUNDSCHECKING) + @${ECHO_MSG} "You can enable fine-grained bounds-checking support for compiled C programs" + @${ECHO_MSG} "by defining WITH_BOUNDSCHECKING. Compile and link with \"-fbounds-checking\"" + @${ECHO_MSG} "to use." +.endif .if defined(CVS_DATE) DIST_SUBDIR= ${PKGNAME} @@ -110,6 +124,16 @@ do-extract: cd ${DISTDIR}/${DIST_SUBDIR}/gcc ; pax -pe -rwt . ${SRCDIR} .endif # CVS_DATE +.if defined(WITH_BOUNDSCHECKING) +# Extract bounds-checking patch, removing the ada parts of the patch with sed. +pre-patch: + ( cd ${_DISTDIR} && \ + ${BZCAT} ${BCPATCH} | \ + ${SED} -e '/^--- .*ada/,/^diff/d' | \ + ${PATCH} -d ${PATCH_WRKSRC} -E -p1 --quiet \ + ) +.endif + pre-configure: @# Keep from running `autoconf' and `autoheader' since we modified @# configure.in by patching it. diff --git a/lang/gcc32/distinfo b/lang/gcc32/distinfo index ae024722a95f..da7147d1e97a 100644 --- a/lang/gcc32/distinfo +++ b/lang/gcc32/distinfo @@ -4,3 +4,4 @@ MD5 (gcc-g++-3.2.2.tar.bz2) = 86b63f1375ce75c5df03cbf23731c3c1 MD5 (gcc-g77-3.2.2.tar.bz2) = 0b220a0cd5dd471c34c080952265e91e MD5 (gcc-java-3.2.2.tar.bz2) = 05660a2dc4c874bbb361dec8363da852 MD5 (gcc-objc-3.2.2.tar.bz2) = c2c99dca89281512403b9805c59ffd2d +MD5 (bounds-checking-gcc-3.2.2-1.00.patch.bz2) = 44a7e5030fde6e0e9350aa5029eacbaf diff --git a/lang/gcc32/files/opt.patch-bc b/lang/gcc32/files/opt.patch-bc new file mode 100644 index 000000000000..8b310da4e992 --- /dev/null +++ b/lang/gcc32/files/opt.patch-bc @@ -0,0 +1,11 @@ +--- gcc/bounds/lib/malloc/Makefile.orig Fri Sep 28 15:31:19 2001 ++++ gcc/bounds/lib/malloc/Makefile Mon Oct 1 13:58:20 2001 +@@ -52,7 +52,7 @@ VPATH = $(srcdir)/bounds/lib/malloc + SUBDIR_INCLUDES = -I$(srcdir)/bounds/lib/malloc -I../../.. -I$(srcdir) -I$(srcdir)/config -I../../../../include + + # Use this on System V. +-CPPFLAGS = -DUSG ++CPPFLAGS = -DBSD4_2 + + .c.o: + $(GCC_FOR_TARGET) -Wall $(OPTIMIZE) $(CPPFLAGS) \