aboutsummaryrefslogtreecommitdiff
path: root/lang/gdc/Makefile
blob: cf2478b0e3a5a671e93697ea6e1d88e30c62f849 (plain) (blame)
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
# New ports collection makefile for:	D Front End for GCC
# Date created:		18 November 2004
# Whom:			Masanori OZAWA (ozawa@ongs.co.jp)
#
# $FreeBSD$
#

PORTNAME=	gdc
PORTVERSION=	0.24
PORTREVISION=	6
CATEGORIES=	lang
MASTER_SITES=	${MASTER_SITE_GCC} \
		${MASTER_SITE_SOURCEFORGE:S/%SUBDIR%/dgcc/g:S/$/:gdc/g}
MASTER_SITE_SUBDIR=	${GCC_MASTER_SITE_SUBDIR}
DISTFILES=	${DISTNAME}-src${EXTRACT_SUFX}:gdc \
		gcc-core-${GCC_VERSIONSTRING}${EXTRACT_SUFX} \
		gcc-g++-${GCC_VERSIONSTRING}${EXTRACT_SUFX}

MAINTAINER=	ports@FreeBSD.org
COMMENT=	D Front End for GCC

ONLY_FOR_ARCHS=	i386 amd64

USE_BISON=	build
USE_BZIP2=	yes
USE_GMAKE=	yes
USE_PERL5=	yes
USE_ICONV=	yes

SRCDIR=		${WRKDIR}/gcc-${GCC_VERSIONSTRING}
WRKSRC=		${WRKDIR}/build
PATCH_WRKSRC=	${SRCDIR}

GNU_CONFIGURE=	yes
CONFIGURE_ARGS+=--disable-nls \
		--with-system-zlib \
		--with-libiconv-prefix=${LOCALBASE} \
		--disable-shared \
		--enable-languages=c,c++,d \
		--enable-thread-lib=-pthread
CONFIGURE_SCRIPT=	../${SRCDIR:C/${WRKDIR}\///}/configure

PLIST_SUB=	GCC_VER=${GCC_VERSION} CONF_TARGET=${CONFIGURE_TARGET}

MAN1=		gdc.1 gdmd.1

GCCDIR=		${SRCDIR}/gcc
GDC_INC=	${PREFIX}/include/d/${GCC_VERSION}

.include <bsd.port.pre.mk>

.if ${OSVERSION} >= 800041
EXTRA_PATCHES+=	${FILESDIR}/extra-patch-gcc-d-phobos-std-math.d
.endif

.ifndef TARGET_GCC
.if ${OSVERSION} >= 700000 || ${ARCH} == "amd64"
TARGET_GCC=	4.1
.else
TARGET_GCC=	3.4
.endif
.elif ${TARGET_GCC} != 3.4 && ${TARGET_GCC} != 4.0 && ${TARGET_GCC} != 4.1
.error it cannot be specified as TARGET_GCC other than 3.4, 4.0 or 4.1
.endif

.if ${TARGET_GCC} == 4.1
GCC_VERSION=	4.1.3
GCC_REVISION=	20080428
GCC_VERSIONSTRING=	4.1-${GCC_REVISION}
GCC_MASTER_SITE_SUBDIR=	snapshots/${GCC_VERSIONSTRING}
.elif ${TARGET_GCC} == 4.0
GCC_VERSION=	4.0.4
GCC_VERSIONSTRING=	${GCC_VERSION}
GCC_MASTER_SITE_SUBDIR=	releases/gcc-${GCC_VERSIONSTRING}
.else
GCC_VERSION=	3.4.6
GCC_VERSIONSTRING=	${GCC_VERSION}
GCC_MASTER_SITE_SUBDIR=	releases/gcc-${GCC_VERSIONSTRING}
.endif

.if ${ARCH} == "amd64"
CONFIGURE_TARGET=	x86_64-portbld-freebsd${OSREL}
.endif

pre-fetch:
	@${ECHO_CMD}
	@${ECHO_CMD} "========================================================="
	@${ECHO_CMD}
	@${ECHO_CMD} "GDC is built with GCC version '${TARGET_GCC}'."
	@${ECHO_CMD}
	@${ECHO_CMD} "You can set one of the following variables as TARGET_GCC."
	@${ECHO_CMD}
	@${ECHO_CMD} " '3.4' , '4.0' , '4.1'"
	@${ECHO_CMD}
	@${ECHO_CMD} "========================================================="
	@${ECHO_CMD}

post-extract:
	@${MV} ${WRKDIR}/d ${GCCDIR}

post-patch:
	@(cd ${SRCDIR} && ${SH} ./gcc/d/setup-gcc.sh)
	@${REINPLACE_CMD} -e \
		's|\(const char version_string.*\)";|\1 [FreeBSD]";|' \
		${GCCDIR}/version.c
	@${REINPLACE_CMD} -e \
		's|^\(gcc_d_include_dir\).*|\1 = ${GDC_INC}|' \
		${GCCDIR}/d/Make-lang.in
	@${REINPLACE_CMD} -e 's, BsdSockets_salen, GNU_BsdSockets_salen,' \
		${GCCDIR}/d/phobos/config/unix-mid

pre-configure:
	@(cd ${SRCDIR} && contrib/gcc_update --touch)
	@${RM} -f ${SRCDIR}/gcc/*/*.info*
	@${MKDIR} ${CONFIGURE_WRKSRC}

post-build:
	@${ECHO_CMD}
	@${ECHO_CMD} "========================================================="
	@${ECHO_CMD}
	@${ECHO_CMD} "To test the Phobos run-time library run 'make check'."
	@${ECHO_CMD}
	@${ECHO_CMD} "Note that some tests will fail."
	@${ECHO_CMD}
	@${ECHO_CMD} "========================================================="
	@${ECHO_CMD}

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/gcc/gdc ${PREFIX}/bin
	${INSTALL_PROGRAM} ${WRKSRC}/gcc/cc1d ${PREFIX}/bin
	${INSTALL_SCRIPT} ${GCCDIR}/d/dmd-script ${PREFIX}/bin/gdmd
.ifndef NOPORTDOCS
	${MKDIR} ${DOCSDIR}
	${INSTALL_DATA} ${GCCDIR}/d/GDC.html ${DOCSDIR}
	${INSTALL_DATA} ${GCCDIR}/d/README ${DOCSDIR}/README.gdc
.endif
	${INSTALL_MAN} ${GCCDIR}/d/gdc.1 ${PREFIX}/man/man1
	${INSTALL_MAN} ${GCCDIR}/d/dmd-script.1 ${PREFIX}/man/man1/gdmd.1
	@(cd ${WRKSRC} && ${GMAKE} install-target-libphobos)

check: build
	@(cd ${WRKSRC} && ${GMAKE} check-target-libphobos)

.include <bsd.port.post.mk>