aboutsummaryrefslogtreecommitdiff
path: root/x11-toolkits/ocaml-lablgtk2/Makefile
blob: 4a0dcbfd32761e3189ef7bcd165acd8dfee55182 (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# New ports collection makefile for:	lablgtk2
# Date created:		2004-11-02
# Whom:			Rene Ladan
#
# $FreeBSD$

PORTNAME=	lablgtk2
PORTVERSION=	2.6.0
PORTREVISION=	3
CATEGORIES=	x11-toolkits
MASTER_SITES=	ftp://ftp.kurims.kyoto-u.ac.jp/pub/lang/olabl/ \
		http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/dist/ \
		ftp://ftp.inria.fr/INRIA/caml-light/bazar-ocaml/ \
		http://caml.inria.fr/distrib/bazar-ocaml/
PKGNAMEPREFIX=	ocaml-
DISTNAME=	lablgtk-${PORTVERSION}

MAINTAINER=	stas@FreeBSD.org
COMMENT=	An Objective Caml interface to GTK+ 2.x

USE_GMAKE=	yes
USE_GNOME=	gtk20
USE_OCAML=	yes

OPTIONS=	GLADE "With glade support" ON \
		GNOMECANVAS "With gnomecanvas support" ON \
		GNOMEPANEL "With gnomepanel support" ON \
		GNOMEUI "With gnomeui support" ON \
		GTKSPELL "With gtkspell support" ON \
		GTKTL "With gtkglarea support" ON \
		RSVG "With rsvg support" ON

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

HAS_CONFIGURE=	yes
ALL_TARGET=	all opt

CONFIGURE_ARGS=	--prefix=${PREFIX} --with-libdir=${PREFIX}/lib/ocaml

PATTERN=	[[:space:]]*(do|then)?[[:space:]]*)cp([[:space:]]

.include <bsd.port.pre.mk>

.if (exists(${LOCALBASE}/bin/lablgl) && exists(${LOCALBASE}/libdata/pkgconfig/gtkgl-2.0.pc)) || defined(WITH_GTKTL)
CONFIGURE_ARGS+=	--with-gl
BUILD_DEPENDS+=	lablgl:${PORTSDIR}/graphics/ocaml-lablgl
RUN_DEPENDS+=	lablgl:${PORTSDIR}/graphics/ocaml-lablgl
LIB_DEPENDS+=	gtkgl-2.0.1:${PORTSDIR}/x11-toolkits/gtkglarea2
WITH_GL=	yes
PLIST_SUB+=	GL=""
.else
CONFIGURE_ARGS+=	--without-gl
PLIST_SUB+=	GL="@comment "
.endif

.if (exists(${LOCALBASE}/libdata/pkgconfig/libglade-2.0.pc)) || defined(WITH_GLADE)
CONFIGURE_ARGS+=	--with-glade
USE_GNOME+=	libglade2
WITH_GLADE=	yes
PLIST_SUB+=	GLADE=""
.else
CONFIGURE_ARGS+=	--without-glade
PLIST_SUB+=	GLADE="@comment "
.endif

.if (exists(${LOCALBASE}/libdata/pkgconfig/libgnomeui-2.0.pc)) || defined(WITH_GNOMEUI)
CONFIGURE_ARGS+=	--with-gnomeui
USE_GNOME+=	libgnomeui
WITH_GNOMEUI=	yes
PLIST_SUB+=	GNOMEUI=""
.else
CONFIGURE_ARGS+=	--without-gnomeui
PLIST_SUB+=	GNOMEUI="@comment "
.endif

.if (exists(${LOCALBASE}/libdata/pkgconfig/libgnomecanvas-2.0.pc)) || defined(WITH_GNOMECANVAS)
CONFIGURE_ARGS+=	--with-gnomecanvas
USE_GNOME+=	libgnomecanvas
PLIST_SUB+=	GNOMECANVAS=""
WITH_GNOMECANVAS=	yes
.else
CONFIGURE_ARGS+=	--without-gnomecanvas
PLIST_SUB+=	GNOMECANVAS="@comment "
.endif

.if (exists(${LOCALBASE}/libdata/pkgconfig/librsvg-2.0.pc)) || defined(WITH_RSVG)
CONFIGURE_ARGS+=	--with-rsvg
USE_GNOME+=	librsvg2
WITH_RSVG=	yes
PLIST_SUB+=	RSVG=""
.else
CONFIGURE_ARGS+=	--without-rsvg
PLIST_SUB+=	RSVG="@comment "
.endif

.if (exists(${LOCALBASE}/libdata/pkgconfig/libpanelapplet-2.0.pc)) || defined(WITH_GNOMEPANEL)
CONFIGURE_ARGS+=	--with-panel
USE_GNOME+=	gnomepanel
WITH_PANEL=	yes
PLIST_SUB+=	PANEL=""
.else
CONFIGURE_ARGS+=	--without-panel
PLIST_SUB+=	PANEL="@comment "
.endif

.if (exists(${LOCALBASE}/libdata/pkgconfig/gtkspell-2.0.pc)) || defined(WITH_GTKSPELL)
LIB_DEPENDS+=	gtkspell.0:${PORTSDIR}/textproc/gtkspell

CONFIGURE_ARGS+=	--with-gtkspell
PLIST_SUB+=	GTKSPELL=""
WITH_GTKSPELL=	yes
.else
CONFIGURE_ARGS+=	--without-gtkspell
PLIST_SUB+=	GTKSPELL="@comment "
.endif

post-extract:
	@${REINPLACE_CMD} -E \
		-e 's,^(CFLAGS[[:space:]]*\+=[[:space:]]*-O),\1 ${CFLAGS},' \
		-e 's,^(${PATTERN}+.*INSTALLDIR),\1\$${BSD_INSTALL_DATA} \3,' \
		-e 's,^(${PATTERN}+.*BINDIR),\1\$${BSD_INSTALL_SCRIPT} \3,' \
		-e 's,^(${PATTERN}+.*LIBDIR),\1\$${BSD_INSTALL_DATA} \3,' \
		${WRKSRC}/src/Makefile

post-install:
.if !defined(NOPORTDOCS)
	@${MKDIR} ${EXAMPLESDIR}
	@${INSTALL_DATA} ${WRKSRC}/examples/image256x256.rgb \
		${WRKSRC}/examples/test.xpm \
		${WRKSRC}/examples/*.ml ${EXAMPLESDIR}
	@${MKDIR} ${EXAMPLESDIR}/text
	@${INSTALL_DATA} ${WRKSRC}/examples/text/* ${EXAMPLESDIR}/text
	@${MKDIR} ${DOCSDIR}
	@${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}/README
	@${INSTALL_DATA} ${WRKSRC}/COPYING ${DOCSDIR}/COPYING
.endif
.if defined(WITH_GL) && !defined(NOPORTDOCS)
	@${MKDIR} ${EXAMPLESDIR}/GL
	@${INSTALL_DATA} ${WRKSRC}/examples/GL/* ${EXAMPLESDIR}/GL
.endif
.if defined(WITH_GNOMECANVAS) && !defined(NOPORTDOCS)
	@${MKDIR} ${EXAMPLESDIR}/canvas
	@${INSTALL_DATA} ${WRKSRC}/examples/canvas/* ${EXAMPLESDIR}/canvas
.endif
.if defined(WITH_GLADE) && !defined(NOPORTDOCS)
	@${MKDIR} ${EXAMPLESDIR}/glade
	@${INSTALL_DATA} ${WRKSRC}/examples/glade/* ${EXAMPLESDIR}/glade
.endif
.if defined(WITH_PANEL) && !defined(NOPORTDOCS)
	@${MKDIR} ${EXAMPLESDIR}/panel
	@${INSTALL_DATA} ${WRKSRC}/examples/panel/* ${EXAMPLESDIR}/panel
.endif
.if defined(WITH_RSVG) && !defined(NOPORTDOCS)
	@${MKDIR} ${EXAMPLESDIR}/rsvg
	@${INSTALL_DATA} ${WRKSRC}/examples/rsvg/* ${EXAMPLESDIR}/rsvg
.endif

.include <bsd.port.post.mk>