aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/mapserver/Makefile
blob: da7081f5809a039dc126a3a6c3c34157d25ec0c1 (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
210
211
212
213
214
215
# Created by: Douglas K. Rand <rand@meridian-enviro.com>
# $FreeBSD$

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

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

LIB_DEPENDS=        gd:${PORTSDIR}/graphics/gd \
            proj:${PORTSDIR}/graphics/proj \
            png15:${PORTSDIR}/graphics/png \
            jpeg:${PORTSDIR}/graphics/jpeg \
            gif:${PORTSDIR}/graphics/giflib \
            curl:${PORTSDIR}/ftp/curl

USE_GMAKE=      yes
GNU_CONFIGURE=      yes
CONFIGURE_ARGS=     --with-proj=${LOCALBASE} \
            --with-gd=${LOCALBASE} \
            --with-png=${LOCALBASE} \
            --with-jpeg=${LOCALBASE} \
            --with-gif=${LOCALBASE} \
            --with-curl-config=${LOCALBASE}
MAKE_JOBS_UNSAFE=   yes

OPTIONS_DEFINE=     AGG TIFF PDF GDAL GEOS KML MING MYGIS POSTGIS PHP PERL PYTHON \
            WMS WFS MAPSERV FASTCGI DEBUG CAIRO CAIRO_SVG
OPTIONS_DEFAULT=    AGG GDAL GEOS MAPSERV
AGG_DESC=       AGG image rendering support
CAIRO_SVG_DESC=     Cairo SVG parser support
GDAL_DESC=      GDAL library support
KML_DESC=       KML support
MING_DESC=      Macromedia Flash output support
MYGIS_DESC=     MyGIS support
WMS_DESC=       Web map service server and client support
WFS_DESC=       Web feature service support
MAPSERV_DESC=       Mapserv cgi interface support

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MMAPSERV}
USE_APACHE_RUN=     22+
PLIST_SUB+=     MAPSERV=""
PLIST_SUB+=     APA_VER=${APACHE_VERSION}
PLIST_DIRSTRY=      www/apache${APACHE_VERSION}/cgi-bin
.else
PLIST_SUB+=     MAPSERV="@comment "
.endif

.if ${PORT_OPTIONS:MPYTHON}
USE_PYTHON=     2.6
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:MAGG}
LIB_DEPENDS+=       agg:${PORTSDIR}/graphics/agg
.endif

.if ${PORT_OPTIONS:MCAIRO}
LIB_DEPENDS+=       cairo:${PORTSDIR}/graphics/cairo \
            expat:${PORTSDIR}/textproc/expat2
CONFIGURE_ARGS+=    --with-cairo=yes --with-expat=${LOCALBASE}
USES+=          pkgconfig
.endif

.if ${PORT_OPTIONS:MCAIRO_SVG}
LIB_DEPENDS+=       cairo:${PORTSDIR}/graphics/cairo \
            svg-cairo:${PORTSDIR}/graphics/libsvg-cairo \
            expat:${PORTSDIR}/textproc/expat2
CONFIGURE_ARGS+=    --with-cairo=yes \
            --with-libsvg-cairo \
            --with-expat=${LOCALBASE}
USES+=          pkgconfig
.endif

.if ${PORT_OPTIONS:MKML}
LIB_DEPENDS+=       xml2:${PORTSDIR}/textproc/libxml2
CONFIGURE_ARGS+=    --with-kml --with-xml2-config=${LOCALBASE}/bin/xml2-config
.endif

.if ${PORT_OPTIONS:MTIFF}
LIB_DEPENDS+=       tiff:${PORTSDIR}/graphics/tiff
CONFIGURE_ARGS+=    --with-tiff
.endif

.if ${PORT_OPTIONS:MMING}
LIB_DEPENDS+=       ming:${PORTSDIR}/graphics/ming
CONFIGURE_ARGS+=    --with-ming=${LOCALBASE}
.endif

.if ${PORT_OPTIONS:MPDF}
LIB_DEPENDS+=       pdf:${PORTSDIR}/print/pdflib \
            tiff:${PORTSDIR}/graphics/tiff
CONFIGURE_ARGS+=    --with-pdf=${LOCALBASE} --with-tiff=${LOCALBASE} --with-png=${LOCALBASE}
.endif

.if ${PORT_OPTIONS:MWMS}
CONFIGURE_ARGS+=    --with-wms --with-wmsclient
.endif

.if ${PORT_OPTIONS:MWFS}
LIB_DEPENDS+=       curl:${PORTSDIR}/ftp/curl \
            gdal:${PORTSDIR}/graphics/gdal
CONFIGURE_ARGS+=    --with-wfs --with-wfsclient --with-curl=${LOCALBASE} \
            --with-gdal=${LOCALBASE}/bin/gdal-config \
            --with-ogr=${LOCALBASE}/bin/gdal-config
.endif

.if ${PORT_OPTIONS:MGDAL}
LIB_DEPENDS+=       gdal:${PORTSDIR}/graphics/gdal
CONFIGURE_ARGS+=    --with-gdal=${LOCALBASE}/bin/gdal-config \
            --with-ogr=${LOCALBASE}/bin/gdal-config
.endif

.if ${PORT_OPTIONS:MGEOS}
LIB_DEPENDS+=       geos:${PORTSDIR}/graphics/geos
CONFIGURE_ARGS+=    --with-geos=${LOCALBASE}/bin/geos-config
.endif

.if ${PORT_OPTIONS:MMYGIS}
USE_MYSQL=      yes
CONFIGURE_ARGS+=    --with-mygis=${LOCALBASE}/bin/mysql_config
.endif

.if ${PORT_OPTIONS:MPOSTGIS}
BUILD_DEPENDS+=     ${LOCALBASE}/lib/libpgport.a:${PORTSDIR}/databases/postgresql${PGSQL_VER}-server
USE_PGSQL=      yes
DEFAULT_PGSQL_VER=  83
CONFIGURE_ARGS+=    --with-postgis=${LOCALBASE}/bin/pg_config
.endif

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

.if ${PORT_OPTIONS:MPERL}
USE_PERL5=yes
PLIST_SUB+=     PERL=""
.else
PLIST_SUB+=     PERL="@comment "
.endif

.if ${PORT_OPTIONS:MCURL}
LIB_DEPENDS+=       curl:${PORTSDIR}/ftp/curl
CONFIGURE_ARGS+=    --with-curl=${LOCALBASE}
.endif

.if ${PORT_OPTIONS:MFASTCGI}
BUILD_DEPENDS+=     ${LOCALBASE}/bin/cgi-fcgi:${PORTSDIR}/www/fcgi
CONFIGURE_ARGS+=    --with-fastcgi=${LOCALBASE}
.endif

.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+=    --enable-debug
.endif

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

post-patch:
.if ${PORT_OPTIONS:MMING}
    ${REINPLACE_CMD} -e 's#with_ming/include#with_ming/include/ming#g' \
        ${WRKSRC}/configure
.endif

post-build:
.if ${PORT_OPTIONS:MPERL}
    (cd ${WRKSRC}/mapscript/perl && ${PERL5} Makefile.PL && make)
.endif

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

.if ${PORT_OPTIONS:MMAPSERV}
    ${MKDIR} ${LOCALBASE}/www/apache${APACHE_VERSION}/cgi-bin/
    ${INSTALL_SCRIPT} ${WRKSRC}/.libs/mapserv ${LOCALBASE}/www/apache${APACHE_VERSION}/cgi-bin/mapserv
.endif

.if ${PORT_OPTIONS:MPHP}
    @${MKDIR} ${LOCALBASE}/${PHP_EXTENSION_DIR}
    ${INSTALL_PROGRAM} ${WRKSRC}/mapscript/php/.libs/php_mapscript.so \
        ${LOCALBASE}/${PHP_EXTENSION_DIR}/
.endif

.if ${PORT_OPTIONS:MPERL}
    (cd ${WRKSRC}/mapscript/perl && make install)
.endif

.if ${PORT_OPTIONS:MPYTHON}
    (cd ${WRKSRC}/mapscript/python && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} setup.py install)
.endif

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

.include <bsd.port.mk>