summaryrefslogtreecommitdiffstats
path: root/lang/lua-ada/Makefile
blob: 10173219d044261b5c90c02973cc75846783ce87 (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
# Created by: John Marino <marino@FreeBSD.org>
# $FreeBSD$

PORTNAME=	lua-ada
PORTVERSION=	1.0			# made-up; no version info on GH
CATEGORIES=	lang

MAINTAINER=	marino@FreeBSD.org
COMMENT=	Ada binding for Lua

LICENSE=	GPLv3 GPLv3RLE
LICENSE_COMB=	multi

BUILD_DEPENDS=	gprbuild:devel/gprbuild

USES=		ada lua
USE_GITHUB=	yes
GH_ACCOUNT=	AdaCore
GH_PROJECT=	ada-lua
GH_TAGNAME=	e008192

SUB_FILES=	lua.gpr
SUB_LIST=	LUA_VER=${LUA_VER}

PORTEXAMPLES=	example1 example2
EXDIRPREFIX=	${WRKSRC}/examples/example
REPLACEMENT=	"-L${LOCALBASE}/lib", "-Wl,-R,${LOCALBASE}/lib",\
		"-llua-${LUA_VER}"

OPTIONS_DEFINE=	EXAMPLES

.include <bsd.port.options.mk>

post-patch:
	@${REINPLACE_CMD} -e 's|with "Lua"|with "../../lua.gpr"|' \
		-e 's|"-L../..", "-llua"|${REPLACEMENT}|' \
		${EXDIRPREFIX}1/example1.gpr \
		${EXDIRPREFIX}2/example2.gpr

do-build:
	(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
		gprbuild -Plua --create-missing-dirs)
.if ${PORT_OPTIONS:MEXAMPLES}
	(cd ${WRKSRC}/examples/example1 && ${SETENV} ${MAKE_ENV} \
		gprbuild -Pexample1 --create-missing-dirs)
	(cd ${WRKSRC}/examples/example2 && ${SETENV} ${MAKE_ENV} \
		gprbuild -Pexample2 --create-missing-dirs)
.endif

do-install:
	${MKDIR} ${STAGEDIR}${PREFIX}/lib/lua-ada \
		${STAGEDIR}${PREFIX}/lib/gnat \
		${STAGEDIR}${PREFIX}/include/lua-ada
	${INSTALL_DATA} ${WRKSRC}/lib/* ${STAGEDIR}${PREFIX}/lib/lua-ada
	${INSTALL_DATA} ${WRKSRC}/lua.gpr ${STAGEDIR}${PREFIX}/lib/gnat
	${INSTALL_DATA} ${WRKSRC}/src/*.ad[bs] \
		${STAGEDIR}${PREFIX}/include/lua-ada
.if ${PORT_OPTIONS:MEXAMPLES}
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/example1/bin \
		${STAGEDIR}${EXAMPLESDIR}/example2/bin
	${INSTALL_DATA} ${EXDIRPREFIX}1/example1.lua \
		${EXDIRPREFIX}1/src/main.adb \
		${STAGEDIR}${EXAMPLESDIR}/example1
	${INSTALL_PROGRAM} ${EXDIRPREFIX}1/obj/main \
		${STAGEDIR}${EXAMPLESDIR}/example1/bin/hello-lua
	${INSTALL_DATA} ${EXDIRPREFIX}2/example2.lua \
		${EXDIRPREFIX}2/src/main.adb \
		${STAGEDIR}${EXAMPLESDIR}/example2
	${INSTALL_PROGRAM} ${EXDIRPREFIX}2/obj/main \
		${STAGEDIR}${EXAMPLESDIR}/example2/bin/hello-function
.endif

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