aboutsummaryrefslogtreecommitdiffstats
path: root/devel/ocaml-event/Makefile
blob: 9d01c8a7e34b10446e9bcff49e40a16e7716640e (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
# Created by: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
# $FreeBSD$

PORTNAME=   event
PORTVERSION=    0.6.0
PORTREVISION=   2
CATEGORIES= devel
MASTER_SITES=   http://www.xs4all.nl/~mmzeeman/ocaml/
PKGNAMEPREFIX=  ocaml-
DISTNAME=   ${PKGNAMEPREFIX}${PORTNAME}-${PORTVERSION}

MAINTAINER= ports@FreeBSD.org
COMMENT=    Ocaml wrapper for the libevent API

BUILD_DEPENDS=  ocamlc:${PORTSDIR}/lang/ocaml
LIB_DEPENDS=    libevent-1.4.so:${PORTSDIR}/devel/libevent

ALL_TARGET= all allopt
USES=       gmake

.ifndef(NOPORTDOCS)
ALL_TARGET+=    doc

PORTDOCS=   *
.endif

EXAMPLE_FILES=  \
        Makefile \
        fifo_example.ml \
        http_server.ml \
        signal_example.ml
LIB_FILES=  \
        liboevent.a \
        liboevent.cmxa \
        libmloevent.a \
        liboevent.cma \
        liboevent.mli \
        liboevent.cmi
LIB_STUB_FILES= \
        dllmloevent.so

# examples to install
PLIST_DIRS+=    ${EXAMPLESDIR:S,^${PREFIX}/,,}
.for file in ${EXAMPLE_FILES}
PLIST_FILES+=   ${EXAMPLESDIR:S,^${PREFIX}/,,}/${file}
.endfor
# libraries to install
.for file in ${LIB_FILES}
PLIST_FILES+=   lib/ocaml/${file}
.endfor
.for file in ${LIB_STUB_FILES}
PLIST_FILES+=   lib/ocaml/stublibs/${file}
.endfor

NO_STAGE=   yes
post-configure:
# CFLAGS, LOCALBASE safeness
    ${REINPLACE_CMD} -E -e \
        's|^(EVENT_LIB=).*$$|\1-levent|; \
        s|^EVENT_LIBDIR=.*$$|EVENT_LIBDIR=${LOCALBASE}/lib|;  \
        s|^EVENT_INCDIR=.*$$|EVENT_INCDIR=${LOCALBASE}/include|; \
        s|^(CFLAGS).*$$|\1=${CFLAGS} -I\$$(EVENT_INCDIR)|' \
        ${WRKSRC}/Makefile

pre-build:
.for file in liboevent.cmi
    @cd ${WRKSRC} && ${MAKE_CMD} ${file}
.endfor

do-install:
# docs
.ifndef(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    @${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR}
.endif
# examples
    @${MKDIR} ${EXAMPLESDIR}
    @${INSTALL_DATA} ${WRKSRC}/examples/* ${EXAMPLESDIR}
# libs
    @${MKDIR} ${PREFIX}/lib/ocaml/stublibs
.for file in ${LIB_FILES}
    @${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/lib/ocaml
.endfor
.for file in ${LIB_STUB_FILES}
    @${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/lib/ocaml/stublibs
.endfor

.include <bsd.port.pre.mk>

DOCSDIR=    ${PREFIX}/share/doc/${PKGNAMEPREFIX}${PORTNAME}
EXAMPLESDIR=    ${PREFIX}/share/examples/${PKGNAMEPREFIX}${PORTNAME}

.include <bsd.port.post.mk>