summaryrefslogtreecommitdiff
path: root/lang/pgcc/Makefile
blob: 5f0dc7f92c3d68fc71fdc98ba6ddfd043d7edb03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# $NetBSD: Makefile,v 1.23 2003/08/09 10:59:11 seb Exp $

DISTNAME=		gcc-2.95.2
PKGNAME=		pgcc-2.95.2.1
PKGREVISION=		1
CATEGORIES=		lang
MASTER_SITES=		${MASTER_SITE_GNU:=gcc/}

PATCH_SITES=		http://goof.com/pcg/data/source/
PATCHFILES=		gcc-${PGCC_VERSION}-${PKGNAME_NOREV}.diff.gz
PATCH_DIST_STRIP+=	-p1

MAINTAINER=		jmcneill@invisible.yi.org
HOMEPAGE=		http://goof.com/pcg/
COMMENT=		Pentium GNU Compiler Collection

# 'Pentium GCC' is optimized for the Intel Pentium processor, but should
# work on all platforms on which GCC works.
ONLY_FOR_PLATFORM=	NetBSD-*-arm NetBSD-*-arm32 NetBSD-*-i386	\
			NetBSD-*-m68k NetBSD-*-sparc SunOS-*-*

USE_BUILDLINK2=		YES
USE_PKGINSTALL=		YES
USE_GMAKE=		YES

HAS_CONFIGURE=		YES
CONFIGURE_SCRIPT=	${WRKSRC}/configure
CONFIGURE_ARGS=		--host=${MACHINE_GNU_PLATFORM}
CONFIGURE_ARGS+=	--prefix=${GCC_PREFIX}
CONFIGURE_ARGS+=	--enable-shared

CONFIGURE_DIRS=		${WRKDIR}/objdir
BUILD_DIRS=		${CONFIGURE_DIRS}

INFO_DIR=		${GCC_PREFIX:S|^${PREFIX}/||}/info
INFO_FILES=		chill.info cpp.info g77.info gcc.info

# For pgcc, GCC_VERSION is actually the name of a subdirectory in the gcc
# library tree.  We keep the odd name to keep this Makefile in-sync with
# lang/gcc/Makefile.  PGCC_VERSION is set to the actual version of pgcc.
#
PGCC_VERSION=	${PKGNAME:C/.*-//:C/nb[0-9]*$//}
GCC_ARCHDIR=	${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${GCC_VERSION}
GCC_VERSION=	${PKGNAME}

.include "../../mk/bsd.prefs.mk"

GCC_PREFIX=		${PREFIX}/${PKGNAME_NOREV}
PLIST_SRC=		${WRKDIR}/PLIST_DYNAMIC

.if ${OPSYS} == "SunOS"
.  if ${CC:M*gcc*} == ""
ALL_TARGET=		bootstrap
.  endif
# we know it's a GNU toolchain on Linux and the BSDs.
.elif ${OPSYS:M*BSD} != "" || ${OPSYS} == "Linux"
CONFIGURE_ARGS+=	--with-gnu-as
CONFIGURE_ARGS+=	--with-gnu-ld
.else
# play it safe, force a bootstrap build if we don't know for sure it
# is gcc.
.  if ${CC:M*gcc*} == ""
ALL_TARGET=             bootstrap
.  endif
.endif

FILES_SUBST+=		GCC_PREFIX=${GCC_PREFIX}
FILES_SUBST+=		PKGNAME_NOREV=${PKGNAME_NOREV}
MESSAGE_SUBST+=		PKGNAME_NOREV=${PKGNAME_NOREV}

post-extract:
	${CP} ${FILESDIR}/netbsd*.ml ${WRKSRC}/libstdc++/config

pre-configure:
	${MKDIR} ${BUILD_DIRS}
	cd ${WRKSRC} && contrib/egcs_update --touch

post-build:
	@${SED} ${FILES_SUBST_SED} ${FILESDIR}/gcc.mk > ${WRKDIR}/gcc.mk

post-install:
.if (${OPSYS} == "SunOS")
	-cd ${GCC_ARCHDIR}/include && ${RM} -f fixed && ${RMDIR} v7 v9
.else
	${RM} -f ${GCC_ARCHDIR}/include/curses.h ${GCC_PREFIX}/bin/cc
.endif
	${INSTALL_DATA_DIR} ${PREFIX}/share/examples/${PKGNAME_NOREV}
	${INSTALL_DATA} ${WRKDIR}/gcc.mk ${PREFIX}/share/examples/${PKGNAME_NOREV}/mk.conf
	${LN} -s gcc ${GCC_PREFIX}/bin/cc
	${CP} -f ${PKGDIR}/PLIST ${PLIST_SRC}
	${FIND} ${GCC_PREFIX} \( -type f -o -type l \) -print		\
		| ${SORT} | ${SED} -e "s,${PREFIX}/,,g"			\
		>> ${PLIST_SRC}
	${FIND} ${GCC_PREFIX} -type d -print				\
		| ${SORT} -r | ${SED} -e "s,${PREFIX}/,@dirrm ,g"	\
		>> ${PLIST_SRC}

.include "../../mk/bsd.pkg.mk"

# Make bootstrap with compiler != gcc possible.
LDFLAGS=		${_STRIPFLAG_CC}