# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils mono DESCRIPTION="OpenSource development environment for constructing spatially enabled Internet-web applications." HOMEPAGE="http://mapserver.gis.umn.edu/" SRC_URI="http://cvs.gis.umn.edu/dist/${P}.tar.gz" LICENSE="Regents of the University of Minnesota." SLOT="0" KEYWORDS="~x86" IUSE="pdf proj geos tiff gdal xpm threads postgis mygis ming \ php python perl ruby tcl java mono" MY_ProjUSE="wmsclient" MY_GPUSE="wfs wcs wmsclient wfsclient" DEPEND="geos? (sci-libs/geos) proj? (sci-libs/proj net-misc/curl) gdal? (sci-libs/gdal) postgis? (dev-db/postgis) mygis? (dev-db/mygis) media-libs/freetype tiff? (media-libs/tiff sci-libs/libgeotiff) media-libs/libpng media-libs/jpeg xpm? (media-libs/xpm) sys-libs/zlib ming? (media-libs/ming) pdf? (media-libs/pdflib) >=media-libs/gd-2.0.12 net-www/apache php? (dev-php/php-cgi) ruby? (dev-lang/ruby dev-lang/swig) python? (dev-lang/python) perl? (dev-perl/DBI) java? (=virtual/jdk-1.4* dev-java/java-config) mono? (dev-lang/mono)" S="${WORKDIR}/${P}" MY_PHPV="" cd_script() { einfo "$2 the mapserver $1-mapscript" cd ${S}/mapscript/$1 } pkg_setup() { if (use php); then MY_PHPV="$(portageq match / dev-php/php-cgi | cut -d'-' -f4)" MY_PHPR="$(portageq match / dev-php/php-cgi | cut -d'-' -f5)" [ -n "${MY_PHPR}" ] && MY_PHPFV="$(echo ${MY_PHPV}-${MY_PHPR})" || MY_PHPFV="${MY_PHPV}" MY_PHPDIR="/${BUILD_PREFIX}/php-cgi-${MY_PHPFV}/work/php-${MY_PHPV}/" einfo "using PHP v-${MY_PHPFV}" if [ -z "$(ls /var/tmp/portage/ | grep php-cgi-${MY_PHPFV})" ] ; then eerror "Error: you need to emerge php-cgi using mapscript support" eerror "and the FEATURES variable must contain \"noclean\"." die "read the message above." else if [ -z "$(find ${MY_PHPDIR}/regex/ -name *.o)" ] ; then ewarn "Warning : no regex was found." fi fi fi } src_compile() { local tmp, step step="Building" cd ${S} my_conf="--with-freetype" if (use gdal && use proj); then my_conf="--with-ogr ${my_conf}"; for i in ${MY_GPUSE}; do my_conf="${my_conf} --with-${i}" done fi if (use proj); then for i in ${MY_ProjUSE}; do my_conf="${my_conf} --with-${i}" done fi if (use php); then my_conf="${my_conf} --with-php-regex-dir=${MY_PHPDIR}/regex --with-php=${MY_PHPDIR}" fi if (use perl || use python || use ruby || use tcl || use php) ; then my_conf="${my_conf} --with-mapscript\ $(use_with perl) $(use_with python) \ $(use_with ruby) $(use_with tcl)"; fi cd ${S} econf \ $(use_with gdal)\ $(use_with proj)\ $(use_with postgis)\ $(use_with tiff)\ $(use_with pdf)\ $(use_with ming)\ $(use_with java)\ ${my_conf}\ || die "econf failed" make || die "make failed" if use perl; then local MY_D cd_script perl ${step} MY_D="$(echo ${D}/usr | sed s/"\/"/'\\\/'/g)" cat Makefile.PL | \ sed s/"WriteMakefile("/"WriteMakefile(\n\ 'PREFIX' => '${MY_D}',\n\ 'PERLPREFIX' =\> '${MY_D}',\n\ 'SITEPREFIX' =\> '${MY_D}',\n\ 'VENDORPREFIX' =\> '${MY_D}',"/ > Makefile.TPL perl Makefile.TPL emake fi if use python; then cd_script python ${step} cp modern/* . python setup.py build fi if use ruby; then cd_script ruby ${step} ruby -I${D} extconf.rb cp ../mapscript.i . local my_gdalinc my_gdalinc="$(gdal-config --cflags | sed s/"\/"/"\\\\\/"/g)" tmp="$(mktemp -p ${S})" cat Makefile | \ sed s/"-I."/"-I\/usr\/include ${my_gdalinc} -I. "/ >\ $tmp mv $tmp Makefile emake fi if use tcl; then cd_script tcl ${step} tmp="$(mktemp -p ${S})" cat configure | \ sed s/"perlvars"/"mapscriptvars"/ > \ $tmp mv $tmp configure chmod 777 configure econf --with-tcl=/usr local MY_D MY_D="$(echo ${D}| sed s/"\/"/"\\\\\/"/g)" cat Makefile |\ sed -e s/" -DTCL_WIDE_INT_TYPE=long long"/""/ \ -e s/"TCL_EXEC_PREFIX = \/usr"/"TCL_EXEC_PREFIX = ${MY_D}\/usr"/ >\ $tmp mv $tmp Makefile emake fi if use java; then cd_script java ${step} emake fi if use mono; then cd_script csharp ${step} tmp="$(mktemp -p ${S})" cat Makefile | \ sed s/"\/usr\/local\/bin\/swig"/"\/usr\/bin\/swig"/ >\ $tmp mv $tmp Makefile make fi } mapscript_install_examples() { local arg arg="$1" einfo "$arg-mapscript examples could be found" einfo "/usr/share/doc/${PF}/mapscript/examples/$arg" insinto /usr/share/doc/${PF}/mapscript/examples/$arg/ doins examples/* } src_install() { local step step="Installing" extra_dir="fonts tests tests/vera symbols" dodir /usr /usr/bin into /usr mapscripts="perl ruby tcl" for i in ${mapscripts}; do if use $i; then cd_script $i ${step} einstall mapscript_install_examples $i fi done if use python; then cd_script python ${step} python setup.py install --prefix="${D}/usr/" mapscript_install_examples python fi if (use java); then cd_script java ${step} insinto $(find /opt/ -name *jdk*)/lib doins mapscript.jar dolib.so libmapscript.so mapscript_install_examples java fi if use mono; then cd_script csharp mapscript_install_examples csharp ${step} insinto /usr/share/doc/${PF}/mapscript/examples/csharp doins mapscript_csharp.dll libmapscript.so fi cd ${S} into /usr if use pdf; then dobin ${S}/shp2pdf fi dobin ${S}/sortshp ${S}/shp2img ${S}/shptree ${S}/shptreevis ${S}/shptreetst ${S}/legend ${S}/scalebar ${S}/tile4ms dodoc INSTALL README HISTORY.TXT if (use php); then insinto /usr/lib/php/extensions/no-debug-non-zts-20020429/ cp mapscript/php3/php_mapscript.so \ ${D}/usr/lib/php/extensions/no-debug-non-zts-20020429/ fi for i in ${extra_dir}; do insinto /usr/share/doc/${PF}/$i doins ${S}/$i/* done exeinto /var/www/localhost/cgi-bin/ doexe ${S}/mapserv }