commit:     238b62dfa764bfcc95ed52b1c29e5b19dc6b2be7
Author:     Amy Winston <amynka <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 27 12:18:18 2016 +0000
Commit:     Amy Winston <amynka <AT> gentoo <DOT> org>
CommitDate: Sat Feb 27 12:18:18 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=238b62df

sci-geosciences/mapserver: version bump 7.0.0 bug #471250

Package-Manager: portage-2.2.26

 sci-geosciences/mapserver/Manifest                 |   1 +
 .../files/mapserver-7.0.0-OGREscapeSQLParam.patch  |  22 +
 .../mapserver-7.0.0-correct-min-max-calls.patch    | 511 +++++++++++++++++++++
 .../files/mapserver-7.0.0-disabled-ogr.patch       |  56 +++
 .../mapserver/files/mapserver-7.0.0-giflib51.patch |  35 ++
 .../mapserver-7.0.0-mapwcs-disabled-libxml2.patch  |  20 +
 .../files/mapserver-7.0.0-no-applicable-code.patch |  34 ++
 .../files/mapserver-7.0.0-sec-format.patch         |  13 +
 sci-geosciences/mapserver/mapserver-7.0.0.ebuild   | 177 +++++++
 9 files changed, 869 insertions(+)

diff --git a/sci-geosciences/mapserver/Manifest 
b/sci-geosciences/mapserver/Manifest
index d294b0b..c981436 100644
--- a/sci-geosciences/mapserver/Manifest
+++ b/sci-geosciences/mapserver/Manifest
@@ -1 +1,2 @@
 DIST mapserver-6.0.1.tar.gz 2430064 SHA256 
dd6821917aa7030381442f5e092e4f46f44b9deb9425ec92729e5819e9b61d65 SHA512 
0fd9da9d6452fbfbaf0c815e6d15309e185119a4ab33cab2f1c6839bfb8c3a75ce6e7e7779b0eb2aa6e80d1a623ca6e0e58a02049b0db0bfa3f7b0f29117d5dc
 WHIRLPOOL 
e4846d40b93c22f7b5dcce1c242b4d88db253be9185194b45c4acddf9066d10c2ec2fbe667941dfe15702838690517a0e57719b1937169e55517e43ed1c225b8
+DIST mapserver-7.0.0.tar.gz 2495028 SHA256 
b306b8111e0718a577ce595640c2d3224f913745af732a1b75f6f5cb3dddce45 SHA512 
1e4d15f6c42cdf0b00533e2aa26c1b65f84bdbb3a91538d6addde3aa0e8874deed4969146cf7045858bcab2880e4d7429965660c5985d175bd19ce018ae90652
 WHIRLPOOL 
f18f0679b70da795d0585df2dbcc07fda0f8533c9ef7972280301446e5d521d9f24f0ff482d8e5497954e3b67436f2f9f2576516f6f088dc388046314817a46b

diff --git 
a/sci-geosciences/mapserver/files/mapserver-7.0.0-OGREscapeSQLParam.patch 
b/sci-geosciences/mapserver/files/mapserver-7.0.0-OGREscapeSQLParam.patch
new file mode 100644
index 0000000..6ea6d92
--- /dev/null
+++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-OGREscapeSQLParam.patch
@@ -0,0 +1,22 @@
+diff --git a/mapogr.cpp b/mapogr.cpp
+index 1708d1c..217239b 100755
+--- a/mapogr.cpp
++++ b/mapogr.cpp
+@@ -1311,6 +1311,8 @@ static int msOGRFileClose(layerObj *layer, msOGRFileInfo 
*psInfo )
+   return MS_SUCCESS;
+ }
+ 
++#endif
++
+ /************************************************************************/
+ /*                           msOGREscapeSQLParam                        */
+ /************************************************************************/
+@@ -1337,6 +1339,8 @@ static char *msOGREscapeSQLParam(layerObj *layer, const 
char *pszString)
+ #endif /* USE_OGR */
+ }
+ 
++#ifdef USE_OGR
++
+ /**********************************************************************
+  *                     msOGRTranslateMsExpressionToOGRSQL()
+  *

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
new file mode 100644
index 0000000..7383457
--- /dev/null
+++ 
b/sci-geosciences/mapserver/files/mapserver-7.0.0-correct-min-max-calls.patch
@@ -0,0 +1,511 @@
+diff --git a/mapcontour.c b/mapcontour.c
+index ae52fc6..74cf7d1 100644
+--- a/mapcontour.c
++++ b/mapcontour.c
+@@ -345,11 +345,11 @@ static int msContourLayerReadRaster(layerObj *layer, 
rectObj rect)
+     ury = floor(ury / virtual_grid_step_y) * virtual_grid_step_y - 
(virtual_grid_step_x*5);
+     lly = ceil(lly / virtual_grid_step_y) * virtual_grid_step_y + 
(virtual_grid_step_x*5);
+     
+-    src_xoff = MAX(0,(int) floor(llx+0.5));
+-    src_yoff = MAX(0,(int) floor(ury+0.5));
+-    src_xsize = MIN(MAX(0,(int) (urx - llx + 0.5)),
++    src_xoff = MS_MAX(0,(int) floor(llx+0.5));
++    src_yoff = MS_MAX(0,(int) floor(ury+0.5));
++    src_xsize = MS_MIN(MS_MAX(0,(int) (urx - llx + 0.5)),
+                     GDALGetRasterXSize(clinfo->hOrigDS) - src_xoff);
+-    src_ysize = MIN(MAX(0,(int) (lly - ury + 0.5)),
++    src_ysize = MS_MIN(MS_MAX(0,(int) (lly - ury + 0.5)),
+                     GDALGetRasterYSize(clinfo->hOrigDS) - src_yoff);
+ 
+     /* Update the geographic extent (buffer added) */
+@@ -386,8 +386,8 @@ static int msContourLayerReadRaster(layerObj *layer, 
rectObj rect)
+   } else {
+     src_xoff = 0;
+     src_yoff = 0;
+-    dst_xsize = src_xsize = MIN(map->width,src_xsize);
+-    dst_ysize = src_ysize = MIN(map->height,src_ysize);
++    dst_xsize = src_xsize = MS_MIN(map->width,src_xsize);
++    dst_ysize = src_ysize = MS_MIN(map->height,src_ysize);
+     copyRect.minx = copyRect.miny = 0;
+     copyRect.maxx = map->width;
+     copyRect.maxy = map->height;
+@@ -436,7 +436,7 @@ static int msContourLayerReadRaster(layerObj *layer, 
rectObj rect)
+   adfGeoTransform[4] = 0;
+   adfGeoTransform[5] = -dst_cellsize_y;
+ 
+-  clinfo->cellsize = MAX(dst_cellsize_x, dst_cellsize_y);
++  clinfo->cellsize = MS_MAX(dst_cellsize_x, dst_cellsize_y);
+   {
+     char buf[64];
+     sprintf(buf, "%lf", clinfo->cellsize);
+diff --git a/mapdrawgdal.c b/mapdrawgdal.c
+index e843318..f90f2ac 100644
+--- a/mapdrawgdal.c
++++ b/mapdrawgdal.c
+@@ -217,21 +217,21 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, 
imageObj *image,
+     urx = GEO_TRANS(adfInvGeoTransform+0,copyRect.maxx,copyRect.maxy);
+     ury = GEO_TRANS(adfInvGeoTransform+3,copyRect.maxx,copyRect.maxy);
+ 
+-    src_xoff = MAX(0,(int) floor(llx+0.5));
+-    src_yoff = MAX(0,(int) floor(ury+0.5));
+-    src_xsize = MIN(MAX(0,(int) (urx - llx + 0.5)),
++    src_xoff = MS_MAX(0,(int) floor(llx+0.5));
++    src_yoff = MS_MAX(0,(int) floor(ury+0.5));
++    src_xsize = MS_MIN(MS_MAX(0,(int) (urx - llx + 0.5)),
+                     GDALGetRasterXSize(hDS) - src_xoff);
+-    src_ysize = MIN(MAX(0,(int) (lly - ury + 0.5)),
++    src_ysize = MS_MIN(MS_MAX(0,(int) (lly - ury + 0.5)),
+                     GDALGetRasterYSize(hDS) - src_yoff);
+ 
+     /* We want very small windows to use at least one source pixel (#4172) */
+     if( src_xsize == 0 && (urx - llx) > 0.0 ) {
+       src_xsize = 1;
+-      src_xoff = MIN(src_xoff,GDALGetRasterXSize(hDS)-1);
++      src_xoff = MS_MIN(src_xoff,GDALGetRasterXSize(hDS)-1);
+     }
+     if( src_ysize == 0 && (lly - ury) > 0.0 ) {
+       src_ysize = 1;
+-      src_yoff = MIN(src_yoff,GDALGetRasterYSize(hDS)-1);
++      src_yoff = MS_MIN(src_yoff,GDALGetRasterYSize(hDS)-1);
+     }
+ 
+     if( src_xsize == 0 || src_ysize == 0 ) {
+@@ -251,11 +251,11 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, 
imageObj *image,
+ 
+     dst_lrx = (int) ((copyRect.maxx - mapRect.minx) / map->cellsize + 0.5);
+     dst_lry = (int) ((mapRect.maxy - copyRect.miny) / map->cellsize + 0.5);
+-    dst_lrx = MAX(0,MIN(image->width,dst_lrx));
+-    dst_lry = MAX(0,MIN(image->height,dst_lry));
++    dst_lrx = MS_MAX(0,MS_MIN(image->width,dst_lrx));
++    dst_lry = MS_MAX(0,MS_MIN(image->height,dst_lry));
+ 
+-    dst_xsize = MAX(0,MIN(image->width,dst_lrx - dst_xoff));
+-    dst_ysize = MAX(0,MIN(image->height,dst_lry - dst_yoff));
++    dst_xsize = MS_MAX(0,MS_MIN(image->width,dst_lrx - dst_xoff));
++    dst_ysize = MS_MAX(0,MS_MIN(image->height,dst_lry - dst_yoff));
+ 
+     if( dst_xsize == 0 || dst_ysize == 0 ) {
+       if( layer->debug )
+@@ -290,8 +290,8 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, 
imageObj *image,
+   else {
+     dst_xoff = src_xoff = 0;
+     dst_yoff = src_yoff = 0;
+-    dst_xsize = src_xsize = MIN(image->width,src_xsize);
+-    dst_ysize = src_ysize = MIN(image->height,src_ysize);
++    dst_xsize = src_xsize = MS_MIN(image->width,src_xsize);
++    dst_ysize = src_ysize = MS_MIN(image->height,src_ysize);
+   }
+ 
+   /*
+@@ -533,7 +533,7 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, 
imageObj *image,
+       return -1;
+     }
+ 
+-    color_count = MIN(256,GDALGetColorEntryCount(hColorMap));
++    color_count = MS_MIN(256,GDALGetColorEntryCount(hColorMap));
+     for(i=0; i < color_count; i++) {
+       colorObj pixel;
+       int colormap_index;
+@@ -598,7 +598,7 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, 
imageObj *image,
+     cmap_set = TRUE;
+ #endif
+ 
+-    color_count = MIN(256,GDALGetColorEntryCount(hColorMap));
++    color_count = MS_MIN(256,GDALGetColorEntryCount(hColorMap));
+ 
+     for(i=0; i < color_count; i++) {
+       GDALColorEntry sEntry;
+@@ -889,8 +889,8 @@ static int ParseDefaultLUT( const char *lut_def, GByte 
*lut )
+         lut_read++;
+     }
+ 
+-    this_in = MAX(0,MIN(255,this_in));
+-    this_out = MAX(0,MIN(255,this_out));
++    this_in = MS_MAX(0,MS_MIN(255,this_in));
++    this_out = MS_MAX(0,MS_MIN(255,this_out));
+ 
+     /* apply linear values from last in:out to this in:out */
+     for( lut_i = last_in; lut_i <= this_in; lut_i++ ) {
+@@ -1275,8 +1275,8 @@ LoadGDALImages( GDALDatasetH hDS, int band_numbers[4], 
int band_count,
+           bMinMaxSet = TRUE;
+         }
+ 
+-        dfScaleMin = MIN(dfScaleMin,pafRawData[i]);
+-        dfScaleMax = MAX(dfScaleMax,pafRawData[i]);
++        dfScaleMin = MS_MIN(dfScaleMin,pafRawData[i]);
++        dfScaleMax = MS_MAX(dfScaleMax,pafRawData[i]);
+       }
+ 
+       if( dfScaleMin == dfScaleMax )
+@@ -1768,8 +1768,8 @@ msDrawRasterLayerGDAL_16BitClassification(
+       fDataMin = fDataMax = pafRawData[i];
+       bGotFirstValue = TRUE;
+     } else {
+-      fDataMin = MIN(fDataMin,pafRawData[i]);
+-      fDataMax = MAX(fDataMax,pafRawData[i]);
++      fDataMin = MS_MIN(fDataMin,pafRawData[i]);
++      fDataMax = MS_MAX(fDataMax,pafRawData[i]);
+     }
+   }
+ 
+@@ -2018,7 +2018,7 @@ int *msGetGDALBandList( layerObj *layer, void *hDS,
+   /* -------------------------------------------------------------------- */
+   if( CSLFetchNameValue( layer->processing, "BANDS" ) == NULL ) {
+     if( max_bands > 0 )
+-      *band_count = MIN(file_bands,max_bands);
++      *band_count = MS_MIN(file_bands,max_bands);
+     else
+       *band_count = file_bands;
+ 
+diff --git a/maprasterquery.c b/maprasterquery.c
+index 80accfa..06f0ece 100644
+--- a/maprasterquery.c
++++ b/maprasterquery.c
+@@ -330,11 +330,11 @@ static void msRasterQueryAddPixel( layerObj *layer, 
pointObj *location,
+   /* -------------------------------------------------------------------- */
+   else {
+     if( rlinfo->band_count >= 3 ) {
+-      red = (int) MAX(0,MIN(255,values[0]));
+-      green = (int) MAX(0,MIN(255,values[1]));
+-      blue = (int) MAX(0,MIN(255,values[2]));
++      red = (int) MS_MAX(0,MS_MIN(255,values[0]));
++      green = (int) MS_MAX(0,MS_MIN(255,values[1]));
++      blue = (int) MS_MAX(0,MS_MIN(255,values[2]));
+     } else {
+-      red = green = blue = (int) MAX(0,MIN(255,values[0]));
++      red = green = blue = (int) MS_MAX(0,MS_MIN(255,values[0]));
+     }
+   }
+ 
+@@ -454,35 +454,35 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, 
GDALDatasetH hDS,
+   /* top right */
+   dfX = GEO_TRANS(adfInvGeoTransform  , searchrect.maxx, searchrect.maxy);
+   dfY = GEO_TRANS(adfInvGeoTransform+3, searchrect.maxx, searchrect.maxy);
+-  dfXMin = MIN(dfXMin,dfX);
+-  dfXMax = MAX(dfXMax,dfX);
+-  dfYMin = MIN(dfYMin,dfY);
+-  dfYMax = MAX(dfYMax,dfY);
++  dfXMin = MS_MIN(dfXMin,dfX);
++  dfXMax = MS_MAX(dfXMax,dfX);
++  dfYMin = MS_MIN(dfYMin,dfY);
++  dfYMax = MS_MAX(dfYMax,dfY);
+ 
+   /* bottom left */
+   dfX = GEO_TRANS(adfInvGeoTransform  , searchrect.minx, searchrect.miny);
+   dfY = GEO_TRANS(adfInvGeoTransform+3, searchrect.minx, searchrect.miny);
+-  dfXMin = MIN(dfXMin,dfX);
+-  dfXMax = MAX(dfXMax,dfX);
+-  dfYMin = MIN(dfYMin,dfY);
+-  dfYMax = MAX(dfYMax,dfY);
++  dfXMin = MS_MIN(dfXMin,dfX);
++  dfXMax = MS_MAX(dfXMax,dfX);
++  dfYMin = MS_MIN(dfYMin,dfY);
++  dfYMax = MS_MAX(dfYMax,dfY);
+ 
+   /* bottom right */
+   dfX = GEO_TRANS(adfInvGeoTransform  , searchrect.maxx, searchrect.miny);
+   dfY = GEO_TRANS(adfInvGeoTransform+3, searchrect.maxx, searchrect.miny);
+-  dfXMin = MIN(dfXMin,dfX);
+-  dfXMax = MAX(dfXMax,dfX);
+-  dfYMin = MIN(dfYMin,dfY);
+-  dfYMax = MAX(dfYMax,dfY);
++  dfXMin = MS_MIN(dfXMin,dfX);
++  dfXMax = MS_MAX(dfXMax,dfX);
++  dfYMin = MS_MIN(dfYMin,dfY);
++  dfYMax = MS_MAX(dfYMax,dfY);
+ 
+   /* -------------------------------------------------------------------- */
+   /*      Trim the rectangle to the area of the file itself, but out      */
+   /*      to the edges of the touched edge pixels.                        */
+   /* -------------------------------------------------------------------- */
+-  dfXMin = MAX(0.0,MIN(nRXSize,floor(dfXMin)));
+-  dfYMin = MAX(0.0,MIN(nRYSize,floor(dfYMin)));
+-  dfXMax = MAX(0.0,MIN(nRXSize,ceil(dfXMax)));
+-  dfYMax = MAX(0.0,MIN(nRYSize,ceil(dfYMax)));
++  dfXMin = MS_MAX(0.0,MS_MIN(nRXSize,floor(dfXMin)));
++  dfYMin = MS_MAX(0.0,MS_MIN(nRYSize,floor(dfYMin)));
++  dfXMax = MS_MAX(0.0,MS_MIN(nRXSize,ceil(dfXMax)));
++  dfYMax = MS_MAX(0.0,MS_MIN(nRYSize,ceil(dfYMax)));
+ 
+   /* -------------------------------------------------------------------- */
+   /*      Convert to integer offset/size values.                          */
+diff --git a/mapresample.c b/mapresample.c
+index 26b253e..532b6a8 100644
+--- a/mapresample.c
++++ b/mapresample.c
+@@ -34,8 +34,8 @@
+ 
+ 
+ #ifndef MAX
+-#  define MIN(a,b)      ((a<b) ? a : b)
+-#  define MAX(a,b)      ((a>b) ? a : b)
++#  define MS_MIN(a,b)      ((a<b) ? a : b)
++#  define MS_MAX(a,b)      ((a>b) ? a : b)
+ #endif
+ 
+ #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))
+@@ -319,7 +319,7 @@ msBilinearRasterResampler( imageObj *psSrcImage, 
rasterBufferObj *src_rb,
+   int   nSrcYSize = psSrcImage->height;
+   int   nFailedPoints = 0, nSetPoints = 0;
+   double     *padfPixelSum;
+-  int         bandCount = MAX(4,psSrcImage->format->bands);
++  int         bandCount = MS_MAX(4,psSrcImage->format->bands);
+ 
+   padfPixelSum = (double *) msSmallMalloc(sizeof(double) * bandCount);
+ 
+@@ -369,10 +369,10 @@ msBilinearRasterResampler( imageObj *psSrcImage, 
rasterBufferObj *src_rb,
+         continue;
+ 
+       /* Trim in stuff one pixel off the edge */
+-      nSrcX = MAX(nSrcX,0);
+-      nSrcY = MAX(nSrcY,0);
+-      nSrcX2 = MIN(nSrcX2,nSrcXSize-1);
+-      nSrcY2 = MIN(nSrcY2,nSrcYSize-1);
++      nSrcX = MS_MAX(nSrcX,0);
++      nSrcY = MS_MAX(nSrcY,0);
++      nSrcX2 = MS_MIN(nSrcX2,nSrcXSize-1);
++      nSrcY2 = MS_MIN(nSrcY2,nSrcYSize-1);
+ 
+       memset( padfPixelSum, 0, sizeof(double) * bandCount);
+ 
+@@ -407,10 +407,10 @@ msBilinearRasterResampler( imageObj *psSrcImage, 
rasterBufferObj *src_rb,
+           int dst_rb_off = nDstX * dst_rb->data.rgba.pixel_step + nDstY * 
dst_rb->data.rgba.row_step;
+           unsigned char red, green, blue, alpha;
+ 
+-          red   = (unsigned char) MAX(0,MIN(255,padfPixelSum[0]));
+-          green = (unsigned char) MAX(0,MIN(255,padfPixelSum[1]));
+-          blue  = (unsigned char) MAX(0,MIN(255,padfPixelSum[2]));
+-          alpha = (unsigned char)MAX(0,MIN(255,255.5*dfWeightSum));
++          red   = (unsigned char) MS_MAX(0,MS_MIN(255,padfPixelSum[0]));
++          green = (unsigned char) MS_MAX(0,MS_MIN(255,padfPixelSum[1]));
++          blue  = (unsigned char) MS_MAX(0,MS_MIN(255,padfPixelSum[2]));
++          alpha = (unsigned char)MS_MAX(0,MS_MIN(255,255.5*dfWeightSum));
+ 
+           msAlphaBlendPM( red, green, blue, alpha,
+                           dst_rb->data.rgba.r + dst_rb_off,
+@@ -436,7 +436,7 @@ msBilinearRasterResampler( imageObj *psSrcImage, 
rasterBufferObj *src_rb,
+               = (float) padfPixelSum[band];
+           } else if( psSrcImage->format->imagemode == MS_IMAGEMODE_BYTE ) {
+             psDstImage->img.raw_byte[dst_off]
+-              = (unsigned char)MAX(0,MIN(255,padfPixelSum[band]));
++              = (unsigned char)MS_MAX(0,MS_MIN(255,padfPixelSum[band]));
+           }
+ 
+           dst_off += psDstImage->width*psDstImage->height;
+@@ -489,14 +489,14 @@ msAverageSample( imageObj *psSrcImage, rasterBufferObj 
*src_rb,
+   for( iY = nYMin; iY < nYMax; iY++ ) {
+     double dfYCellMin, dfYCellMax;
+ 
+-    dfYCellMin = MAX(iY,dfYMin);
+-    dfYCellMax = MIN(iY+1,dfYMax);
++    dfYCellMin = MS_MAX(iY,dfYMin);
++    dfYCellMax = MS_MIN(iY+1,dfYMax);
+ 
+     for( iX = nXMin; iX < nXMax; iX++ ) {
+       double dfXCellMin, dfXCellMax, dfWeight;
+ 
+-      dfXCellMin = MAX(iX,dfXMin);
+-      dfXCellMax = MIN(iX+1,dfXMax);
++      dfXCellMin = MS_MAX(iX,dfXMin);
++      dfXCellMax = MS_MIN(iX+1,dfXMax);
+ 
+       dfWeight = (dfXCellMax-dfXCellMin) * (dfYCellMax-dfYCellMin);
+ 
+@@ -537,7 +537,7 @@ msAverageRasterResampler( imageObj *psSrcImage, 
rasterBufferObj *src_rb,
+   int   nFailedPoints = 0, nSetPoints = 0;
+   double     *padfPixelSum;
+ 
+-  int         bandCount = MAX(4,psSrcImage->format->bands);
++  int         bandCount = MS_MAX(4,psSrcImage->format->bands);
+ 
+   padfPixelSum = (double *) msSmallMalloc(sizeof(double) * bandCount);
+ 
+@@ -573,19 +573,19 @@ msAverageRasterResampler( imageObj *psSrcImage, 
rasterBufferObj *src_rb,
+         continue;
+       }
+ 
+-      dfXMin = MIN(MIN(x1[nDstX],x1[nDstX+1]),
+-                   MIN(x2[nDstX],x2[nDstX+1]));
+-      dfYMin = MIN(MIN(y1[nDstX],y1[nDstX+1]),
+-                   MIN(y2[nDstX],y2[nDstX+1]));
+-      dfXMax = MAX(MAX(x1[nDstX],x1[nDstX+1]),
+-                   MAX(x2[nDstX],x2[nDstX+1]));
+-      dfYMax = MAX(MAX(y1[nDstX],y1[nDstX+1]),
+-                   MAX(y2[nDstX],y2[nDstX+1]));
++      dfXMin = MS_MIN(MS_MIN(x1[nDstX],x1[nDstX+1]),
++                   MS_MIN(x2[nDstX],x2[nDstX+1]));
++      dfYMin = MS_MIN(MS_MIN(y1[nDstX],y1[nDstX+1]),
++                   MS_MIN(y2[nDstX],y2[nDstX+1]));
++      dfXMax = MS_MAX(MS_MAX(x1[nDstX],x1[nDstX+1]),
++                   MS_MAX(x2[nDstX],x2[nDstX+1]));
++      dfYMax = MS_MAX(MS_MAX(y1[nDstX],y1[nDstX+1]),
++                   MS_MAX(y2[nDstX],y2[nDstX+1]));
+ 
+-      dfXMin = MIN(MAX(dfXMin,0),psSrcImage->width+1);
+-      dfYMin = MIN(MAX(dfYMin,0),psSrcImage->height+1);
+-      dfXMax = MIN(MAX(-1,dfXMax),psSrcImage->width);
+-      dfYMax = MIN(MAX(-1,dfYMax),psSrcImage->height);
++      dfXMin = MS_MIN(MS_MAX(dfXMin,0),psSrcImage->width+1);
++      dfYMin = MS_MIN(MS_MAX(dfYMin,0),psSrcImage->height+1);
++      dfXMax = MS_MIN(MS_MAX(-1,dfXMax),psSrcImage->width);
++      dfYMax = MS_MIN(MS_MAX(-1,dfYMax),psSrcImage->height);
+ 
+       memset( padfPixelSum, 0, sizeof(double)*bandCount );
+ 
+@@ -605,13 +605,13 @@ msAverageRasterResampler( imageObj *psSrcImage, 
rasterBufferObj *src_rb,
+           unsigned char red, green, blue, alpha;
+ 
+           red   = (unsigned char)
+-                  MAX(0,MIN(255,padfPixelSum[0]+0.5));
++                  MS_MAX(0,MS_MIN(255,padfPixelSum[0]+0.5));
+           green = (unsigned char)
+-                  MAX(0,MIN(255,padfPixelSum[1]+0.5));
++                  MS_MAX(0,MS_MIN(255,padfPixelSum[1]+0.5));
+           blue  = (unsigned char)
+-                  MAX(0,MIN(255,padfPixelSum[2]+0.5));
++                  MS_MAX(0,MS_MIN(255,padfPixelSum[2]+0.5));
+           alpha = (unsigned char)
+-                  MAX(0,MIN(255,255*dfAlpha01+0.5));
++                  MS_MAX(0,MS_MIN(255,255*dfAlpha01+0.5));
+ 
+           RB_MIX_PIXEL(dst_rb,nDstX,nDstY,
+                        red, green, blue, alpha );
+@@ -1121,10 +1121,10 @@ static int msTransformMapToSource( int nDstXSize, int 
nDstYSize,
+       psSrcExtent->miny = psSrcExtent->maxy = y_out;
+       bOutInit = 1;
+     } else {
+-      psSrcExtent->minx = MIN(psSrcExtent->minx, x_out);
+-      psSrcExtent->maxx = MAX(psSrcExtent->maxx, x_out);
+-      psSrcExtent->miny = MIN(psSrcExtent->miny, y_out);
+-      psSrcExtent->maxy = MAX(psSrcExtent->maxy, y_out);
++      psSrcExtent->minx = MS_MIN(psSrcExtent->minx, x_out);
++      psSrcExtent->maxx = MS_MAX(psSrcExtent->maxx, x_out);
++      psSrcExtent->miny = MS_MIN(psSrcExtent->miny, y_out);
++      psSrcExtent->maxy = MS_MAX(psSrcExtent->maxy, y_out);
+     }
+   }
+ 
+@@ -1141,10 +1141,10 @@ static int msTransformMapToSource( int nDstXSize, int 
nDstYSize,
+     int nGrowAmountY = (int)
+                        (psSrcExtent->maxy - psSrcExtent->miny)/EDGE_STEPS + 1;
+ 
+-    psSrcExtent->minx = MAX(psSrcExtent->minx - nGrowAmountX,0);
+-    psSrcExtent->miny = MAX(psSrcExtent->miny - nGrowAmountY,0);
+-    psSrcExtent->maxx = MIN(psSrcExtent->maxx + nGrowAmountX,nSrcXSize);
+-    psSrcExtent->maxy = MIN(psSrcExtent->maxy + nGrowAmountY,nSrcYSize);
++    psSrcExtent->minx = MS_MAX(psSrcExtent->minx - nGrowAmountX,0);
++    psSrcExtent->miny = MS_MAX(psSrcExtent->miny - nGrowAmountY,0);
++    psSrcExtent->maxx = MS_MIN(psSrcExtent->maxx + nGrowAmountX,nSrcXSize);
++    psSrcExtent->maxy = MS_MIN(psSrcExtent->maxy + nGrowAmountY,nSrcYSize);
+   }
+ 
+   return MS_TRUE;
+@@ -1342,10 +1342,10 @@ int msResampleGDALToMap( mapObj *map, layerObj *layer, 
imageObj *image,
+     sSrcExtent.maxy = ceil (sSrcExtent.maxy+1.0);
+   }
+ 
+-  sSrcExtent.minx = MAX(0,sSrcExtent.minx);
+-  sSrcExtent.maxx = MIN(sSrcExtent.maxx, nSrcXSize );
+-  sSrcExtent.miny = MAX(sSrcExtent.miny, 0 );
+-  sSrcExtent.maxy = MIN(sSrcExtent.maxy, nSrcYSize );
++  sSrcExtent.minx = MS_MAX(0,sSrcExtent.minx);
++  sSrcExtent.maxx = MS_MIN(sSrcExtent.maxx, nSrcXSize );
++  sSrcExtent.miny = MS_MAX(sSrcExtent.miny, 0 );
++  sSrcExtent.maxy = MS_MIN(sSrcExtent.maxy, nSrcYSize );
+ 
+   if( sSrcExtent.maxx <= sSrcExtent.minx
+       || sSrcExtent.maxy <= sSrcExtent.miny ) {
+@@ -1383,9 +1383,9 @@ int msResampleGDALToMap( mapObj *map, layerObj *layer, 
imageObj *image,
+   else
+     sDummyMap.cellsize = dfNominalCellSize;
+ 
+-  nLoadImgXSize = MAX(1, (int) (sSrcExtent.maxx - sSrcExtent.minx)
++  nLoadImgXSize = MS_MAX(1, (int) (sSrcExtent.maxx - sSrcExtent.minx)
+                       * (dfNominalCellSize / sDummyMap.cellsize));
+-  nLoadImgYSize = MAX(1, (int) (sSrcExtent.maxy - sSrcExtent.miny)
++  nLoadImgYSize = MS_MAX(1, (int) (sSrcExtent.maxy - sSrcExtent.miny)
+                       * (dfNominalCellSize / sDummyMap.cellsize));
+ 
+   /*
+diff --git a/mapstring.c b/mapstring.c
+index ea5b67f..82ee82a 100644
+--- a/mapstring.c
++++ b/mapstring.c
+@@ -135,7 +135,7 @@ char *strrstr(char *string, char *find)
+  * Appends src to string dst of size siz (unlike strncat, siz is the
+  * full size of dst, not space left).  At most siz-1 characters
+  * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
+- * Returns strlen(src) + MIN(siz, strlen(initial dst)).
++ * Returns strlen(src) + MS_MIN(siz, strlen(initial dst)).
+  * If retval >= siz, truncation occurred.
+  */
+ size_t strlcat(char *dst, const char *src, size_t siz)
+diff --git a/mapwcs20.c b/mapwcs20.c
+index 347e9b7..266a07d 100644
+--- a/mapwcs20.c
++++ b/mapwcs20.c
+@@ -4189,8 +4189,8 @@ this request. Check wcs/ows_enable_request settings.", 
"msWCSGetCoverage20()", p
+             + (orig_bbox.maxx+1) * cm.geotransform[1]
+             + (orig_bbox.maxy+1) * cm.geotransform[2];
+ 
+-      subsets.minx = MIN(x_1, x_2);
+-      subsets.maxx = MAX(x_1, x_2);
++      subsets.minx = MS_MIN(x_1, x_2);
++      subsets.maxx = MS_MAX(x_1, x_2);
+     }
+     if(subsets.miny != -DBL_MAX || subsets.maxy != DBL_MAX) {
+       y_1 = cm.geotransform[3]
+@@ -4201,8 +4201,8 @@ this request. Check wcs/ows_enable_request settings.", 
"msWCSGetCoverage20()", p
+             + orig_bbox.minx * cm.geotransform[4]
+             + orig_bbox.miny * cm.geotransform[5];
+ 
+-      subsets.miny = MIN(y_1, y_2);
+-      subsets.maxy = MAX(y_1, y_2);
++      subsets.miny = MS_MIN(y_1, y_2);
++      subsets.maxy = MS_MAX(y_1, y_2);
+     }
+   } else { /* if crs is not the 'imageCRS' */
+     projectionObj subsetProj;
+@@ -4241,10 +4241,10 @@ this request. Check wcs/ows_enable_request settings.", 
"msWCSGetCoverage20()", p
+   }
+ 
+   /* write combined bounding box */
+-  bbox.minx = MAX(subsets.minx, map->extent.minx);
+-  bbox.miny = MAX(subsets.miny, map->extent.miny);
+-  bbox.maxx = MIN(subsets.maxx, map->extent.maxx);
+-  bbox.maxy = MIN(subsets.maxy, map->extent.maxy);
++  bbox.minx = MS_MAX(subsets.minx, map->extent.minx);
++  bbox.miny = MS_MAX(subsets.miny, map->extent.miny);
++  bbox.maxx = MS_MIN(subsets.maxx, map->extent.maxx);
++  bbox.maxy = MS_MIN(subsets.maxy, map->extent.maxy);
+ 
+   /* check if we are overspecified  */
+   if ((params->width != 0 &&  params->resolutionX != MS_WCS20_UNBOUNDED)
+@@ -4620,10 +4620,10 @@ this request. Check wcs/ows_enable_request settings.", 
"msWCSGetCoverage20()", p
+     tmpCm.xresolution = map->gt.geotransform[1];
+     tmpCm.yresolution = map->gt.geotransform[5];
+ 
+-    tmpCm.extent.minx = MIN(map->gt.geotransform[0], map->gt.geotransform[0] 
+ map->width * tmpCm.xresolution);
+-    tmpCm.extent.miny = MIN(map->gt.geotransform[3], map->gt.geotransform[3] 
+ map->height * tmpCm.yresolution);
+-    tmpCm.extent.maxx = MAX(map->gt.geotransform[0], map->gt.geotransform[0] 
+ map->width * tmpCm.xresolution);
+-    tmpCm.extent.maxy = MAX(map->gt.geotransform[3], map->gt.geotransform[3] 
+ map->height * tmpCm.yresolution);
++    tmpCm.extent.minx = MS_MIN(map->gt.geotransform[0], 
map->gt.geotransform[0] + map->width * tmpCm.xresolution);
++    tmpCm.extent.miny = MS_MIN(map->gt.geotransform[3], 
map->gt.geotransform[3] + map->height * tmpCm.yresolution);
++    tmpCm.extent.maxx = MS_MAX(map->gt.geotransform[0], 
map->gt.geotransform[0] + map->width * tmpCm.xresolution);
++    tmpCm.extent.maxy = MS_MAX(map->gt.geotransform[3], 
map->gt.geotransform[3] + map->height * tmpCm.yresolution);
+ 
+     swapAxes = msWCSSwapAxes20(srs_uri);
+     msFree(srs_uri);
+diff --git a/mapwmslayer.c b/mapwmslayer.c
+index 42a44f1..3e4747d 100644
+--- a/mapwmslayer.c
++++ b/mapwmslayer.c
+@@ -698,7 +698,7 @@ msBuildWMSLayerURL(mapObj *map, layerObj *lp, int 
nRequestType,
+       else {
+         double cellsize_x = (bbox.maxx-bbox.minx) / bbox_width;
+         double cellsize_y = (bbox.maxy-bbox.miny) / bbox_height;
+-        double cellsize = MIN(cellsize_x,cellsize_y);
++        double cellsize = MS_MIN(cellsize_x,cellsize_y);
+ 
+         msRectIntersect( &bbox, &layer_rect );
+ 

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
new file mode 100644
index 0000000..088e37b
--- /dev/null
+++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-disabled-ogr.patch
@@ -0,0 +1,56 @@
+From ab2a6129435ca37d02730a6faf85593afa0daf9b Mon Sep 17 00:00:00 2001
+From: Thomas Bonfort <[email protected]>
+Date: Mon, 16 Nov 2015 16:56:02 +0100
+Subject: [PATCH] Fix build issues with OGR disabled
+
+---
+ mapimageio.c   | 2 +-
+ mapogcfilter.c | 1 +
+ mapogr.cpp     | 2 ++
+ 3 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/mapimageio.c b/mapimageio.c
+index 771188b..95feda2 100644
+--- a/mapimageio.c
++++ b/mapimageio.c
+@@ -210,7 +210,7 @@ int saveAsJPEG(mapObj *map, rasterBufferObj *rb, 
streamInfo *info,
+       /* If the user doesn't provide a value for JPEGMEM, we want to be sure 
*/
+       /* that at least the image size will be used before creating the 
temporary file */
+       cinfo.mem->max_memory_to_use =
+-        MAX(cinfo.mem->max_memory_to_use, cinfo.input_components * rb->width 
* rb->height);
++        MS_MAX(cinfo.mem->max_memory_to_use, cinfo.input_components * 
rb->width * rb->height);
+     }
+   }
+ 
+diff --git a/mapogcfilter.c b/mapogcfilter.c
+index 50e2e7b..05f017a 100644
+--- a/mapogcfilter.c
++++ b/mapogcfilter.c
+@@ -40,6 +40,7 @@
+ #include "mapowscommon.h"
+ #include "maptime.h"
+ #include "mapows.h"
++#include <ctype.h>
+ 
+ static int FLTHasUniqueTopLevelDuringFilter(FilterEncodingNode *psFilterNode);
+ 
+diff --git a/mapogr.cpp b/mapogr.cpp
+index 07acdba..80f032b 100644
+--- a/mapogr.cpp
++++ b/mapogr.cpp
+@@ -1318,6 +1318,7 @@ static int msOGRFileClose(layerObj *layer, msOGRFileInfo 
*psInfo )
+ 
+   return MS_SUCCESS;
+ }
++#endif /* USE_OGR */
+ 
+ /************************************************************************/
+ /*                           msOGREscapeSQLParam                        */
+@@ -1345,6 +1346,7 @@ static char *msOGREscapeSQLParam(layerObj *layer, const 
char *pszString)
+ #endif /* USE_OGR */
+ }
+ 
++#ifdef USE_OGR
+ /**********************************************************************
+  *                     msOGRTranslateMsExpressionToOGRSQL()
+  *

diff --git a/sci-geosciences/mapserver/files/mapserver-7.0.0-giflib51.patch 
b/sci-geosciences/mapserver/files/mapserver-7.0.0-giflib51.patch
new file mode 100644
index 0000000..1fa7710
--- /dev/null
+++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-giflib51.patch
@@ -0,0 +1,35 @@
+From 0101157d4edd5d837d17356c66c7d25af7e020ac Mon Sep 17 00:00:00 2001
+From: Sander Jansen <[email protected]>
+Date: Wed, 19 Aug 2015 16:51:13 -0500
+Subject: [PATCH] Fix compilation with gif_lib 5.1
+
+---
+ mapimageio.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/mapimageio.c b/mapimageio.c
+index e6bdcb5..5eed924 100644
+--- a/mapimageio.c
++++ b/mapimageio.c
+@@ -1058,6 +1058,13 @@ int readGIF(char *path, rasterBufferObj *rb)
+ 
+   } while (recordType != TERMINATE_RECORD_TYPE);
+ 
++
++#if defined GIFLIB_MAJOR && GIFLIB_MINOR && ((GIFLIB_MAJOR == 5 && 
GIFLIB_MINOR >= 1) || (GIFLIB_MAJOR > 5))
++  if (DGifCloseFile(image, &errcode) == GIF_ERROR) {
++    msSetError(MS_MISCERR,"failed to close gif after loading: 
%s","readGIF()", gif_error_msg(errcode));
++    return MS_FAILURE;
++  }
++#else
+   if (DGifCloseFile(image) == GIF_ERROR) {
+ #if defined GIFLIB_MAJOR && GIFLIB_MAJOR >= 5
+     msSetError(MS_MISCERR,"failed to close gif after loading: 
%s","readGIF()", gif_error_msg(image->Error));
+@@ -1066,6 +1073,7 @@ int readGIF(char *path, rasterBufferObj *rb)
+ #endif
+     return MS_FAILURE;
+   }
++#endif
+ 
+   return MS_SUCCESS;
+ }

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
new file mode 100644
index 0000000..5625746
--- /dev/null
+++ 
b/sci-geosciences/mapserver/files/mapserver-7.0.0-mapwcs-disabled-libxml2.patch
@@ -0,0 +1,20 @@
+diff --git a/mapwcs20.c b/mapwcs20.c
+index ac2fb89..9560a25 100755
+--- a/mapwcs20.c
++++ b/mapwcs20.c
+@@ -700,6 +700,7 @@ static int msWCSParseScaleExtentString20(char *string, 
char *outAxis,
+   return MS_SUCCESS;
+ }
+ 
++#if defined(USE_LIBXML2)
+ /*
+   Utility function to get the first child of a node with a given node name
+   */
+@@ -739,6 +740,7 @@ xmlNodePtr msLibXml2GetFirstChildNs(xmlNodePtr parent, 
const char *name, xmlNsPt
+   }
+   return NULL;
+ }
++#endif /* defined(USE_LIBXML2) */
+ 
+ /************************************************************************/
+ /*                   msWCSParseRequest20_XMLGetCapabilities()           */

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
new file mode 100644
index 0000000..f438bec
--- /dev/null
+++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-no-applicable-code.patch
@@ -0,0 +1,34 @@
+diff --git a/mapwfs11.c b/mapwfs11.c
+index 20ab164..4dc15fc 100755
+--- a/mapwfs11.c
++++ b/mapwfs11.c
+@@ -29,12 +29,12 @@
+ 
+ #include "mapserver.h"
+ #include "mapows.h"
++#include "mapowscommon.h"
+ 
+ 
+ 
+ #if defined(USE_WFS_SVR) && defined(USE_LIBXML2)
+ #include "maplibxml2.h"
+-#include "mapowscommon.h"
+ #include "mapogcfilter.h"
+ 
+ /************************************************************************/
+diff --git a/mapwfs20.c b/mapwfs20.c
+index 710d444..cf69ee3 100755
+--- a/mapwfs20.c
++++ b/mapwfs20.c
+@@ -29,10 +29,10 @@
+ 
+ #include "mapserver.h"
+ #include "mapows.h"
++#include "mapowscommon.h"
+ 
+ #if defined(USE_WFS_SVR) && defined(USE_LIBXML2)
+ #include "maplibxml2.h"
+-#include "mapowscommon.h"
+ #include "mapogcfilter.h"
+ 
+ #define MS_OWS_11_NAMESPACE_PREFIX       MS_OWSCOMMON_OWS_NAMESPACE_PREFIX

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
new file mode 100644
index 0000000..17016c6
--- /dev/null
+++ b/sci-geosciences/mapserver/files/mapserver-7.0.0-sec-format.patch
@@ -0,0 +1,13 @@
+diff --git a/apache/mod_mapserver.c b/apache/mod_mapserver.c
+index 7949ddf..c8dbde6 100644
+--- a/apache/mod_mapserver.c
++++ b/apache/mod_mapserver.c
+@@ -40,7 +40,7 @@ static int
+ msIO_apacheError (void *cbData, void *data, int byteCount)
+ {
+   /* error reporting is done through the log file... */
+-  ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, (char*) data);
++  ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, "%s", (char*) data);
+   return strlen ((char*) data);
+ }
+ 

diff --git a/sci-geosciences/mapserver/mapserver-7.0.0.ebuild 
b/sci-geosciences/mapserver/mapserver-7.0.0.ebuild
new file mode 100644
index 0000000..da2eb5d
--- /dev/null
+++ b/sci-geosciences/mapserver/mapserver-7.0.0.ebuild
@@ -0,0 +1,177 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P="${PN}-${PV/_/-}"
+
+PHP_EXT_OPTIONAL_USE="php"
+PHP_EXT_NAME="php_mapscript"
+PHP_EXT_S="${WORKDIR}/${MY_P}/mapscript/php/"
+PHP_EXT_SKIP_PHPIZE="no"
+USE_PHP="php5-4 php5-5"
+
+PYTHON_COMPAT=( python2_7 )
+
+#USE_RUBY="ruby18 ruby19"
+#RUBY_OPTIONAL="yes"
+
+WEBAPP_MANUAL_SLOT=yes
+
+inherit eutils depend.apache webapp distutils-r1 flag-o-matic perl-module 
php-ext-source-r2 multilib cmake-utils # ruby-ng
+
+DESCRIPTION="Development environment for building spatially enabled webapps"
+HOMEPAGE="http://mapserver.org/";
+SRC_URI="http://download.osgeo.org/mapserver/${MY_P}.tar.gz";
+
+LICENSE="MIT"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+IUSE="bidi cairo gdal geos mysql opengl perl php postgis proj python threads 
tiff xml xslt" # ruby php tcl
+
+REQUIRED_USE="php? ( ^^ ( php_targets_php5-4 php_targets_php5-5 ) )
+                       xslt? ( xml )"
+
+RDEPEND="
+       dev-libs/expat
+       dev-libs/fcgi
+       >=media-libs/gd-2.0.12[truetype,jpeg,png,zlib]
+       media-libs/giflib
+       net-misc/curl
+       virtual/jpeg:=
+       virtual/libiconv
+       x11-libs/agg
+       bidi? ( dev-libs/fribidi
+                       media-libs/harfbuzz )
+       cairo? ( x11-libs/cairo )
+       gdal? ( >=sci-libs/gdal-1.8.0 )
+       geos? ( sci-libs/geos )
+       mysql? ( virtual/mysql )
+       opengl? (
+               media-libs/ftgl
+               media-libs/mesa
+       )
+       perl? ( dev-lang/perl:= )
+       postgis? ( dev-db/postgis )
+       proj? ( sci-libs/proj net-misc/curl )
+       tiff? (
+               media-libs/tiff:=
+               sci-libs/libgeotiff
+       )
+       xml? ( dev-libs/libxml2:2 )
+       xslt? ( dev-libs/libxslt[crypt] )
+"
+DEPEND="${RDEPEND}
+       perl? ( >=dev-lang/swig-2.0 )
+       python? ( >=dev-lang/swig-2.0 )"
+
+need_apache2
+
+PATCHES=(
+       "${FILESDIR}/${P}-giflib51.patch"  # see 
https://github.com/mapserver/mapserver/pull/5144
+       "${FILESDIR}/${P}-disabled-ogr.patch"  # see 
https://github.com/mapserver/mapserver/commit/ab2a6129435ca37d02730a6faf85593afa0daf9b
+       "${FILESDIR}/${P}-correct-min-max-calls.patch"  # see 
https://github.com/mapserver/mapserver/pull/5251
+       "${FILESDIR}/${P}-sec-format.patch"  # see 
https://github.com/mapserver/mapserver/pull/5248
+       "${FILESDIR}/${P}-mapwcs-disabled-libxml2.patch"
+       "${FILESDIR}/${P}-no-applicable-code.patch"
+)
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+       webapp_pkg_setup
+       use perl && perl_set_version
+       #use ruby && ruby-ng_pkg_setup
+}
+
+src_unpack() {
+       # unpack A and then copy the php thingies into workdir/php-slot
+       php-ext-source-r2_src_unpack
+       # HACK: and then remove it and replace by symlink
+       for slot in $(php_get_slots); do
+               rm -rf "${WORKDIR}/${slot}" || die
+               ln -s "${PHP_EXT_S}" "${WORKDIR}/${slot}" || die
+       done
+}
+
+src_prepare() {
+       local glibdir="${EPREFIX}/usr/include/glib-2.0"
+       local usrglibdir="${EPREFIX}/usr/$(get_libdir)/glib-2.0/include"
+
+       sed -e "s:^include_directories(:&${glibdir})\ninclude_directories(:" \
+               -i "${S}/CMakeLists.txt" || die
+       sed -e "s:include_directories(:&${usrglibdir})\ninclude_directories(:" \
+               -i "${S}/CMakeLists.txt" || die
+
+       cmake-utils_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               "-DCMAKE_SKIP_RPATH=ON"
+               "-DWITH_ORACLESPATIAL=OFF"
+               "-DWITH_SDE=OFF"
+               "-DWITH_APACHE_MODULE=ON"
+               "-DWITH_ICONV=ON"
+               "-DWITH_GD=ON"
+               "-DWITH_GIF=ON"
+               "-DWITH_CURL=ON"
+               "-DWITH_FCGI=ON"
+               "-DWITH_PROJ=$(usex proj ON OFF)"
+               "-DWITH_WMS=$(usex proj ON OFF)"
+               "-DWITH_KML=$(usex xml ON OFF)"
+               "-DWITH_GEOS=$(usex geos ON OFF)"
+               "-DWITH_GDAL=$(usex gdal ON OFF)"
+               "-DWITH_OGR=$(usex gdal ON OFF)"
+               "-DWITH_POSTGIS=$(usex postgis ON OFF)"
+               "-DWITH_MYSQL=$(usex mysql ON OFF)"
+               "-DWITH_LIBXML2=$(usex xml ON OFF)"
+               "-DWITH_XMLMAPFILE=$(usex xslt ON OFF)"
+               "-DWITH_FRIBIDI=$(usex bidi ON OFF)"
+               "-DWITH_HARFBUZZ=$(usex bidi ON OFF)"
+               "-DWITH_CAIRO=$(usex cairo ON OFF)"
+               "-DWITH_PHP=$(usex php ON OFF)"
+               "-DWITH_PYTHON=$(usex python ON OFF)"
+               "-DWITH_PERL=$(usex perl ON OFF)"
+       )
+
+       if use gdal && use proj ; then
+               mycmakeargs+=( "-DWITH_WFS=ON"
+                               "-DWITH_WCS=ON"
+                               "-DWITH_CLIENT_WMS=ON"
+                               "-DWITH_CLIENT_WFS=ON"
+                               "-DWITH_SOS=$(usex xml ON OFF)"
+                       )
+       else
+               mycmakeargs+=( "-DWITH_WFS=OFF"
+                       "-DWITH_WCS=OFF"
+                       "-DWITH_CLIENT_WMS=OFF"
+                       "-DWITH_CLIENT_WFS=OFF"
+                       "-DWITH_SOS=OFF"
+               )
+       fi
+
+       cmake-utils_src_configure
+}
+
+src_compile() {
+       cmake-utils_src_compile
+}
+
+src_install() {
+       cmake-utils_src_install
+
+       webapp_src_preinst
+       exeinto "${MY_CGIBINDIR}"
+       doexe "${S}_build/mapserv"
+       webapp_src_install
+}
+
+pkg_postinst() {
+       webapp_pkg_postinst
+}
+
+pkg_prerm() {
+       webapp_pkg_prerm
+}

Reply via email to