For a general build of MapServer, without fastcgi support, use the build script on the MapServer download page. This will build the MapServer library as a framework, which is used by CGI, PHP-Mapscript and Python-mapscript.
For MapServer CGI with fastcgi support, see below.
version: 5.6.3
source: MapServer
parallel: no
The fastcgi support in MapServer doesn't work with Python-Mapscript, so the framework build does not include fastcgi support. Since fastcgi is only useful in the mapserv CGI, you might as well do a normal Mapserver build without any mapscripts, where the library is compiled into the CGI.
Apple included the fastcgi library starting with Leopard. I have not looked into compiling fastcgi recently, so I will not include instructions for Tiger or Panther.
Note that configuring in cairo support normally requires pkg-config, something I consider lame. See the alternate build below to build MapServer using my frameworks, without the need for pkg-config.
For all the below system configurations, you can also add the following optional features (note: you should also be able to get PDF output from cairo):
If you installed PDFlib, add this to the configure line:
--with-pdf=/usr/local
If you installed PostGreSQL + PostGIS, add this to the configure line:
--with-postgis=/usr/local/pgsql/bin/pg_config
In the mapserver source:
export MACOSX_DEPLOYMENT_TARGET=10.6 ./configure --with-zlib=/usr --with-wfs --with-wcs --with-wfsclient --with-wmsclient --with-sos \ --with-proj=/usr/local --with-gdal=/usr/local/bin/gdal-config --with-geos=/usr/local/bin/geos-config \ --with-jpeg=/usr/local --with-png=/usr/local --with-freetype=/usr/local/bin/freetype-config \ --with-agg --with-ming=/usr/local --with-gd=/usr/local --with-ogr \ --with-cairo=/usr/local --without-php --without-xpm --with-fastcgi=/usr \ CFLAGS="-Os -arch i386 -arch x86_64" CXXFLAGS="-Os -arch i386 -arch x86_64" \ LDFLAGS="-arch i386 -arch x86_64" make
In the mapserver source:
export MACOSX_DEPLOYMENT_TARGET=10.5 ./configure --with-zlib=/usr --with-wfs --with-wcs --with-wfsclient --with-wmsclient --with-sos \ --with-proj=/usr/local --with-gdal=/usr/local/bin/gdal-config --with-geos=/usr/local/bin/geos-config \ --with-jpeg=/usr/local --with-png=/usr/local --with-freetype=/usr/local/bin/freetype-config \ --with-agg --with-ming=/usr/local --with-gd=/usr/local --with-ogr \ --with-cairo=/usr/local --without-php --without-xpm --with-fastcgi=/usr \ CFLAGS="-Os -arch ppc -arch i386 -arch ppc64 -arch x86_64" \ CXXFLAGS="-Os -arch ppc -arch i386 -arch ppc64 -arch x86_64" \ LDFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64" make
To install it, we manually copy the binaries.
sudo cp -f mapserv /Library/Webserver/CGI-Executables/fmapserv
I named it 'fmapserv' so it can exist side-by-side with my MapServer framework binaries.
To build using the frameworks, change the following options as given:
--with-proj=/Library/Frameworks/PROJ.framework/unix \ --with-gdal=/Library/Frameworks/GDAL.framework/Programs/gdal-config \ --with-geos=/Library/Frameworks/GEOS.framework/Programs/geos-config \ --with-jpeg=/Library/Frameworks/UnixImageIO.framework/unix \ --with-png=/Library/Frameworks/UnixImageIO.framework/unix \ --with-freetype=/Library/Frameworks/FreeType.framework/Programs/freetype-config \ --with-cairo=no --with-pkg-config=no \
Then, before make, patch in cairo support (configure can't pick up cairo from the framework). Edit the Makefile and change the following lines to match:
CAIRO=-DUSE_CAIRO CAIRO_LIB=-framework cairo CAIRO_INC=-I/Library/Frameworks/cairo.framework/Headers
And, find the line that starts with "DEFINES =" and add to the end of it (make sure a space separates it from the rest):
-DUSE_CAIRO
Now you can run make, and install it.