aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/mapserver/Makefile
blob: 134de1bf48596e053a472c90559f9701e1b5389e (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Created by: Douglas K. Rand <rand@meridian-enviro.com>
# $FreeBSD$

PORTNAME=       mapserver
PORTVERSION=        6.4.1
PORTREVISION=       6
CATEGORIES=     graphics www geography
MASTER_SITES=       http://download.osgeo.org/mapserver/

MAINTAINER=     wen@FreeBSD.org
COMMENT=        System for developing web-based GIS applications

LICENSE=        MIT

LIB_DEPENDS=        libgd.so:${PORTSDIR}/graphics/gd \
            libproj.so:${PORTSDIR}/graphics/proj \
            libpng.so:${PORTSDIR}/graphics/png \
            libgif.so:${PORTSDIR}/graphics/giflib

USES=           cpe cmake:outsource jpeg
CPE_VENDOR=     umn
USE_GNOME=      libxml2
LDFLAGS+=       -L${LOCALBASE} -pthread
CMAKE_ARGS+=        -DCMAKE_PREFIX_PATH=${LOCALBASE} \
            -DCMAKE_INSTALL_PREFIX=${PREFIX} \
            -DWITH_GD=1
MAKE_JOBS_UNSAFE=   yes

OPTIONS_DEFINE=     FRIBIDI CURL GDAL GEOS KML POSTGIS PHP PERL PYTHON \
            WMS WFS WCS FASTCGI DEBUG CAIRO CAIRO_SVG \
            CLIENT_WMS CLIENT_WFS
OPTIONS_DEFAULT=    FRIBIDI GDAL GEOS CLIENT_WMS CLIENT_WFS
CAIRO_SVG_DESC=     Cairo SVG parser support
GDAL_DESC=      GDAL library support
FRIBIDI_DESC=       Fribidi library support
KML_DESC=       KML support
WMS_DESC=       WMS Server support
WFS_DESC=       WFS Server support
WCS_DESC=               WCS Server support

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MPYTHON}
USES+=          python:2
BUILD_DEPENDS+=     swig2.0:${PORTSDIR}/devel/swig20
CMAKE_ARGS+=        -DWITH_PYTHON=yes
PLIST_SUB+=     PYTHON=""
MAP_EGG=        MapScript-${PORTVERSION}-${PYTHON_VERSION:S/thon//}
PLIST_SUB+=     MAP_EGG=${MAP_EGG}
.else
PLIST_SUB+=     PYTHON="@comment "
.endif

.if ${PORT_OPTIONS:MCAIRO}
LIB_DEPENDS+=       libcairo.so:${PORTSDIR}/graphics/cairo \
            libexpat.so:${PORTSDIR}/textproc/expat2
CMAKE_ARGS+=        -DWITH_CAIRO=1
.else
CMAKE_ARGS+=        -DWITH_CAIRO=0
.endif

.if ${PORT_OPTIONS:MFRIBIDI}
LIB_DEPENDS+=       libfribidi.so:${PORTSDIR}/converters/fribidi
CMAKE_ARGS+=        -DWITH_FRIBIDI=1
.else
CMAKE_ARGS+=        -DWITH_FRIBIDI=0
.endif

.if ${PORT_OPTIONS:MCAIRO_SVG}
LIB_DEPENDS+=       libcairo.so:${PORTSDIR}/graphics/cairo \
            libsvg-cairo.so:${PORTSDIR}/graphics/libsvg-cairo \
            libexpat.so:${PORTSDIR}/textproc/expat2
CMAKE_ARGS+=        -DWITH_SVGCAIRO=1 -DWITH_CAIRO=1
USES+=          pkgconfig
.else
CMAKE_ARGS+=        -DWITH_SVGCAIRO=0
.endif

.if ${PORT_OPTIONS:MKML}
LIB_DEPENDS+=       libxml2.so:${PORTSDIR}/textproc/libxml2
CMAKE_ARGS+=        -DWITH_KML=1
.else
CMAKE_ARGS+=        -DWITH_KML=0
.endif

.if ${PORT_OPTIONS:MWMS}
CMAKE_ARGS+=        -DWITH_WMS=1
.else
CMAKE_ARGS+=        -DWITH_WMS=0
.endif

.if ${PORT_OPTIONS:MWFS}
CMAKE_ARGS+=        -DWITH_WFS=1
.else
CMAKE_ARGS+=        -DWITH_WFS=0
.endif

.if ${PORT_OPTIONS:MWCS}
CMAKE_ARGS+=        -DWITH_WCS=1
.else
CMAKE_ARGS+=        -DWITH_WCS=0
.endif

.if ${PORT_OPTIONS:MGDAL}
USES+=          iconv
LIB_DEPENDS+=       libgdal.so:${PORTSDIR}/graphics/gdal
CMAKE_ARGS+=        -DWITH_GDAL=1
.else
CMAKE_ARGS+=        -DWITH_GDAL=0
.endif

.if ${PORT_OPTIONS:MGEOS}
LIB_DEPENDS+=       libgeos.so:${PORTSDIR}/graphics/geos
CMAKE_ARGS+=        -DWITH_GEOS=1
.else
CMAKE_ARGS+=        -DWITH_GEOS=0
.endif

.if ${PORT_OPTIONS:MPOSTGIS}
USES+=          pgsql
CMAKE_ARGS+=        -DWITH_POSTGIS=1
.else
CMAKE_ARGS+=        -DWITH_POSTGIS=0
.endif

.if ${PORT_OPTIONS:MPHP}
BUILD_DEPENDS+=     ${LOCALBASE}/bin/php-config:${PORTSDIR}/lang/php5
RUN_BUILDS+=        ${LOCALBASE}/bin/php-config:${PORTSDIR}/lang/php5
PHP_EXTENSION_DIR!= ${LOCALBASE}/bin/php-config --extension-dir | ${SED} -e "s,/usr/local/,,"
CMAKE_ARGS+=        -DWITH_PHP=1
PLIST_SUB+=     PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
PLIST_SUB+=     PHP=""
.else
CMAKE_ARGS+=        -DWITH_PHP=0
PLIST_SUB+=     PHP="@comment "
.endif

.if ${PORT_OPTIONS:MPERL}
USES+=      perl5
BUILD_DEPENDS=  ${LOCALBASE}/bin/swig2.0:${PORTSDIR}/devel/swig20
CMAKE_ARGS+=    -DWITH_PERL=1
PLIST_SUB+= PERL=""
.else
CMAKE_ARGS+=    -DWITH_PERL=0
PLIST_SUB+= PERL="@comment "
.endif

.if ${PORT_OPTIONS:MCURL}
LIB_DEPENDS+=       libcurl.so:${PORTSDIR}/ftp/curl
CMAKE_ARGS+=        -DWITH_CURL=1
.else
CMAKE_ARGS+=        -DWITH_CURL=0
.endif

.if ${PORT_OPTIONS:MFASTCGI}
BUILD_DEPENDS+=     ${LOCALBASE}/bin/cgi-fcgi:${PORTSDIR}/www/fcgi
CMAKE_ARGS+=        -DWITH_FCGI=1
.else
CMAKE_ARGS+=        -DWITH_FCGI=0
.endif

.if ${PORT_OPTIONS:MDEBUG}
CMAKE_ARGS+=        -DCMAKE_BUILD_TYPE=Debug
.else
CMAKE_ARGS+=        -DCMAKE_BUILD_TYPE=Release
.endif

PROG_FILES=     legend scalebar shp2img shptree shptreetst shptreevis \
            sortshp msencrypt tile4ms mapserv

.if ${PORT_OPTIONS:MCLIENT_WMS}
LIB_DEPENDS+=       libcurl.so:${PORTSDIR}/ftp/curl
LIB_DEPENDS+=       libgdal.so:${PORTSDIR}/graphics/gdal
CMAKE_ARGS+=        -DWITH_CURL=1 -DWITH_GDAL=1 -DWITH_CLIENT_WMS=1
.endif

.if ${PORT_OPTIONS:MCLIENT_WFS}
LIB_DEPENDS+=       libcurl.so:${PORTSDIR}/ftp/curl
LIB_DEPENDS+=       libgdal.so:${PORTSDIR}/graphics/gdal
CMAKE_ARGS+=        -DWITH_CURL=1 -DWITH_GDAL=1 -DWITH_CLIENT_WFS=1
.endif

do-install:
.for f in ${PROG_FILES}
    ${STRIP_CMD} ${BUILD_WRKSRC}/${f}
    ${INSTALL_SCRIPT} ${BUILD_WRKSRC}/${f} ${STAGEDIR}${PREFIX}/bin
.endfor
    ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/libmapserver.so.${PORTVERSION} ${STAGEDIR}${PREFIX}/lib

.if ${PORT_OPTIONS:MPHP}
    @${MKDIR} ${STAGEDIR}${PREFIX}/${PHP_EXTENSION_DIR}
    ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/mapscript/php/php_mapscript.so \
        ${STAGEDIR}${PREFIX}/${PHP_EXTENSION_DIR}/
.endif

.if ${PORT_OPTIONS:MPYTHON}
    @${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/
    (cd ${BUILD_WRKSRC}/mapscript/python && ${CP} mapscript.py _mapscript.so ${STAGEDIR}${PYTHON_SITELIBDIR}/)
.endif

post-install:
    @${LN} -s ${PREFIX}/lib/libmapserver.so.6.4.1 ${STAGEDIR}${PREFIX}/lib/libmapserver.so.1
    @${LN} -s ${PREFIX}/lib/libmapserver.so.1 ${STAGEDIR}${PREFIX}/lib/libmapserver.so

.if ${PORT_OPTIONS:MPHP}
    @${ECHO_MSG} "Please add the line extension=php_mapscript.so to ${PREFIX}/etc/php/extensions.ini"
.endif

.include <bsd.port.mk>