summaryrefslogtreecommitdiffstats
path: root/lang/dmd2/Makefile
blob: a45d2936cd3e471e4fedc50b954729624057b724 (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
# Created by: Ruben <chromium@hybridsource.org>
# $FreeBSD$

PORTNAME=	dmd
PORTVERSION=	2.073.2
DISTVERSIONPREFIX=	v
CATEGORIES=	lang
PKGNAMESUFFIX=	2

MAINTAINER=	cy@FreeBSD.org
COMMENT=	D 2.0 compiler, not officially validated for FreeBSD

LICENSE=	ART10 DMD BSL
LICENSE_COMB=	multi
LICENSE_NAME_DMD=	Digital Mars license
LICENSE_FILE_DMD=	${WRKSRC}/dmd/src/backendlicense.txt
LICENSE_PERMS_DMD=	no-dist-mirror no-dist-sell no-pkg-mirror no-pkg-sell auto-accept

USE_GITHUB=	nodefault
GH_ACCOUNT=	dlang
GH_PROJECT=	dmd:dmd druntime:druntime phobos:phobos dlang.org:dlang_org
USES=		gmake
MAKEFILE=	posix.mak
MAKE_ARGS=	HOST_DMD=${WRKDIR}/.host_dmd-2.067.1/stage/usr/local/bin/dmd
EXAMPLESDIR=	${PREFIX}/share/examples/dmd2
DOCSDIR=	${PREFIX}/share/doc/dmd2
WRKSRC=		${WRKDIR}

BROKEN_aarch64=		Does not configure: no cpu specified, assuming X86
BROKEN_mips64=		Does not compile: cc1: error: unrecognized command line option -m32
BROKEN_powerpc64=	Does not build
BROKEN_sparc64=		Does not install: divide-by-zero error

OPTIONS_DEFINE=	DOCS EXAMPLES

.include <bsd.port.options.mk>

post-extract:
	@${MV} ${WRKSRC_dmd} ${WRKSRC}/dmd
	@${MV} ${WRKSRC_druntime} ${WRKSRC}/druntime
	@${MV} ${WRKSRC_phobos} ${WRKSRC}/phobos
	@${MV} ${WRKSRC_dlang_org} ${WRKSRC}/dlang.org

.if ${ARCH} == "amd64"
MAKE_ARGS+=	MODEL=64
MODEL=		64
.else
MAKE_ARGS+=	MODEL=32
MODEL=		32
.endif

.if defined(WITH_DEBUG)
BUILD=		debug
MAKE_ARGS+=	DEBUG_FLAGS=-g\ -DDEBUG=1\ -DUNITTEST
.endif

MODULEDIR=	${PREFIX}/include/d/phobos2

post-patch:
	@${REINPLACE_CMD} -e "s|g++|${CXX}|" \
			  -e "s|/etc|${PREFIX}/etc|" \
		${WRKSRC}/dmd/src/posix.mak
	@${REINPLACE_CMD} -e "s|gcc|${CC}|" ${WRKSRC}/dmd/src/link.d
	@${REINPLACE_CMD} -e "s|cc|${CC}|" ${WRKSRC}/phobos/posix.mak
	@${REINPLACE_CMD} -e "s|/etc|${PREFIX}/etc|"	\
			  -e "s|\(dmd\)|\12|gI"		\
			  -e "s|\\\BR|.BR|"		\
		${WRKDIR}/dmd/docs/man/man1/dmd.1		\
		${WRKDIR}/dmd/docs/man/man5/dmd.conf.5
	@${REINPLACE_CMD} -e "s|%@P%/../../src/phobos|${MODULEDIR}|"	\
			  -e "s|%@P%/../lib|${PREFIX}/lib|"		\
			  -e "s|%@P%/../../src/druntime|${PREFIX}/include/d/druntime|"	\
			  ${WRKDIR}/dmd/ini/freebsd/bin${MODEL}/dmd.conf
	@${ECHO_CMD} >> ${WRKDIR}/dmd/ini/freebsd/bin${MODEL}/dmd.conf

make-phobos:
	cd ${WRKSRC}/phobos && ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} -f ${MAKEFILE} ${BUILD}


make-druntime:
	cd ${WRKSRC}/druntime && ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} -f ${MAKEFILE} ${BUILD}

make-dmd:
	cd ${WRKSRC}/dmd && ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} -f ${MAKEFILE} ${BUILD}

do-build: make-dmd make-phobos make-druntime

do-install:
	${INSTALL_MAN} ${WRKDIR}/dmd/docs/man/man1/dmd.1 ${STAGEDIR}${MANPREFIX}/man/man1/dmd.1
	${INSTALL_MAN} ${WRKDIR}/dmd/docs/man/man5/dmd.conf.5 ${STAGEDIR}${MANPREFIX}/man/man5/dmd.conf.5
	${INSTALL_DATA} ${WRKDIR}/dmd/ini/freebsd/bin${MODEL}/dmd.conf ${STAGEDIR}${PREFIX}/etc/dmd.conf
	${INSTALL_PROGRAM} ${WRKSRC}/dmd/src/dmd ${STAGEDIR}${PREFIX}/bin/dmd
	${INSTALL_DATA} ${WRKSRC}/phobos/generated/freebsd/release/${MODEL}/libphobos2.a ${STAGEDIR}${PREFIX}/lib
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	${INSTALL_DATA} ${WRKDIR}/dmd/ini/freebsd/bin${MODEL}/dmd.conf ${STAGEDIR}${PREFIX}/etc/dmd.conf.sample
	cd ${WRKDIR}/druntime/import && ${COPYTREE_SHARE} . ${STAGEDIR}${MODULEDIR}
	cd ${WRKSRC}/phobos && ${COPYTREE_SHARE} std ${STAGEDIR}${MODULEDIR}
	cd ${WRKSRC}/phobos && ${COPYTREE_SHARE} etc ${STAGEDIR}${MODULEDIR}
	
post-install-DOCS-on:
	cd ${WRKSRC}/dlang.org && ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} -f ${MAKEFILE} html ${BUILD} LATEST=${PORTVERSION}
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	${INSTALL_DATA} ${WRKSRC}/dmd/*.md ${STAGEDIR}${DOCSDIR}
	cd ${WRKDIR}/dlang.org/web && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}

post-install-EXAMPLES-on:
	cd ${WRKDIR}/dmd && ${COPYTREE_SHARE} samples ${STAGEDIR}${EXAMPLESDIR}
	${INSTALL_DATA} ${WRKDIR}/dmd/ini/freebsd/bin32/dmd.conf ${STAGEDIR}${EXAMPLESDIR}/dmd32.conf
	${INSTALL_DATA} ${WRKDIR}/dmd/ini/freebsd/bin64/dmd.conf ${STAGEDIR}${EXAMPLESDIR}/dmd64.conf

pre-fetch:
	${MAKE} -f Makefile.bootstrap BOOTDIR=${WRKDIR} checksum

pre-configure:
	${MAKE} -f Makefile.bootstrap BOOTDIR=${WRKDIR}

.include <bsd.port.mk>
OpenPOWER on IntegriCloud