summaryrefslogtreecommitdiff
path: root/base/gcc6/Makefile
blob: ef94a3ca21f95a2f99fd30b80b48e059e8cd7bb9 (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

PORTNAME=	gcc
PORTVERSION=	6.5.0
PORTREVISION=	1
CATEGORIES=	base
MASTER_SITES=	GCC/releases/gcc-${DISTVERSION} \
		http://www.mpfr.org/mpfr-3.1.6/:mpfr \
		http://www.mpfr.org/mpfr-current/:mpfr \
		GNU/gmp:gmp \
		https://ftp.gnu.org/gnu/mpc/:mpc
DISTFILES=	${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX} \
		mpfr-3.1.6.tar.xz:mpfr \
		gmp-6.1.2.tar.xz:gmp \
		mpc-1.0.3.tar.gz:mpc
PKGNAMEPREFIX=	${OPSYS:tl}-
PKGNAMESUFFIX=	${SUFFIX}

MAINTAINER=	bapt@FreeBSD.org
COMMENT=	GNU Compiler Collection

LICENSE=	GPLv3 GPLv3RLE
LICENSE_COMB=	multi

TARGETARCH=	${ARCH:S/amd64/x86_64/}
GCC_TARGET=	${TARGETARCH}-unknown-${OPSYS:tl}${OSREL}
SUFFIX=		${PORTVERSION:C/([0-9]+).*/\1/}

PREFIX=		/usr
.for _tool in CC CXX CPP AS AR LD NM OBJCOPY RANLIB SIZE STRINGS
CONFIGURE_ENV+= ${_tool}_FOR_TARGET="${${_tool}}"
.endfor

USES=	gmake libtool tar:xz makeinfo
PLIST_SUB=	OPSYS=${OPSYS:tl} \
		SUFFIX=${SUFFIX} \
		GCC_TARGET=${GCC_TARGET} \
		GCC_VERSION=${PORTVERSION}

GCC_PORTDIR=	${.CURDIR}/../../devel/freebsd-gcc${SUFFIX}
EXTRA_PATCHES+= ${GCC_PORTDIR}/files

GNU_CONFIGURE=	yes
CONFIGURE_OUTSOURCE=	yes
CONFIGURE_ARGS+=	\
		--target=${GCC_TARGET} \
		--enable-languages=c,c++ \
		--enable-gnu-indirect-function \
		--disable-nls \
		--without-headers \
		--with-gxx-include-dir=/usr/include/c++/v1/ \
		--with-sysroot="/" \
		--with-build-sysroot=${CROSS_SYSROOT} \
		-with-pkgversion="GNU Collection for FreeBSD"

ALL_TARGET?=	all-gcc
INSTALL_TARGET?=	install-gcc

.include <bsd.port.pre.mk>

.if ${OSVERSION} >= 1200000
CONFIGURE_ARGS+= --enable-initfini-array
.endif

.if ${HOSTARCH} == "amd64"
CONFIGURE_TARGET=	x86_64-unknown-${OPSYS:tl}${OSREL}
.else
CONFIGURE_TARGET=	${HOSTARCH}-unknown-${OPSYS:tl}${OSREL}
.endif

PLIST_SUB+=	PLUGINS=""

.if ${ARCH} == "amd64" || ${ARCH} == "i386"
PLIST_SUB+=	FLOAT_H="@comment "
.else
PLIST_SUB+=	FLOAT_H=""
.endif

PLIST=		${.CURDIR}/pkg-plist ${GCC_PORTDIR}/pkg-plist.common

.if ${TARGETARCH} == "aarch64"
PLIST+=		${GCC_PORTDIR}/pkg-plist.aarch64
.endif
.if ${TARGETARCH} == "aarch64" || ${TARGETARCH:Marm*}
PLIST+=		${GCC_PORTDIR}/pkg-plist.arm
.endif
.if ${ARCH} == "amd64"
PLIST+=		${GCC_PORTDIR}/pkg-plist.amd64
.endif
.if ${ARCH} == "amd64" || ${ARCH} == "i386"
PLIST+=		${GCC_PORTDIR}/pkg-plist.i386
.endif
.if ${ARCH:Mmips*}
PLIST+=		${GCC_PORTDIR}/pkg-plist.mips
.endif
.if ${ARCH:Mpowerpc*}
PLIST+=		${GCC_PORTDIR}/pkg-plist.powerpc
.endif
.if ${TARGETARCH} == "sparc64"
PLIST+=		${GCC_PORTDIR}/pkg-plist.sparc64
.endif

post-extract:
	cd ${WRKSRC}; ${LN} -sf ../mpfr-3.1.6 mpfr ; \
		${LN} -sf ../gmp-6.1.2 gmp ; \
		${LN} -sf ../mpc-1.0.3 mpc

post-patch:
	@${REINPLACE_CMD} -e '/LIBSTDCXX/ s/stdc\+\+/c\+\+/g ' \
		${WRKSRC}//gcc/cp/g++spec.c
	@${REINPLACE_CMD} -e '/LOCAL_INCLUDE_DIR/ d ' \
		${WRKSRC}//gcc/Makefile.in

post-install:
	${LN} -f ${STAGEDIR}/usr/bin/gcc  ${STAGEDIR}/usr/bin/cc ; \
	${LN} -sf gcc.1 ${STAGEDIR}/${MANDIR}1/cc.1
	${LN} -sf g++.1 ${STAGEDIR}/${MANDIR}1/c++.1
	${RM} -r ${STAGEDIR}/usr/share/info
	${RM} -r ${STAGEDIR}/usr/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include-fixed
.if ${ARCH} == "amd64" || ${ARCH} == "i386"
	${RM} ${STAGEDIR}/usr/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include/float.h
.endif
	@${MKDIR} ${STAGEDIR}${PREFIX}/share/toolchains
	${INSTALL_DATA} ${FILESDIR}/freebsd-gcc.mk ${STAGEDIR}${PREFIX}/share/toolchains/freebsd-gcc${SUFFIX}.mk

.include <bsd.port.post.mk>