summaryrefslogtreecommitdiff
path: root/lang/gcc34/Makefile
blob: beff8c3200f51544bd4ad79a1266ccfebb16aeb8 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# $NetBSD: Makefile,v 1.58 2019/11/03 19:03:58 rillig Exp $
#

DISTNAME=	gcc-${GCC_VERSION}
PKGNAME=	gcc34-${GCC_VERSION}
PKGREVISION=	8
CATEGORIES=	lang
MASTER_SITES=	${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
EXTRACT_SUFX=	.tar.bz2

MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	http://www.gnu.org/software/gcc/gcc.html
COMMENT=	This is the gcc 3.4 compiler
LICENSE=	gnu-gpl-v2 AND gnu-lgpl-v2.1

GCC_VERSION=		3.4.6

NOT_FOR_PLATFORM=	Interix-*-*

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

# Determine whether to use binutils
.if ${OPSYS} == "NetBSD"
.  if !defined(USE_BINUTILS)
AS_PATH:=		${AS}
.    for _dir_ in ${PATH:C/\:/ /g}
.      if empty(AS_PATH:M/*)
.        if exists(${_dir_}/${AS})
AS_PATH:=		${_dir_}/${AS}
.        endif
.      endif
.    endfor
.    if !empty(AS_PATH:M${LOCALBASE}/*)
USE_BINUTILS=		YES
.    else
AS_VERSION!=		${AS_PATH} --version | ${AWK} '{			\
		    split($$3, v, /[.]/);				\
		    printf "%02d%02d%02d%02d\n",v[1],v[2],v[3],v[4];	\
		    exit;						\
		}'
USE_BINUTILS!=		${TEST} ${AS_VERSION} -lt 02130201 && ${ECHO} YES || ${ECHO} NO
.    endif
MAKEFLAGS+=		USE_BINUTILS=${USE_BINUTILS:Q}
.  endif
.elif ${OPSYS} == "SunOS"
CONFIGURE_ENV+=		OBJDUMP=/usr/sfw/bin/gobjdump
CONFIGURE_ARGS+=	--without-gnu-ld --with-ld=/usr/ccs/bin/ld
.  if !exists(/usr/sfw/bin/gas)
CONFIGURE_ARGS+=	--without-gnu-as --with-as=/usr/ccs/bin/as
.  else
CONFIGURE_ARGS+=	--with-gnu-as --with-as=/usr/sfw/bin/gas
.  endif
.endif
.if defined(USE_BINUTILS) && !empty(USE_BINUTILS:M[yY][eE][sS])
DEPENDS+=		binutils>=2.14:../../devel/binutils
CONFIGURE_ARGS+=	--with-as=${LOCALBASE}/bin/as
CONFIGURE_ARGS+=	--with-ld=${LOCALBASE}/bin/ld
CONFIGURE_ARGS+=	--with-gnu-as
CONFIGURE_ARGS+=	--with-gnu-ld
.endif

CONFIGURE_ARGS+=	--enable-languages=${LANGS:Q}
CONFIGURE_ARGS+=	--enable-shared
CONFIGURE_ARGS+=	--enable-long-long
CONFIGURE_ARGS+=	--with-local-prefix=${GCC_PREFIX:Q}
MAKE_ENV+=		SHELL=${CONFIG_SHELL}

UNLIMIT_RESOURCES+=	datasize

# GNU pth is useless here
PTHREAD_OPTS+=		native
.include "../../mk/pthread.buildlink3.mk"
.if defined(PTHREAD_TYPE) && ${PTHREAD_TYPE} != "native"
CONFIGURE_ARGS+=	--disable-threads
.endif

USE_TOOLS+=		gmake makeinfo
HAS_CONFIGURE=		YES # no GNU_CONFIGURE!
CONFIG_SHELL?=		${SH}
CONFIGURE_ENV+=		CONFIG_SHELL=${CONFIG_SHELL:Q}

GCC_SUBPREFIX=		gcc34
GCC_PREFIX=		${PREFIX}/${GCC_SUBPREFIX}
FILES_SUBST+=		PKGNAME=${PKGNAME:Q}
MESSAGE_SUBST+=		GCC_PREFIX=${GCC_PREFIX}
CONFIGURE_ARGS+=	--prefix=${GCC_PREFIX:Q}
CPPFLAGS+=		-I${BUILDLINK_DIR}/include
CFLAGS+=		-I${BUILDLINK_DIR}/include
.if ${OPSYS} == "NetBSD"
# thread / crtbegin / __cxa_atexit support depend on a "netbsd2" OS name
GCC_PLATFORM=		${MACHINE_ARCH}--${LOWER_OPSYS}${APPEND_ELF}${LOWER_OS_VERSION:C/[_a-z].*//}
CONFIGURE_ARGS+=	--host=${GCC_PLATFORM:Q}
ABI_BASELINE_PAIR=	${GCC_PLATFORM:C/--/-/}
MAKE_ENV+=		ABI_BASELINE_PAIR=${ABI_BASELINE_PAIR:Q}
.endif # NetBSD

post-patch:
.if ${OPSYS} == "NetBSD"
.  if exists(${FILESDIR}/${MACHINE_ARCH}-baseline_symbols${LOWER_OS_VERSION:C/\..*//}.txt)
	(${TEST} -d ${WRKSRC}/libstdc++-v3/config/abi/${ABI_BASELINE_PAIR} || \
		${MKDIR} ${WRKSRC}/libstdc++-v3/config/abi/${ABI_BASELINE_PAIR})
	${CP} ${FILESDIR}/${MACHINE_ARCH}-baseline_symbols${LOWER_OS_VERSION:C/\..*//}.txt \
		${WRKSRC}/libstdc++-v3/config/abi/${ABI_BASELINE_PAIR}/baseline_symbols.txt
.  endif
.endif

.if ${OPSYS} == "DragonFly"
pre-configure:
	${CP} ${FILESDIR}/dragonfly.h ${WRKSRC}/gcc/config/dragonfly.h
	${CP} ${FILESDIR}/dragonfly-spec.h ${WRKSRC}/gcc/config/dragonfly-spec.h
	${CP} ${FILESDIR}/i386-dragonfly.h ${WRKSRC}/gcc/config/i386/dragonfly.h
	${CP} ${FILESDIR}/i386-dragonfly64.h ${WRKSRC}/gcc/config/i386/dragonfly64.h
.endif

do-configure:
	${MKDIR} ${WRKDIR}/obj
	cd ${WRKDIR}/obj; ${SETENV} ${CONFIGURE_ENV} ${CONFIG_SHELL} ${WRKSRC}/configure ${CONFIGURE_ARGS}

do-build:
	(${_ULIMIT_CMD} cd ${WRKDIR}/obj && ${SETENV} ${MAKE_ENV} ${GMAKE} bootstrap)
.if !empty(PKG_OPTIONS:Mgcc-ada)
	(${_ULIMIT_CMD} cd ${WRKDIR}/obj/gcc && ${SETENV} ${MAKE_ENV} ${GMAKE} gnatlib-shared)
	(${_ULIMIT_CMD} cd ${WRKDIR}/obj/gcc && ${SETENV} ${MAKE_ENV} ${GMAKE} gnatlib_and_tools)
.endif

do-test:
.if (${MACHINE_GNU_ARCH} == "x86_64")
	(cd ${FILESDIR} && ${CP} netbsd64macro.dfs ${WRKSRC}/gcc/testsuite/ada/acats/support/macro.dfs)
.endif
	(cd ${WRKDIR}/obj && ${GMAKE} -k check)

do-install:
	(cd ${WRKDIR}/obj && ${SETENV} ${INSTALL_ENV} ${MAKE_ENV} ${GMAKE} install \
	 && ${TEST} -f ${GCC_PREFIX}/bin/cc || ${LN} -f ${DESTDIR}${GCC_PREFIX}/bin/gcc ${DESTDIR}${GCC_PREFIX}/bin/cc)
.if !empty(PKG_OPTIONS:Mgcc-ada)
	(SPECPATH=`${GCC_PREFIX}/bin/gcc -print-file-name=specs` && \
	for EXPANDEDSPECPATH in $${SPECPATH} ; do \
		SPECDIR=`${DIRNAME} $${EXPANDEDSPECPATH}`; \
		${ECHO} $${SPECDIR}/adainclude > $${SPECDIR}/ada_source_path;	\
		${ECHO} $${SPECDIR}/adalib > $${SPECDIR}/ada_object_path;	\
	done )
.endif

GENERATE_PLIST+=							\
	${FIND} ${DESTDIR}${GCC_PREFIX} \( -type f -o -type l \) -print		\
		| ${SORT} | ${SED} -e "s,${DESTDIR}${PREFIX}/,,g";

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