Gentoo Archives: gentoo-commits

From: Amy Winston <amynka@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-geosciences/mapserver/, sci-geosciences/mapserver/files/
Date: Sat, 27 Feb 2016 12:23:00
Message-Id: 1456575498.238b62dfa764bfcc95ed52b1c29e5b19dc6b2be7.amynka@gentoo
1 commit: 238b62dfa764bfcc95ed52b1c29e5b19dc6b2be7
2 Author: Amy Winston <amynka <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 27 12:18:18 2016 +0000
4 Commit: Amy Winston <amynka <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 27 12:18:18 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=238b62df
7
8 sci-geosciences/mapserver: version bump 7.0.0 bug #471250
9
10 Package-Manager: portage-2.2.26
11
12 sci-geosciences/mapserver/Manifest | 1 +
13 .../files/mapserver-7.0.0-OGREscapeSQLParam.patch | 22 +
14 .../mapserver-7.0.0-correct-min-max-calls.patch | 511 +++++++++++++++++++++
15 .../files/mapserver-7.0.0-disabled-ogr.patch | 56 +++
16 .../mapserver/files/mapserver-7.0.0-giflib51.patch | 35 ++
17 .../mapserver-7.0.0-mapwcs-disabled-libxml2.patch | 20 +
18 .../files/mapserver-7.0.0-no-applicable-code.patch | 34 ++
19 .../files/mapserver-7.0.0-sec-format.patch | 13 +
20 sci-geosciences/mapserver/mapserver-7.0.0.ebuild | 177 +++++++
21 9 files changed, 869 insertions(+)
22
23 diff --git a/sci-geosciences/mapserver/Manifest b/sci-geosciences/mapserver/Manifest
24 index d294b0b..c981436 100644
25 --- a/sci-geosciences/mapserver/Manifest
26 +++ b/sci-geosciences/mapserver/Manifest
27 @@ -1 +1,2 @@
28 DIST mapserver-6.0.1.tar.gz 2430064 SHA256 dd6821917aa7030381442f5e092e4f46f44b9deb9425ec92729e5819e9b61d65 SHA512 0fd9da9d6452fbfbaf0c815e6d15309e185119a4ab33cab2f1c6839bfb8c3a75ce6e7e7779b0eb2aa6e80d1a623ca6e0e58a02049b0db0bfa3f7b0f29117d5dc WHIRLPOOL e4846d40b93c22f7b5dcce1c242b4d88db253be9185194b45c4acddf9066d10c2ec2fbe667941dfe15702838690517a0e57719b1937169e55517e43ed1c225b8
29 +DIST mapserver-7.0.0.tar.gz 2495028 SHA256 b306b8111e0718a577ce595640c2d3224f913745af732a1b75f6f5cb3dddce45 SHA512 1e4d15f6c42cdf0b00533e2aa26c1b65f84bdbb3a91538d6addde3aa0e8874deed4969146cf7045858bcab2880e4d7429965660c5985d175bd19ce018ae90652 WHIRLPOOL f18f0679b70da795d0585df2dbcc07fda0f8533c9ef7972280301446e5d521d9f24f0ff482d8e5497954e3b67436f2f9f2576516f6f088dc388046314817a46b
30
31 diff --git a/sci-geosciences/mapserver/files/mapserver-7.0.0-OGREscapeSQLParam.patch b/sci-geosciences/mapserver/files/mapserver-7.0.0-OGREscapeSQLParam.patch
32 new file mode 100644
33 index 0000000..6ea6d92
34 --- /dev/null
35 +++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-OGREscapeSQLParam.patch
36 @@ -0,0 +1,22 @@
37 +diff --git a/mapogr.cpp b/mapogr.cpp
38 +index 1708d1c..217239b 100755
39 +--- a/mapogr.cpp
40 ++++ b/mapogr.cpp
41 +@@ -1311,6 +1311,8 @@ static int msOGRFileClose(layerObj *layer, msOGRFileInfo *psInfo )
42 + return MS_SUCCESS;
43 + }
44 +
45 ++#endif
46 ++
47 + /************************************************************************/
48 + /* msOGREscapeSQLParam */
49 + /************************************************************************/
50 +@@ -1337,6 +1339,8 @@ static char *msOGREscapeSQLParam(layerObj *layer, const char *pszString)
51 + #endif /* USE_OGR */
52 + }
53 +
54 ++#ifdef USE_OGR
55 ++
56 + /**********************************************************************
57 + * msOGRTranslateMsExpressionToOGRSQL()
58 + *
59
60 diff --git a/sci-geosciences/mapserver/files/mapserver-7.0.0-correct-min-max-calls.patch b/sci-geosciences/mapserver/files/mapserver-7.0.0-correct-min-max-calls.patch
61 new file mode 100644
62 index 0000000..7383457
63 --- /dev/null
64 +++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-correct-min-max-calls.patch
65 @@ -0,0 +1,511 @@
66 +diff --git a/mapcontour.c b/mapcontour.c
67 +index ae52fc6..74cf7d1 100644
68 +--- a/mapcontour.c
69 ++++ b/mapcontour.c
70 +@@ -345,11 +345,11 @@ static int msContourLayerReadRaster(layerObj *layer, rectObj rect)
71 + ury = floor(ury / virtual_grid_step_y) * virtual_grid_step_y - (virtual_grid_step_x*5);
72 + lly = ceil(lly / virtual_grid_step_y) * virtual_grid_step_y + (virtual_grid_step_x*5);
73 +
74 +- src_xoff = MAX(0,(int) floor(llx+0.5));
75 +- src_yoff = MAX(0,(int) floor(ury+0.5));
76 +- src_xsize = MIN(MAX(0,(int) (urx - llx + 0.5)),
77 ++ src_xoff = MS_MAX(0,(int) floor(llx+0.5));
78 ++ src_yoff = MS_MAX(0,(int) floor(ury+0.5));
79 ++ src_xsize = MS_MIN(MS_MAX(0,(int) (urx - llx + 0.5)),
80 + GDALGetRasterXSize(clinfo->hOrigDS) - src_xoff);
81 +- src_ysize = MIN(MAX(0,(int) (lly - ury + 0.5)),
82 ++ src_ysize = MS_MIN(MS_MAX(0,(int) (lly - ury + 0.5)),
83 + GDALGetRasterYSize(clinfo->hOrigDS) - src_yoff);
84 +
85 + /* Update the geographic extent (buffer added) */
86 +@@ -386,8 +386,8 @@ static int msContourLayerReadRaster(layerObj *layer, rectObj rect)
87 + } else {
88 + src_xoff = 0;
89 + src_yoff = 0;
90 +- dst_xsize = src_xsize = MIN(map->width,src_xsize);
91 +- dst_ysize = src_ysize = MIN(map->height,src_ysize);
92 ++ dst_xsize = src_xsize = MS_MIN(map->width,src_xsize);
93 ++ dst_ysize = src_ysize = MS_MIN(map->height,src_ysize);
94 + copyRect.minx = copyRect.miny = 0;
95 + copyRect.maxx = map->width;
96 + copyRect.maxy = map->height;
97 +@@ -436,7 +436,7 @@ static int msContourLayerReadRaster(layerObj *layer, rectObj rect)
98 + adfGeoTransform[4] = 0;
99 + adfGeoTransform[5] = -dst_cellsize_y;
100 +
101 +- clinfo->cellsize = MAX(dst_cellsize_x, dst_cellsize_y);
102 ++ clinfo->cellsize = MS_MAX(dst_cellsize_x, dst_cellsize_y);
103 + {
104 + char buf[64];
105 + sprintf(buf, "%lf", clinfo->cellsize);
106 +diff --git a/mapdrawgdal.c b/mapdrawgdal.c
107 +index e843318..f90f2ac 100644
108 +--- a/mapdrawgdal.c
109 ++++ b/mapdrawgdal.c
110 +@@ -217,21 +217,21 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
111 + urx = GEO_TRANS(adfInvGeoTransform+0,copyRect.maxx,copyRect.maxy);
112 + ury = GEO_TRANS(adfInvGeoTransform+3,copyRect.maxx,copyRect.maxy);
113 +
114 +- src_xoff = MAX(0,(int) floor(llx+0.5));
115 +- src_yoff = MAX(0,(int) floor(ury+0.5));
116 +- src_xsize = MIN(MAX(0,(int) (urx - llx + 0.5)),
117 ++ src_xoff = MS_MAX(0,(int) floor(llx+0.5));
118 ++ src_yoff = MS_MAX(0,(int) floor(ury+0.5));
119 ++ src_xsize = MS_MIN(MS_MAX(0,(int) (urx - llx + 0.5)),
120 + GDALGetRasterXSize(hDS) - src_xoff);
121 +- src_ysize = MIN(MAX(0,(int) (lly - ury + 0.5)),
122 ++ src_ysize = MS_MIN(MS_MAX(0,(int) (lly - ury + 0.5)),
123 + GDALGetRasterYSize(hDS) - src_yoff);
124 +
125 + /* We want very small windows to use at least one source pixel (#4172) */
126 + if( src_xsize == 0 && (urx - llx) > 0.0 ) {
127 + src_xsize = 1;
128 +- src_xoff = MIN(src_xoff,GDALGetRasterXSize(hDS)-1);
129 ++ src_xoff = MS_MIN(src_xoff,GDALGetRasterXSize(hDS)-1);
130 + }
131 + if( src_ysize == 0 && (lly - ury) > 0.0 ) {
132 + src_ysize = 1;
133 +- src_yoff = MIN(src_yoff,GDALGetRasterYSize(hDS)-1);
134 ++ src_yoff = MS_MIN(src_yoff,GDALGetRasterYSize(hDS)-1);
135 + }
136 +
137 + if( src_xsize == 0 || src_ysize == 0 ) {
138 +@@ -251,11 +251,11 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
139 +
140 + dst_lrx = (int) ((copyRect.maxx - mapRect.minx) / map->cellsize + 0.5);
141 + dst_lry = (int) ((mapRect.maxy - copyRect.miny) / map->cellsize + 0.5);
142 +- dst_lrx = MAX(0,MIN(image->width,dst_lrx));
143 +- dst_lry = MAX(0,MIN(image->height,dst_lry));
144 ++ dst_lrx = MS_MAX(0,MS_MIN(image->width,dst_lrx));
145 ++ dst_lry = MS_MAX(0,MS_MIN(image->height,dst_lry));
146 +
147 +- dst_xsize = MAX(0,MIN(image->width,dst_lrx - dst_xoff));
148 +- dst_ysize = MAX(0,MIN(image->height,dst_lry - dst_yoff));
149 ++ dst_xsize = MS_MAX(0,MS_MIN(image->width,dst_lrx - dst_xoff));
150 ++ dst_ysize = MS_MAX(0,MS_MIN(image->height,dst_lry - dst_yoff));
151 +
152 + if( dst_xsize == 0 || dst_ysize == 0 ) {
153 + if( layer->debug )
154 +@@ -290,8 +290,8 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
155 + else {
156 + dst_xoff = src_xoff = 0;
157 + dst_yoff = src_yoff = 0;
158 +- dst_xsize = src_xsize = MIN(image->width,src_xsize);
159 +- dst_ysize = src_ysize = MIN(image->height,src_ysize);
160 ++ dst_xsize = src_xsize = MS_MIN(image->width,src_xsize);
161 ++ dst_ysize = src_ysize = MS_MIN(image->height,src_ysize);
162 + }
163 +
164 + /*
165 +@@ -533,7 +533,7 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
166 + return -1;
167 + }
168 +
169 +- color_count = MIN(256,GDALGetColorEntryCount(hColorMap));
170 ++ color_count = MS_MIN(256,GDALGetColorEntryCount(hColorMap));
171 + for(i=0; i < color_count; i++) {
172 + colorObj pixel;
173 + int colormap_index;
174 +@@ -598,7 +598,7 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
175 + cmap_set = TRUE;
176 + #endif
177 +
178 +- color_count = MIN(256,GDALGetColorEntryCount(hColorMap));
179 ++ color_count = MS_MIN(256,GDALGetColorEntryCount(hColorMap));
180 +
181 + for(i=0; i < color_count; i++) {
182 + GDALColorEntry sEntry;
183 +@@ -889,8 +889,8 @@ static int ParseDefaultLUT( const char *lut_def, GByte *lut )
184 + lut_read++;
185 + }
186 +
187 +- this_in = MAX(0,MIN(255,this_in));
188 +- this_out = MAX(0,MIN(255,this_out));
189 ++ this_in = MS_MAX(0,MS_MIN(255,this_in));
190 ++ this_out = MS_MAX(0,MS_MIN(255,this_out));
191 +
192 + /* apply linear values from last in:out to this in:out */
193 + for( lut_i = last_in; lut_i <= this_in; lut_i++ ) {
194 +@@ -1275,8 +1275,8 @@ LoadGDALImages( GDALDatasetH hDS, int band_numbers[4], int band_count,
195 + bMinMaxSet = TRUE;
196 + }
197 +
198 +- dfScaleMin = MIN(dfScaleMin,pafRawData[i]);
199 +- dfScaleMax = MAX(dfScaleMax,pafRawData[i]);
200 ++ dfScaleMin = MS_MIN(dfScaleMin,pafRawData[i]);
201 ++ dfScaleMax = MS_MAX(dfScaleMax,pafRawData[i]);
202 + }
203 +
204 + if( dfScaleMin == dfScaleMax )
205 +@@ -1768,8 +1768,8 @@ msDrawRasterLayerGDAL_16BitClassification(
206 + fDataMin = fDataMax = pafRawData[i];
207 + bGotFirstValue = TRUE;
208 + } else {
209 +- fDataMin = MIN(fDataMin,pafRawData[i]);
210 +- fDataMax = MAX(fDataMax,pafRawData[i]);
211 ++ fDataMin = MS_MIN(fDataMin,pafRawData[i]);
212 ++ fDataMax = MS_MAX(fDataMax,pafRawData[i]);
213 + }
214 + }
215 +
216 +@@ -2018,7 +2018,7 @@ int *msGetGDALBandList( layerObj *layer, void *hDS,
217 + /* -------------------------------------------------------------------- */
218 + if( CSLFetchNameValue( layer->processing, "BANDS" ) == NULL ) {
219 + if( max_bands > 0 )
220 +- *band_count = MIN(file_bands,max_bands);
221 ++ *band_count = MS_MIN(file_bands,max_bands);
222 + else
223 + *band_count = file_bands;
224 +
225 +diff --git a/maprasterquery.c b/maprasterquery.c
226 +index 80accfa..06f0ece 100644
227 +--- a/maprasterquery.c
228 ++++ b/maprasterquery.c
229 +@@ -330,11 +330,11 @@ static void msRasterQueryAddPixel( layerObj *layer, pointObj *location,
230 + /* -------------------------------------------------------------------- */
231 + else {
232 + if( rlinfo->band_count >= 3 ) {
233 +- red = (int) MAX(0,MIN(255,values[0]));
234 +- green = (int) MAX(0,MIN(255,values[1]));
235 +- blue = (int) MAX(0,MIN(255,values[2]));
236 ++ red = (int) MS_MAX(0,MS_MIN(255,values[0]));
237 ++ green = (int) MS_MAX(0,MS_MIN(255,values[1]));
238 ++ blue = (int) MS_MAX(0,MS_MIN(255,values[2]));
239 + } else {
240 +- red = green = blue = (int) MAX(0,MIN(255,values[0]));
241 ++ red = green = blue = (int) MS_MAX(0,MS_MIN(255,values[0]));
242 + }
243 + }
244 +
245 +@@ -454,35 +454,35 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
246 + /* top right */
247 + dfX = GEO_TRANS(adfInvGeoTransform , searchrect.maxx, searchrect.maxy);
248 + dfY = GEO_TRANS(adfInvGeoTransform+3, searchrect.maxx, searchrect.maxy);
249 +- dfXMin = MIN(dfXMin,dfX);
250 +- dfXMax = MAX(dfXMax,dfX);
251 +- dfYMin = MIN(dfYMin,dfY);
252 +- dfYMax = MAX(dfYMax,dfY);
253 ++ dfXMin = MS_MIN(dfXMin,dfX);
254 ++ dfXMax = MS_MAX(dfXMax,dfX);
255 ++ dfYMin = MS_MIN(dfYMin,dfY);
256 ++ dfYMax = MS_MAX(dfYMax,dfY);
257 +
258 + /* bottom left */
259 + dfX = GEO_TRANS(adfInvGeoTransform , searchrect.minx, searchrect.miny);
260 + dfY = GEO_TRANS(adfInvGeoTransform+3, searchrect.minx, searchrect.miny);
261 +- dfXMin = MIN(dfXMin,dfX);
262 +- dfXMax = MAX(dfXMax,dfX);
263 +- dfYMin = MIN(dfYMin,dfY);
264 +- dfYMax = MAX(dfYMax,dfY);
265 ++ dfXMin = MS_MIN(dfXMin,dfX);
266 ++ dfXMax = MS_MAX(dfXMax,dfX);
267 ++ dfYMin = MS_MIN(dfYMin,dfY);
268 ++ dfYMax = MS_MAX(dfYMax,dfY);
269 +
270 + /* bottom right */
271 + dfX = GEO_TRANS(adfInvGeoTransform , searchrect.maxx, searchrect.miny);
272 + dfY = GEO_TRANS(adfInvGeoTransform+3, searchrect.maxx, searchrect.miny);
273 +- dfXMin = MIN(dfXMin,dfX);
274 +- dfXMax = MAX(dfXMax,dfX);
275 +- dfYMin = MIN(dfYMin,dfY);
276 +- dfYMax = MAX(dfYMax,dfY);
277 ++ dfXMin = MS_MIN(dfXMin,dfX);
278 ++ dfXMax = MS_MAX(dfXMax,dfX);
279 ++ dfYMin = MS_MIN(dfYMin,dfY);
280 ++ dfYMax = MS_MAX(dfYMax,dfY);
281 +
282 + /* -------------------------------------------------------------------- */
283 + /* Trim the rectangle to the area of the file itself, but out */
284 + /* to the edges of the touched edge pixels. */
285 + /* -------------------------------------------------------------------- */
286 +- dfXMin = MAX(0.0,MIN(nRXSize,floor(dfXMin)));
287 +- dfYMin = MAX(0.0,MIN(nRYSize,floor(dfYMin)));
288 +- dfXMax = MAX(0.0,MIN(nRXSize,ceil(dfXMax)));
289 +- dfYMax = MAX(0.0,MIN(nRYSize,ceil(dfYMax)));
290 ++ dfXMin = MS_MAX(0.0,MS_MIN(nRXSize,floor(dfXMin)));
291 ++ dfYMin = MS_MAX(0.0,MS_MIN(nRYSize,floor(dfYMin)));
292 ++ dfXMax = MS_MAX(0.0,MS_MIN(nRXSize,ceil(dfXMax)));
293 ++ dfYMax = MS_MAX(0.0,MS_MIN(nRYSize,ceil(dfYMax)));
294 +
295 + /* -------------------------------------------------------------------- */
296 + /* Convert to integer offset/size values. */
297 +diff --git a/mapresample.c b/mapresample.c
298 +index 26b253e..532b6a8 100644
299 +--- a/mapresample.c
300 ++++ b/mapresample.c
301 +@@ -34,8 +34,8 @@
302 +
303 +
304 + #ifndef MAX
305 +-# define MIN(a,b) ((a<b) ? a : b)
306 +-# define MAX(a,b) ((a>b) ? a : b)
307 ++# define MS_MIN(a,b) ((a<b) ? a : b)
308 ++# define MS_MAX(a,b) ((a>b) ? a : b)
309 + #endif
310 +
311 + #define SKIP_MASK(x,y) (mask_rb && !*(mask_rb->data.rgba.a+(y)*mask_rb->data.rgba.row_step+(x)*mask_rb->data.rgba.pixel_step))
312 +@@ -319,7 +319,7 @@ msBilinearRasterResampler( imageObj *psSrcImage, rasterBufferObj *src_rb,
313 + int nSrcYSize = psSrcImage->height;
314 + int nFailedPoints = 0, nSetPoints = 0;
315 + double *padfPixelSum;
316 +- int bandCount = MAX(4,psSrcImage->format->bands);
317 ++ int bandCount = MS_MAX(4,psSrcImage->format->bands);
318 +
319 + padfPixelSum = (double *) msSmallMalloc(sizeof(double) * bandCount);
320 +
321 +@@ -369,10 +369,10 @@ msBilinearRasterResampler( imageObj *psSrcImage, rasterBufferObj *src_rb,
322 + continue;
323 +
324 + /* Trim in stuff one pixel off the edge */
325 +- nSrcX = MAX(nSrcX,0);
326 +- nSrcY = MAX(nSrcY,0);
327 +- nSrcX2 = MIN(nSrcX2,nSrcXSize-1);
328 +- nSrcY2 = MIN(nSrcY2,nSrcYSize-1);
329 ++ nSrcX = MS_MAX(nSrcX,0);
330 ++ nSrcY = MS_MAX(nSrcY,0);
331 ++ nSrcX2 = MS_MIN(nSrcX2,nSrcXSize-1);
332 ++ nSrcY2 = MS_MIN(nSrcY2,nSrcYSize-1);
333 +
334 + memset( padfPixelSum, 0, sizeof(double) * bandCount);
335 +
336 +@@ -407,10 +407,10 @@ msBilinearRasterResampler( imageObj *psSrcImage, rasterBufferObj *src_rb,
337 + int dst_rb_off = nDstX * dst_rb->data.rgba.pixel_step + nDstY * dst_rb->data.rgba.row_step;
338 + unsigned char red, green, blue, alpha;
339 +
340 +- red = (unsigned char) MAX(0,MIN(255,padfPixelSum[0]));
341 +- green = (unsigned char) MAX(0,MIN(255,padfPixelSum[1]));
342 +- blue = (unsigned char) MAX(0,MIN(255,padfPixelSum[2]));
343 +- alpha = (unsigned char)MAX(0,MIN(255,255.5*dfWeightSum));
344 ++ red = (unsigned char) MS_MAX(0,MS_MIN(255,padfPixelSum[0]));
345 ++ green = (unsigned char) MS_MAX(0,MS_MIN(255,padfPixelSum[1]));
346 ++ blue = (unsigned char) MS_MAX(0,MS_MIN(255,padfPixelSum[2]));
347 ++ alpha = (unsigned char)MS_MAX(0,MS_MIN(255,255.5*dfWeightSum));
348 +
349 + msAlphaBlendPM( red, green, blue, alpha,
350 + dst_rb->data.rgba.r + dst_rb_off,
351 +@@ -436,7 +436,7 @@ msBilinearRasterResampler( imageObj *psSrcImage, rasterBufferObj *src_rb,
352 + = (float) padfPixelSum[band];
353 + } else if( psSrcImage->format->imagemode == MS_IMAGEMODE_BYTE ) {
354 + psDstImage->img.raw_byte[dst_off]
355 +- = (unsigned char)MAX(0,MIN(255,padfPixelSum[band]));
356 ++ = (unsigned char)MS_MAX(0,MS_MIN(255,padfPixelSum[band]));
357 + }
358 +
359 + dst_off += psDstImage->width*psDstImage->height;
360 +@@ -489,14 +489,14 @@ msAverageSample( imageObj *psSrcImage, rasterBufferObj *src_rb,
361 + for( iY = nYMin; iY < nYMax; iY++ ) {
362 + double dfYCellMin, dfYCellMax;
363 +
364 +- dfYCellMin = MAX(iY,dfYMin);
365 +- dfYCellMax = MIN(iY+1,dfYMax);
366 ++ dfYCellMin = MS_MAX(iY,dfYMin);
367 ++ dfYCellMax = MS_MIN(iY+1,dfYMax);
368 +
369 + for( iX = nXMin; iX < nXMax; iX++ ) {
370 + double dfXCellMin, dfXCellMax, dfWeight;
371 +
372 +- dfXCellMin = MAX(iX,dfXMin);
373 +- dfXCellMax = MIN(iX+1,dfXMax);
374 ++ dfXCellMin = MS_MAX(iX,dfXMin);
375 ++ dfXCellMax = MS_MIN(iX+1,dfXMax);
376 +
377 + dfWeight = (dfXCellMax-dfXCellMin) * (dfYCellMax-dfYCellMin);
378 +
379 +@@ -537,7 +537,7 @@ msAverageRasterResampler( imageObj *psSrcImage, rasterBufferObj *src_rb,
380 + int nFailedPoints = 0, nSetPoints = 0;
381 + double *padfPixelSum;
382 +
383 +- int bandCount = MAX(4,psSrcImage->format->bands);
384 ++ int bandCount = MS_MAX(4,psSrcImage->format->bands);
385 +
386 + padfPixelSum = (double *) msSmallMalloc(sizeof(double) * bandCount);
387 +
388 +@@ -573,19 +573,19 @@ msAverageRasterResampler( imageObj *psSrcImage, rasterBufferObj *src_rb,
389 + continue;
390 + }
391 +
392 +- dfXMin = MIN(MIN(x1[nDstX],x1[nDstX+1]),
393 +- MIN(x2[nDstX],x2[nDstX+1]));
394 +- dfYMin = MIN(MIN(y1[nDstX],y1[nDstX+1]),
395 +- MIN(y2[nDstX],y2[nDstX+1]));
396 +- dfXMax = MAX(MAX(x1[nDstX],x1[nDstX+1]),
397 +- MAX(x2[nDstX],x2[nDstX+1]));
398 +- dfYMax = MAX(MAX(y1[nDstX],y1[nDstX+1]),
399 +- MAX(y2[nDstX],y2[nDstX+1]));
400 ++ dfXMin = MS_MIN(MS_MIN(x1[nDstX],x1[nDstX+1]),
401 ++ MS_MIN(x2[nDstX],x2[nDstX+1]));
402 ++ dfYMin = MS_MIN(MS_MIN(y1[nDstX],y1[nDstX+1]),
403 ++ MS_MIN(y2[nDstX],y2[nDstX+1]));
404 ++ dfXMax = MS_MAX(MS_MAX(x1[nDstX],x1[nDstX+1]),
405 ++ MS_MAX(x2[nDstX],x2[nDstX+1]));
406 ++ dfYMax = MS_MAX(MS_MAX(y1[nDstX],y1[nDstX+1]),
407 ++ MS_MAX(y2[nDstX],y2[nDstX+1]));
408 +
409 +- dfXMin = MIN(MAX(dfXMin,0),psSrcImage->width+1);
410 +- dfYMin = MIN(MAX(dfYMin,0),psSrcImage->height+1);
411 +- dfXMax = MIN(MAX(-1,dfXMax),psSrcImage->width);
412 +- dfYMax = MIN(MAX(-1,dfYMax),psSrcImage->height);
413 ++ dfXMin = MS_MIN(MS_MAX(dfXMin,0),psSrcImage->width+1);
414 ++ dfYMin = MS_MIN(MS_MAX(dfYMin,0),psSrcImage->height+1);
415 ++ dfXMax = MS_MIN(MS_MAX(-1,dfXMax),psSrcImage->width);
416 ++ dfYMax = MS_MIN(MS_MAX(-1,dfYMax),psSrcImage->height);
417 +
418 + memset( padfPixelSum, 0, sizeof(double)*bandCount );
419 +
420 +@@ -605,13 +605,13 @@ msAverageRasterResampler( imageObj *psSrcImage, rasterBufferObj *src_rb,
421 + unsigned char red, green, blue, alpha;
422 +
423 + red = (unsigned char)
424 +- MAX(0,MIN(255,padfPixelSum[0]+0.5));
425 ++ MS_MAX(0,MS_MIN(255,padfPixelSum[0]+0.5));
426 + green = (unsigned char)
427 +- MAX(0,MIN(255,padfPixelSum[1]+0.5));
428 ++ MS_MAX(0,MS_MIN(255,padfPixelSum[1]+0.5));
429 + blue = (unsigned char)
430 +- MAX(0,MIN(255,padfPixelSum[2]+0.5));
431 ++ MS_MAX(0,MS_MIN(255,padfPixelSum[2]+0.5));
432 + alpha = (unsigned char)
433 +- MAX(0,MIN(255,255*dfAlpha01+0.5));
434 ++ MS_MAX(0,MS_MIN(255,255*dfAlpha01+0.5));
435 +
436 + RB_MIX_PIXEL(dst_rb,nDstX,nDstY,
437 + red, green, blue, alpha );
438 +@@ -1121,10 +1121,10 @@ static int msTransformMapToSource( int nDstXSize, int nDstYSize,
439 + psSrcExtent->miny = psSrcExtent->maxy = y_out;
440 + bOutInit = 1;
441 + } else {
442 +- psSrcExtent->minx = MIN(psSrcExtent->minx, x_out);
443 +- psSrcExtent->maxx = MAX(psSrcExtent->maxx, x_out);
444 +- psSrcExtent->miny = MIN(psSrcExtent->miny, y_out);
445 +- psSrcExtent->maxy = MAX(psSrcExtent->maxy, y_out);
446 ++ psSrcExtent->minx = MS_MIN(psSrcExtent->minx, x_out);
447 ++ psSrcExtent->maxx = MS_MAX(psSrcExtent->maxx, x_out);
448 ++ psSrcExtent->miny = MS_MIN(psSrcExtent->miny, y_out);
449 ++ psSrcExtent->maxy = MS_MAX(psSrcExtent->maxy, y_out);
450 + }
451 + }
452 +
453 +@@ -1141,10 +1141,10 @@ static int msTransformMapToSource( int nDstXSize, int nDstYSize,
454 + int nGrowAmountY = (int)
455 + (psSrcExtent->maxy - psSrcExtent->miny)/EDGE_STEPS + 1;
456 +
457 +- psSrcExtent->minx = MAX(psSrcExtent->minx - nGrowAmountX,0);
458 +- psSrcExtent->miny = MAX(psSrcExtent->miny - nGrowAmountY,0);
459 +- psSrcExtent->maxx = MIN(psSrcExtent->maxx + nGrowAmountX,nSrcXSize);
460 +- psSrcExtent->maxy = MIN(psSrcExtent->maxy + nGrowAmountY,nSrcYSize);
461 ++ psSrcExtent->minx = MS_MAX(psSrcExtent->minx - nGrowAmountX,0);
462 ++ psSrcExtent->miny = MS_MAX(psSrcExtent->miny - nGrowAmountY,0);
463 ++ psSrcExtent->maxx = MS_MIN(psSrcExtent->maxx + nGrowAmountX,nSrcXSize);
464 ++ psSrcExtent->maxy = MS_MIN(psSrcExtent->maxy + nGrowAmountY,nSrcYSize);
465 + }
466 +
467 + return MS_TRUE;
468 +@@ -1342,10 +1342,10 @@ int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image,
469 + sSrcExtent.maxy = ceil (sSrcExtent.maxy+1.0);
470 + }
471 +
472 +- sSrcExtent.minx = MAX(0,sSrcExtent.minx);
473 +- sSrcExtent.maxx = MIN(sSrcExtent.maxx, nSrcXSize );
474 +- sSrcExtent.miny = MAX(sSrcExtent.miny, 0 );
475 +- sSrcExtent.maxy = MIN(sSrcExtent.maxy, nSrcYSize );
476 ++ sSrcExtent.minx = MS_MAX(0,sSrcExtent.minx);
477 ++ sSrcExtent.maxx = MS_MIN(sSrcExtent.maxx, nSrcXSize );
478 ++ sSrcExtent.miny = MS_MAX(sSrcExtent.miny, 0 );
479 ++ sSrcExtent.maxy = MS_MIN(sSrcExtent.maxy, nSrcYSize );
480 +
481 + if( sSrcExtent.maxx <= sSrcExtent.minx
482 + || sSrcExtent.maxy <= sSrcExtent.miny ) {
483 +@@ -1383,9 +1383,9 @@ int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image,
484 + else
485 + sDummyMap.cellsize = dfNominalCellSize;
486 +
487 +- nLoadImgXSize = MAX(1, (int) (sSrcExtent.maxx - sSrcExtent.minx)
488 ++ nLoadImgXSize = MS_MAX(1, (int) (sSrcExtent.maxx - sSrcExtent.minx)
489 + * (dfNominalCellSize / sDummyMap.cellsize));
490 +- nLoadImgYSize = MAX(1, (int) (sSrcExtent.maxy - sSrcExtent.miny)
491 ++ nLoadImgYSize = MS_MAX(1, (int) (sSrcExtent.maxy - sSrcExtent.miny)
492 + * (dfNominalCellSize / sDummyMap.cellsize));
493 +
494 + /*
495 +diff --git a/mapstring.c b/mapstring.c
496 +index ea5b67f..82ee82a 100644
497 +--- a/mapstring.c
498 ++++ b/mapstring.c
499 +@@ -135,7 +135,7 @@ char *strrstr(char *string, char *find)
500 + * Appends src to string dst of size siz (unlike strncat, siz is the
501 + * full size of dst, not space left). At most siz-1 characters
502 + * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
503 +- * Returns strlen(src) + MIN(siz, strlen(initial dst)).
504 ++ * Returns strlen(src) + MS_MIN(siz, strlen(initial dst)).
505 + * If retval >= siz, truncation occurred.
506 + */
507 + size_t strlcat(char *dst, const char *src, size_t siz)
508 +diff --git a/mapwcs20.c b/mapwcs20.c
509 +index 347e9b7..266a07d 100644
510 +--- a/mapwcs20.c
511 ++++ b/mapwcs20.c
512 +@@ -4189,8 +4189,8 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
513 + + (orig_bbox.maxx+1) * cm.geotransform[1]
514 + + (orig_bbox.maxy+1) * cm.geotransform[2];
515 +
516 +- subsets.minx = MIN(x_1, x_2);
517 +- subsets.maxx = MAX(x_1, x_2);
518 ++ subsets.minx = MS_MIN(x_1, x_2);
519 ++ subsets.maxx = MS_MAX(x_1, x_2);
520 + }
521 + if(subsets.miny != -DBL_MAX || subsets.maxy != DBL_MAX) {
522 + y_1 = cm.geotransform[3]
523 +@@ -4201,8 +4201,8 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
524 + + orig_bbox.minx * cm.geotransform[4]
525 + + orig_bbox.miny * cm.geotransform[5];
526 +
527 +- subsets.miny = MIN(y_1, y_2);
528 +- subsets.maxy = MAX(y_1, y_2);
529 ++ subsets.miny = MS_MIN(y_1, y_2);
530 ++ subsets.maxy = MS_MAX(y_1, y_2);
531 + }
532 + } else { /* if crs is not the 'imageCRS' */
533 + projectionObj subsetProj;
534 +@@ -4241,10 +4241,10 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
535 + }
536 +
537 + /* write combined bounding box */
538 +- bbox.minx = MAX(subsets.minx, map->extent.minx);
539 +- bbox.miny = MAX(subsets.miny, map->extent.miny);
540 +- bbox.maxx = MIN(subsets.maxx, map->extent.maxx);
541 +- bbox.maxy = MIN(subsets.maxy, map->extent.maxy);
542 ++ bbox.minx = MS_MAX(subsets.minx, map->extent.minx);
543 ++ bbox.miny = MS_MAX(subsets.miny, map->extent.miny);
544 ++ bbox.maxx = MS_MIN(subsets.maxx, map->extent.maxx);
545 ++ bbox.maxy = MS_MIN(subsets.maxy, map->extent.maxy);
546 +
547 + /* check if we are overspecified */
548 + if ((params->width != 0 && params->resolutionX != MS_WCS20_UNBOUNDED)
549 +@@ -4620,10 +4620,10 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
550 + tmpCm.xresolution = map->gt.geotransform[1];
551 + tmpCm.yresolution = map->gt.geotransform[5];
552 +
553 +- tmpCm.extent.minx = MIN(map->gt.geotransform[0], map->gt.geotransform[0] + map->width * tmpCm.xresolution);
554 +- tmpCm.extent.miny = MIN(map->gt.geotransform[3], map->gt.geotransform[3] + map->height * tmpCm.yresolution);
555 +- tmpCm.extent.maxx = MAX(map->gt.geotransform[0], map->gt.geotransform[0] + map->width * tmpCm.xresolution);
556 +- tmpCm.extent.maxy = MAX(map->gt.geotransform[3], map->gt.geotransform[3] + map->height * tmpCm.yresolution);
557 ++ tmpCm.extent.minx = MS_MIN(map->gt.geotransform[0], map->gt.geotransform[0] + map->width * tmpCm.xresolution);
558 ++ tmpCm.extent.miny = MS_MIN(map->gt.geotransform[3], map->gt.geotransform[3] + map->height * tmpCm.yresolution);
559 ++ tmpCm.extent.maxx = MS_MAX(map->gt.geotransform[0], map->gt.geotransform[0] + map->width * tmpCm.xresolution);
560 ++ tmpCm.extent.maxy = MS_MAX(map->gt.geotransform[3], map->gt.geotransform[3] + map->height * tmpCm.yresolution);
561 +
562 + swapAxes = msWCSSwapAxes20(srs_uri);
563 + msFree(srs_uri);
564 +diff --git a/mapwmslayer.c b/mapwmslayer.c
565 +index 42a44f1..3e4747d 100644
566 +--- a/mapwmslayer.c
567 ++++ b/mapwmslayer.c
568 +@@ -698,7 +698,7 @@ msBuildWMSLayerURL(mapObj *map, layerObj *lp, int nRequestType,
569 + else {
570 + double cellsize_x = (bbox.maxx-bbox.minx) / bbox_width;
571 + double cellsize_y = (bbox.maxy-bbox.miny) / bbox_height;
572 +- double cellsize = MIN(cellsize_x,cellsize_y);
573 ++ double cellsize = MS_MIN(cellsize_x,cellsize_y);
574 +
575 + msRectIntersect( &bbox, &layer_rect );
576 +
577
578 diff --git a/sci-geosciences/mapserver/files/mapserver-7.0.0-disabled-ogr.patch b/sci-geosciences/mapserver/files/mapserver-7.0.0-disabled-ogr.patch
579 new file mode 100644
580 index 0000000..088e37b
581 --- /dev/null
582 +++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-disabled-ogr.patch
583 @@ -0,0 +1,56 @@
584 +From ab2a6129435ca37d02730a6faf85593afa0daf9b Mon Sep 17 00:00:00 2001
585 +From: Thomas Bonfort <thomas.bonfort@×××××.com>
586 +Date: Mon, 16 Nov 2015 16:56:02 +0100
587 +Subject: [PATCH] Fix build issues with OGR disabled
588 +
589 +---
590 + mapimageio.c | 2 +-
591 + mapogcfilter.c | 1 +
592 + mapogr.cpp | 2 ++
593 + 3 files changed, 4 insertions(+), 1 deletion(-)
594 +
595 +diff --git a/mapimageio.c b/mapimageio.c
596 +index 771188b..95feda2 100644
597 +--- a/mapimageio.c
598 ++++ b/mapimageio.c
599 +@@ -210,7 +210,7 @@ int saveAsJPEG(mapObj *map, rasterBufferObj *rb, streamInfo *info,
600 + /* If the user doesn't provide a value for JPEGMEM, we want to be sure */
601 + /* that at least the image size will be used before creating the temporary file */
602 + cinfo.mem->max_memory_to_use =
603 +- MAX(cinfo.mem->max_memory_to_use, cinfo.input_components * rb->width * rb->height);
604 ++ MS_MAX(cinfo.mem->max_memory_to_use, cinfo.input_components * rb->width * rb->height);
605 + }
606 + }
607 +
608 +diff --git a/mapogcfilter.c b/mapogcfilter.c
609 +index 50e2e7b..05f017a 100644
610 +--- a/mapogcfilter.c
611 ++++ b/mapogcfilter.c
612 +@@ -40,6 +40,7 @@
613 + #include "mapowscommon.h"
614 + #include "maptime.h"
615 + #include "mapows.h"
616 ++#include <ctype.h>
617 +
618 + static int FLTHasUniqueTopLevelDuringFilter(FilterEncodingNode *psFilterNode);
619 +
620 +diff --git a/mapogr.cpp b/mapogr.cpp
621 +index 07acdba..80f032b 100644
622 +--- a/mapogr.cpp
623 ++++ b/mapogr.cpp
624 +@@ -1318,6 +1318,7 @@ static int msOGRFileClose(layerObj *layer, msOGRFileInfo *psInfo )
625 +
626 + return MS_SUCCESS;
627 + }
628 ++#endif /* USE_OGR */
629 +
630 + /************************************************************************/
631 + /* msOGREscapeSQLParam */
632 +@@ -1345,6 +1346,7 @@ static char *msOGREscapeSQLParam(layerObj *layer, const char *pszString)
633 + #endif /* USE_OGR */
634 + }
635 +
636 ++#ifdef USE_OGR
637 + /**********************************************************************
638 + * msOGRTranslateMsExpressionToOGRSQL()
639 + *
640
641 diff --git a/sci-geosciences/mapserver/files/mapserver-7.0.0-giflib51.patch b/sci-geosciences/mapserver/files/mapserver-7.0.0-giflib51.patch
642 new file mode 100644
643 index 0000000..1fa7710
644 --- /dev/null
645 +++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-giflib51.patch
646 @@ -0,0 +1,35 @@
647 +From 0101157d4edd5d837d17356c66c7d25af7e020ac Mon Sep 17 00:00:00 2001
648 +From: Sander Jansen <s.jansen@×××××.com>
649 +Date: Wed, 19 Aug 2015 16:51:13 -0500
650 +Subject: [PATCH] Fix compilation with gif_lib 5.1
651 +
652 +---
653 + mapimageio.c | 8 ++++++++
654 + 1 file changed, 8 insertions(+)
655 +
656 +diff --git a/mapimageio.c b/mapimageio.c
657 +index e6bdcb5..5eed924 100644
658 +--- a/mapimageio.c
659 ++++ b/mapimageio.c
660 +@@ -1058,6 +1058,13 @@ int readGIF(char *path, rasterBufferObj *rb)
661 +
662 + } while (recordType != TERMINATE_RECORD_TYPE);
663 +
664 ++
665 ++#if defined GIFLIB_MAJOR && GIFLIB_MINOR && ((GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1) || (GIFLIB_MAJOR > 5))
666 ++ if (DGifCloseFile(image, &errcode) == GIF_ERROR) {
667 ++ msSetError(MS_MISCERR,"failed to close gif after loading: %s","readGIF()", gif_error_msg(errcode));
668 ++ return MS_FAILURE;
669 ++ }
670 ++#else
671 + if (DGifCloseFile(image) == GIF_ERROR) {
672 + #if defined GIFLIB_MAJOR && GIFLIB_MAJOR >= 5
673 + msSetError(MS_MISCERR,"failed to close gif after loading: %s","readGIF()", gif_error_msg(image->Error));
674 +@@ -1066,6 +1073,7 @@ int readGIF(char *path, rasterBufferObj *rb)
675 + #endif
676 + return MS_FAILURE;
677 + }
678 ++#endif
679 +
680 + return MS_SUCCESS;
681 + }
682
683 diff --git a/sci-geosciences/mapserver/files/mapserver-7.0.0-mapwcs-disabled-libxml2.patch b/sci-geosciences/mapserver/files/mapserver-7.0.0-mapwcs-disabled-libxml2.patch
684 new file mode 100644
685 index 0000000..5625746
686 --- /dev/null
687 +++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-mapwcs-disabled-libxml2.patch
688 @@ -0,0 +1,20 @@
689 +diff --git a/mapwcs20.c b/mapwcs20.c
690 +index ac2fb89..9560a25 100755
691 +--- a/mapwcs20.c
692 ++++ b/mapwcs20.c
693 +@@ -700,6 +700,7 @@ static int msWCSParseScaleExtentString20(char *string, char *outAxis,
694 + return MS_SUCCESS;
695 + }
696 +
697 ++#if defined(USE_LIBXML2)
698 + /*
699 + Utility function to get the first child of a node with a given node name
700 + */
701 +@@ -739,6 +740,7 @@ xmlNodePtr msLibXml2GetFirstChildNs(xmlNodePtr parent, const char *name, xmlNsPt
702 + }
703 + return NULL;
704 + }
705 ++#endif /* defined(USE_LIBXML2) */
706 +
707 + /************************************************************************/
708 + /* msWCSParseRequest20_XMLGetCapabilities() */
709
710 diff --git a/sci-geosciences/mapserver/files/mapserver-7.0.0-no-applicable-code.patch b/sci-geosciences/mapserver/files/mapserver-7.0.0-no-applicable-code.patch
711 new file mode 100644
712 index 0000000..f438bec
713 --- /dev/null
714 +++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-no-applicable-code.patch
715 @@ -0,0 +1,34 @@
716 +diff --git a/mapwfs11.c b/mapwfs11.c
717 +index 20ab164..4dc15fc 100755
718 +--- a/mapwfs11.c
719 ++++ b/mapwfs11.c
720 +@@ -29,12 +29,12 @@
721 +
722 + #include "mapserver.h"
723 + #include "mapows.h"
724 ++#include "mapowscommon.h"
725 +
726 +
727 +
728 + #if defined(USE_WFS_SVR) && defined(USE_LIBXML2)
729 + #include "maplibxml2.h"
730 +-#include "mapowscommon.h"
731 + #include "mapogcfilter.h"
732 +
733 + /************************************************************************/
734 +diff --git a/mapwfs20.c b/mapwfs20.c
735 +index 710d444..cf69ee3 100755
736 +--- a/mapwfs20.c
737 ++++ b/mapwfs20.c
738 +@@ -29,10 +29,10 @@
739 +
740 + #include "mapserver.h"
741 + #include "mapows.h"
742 ++#include "mapowscommon.h"
743 +
744 + #if defined(USE_WFS_SVR) && defined(USE_LIBXML2)
745 + #include "maplibxml2.h"
746 +-#include "mapowscommon.h"
747 + #include "mapogcfilter.h"
748 +
749 + #define MS_OWS_11_NAMESPACE_PREFIX MS_OWSCOMMON_OWS_NAMESPACE_PREFIX
750
751 diff --git a/sci-geosciences/mapserver/files/mapserver-7.0.0-sec-format.patch b/sci-geosciences/mapserver/files/mapserver-7.0.0-sec-format.patch
752 new file mode 100644
753 index 0000000..17016c6
754 --- /dev/null
755 +++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-sec-format.patch
756 @@ -0,0 +1,13 @@
757 +diff --git a/apache/mod_mapserver.c b/apache/mod_mapserver.c
758 +index 7949ddf..c8dbde6 100644
759 +--- a/apache/mod_mapserver.c
760 ++++ b/apache/mod_mapserver.c
761 +@@ -40,7 +40,7 @@ static int
762 + msIO_apacheError (void *cbData, void *data, int byteCount)
763 + {
764 + /* error reporting is done through the log file... */
765 +- ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, (char*) data);
766 ++ ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, "%s", (char*) data);
767 + return strlen ((char*) data);
768 + }
769 +
770
771 diff --git a/sci-geosciences/mapserver/mapserver-7.0.0.ebuild b/sci-geosciences/mapserver/mapserver-7.0.0.ebuild
772 new file mode 100644
773 index 0000000..da2eb5d
774 --- /dev/null
775 +++ b/sci-geosciences/mapserver/mapserver-7.0.0.ebuild
776 @@ -0,0 +1,177 @@
777 +# Copyright 1999-2016 Gentoo Foundation
778 +# Distributed under the terms of the GNU General Public License v2
779 +# $Id$
780 +
781 +EAPI=5
782 +
783 +MY_P="${PN}-${PV/_/-}"
784 +
785 +PHP_EXT_OPTIONAL_USE="php"
786 +PHP_EXT_NAME="php_mapscript"
787 +PHP_EXT_S="${WORKDIR}/${MY_P}/mapscript/php/"
788 +PHP_EXT_SKIP_PHPIZE="no"
789 +USE_PHP="php5-4 php5-5"
790 +
791 +PYTHON_COMPAT=( python2_7 )
792 +
793 +#USE_RUBY="ruby18 ruby19"
794 +#RUBY_OPTIONAL="yes"
795 +
796 +WEBAPP_MANUAL_SLOT=yes
797 +
798 +inherit eutils depend.apache webapp distutils-r1 flag-o-matic perl-module php-ext-source-r2 multilib cmake-utils # ruby-ng
799 +
800 +DESCRIPTION="Development environment for building spatially enabled webapps"
801 +HOMEPAGE="http://mapserver.org/"
802 +SRC_URI="http://download.osgeo.org/mapserver/${MY_P}.tar.gz"
803 +
804 +LICENSE="MIT"
805 +KEYWORDS="~amd64 ~x86"
806 +SLOT="0"
807 +IUSE="bidi cairo gdal geos mysql opengl perl php postgis proj python threads tiff xml xslt" # ruby php tcl
808 +
809 +REQUIRED_USE="php? ( ^^ ( php_targets_php5-4 php_targets_php5-5 ) )
810 + xslt? ( xml )"
811 +
812 +RDEPEND="
813 + dev-libs/expat
814 + dev-libs/fcgi
815 + >=media-libs/gd-2.0.12[truetype,jpeg,png,zlib]
816 + media-libs/giflib
817 + net-misc/curl
818 + virtual/jpeg:=
819 + virtual/libiconv
820 + x11-libs/agg
821 + bidi? ( dev-libs/fribidi
822 + media-libs/harfbuzz )
823 + cairo? ( x11-libs/cairo )
824 + gdal? ( >=sci-libs/gdal-1.8.0 )
825 + geos? ( sci-libs/geos )
826 + mysql? ( virtual/mysql )
827 + opengl? (
828 + media-libs/ftgl
829 + media-libs/mesa
830 + )
831 + perl? ( dev-lang/perl:= )
832 + postgis? ( dev-db/postgis )
833 + proj? ( sci-libs/proj net-misc/curl )
834 + tiff? (
835 + media-libs/tiff:=
836 + sci-libs/libgeotiff
837 + )
838 + xml? ( dev-libs/libxml2:2 )
839 + xslt? ( dev-libs/libxslt[crypt] )
840 +"
841 +DEPEND="${RDEPEND}
842 + perl? ( >=dev-lang/swig-2.0 )
843 + python? ( >=dev-lang/swig-2.0 )"
844 +
845 +need_apache2
846 +
847 +PATCHES=(
848 + "${FILESDIR}/${P}-giflib51.patch" # see https://github.com/mapserver/mapserver/pull/5144
849 + "${FILESDIR}/${P}-disabled-ogr.patch" # see https://github.com/mapserver/mapserver/commit/ab2a6129435ca37d02730a6faf85593afa0daf9b
850 + "${FILESDIR}/${P}-correct-min-max-calls.patch" # see https://github.com/mapserver/mapserver/pull/5251
851 + "${FILESDIR}/${P}-sec-format.patch" # see https://github.com/mapserver/mapserver/pull/5248
852 + "${FILESDIR}/${P}-mapwcs-disabled-libxml2.patch"
853 + "${FILESDIR}/${P}-no-applicable-code.patch"
854 +)
855 +
856 +S=${WORKDIR}/${MY_P}
857 +
858 +pkg_setup() {
859 + webapp_pkg_setup
860 + use perl && perl_set_version
861 + #use ruby && ruby-ng_pkg_setup
862 +}
863 +
864 +src_unpack() {
865 + # unpack A and then copy the php thingies into workdir/php-slot
866 + php-ext-source-r2_src_unpack
867 + # HACK: and then remove it and replace by symlink
868 + for slot in $(php_get_slots); do
869 + rm -rf "${WORKDIR}/${slot}" || die
870 + ln -s "${PHP_EXT_S}" "${WORKDIR}/${slot}" || die
871 + done
872 +}
873 +
874 +src_prepare() {
875 + local glibdir="${EPREFIX}/usr/include/glib-2.0"
876 + local usrglibdir="${EPREFIX}/usr/$(get_libdir)/glib-2.0/include"
877 +
878 + sed -e "s:^include_directories(:&${glibdir})\ninclude_directories(:" \
879 + -i "${S}/CMakeLists.txt" || die
880 + sed -e "s:include_directories(:&${usrglibdir})\ninclude_directories(:" \
881 + -i "${S}/CMakeLists.txt" || die
882 +
883 + cmake-utils_src_prepare
884 +}
885 +
886 +src_configure() {
887 + local mycmakeargs=(
888 + "-DCMAKE_SKIP_RPATH=ON"
889 + "-DWITH_ORACLESPATIAL=OFF"
890 + "-DWITH_SDE=OFF"
891 + "-DWITH_APACHE_MODULE=ON"
892 + "-DWITH_ICONV=ON"
893 + "-DWITH_GD=ON"
894 + "-DWITH_GIF=ON"
895 + "-DWITH_CURL=ON"
896 + "-DWITH_FCGI=ON"
897 + "-DWITH_PROJ=$(usex proj ON OFF)"
898 + "-DWITH_WMS=$(usex proj ON OFF)"
899 + "-DWITH_KML=$(usex xml ON OFF)"
900 + "-DWITH_GEOS=$(usex geos ON OFF)"
901 + "-DWITH_GDAL=$(usex gdal ON OFF)"
902 + "-DWITH_OGR=$(usex gdal ON OFF)"
903 + "-DWITH_POSTGIS=$(usex postgis ON OFF)"
904 + "-DWITH_MYSQL=$(usex mysql ON OFF)"
905 + "-DWITH_LIBXML2=$(usex xml ON OFF)"
906 + "-DWITH_XMLMAPFILE=$(usex xslt ON OFF)"
907 + "-DWITH_FRIBIDI=$(usex bidi ON OFF)"
908 + "-DWITH_HARFBUZZ=$(usex bidi ON OFF)"
909 + "-DWITH_CAIRO=$(usex cairo ON OFF)"
910 + "-DWITH_PHP=$(usex php ON OFF)"
911 + "-DWITH_PYTHON=$(usex python ON OFF)"
912 + "-DWITH_PERL=$(usex perl ON OFF)"
913 + )
914 +
915 + if use gdal && use proj ; then
916 + mycmakeargs+=( "-DWITH_WFS=ON"
917 + "-DWITH_WCS=ON"
918 + "-DWITH_CLIENT_WMS=ON"
919 + "-DWITH_CLIENT_WFS=ON"
920 + "-DWITH_SOS=$(usex xml ON OFF)"
921 + )
922 + else
923 + mycmakeargs+=( "-DWITH_WFS=OFF"
924 + "-DWITH_WCS=OFF"
925 + "-DWITH_CLIENT_WMS=OFF"
926 + "-DWITH_CLIENT_WFS=OFF"
927 + "-DWITH_SOS=OFF"
928 + )
929 + fi
930 +
931 + cmake-utils_src_configure
932 +}
933 +
934 +src_compile() {
935 + cmake-utils_src_compile
936 +}
937 +
938 +src_install() {
939 + cmake-utils_src_install
940 +
941 + webapp_src_preinst
942 + exeinto "${MY_CGIBINDIR}"
943 + doexe "${S}_build/mapserv"
944 + webapp_src_install
945 +}
946 +
947 +pkg_postinst() {
948 + webapp_pkg_postinst
949 +}
950 +
951 +pkg_prerm() {
952 + webapp_pkg_prerm
953 +}