Mapscript / PCL quick install script
This is a small helper script to quickly (re)compile and install both Mapserver/Mapscript and PCL. I got tired of doing this manually over and over again when developing/testing PCL and wrote a simple shell script to automate the process.
The script assumes that all the required components are already installed on your system.
Author: Kai Hänninen
#!/bin/bash
# The PCL version to use. You can also use 'SVN' to get the latest & greatest.
PCL_VERSION=0.10.0
# The Mapserver version to use
MAPSERVER_VERSION=4.8.0
# The tarballs will be unpacked under this directory
BASE_PATH=/usr/local/src
# Location of additional python packages
PYTHON_SITE_PACKAGES=/usr/lib/python2.3/site-packages
cd $BASE_PATH
# Download, unpack, compile and install Mapserver/Mapscript
if [ ! -f mapserver-$MAPSERVER_VERSION.tar.gz ]; then
wget http://cvs.gis.umn.edu/dist/mapserver-$MAPSERVER_VERSION.tar.gz
fi
rm -rf mapserver-$MAPSERVER_VERSION
tar xzvf mapserver-$MAPSERVER_VERSION.tar.gz
cd mapserver-$MAPSERVER_VERSION
./configure --with-tiff \
--with-jpeg \
--with-png \
--with-freetype \
--with-zlib \
--with-threads \
--with-proj \
--with-gdal \
--with-wcs \
--with-ogr \
--with-wmsclient \
--with-wfsclient
make
cd mapscript/python
swig -python -modern -o mapscript_wrap.c ../mapscript.i
python setup.py build
sudo rm -rf $PYTHON_SITE_PACKAGES/mapscript.*
sudo rm -rf $PYTHON_SITE_PACKAGES/_mapscript.so
sudo python setup.py install
echo Installed Mapscript $MAPSERVER_VERSION
# Download, unpack, compile and install PCL
cd $BASE_PATH
rm -rf PCL-$PCL_VERSION
if [ "$PCL_VERSION" == "SVN" ]; then
svn co http://svn.gispython.org/gispy/PCL/trunk PCL-$PCL_VERSION
else
if [ ! -f PCL-$PCL_VERSION.tar.gz ]; then
wget http://www.gispython.org/downloads/gispy/PCL-$PCL_VERSION.tar.gz
fi
tar xzvf PCL-$PCL_VERSION.tar.gz
fi
cd PCL-$PCL_VERSION/PCL-Cartography
perl -i -pe "s#ms_home.*'#ms_home = '$BASE_PATH/mapserver-$MAPSERVER_VERSION'#g" setup.py
rm -f cartography/engine/mapserver/{msbridge.py,msbridge_wrap.c}
python setup.py build
sudo rm -rf $PYTHON_SITE_PACKAGES/cartography
sudo python setup.py install
echo Installed PCL $PCL_VERSION
cd $BASE_PATH
