aboutsummaryrefslogtreecommitdiffstats
path: root/lang/gdc/Makefile
blob: 4e23af64ced1d5155e305ca3515a9502fa063bbf (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
# 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.17
CATEGORIES= lang
MASTER_SITES=   ${MASTER_SITE_GCC} \
        http://home.earthlink.net/~dvdfrdmn/d/:gdc
MASTER_SITE_SUBDIR= snapshots/${GCC_VERSIONSTRING}
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX}:gdc \
        gcc-core-${GCC_VERSIONSTRING}${EXTRACT_SUFX} \
        gcc-g++-${GCC_VERSIONSTRING}${EXTRACT_SUFX}

MAINTAINER= ozawa@ongs.co.jp
COMMENT=    D Front End for GCC

ONLY_FOR_ARCHS= i386

USE_BISON=  yes
USE_BZIP2=  yes
USE_GMAKE=  yes
USE_PERL5_BUILD=yes
USE_REINPLACE=  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
CONFIGURE_SCRIPT=   ../${SRCDIR:C/${WRKDIR}\///}/configure

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

MAN1=       gdc.1

.ifndef TARGET_GCC
TARGET_GCC= 3.4 # default
.elif ${TARGET_GCC} != 3.4 && ${TARGET_GCC} != 4.0
.error it cannot be specified as TARGET_GCC other than 3.4 or 4.0
.endif

.if ${TARGET_GCC} == 4.0
GCC_VERSION=    4.0.3
GCC_REVISION=   20051201
GCC_VERSIONSTRING=  4.0-${GCC_REVISION}
.else
GCC_VERSION=    3.4.5
GCC_REVISION=   20051122
GCC_VERSIONSTRING=  3.4-${GCC_REVISION}
.endif

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

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 500039
# GDC required g++ version on the system of 3.x 4.0.1 and later.
IGNORE=     it is supported on FreeBSD 5.x and later
.endif

.if ${ARCH} == "amd64"
# I hope the GDC will support 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 'TARGET_GCC' variable to '3.4' or '4.0'."
    @${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

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_MAN} ${GCCDIR}/d/gdc.1 ${PREFIX}/man/man1
    @(cd ${WRKSRC} && ${GMAKE} install-target-libphobos)

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

.include <bsd.port.post.mk>