# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # Bug : 129701 inherit eutils autotools depend.php 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" #I must check for mygis use flag availability IUSE="pdf proj geos tiff gdal xpm threads postgis ming php python perl ruby tcl java mono" MY_ProjUSE="wmsserver wmsclient" MY_GPUSE="wfs wcs wmsclient wfsclient" DEPEND="media-libs/libpng media-libs/jpeg >=media-libs/gd-2.0.12 media-libs/freetype sys-libs/zlib net-www/apache geos? ( sci-libs/geos ) proj? ( sci-libs/proj net-misc/curl ) gdal? ( sci-libs/gdal ) postgis? ( dev-db/postgis ) tiff? ( media-libs/tiff sci-libs/libgeotiff ) xpm? ( media-libs/xpm ) ming? ( media-libs/ming ) pdf? ( media-libs/pdflib ) php? ( virtual/php ) 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 dev-lang/swig ) tcl? ( dev-lang/tcl dev-lang/swig )" cd_script() { einfo "$2 the mapserver $1-mapscript" cd "${S}"/mapscript/$1 || die "Unable to go into $1 mapscript dir" } pkg_setup(){ # check if cgi or cli was installed has_php if [ -e "${PHPCLI}" ]; then MY_PHPC="php" else MY_PHPC="php-cgi" fi } src_unpack() { unpack ${A} if (use php); then MY_PHPS="$(eselect ${MY_PHPC} list | grep php | wc -l)" cd "${S}" if [ ${MY_PHPS} -eq 2 ]; then mkdir ./mapscript/php4 cp -r ./mapscript/php3 ./mapscript/php5 ||\ die "Unable to copy php mapscript directory" epatch "${FILESDIR}"/mapserver-4.6.1_phps.patch elif [ ${MY_PHPS} -eq 1 ]; then if [ ${PHP_VERSION} -eq 4 ]; then epatch "${FILESDIR}"/mapserver-4.6.1_php4pb.patch fi fi fi } src_compile() { local step step="Building" cd "${S}" if [ ${MY_PHPS} -eq 2 ]; then AT_GNUCONF_UPDATE="no" eautoreconf fi my_conf="--with-freetype" if use geos; then my_conf="${my_conf} --with-geos=$(which geos-config)" fi 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 ewarn "You use ${MY_PHPS} version of php" if [ ${MY_PHPS} -eq 2 ] ; then my_conf="${my_conf} --with-php4=/usr/lib/php4/ \ --with-php5=/usr/lib/php5/" else my_conf="${my_conf} --with-php=/usr/lib/php${PHP_VERSION}/include/php" fi fi if (use perl || use python || use ruby || use tcl || use php) ; then my_conf="${my_conf} \ --with-mapscript"; fi cd "${S}" econf $(use_with gdal)\ $(use_with perl)\ $(use_with python)\ $(use_with ruby)\ $(use_with tcl)\ $(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 php && use proj); then if [ ${MY_PHPS} -eq 2 ]; then cd_script php5 ${step} emake php_proj.so || die "Unable to build php5 proj" fi cd_script php3 ${step} emake php_proj.so || die "Unable to build php proj" if [ ${MY_PHPS} -eq 2 ]; then cp *.so ../php4/ || die "Unable to copy php4 mapscript object files" fi fi if use perl; then cd_script perl ${step} perl Makefile.PL || die "Unable to build perl mapscript" emake || die "Unable to build perl mapscript" fi if use python; then cd_script python ${step} cp modern/* . || die "Unable to find necessairies files for python" python setup.py build || die "Unable to build python mapscript" fi if use ruby; then cd_script ruby ${step} ruby -I${D} extconf.rb || die "Unable to configure ruby mapscript" cp ../mapscript.i . || die "Unable to find mapscript.i" emake || die "Unable to build ruby mapscript" fi if use tcl; then cd_script tcl ${step} sed "s:perlvars:mapscriptvars:" -i configure econf --with-tcl=/usr || die "Unable to configure tcl mapscript" sed -e "s:-DTCL_WIDE_INT_TYPE=long long:-DTCL_WIDE_INT_TYPE=long\\\ long:g" -i Makefile || \ die "Unable to modify Makefile" emake || die "Unable to build tcl mapscript" fi if use java; then cd_script java ${step} emake || die "Unable to build java mapscript" fi if use mono; then cd_script csharp ${step} sed "s:/usr/local/bin/swig:/usr/bin/swig:" -i Makefile || \ die "Unable to modify Makefile" emake || die "Unable to build mono mapscript" fi } mapscript_install_examples() { einfo "$arg-mapscript examples could be found in the following directory" einfo "/usr/share/doc/${PF}/mapscript/examples/$1" insinto /usr/share/doc/${PF}/mapscript/examples/$1/ doins examples/* || die "Unable to install specified sample data" } src_install() { local step step="Installing" extra_dir="fonts tests tests/vera symbols" dodir /usr /usr/bin into /usr if use php; then if [ 2 -eq "${MY_PHPS}" ] ; then for i in 4 5; do cd_script php$i ${step} destDir="$(/usr/lib/php$i/bin/php-config --extension-dir)" dodir ${destDir} cp *.so ${D}/${destDir} || \ die "Unable to setup mapscript support for php" done else cd_script php3 ${step} destDir="$(php-config --extension-dir)" dodir ${destDir} cp *.so ${D}/${destDir} || \ die "Unable to setup mapscript support for php" fi mapscript_install_examples php fi mapscripts="perl ruby" for i in ${mapscripts}; do if use $i; then cd_script $i ${step} make DESTDIR="${D}" install || \ die "Unable to setup mapscript support for $i." mapscript_install_examples $i fi done if use tcl; then cd_script tcl ${step} sed "s:\$(TCL_EXEC_PREFIX):\$(DESTDIR)\$(TCL_EXEC_PREFIX):g" -i Makefile make DESTDIR="${D}" install || \ die "Unable to setup mapscript support for tcl." mapscript_install_examples tcl fi if use python; then cd_script python ${step} python setup.py install --prefix="${D}/usr/" || \ die "Unable to setup mapscript support for python" mapscript_install_examples python fi if (use java); then cd_script java ${step} insinto $(find /opt/ -name *jdk*)/lib doins mapscript.jar || \ die "Unable to setup mapscript support for this language" dolib.so libmapscript.so || \ die "Unable to setup mapscript support for java" mapscript_install_examples java fi if use mono; then cd_script csharp ${step} mapscript_install_examples csharp ${step} insinto /usr/share/doc/${PF}/mapscript/examples/csharp doins mapscript_csharp.dll libmapscript.so || \ die "Unable to setup mapscript support for mono" fi cd "${S}" into /usr if use pdf; then dobin "${S}"/shp2pdf || die "Unable to setup shp2pdf" fi dobin "${S}"/sortshp "${S}"/shp2img "${S}"/shptree "${S}"/shptreevis \ "${S}"/shptreetst "${S}"/legend "${S}"/scalebar "${S}"/tile4ms || \ die "Unable to setup mapserver tools" dodoc INSTALL README HISTORY.TXT || \ die "Unable to setup documentation" for i in ${extra_dir}; do insinto /usr/share/doc/${PF}/$i doins "${S}"/$i/* || die "Unable to add extra_dir to document tree" done # This must not be done as the following exeinto /var/www/localhost/cgi-bin/ doexe "${S}"/mapserv || die "Unable to install mapserv cgi program" }