aboutsummaryrefslogtreecommitdiff
path: root/devel/ocaml-magic/Makefile
blob: 2d8e728681dd1aa9981dda298fe20dbb7666073f (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
# New ports collection makefile for:	ocaml libmagic(3)
# Date created:		Fri May 12 12:52:15 UTC 2006
# Whom:			Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=	magic
PORTVERSION=	0.6
CATEGORIES=	devel
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE_EXTENDED}
MASTER_SITE_SUBDIR=	${PKGNAMEPREFIX}${PORTNAME}
PKGNAMEPREFIX=	ocaml-
DISTNAME=	OCaml-Magic-${PORTVERSION}

MAINTAINER=	lioux@FreeBSD.org
COMMENT=	An OCaml binding for libmagic(3)

BUILD_DEPENDS=	ocamlc:${PORTSDIR}/lang/ocaml

ALL_TARGET=	opt
INSTALL_TARGET=	install-opt
USE_GMAKE=	yes

# This really is overzealous but I work this way
.if !exists(/usr/lib/libmagic.so)
LIB_DEPENDS+=	magic:${PORTSDIR}/sysutils/file
.endif

.ifndef(NOPORTDOCS)
ALL_TARGET+=	doc
INSTALL_TARGET+=	install-doc

PORTDOCS=	*
.endif

LIB_STUB_FILES=	\
		dllmagic_stub.so

post-configure:
# LIB safeness
	${REINPLACE_CMD} -E \
		-e's|(-lmagic[[:space:]]+)|\1 -lz |' \
		${WRKSRC}/Makefile
# CFLAGS,PREFIX safeness
	@${REINPLACE_CMD} -E \
		-e 's|^PREFIX.+$$||' \
		-e 's|\$$\(shell[[:space:]]+ocamlc[[:space:]]+-version\)||' \
		-e 's|^(DOCDIR).*$$|\1 = ${DOCSDIR}|' \
		-e 's,^((OCAMLC|OCAMLOPT|OCAMLDEP|OCAMLDOC|OCAMLMKLIB)[^=]*)[[:space:]]*=[[:space:]]*(.+)$$,\1 = ${LOCALBASE}/bin/\3,' \
		${WRKSRC}/Makefile.config

post-install:
# stub files
	@${MKDIR} ${PREFIX}/lib/ocaml/stublibs
.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}

.include <bsd.port.post.mk>