Annotation of pkgsrc/lang/gcc-ssp/Makefile, Revision 1.32
1.32 ! kristerw 1: # $NetBSD: Makefile,v 1.31 2004/01/24 13:51:14 grant Exp $
1.1 kent 2:
1.6 kent 3: DISTNAME= gcc-2.95.3
1.18 kent 4: PKGNAME= gcc-ssp-2.95.3.13
1.30 cjep 5: PKGREVISION= 2
1.1 kent 6: CATEGORIES= lang security
7: MASTER_SITES= ${MASTER_SITE_GNU:=gcc/}
8:
1.27 grant 9: MAINTAINER= tech-pkg@NetBSD.org
1.1 kent 10: HOMEPAGE= http://www.trl.ibm.com/projects/security/ssp/
11: COMMENT= GNU Compiler Collection with Stack-smashing protection
1.14 dmcmahil 12:
1.15 dmcmahil 13: PATCH_SITES= ${MASTER_SITE_LOCAL}
14: PATCHFILES= gcc-2.95.3-diff-2002-08-29.gz
1.1 kent 15:
1.18 kent 16: SSP_PATCH= protector-2.95.3-13.tar.gz
1.1 kent 17: DISTFILES+= ${DISTNAME}.tar.gz ${SSP_PATCH}
1.18 kent 18: SITES_protector-2.95.3-13.tar.gz= http://www.trl.ibm.com/projects/security/ssp/gcc2_95_3/
1.28 seb 19:
20: PATCHDIR= ${.CURDIR}/../gcc/patches
21: GCC_FILESDIR= ${.CURDIR}/../gcc/files
1.1 kent 22:
1.2 kent 23: #ONLY_FOR_PLATFORM= NetBSD-*-i386 NetBSD-*-sparc
24: #
25: # Build error for NetBSD/alpha
1.16 kent 26: #NOT_FOR_PLATFORM= NetBSD-*-alpha \
27: # NetBSD-*-powerpc NetBSD-*-macppc \
28: # NetBSD-*-prep NetBSD-*-bebox NetBSD-*-ofppc \
29: # NetBSD-*-amigappc NetBSD-*-sandpoint
1.32 ! kristerw 30: NOT_FOR_PLATFORM= *-*-x86_64
1.2 kent 31:
1.28 seb 32: USE_BUILDLINK2= YES
33: USE_PKGINSTALL= YES
1.31 grant 34: USE_GNU_TOOLS+= make
1.1 kent 35:
36: HAS_CONFIGURE= YES
1.28 seb 37: CONFIGURE_SCRIPT= ${WRKSRC}/configure
38: CONFIGURE_ARGS= --host=${MACHINE_GNU_PLATFORM}
39: CONFIGURE_ARGS+= --prefix=${GCC_PREFIX}
40: CONFIGURE_ARGS+= --enable-shared
41:
42: CONFIGURE_DIRS= ${WRKDIR}/objdir
43: BUILD_DIRS= ${CONFIGURE_DIRS}
44:
45: FILES_SUBST+= PKGNAME_NOREV=${PKGNAME_NOREV} GCC_PREFIX=${GCC_PREFIX}
46: MESSAGE_SUBST+= PKGNAME_NOREV=${PKGNAME_NOREV}
47:
48: INFO_DIR= ${GCC_PREFIX:S|^${PREFIX}/||}/info
49: INFO_FILES= chill.info cpp.info g77.info gcc.info
1.1 kent 50:
51: .include "../../mk/bsd.prefs.mk"
52:
1.28 seb 53: .if ${OPSYS} == "SunOS"
54: . if ${CC:M*gcc*} == ""
55: ALL_TARGET= bootstrap
56: . endif
57: # we know it's a GNU toolchain on Linux and the BSDs.
58: .elif ${OPSYS:M*BSD} != "" || ${OPSYS} == "Linux"
59: CONFIGURE_ARGS+= --with-gnu-as
60: CONFIGURE_ARGS+= --with-gnu-ld
1.1 kent 61: .else
1.28 seb 62: # play it safe, force a bootstrap build if we don't know for sure it
63: # is gcc.
1.26 grant 64: . if ${CC:M*gcc*} == ""
1.1 kent 65: ALL_TARGET= bootstrap
1.26 grant 66: . endif
1.1 kent 67: .endif
68:
1.28 seb 69: GCC_PREFIX= ${PREFIX}/${PKGNAME_NOREV}
70: GCC_VERSION= ${DISTNAME:C/^.*-//}
71: GCC_ARCHDIR= ${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${GCC_VERSION}
72: PLIST_SRC= ${WRKDIR}/PLIST_DYNAMIC
73:
1.1 kent 74: post-extract:
75: ${MKDIR} ${WRKSRC}
1.28 seb 76: ${CP} ${GCC_FILESDIR}/xm-netbsd.h ${WRKSRC}/gcc/config
77: ${CP} ${GCC_FILESDIR}/xm-target64.h ${WRKSRC}/gcc/config
78: for file in ${GCC_FILESDIR}/*_* ; do \
79: arch=`${BASENAME} $${file} | ${SED} -e "s/_.*//"`; \
80: dest=`${BASENAME} $${file} | ${SED} -e "s/$${arch}_//"`; \
81: ${MKDIR} ${WRKSRC}/gcc/config/$${arch}; \
82: ${CP} $${file} ${WRKSRC}/gcc/config/$${arch}/$${dest}; \
1.7 kent 83: done; \
1.28 seb 84: ${RM} ${WRKSRC}/gcc/config/alpha/netbsd-elf.h
85: ${RM} ${WRKSRC}/gcc/config/arm/t-netbsd
86: ${RM} ${WRKSRC}/gcc/config/mips/x-netbsd
87: ${RM} ${WRKSRC}/libf2c/libF77/dtime_.c
88: ${RM} ${WRKSRC}/libf2c/libF77/etime_.c
1.1 kent 89:
90: post-patch:
1.21 grant 91: cd ${WRKDIR} && ${PAX} -O -zrf ${_DISTDIR}/${SSP_PATCH}
1.28 seb 92: ${CP} ${WRKDIR}/protector.c ${WRKDIR}/protector.h ${WRKSRC}/gcc/
93: ${PATCH} -p0 -d ${WRKSRC} --forward --quiet -E < ${WRKDIR}/protector.dif
94: ${PATCH} -p0 -d ${WRKSRC} --forward --quiet -E < ${WRKDIR}/protectonly.dif
95:
96: pre-configure:
97: ${MKDIR} ${BUILD_DIRS}
98: cd ${WRKSRC} && contrib/egcs_update --touch
1.1 kent 99:
1.28 seb 100: post-build:
101: @${SED} ${FILES_SUBST_SED} ${FILESDIR}/gcc.mk > ${WRKDIR}/gcc.mk
1.26 grant 102: .if ${OPSYS} != "SunOS"
1.22 cjep 103: @${ECHO} "===> Check whether stack protection works or not"
1.28 seb 104: ${BUILD_DIRS}/gcc/xgcc -B${BUILD_DIRS}/gcc/ -O2 -o ${WRKDIR}/buffer ${FILESDIR}/buffer.c
1.22 cjep 105: ulimit -c 0 && ${WRKDIR}/buffer abcdefghijklmnopqrstuvwxyz 2> ${WRKDIR}/output || ${TRUE}
106: @if [ x"`${CAT} ${WRKDIR}/output`" = "x: stack smashing attack in function main" ]; then \
107: ${ECHO} "===> Stack protection succeeded."; \
1.2 kent 108: exit 0; \
109: else \
1.22 cjep 110: ${ECHO} "**** Stack protection failed."; \
1.2 kent 111: exit 1; \
112: fi
1.1 kent 113: .endif
114:
1.29 cjep 115: .if ${OPSYS} == "SunOS"
1.28 seb 116: #
117: # remove empty file and directories that show up when one does:
118: # make install; make deinstall; make install
119: #
1.29 cjep 120: post-install:
1.28 seb 121: -cd ${GCC_ARCHDIR}/include && ${RM} -f fixed && ${RMDIR} v7 v9
1.9 kent 122: .else
123: post-install:
1.28 seb 124: . if exists(/usr/include/g++/FlexLexer.h)
125: ${LN} -fs /usr/include/g++/FlexLexer.h \
126: ${GCC_PREFIX}/include/g++-3/FlexLexer.h
127: . endif
128: ${RM} -f ${GCC_ARCHDIR}/include/curses.h ${GCC_PREFIX}/bin/cc
1.1 kent 129: .endif
1.28 seb 130: ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/${PKGNAME_NOREV}
131: ${INSTALL_DATA} ${WRKDIR}/gcc.mk ${PREFIX}/share/examples/${PKGNAME_NOREV}/mk.conf
132: ${LN} -s gcc ${GCC_PREFIX}/bin/cc
133: ${CP} -f ${PKGDIR}/PLIST ${PLIST_SRC}
134: ${FIND} ${GCC_PREFIX} \( -type f -o -type l \) -print \
135: | ${SORT} | ${SED} -e "s,${PREFIX}/,,g" \
136: >> ${PLIST_SRC}
137: ${FIND} ${GCC_PREFIX} -type d -print \
138: | ${SORT} -r | ${SED} -e "s,${PREFIX}/,@dirrm ,g" \
139: >> ${PLIST_SRC}
1.1 kent 140:
141: .include "../../mk/bsd.pkg.mk"
142:
143: # Make bootstrap with compiler != gcc possible.
1.12 yyamano 144: LDFLAGS= ${_STRIPFLAG_CC}
CVSweb <webmaster@jp.NetBSD.org>