mapserver/mapserver.spec

419 lines
13 KiB
RPMSpec
Raw Normal View History

#
# spec file for package mapserver 6.4 series
# this build respect python,java,perl,php package naming convention under
# openSUSE.
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 Ioda-Net Sàrl, Charmoille, Switzerland. Bruno Friedmann (tigerfoot)
# Copyright (c) 2013 Angelos Tzotsos (kalxas)
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the mapserver package itself (unless the
# license for the mapserver package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: mapserver
%define fileversion 6.4.0
%define libname libmapserver1
Version: 6.4.0
Release: 1
License: MIT
#see http://www.mapserver.org/copyright.html#license
Group: Productivity/Networking/Web/Servers
Source: %{name}-%{fileversion}.tar.gz
Url: http://www.mapserver.org
#wget https://github.com/mapserver/mapserver/pull/#PATCH.patch
# tbonfort fix lib in cmake_install
Patch0: 4791.patch
Summary: Environment for building spatially-enabled internet applications
#@TODO : we should normally only require client & libs for database
Requires: postgresql >= 9.1
Requires: mysql
Requires: FastCGI
Requires: apache2
Requires: librsvg
Requires: fribidi
Requires: %{libname} = %{version}-%{release}
%if 0%{?suse_version} != 1010
BuildRequires: xorg-x11-libXpm-devel
%endif
BuildRequires: rpm
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: chrpath
BuildRequires: autoconf
BuildRequires: cmake >= 2.4
BuildRequires: pam
BuildRequires: pam-devel
BuildRequires: postgresql-devel >= 9.1
BuildRequires: libexpat-devel
BuildRequires: mysql-devel
BuildRequires: giflib-devel
BuildRequires: libgeos-devel
BuildRequires: libproj-devel
BuildRequires: libgdal-devel >= 1.10
#BuildRequires: libjpeg8-devel I've normally use that one ?
BuildRequires: openjpeg2-devel
BuildRequires: readline-devel
BuildRequires: freetype2-devel
BuildRequires: FastCGI-devel
BuildRequires: fribidi-devel
BuildRequires: cairo-devel
BuildRequires: gd-devel >= 2.0.16
BuildRequires: krb5-devel
BuildRequires: zlib-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: swig
BuildRequires: update-alternatives
BuildRequires: apache2-devel
BuildRequires: krb5-devel
BuildRequires: libgcj-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
%define _cgibindir /srv/www/cgi-bin
%description
Mapserver is an internet mapping program that converts GIS data to
map images in real time. With appropriate interface pages,
Mapserver can provide an interactive internet map based on
custom GIS data.
%package -n %{libname}
Summary: Mapsserver library for mapserver or mapscript module
Group: Development/Libraries/C and C++
%description -n %{libname}
Mapserver library for mapserver or mapscript module. you need this lib to run mapserver
or any of the mapscript module (php, java, python, ruby)
# We don't require apache2_mod-php5 users could have php5 running
# with other modes (cgi, php-fpm etc)
%package -n php-mapscript
Summary: PHP/Mapscript map making extensions to PHP
Group: Development/Libraries/PHP
Requires: %{libname} = %{version}-%{release}
Requires: apache2
%if 0%{?sles_version} >= 11
BuildRequires: php53-devel
Requires: php53
Requires: php53-gd
%else
BuildRequires: php-devel
Requires: php
Requires: php-gd
%endif
Provides: php-mapserver = %{version}-%{release}
Obsoletes: php-mapserver < %{version}-%{release}
%description -n php-mapscript
The PHP/Mapscript extension provides full map customization capabilities within the PHP scripting language.
%package -n perl-mapscript
Summary: Perl/Mapscript map making extensions to Perl
Group: Development/Languages/Perl
BuildRequires: perl-base
BuildRequires: perl(ExtUtils::MakeMaker)
Requires: %{libname} = %{version}-%{release}
Requires: perl-base
Provides: mapserver-perl = %{version}-%{release}
Obsoletes: mapserver-perl < %{version}-%{release}
%description -n perl-mapscript
The Perl/Mapscript extension provides full map customization capabilities
within the Perl programming language.
%package -n python-mapscript
Summary: Python/Mapscript map making extensions to Python
Group: Development/Languages/Python
BuildRequires: python-devel
Requires: %{libname} = %{version}-%{release}
Requires: python-base
Provides: mapserver-python = %{version}-%{release}
Obsoletes: mapserver-python < %{version}-%{release}
%description -n python-mapscript
The Python/Mapscript extension provides full map customization capabilities
within the Python programming language.
%package -n libjavamapscript
Summary: Java/Mapscript map making extensions to Java
Group: Development/Languages/Java
BuildRequires: java-devel >= 1.6
BuildRequires: java >= 1.6
BuildRequires: swig
%if 0%{?sles_version} == 10
%ifarch i586
BuildRequires: java-1_5_0-ibm-alsa
%endif
%endif
Requires: %{libname} = %{version}-%{release}
Requires: java >= 1.6
Requires: swig
Provides: java-mapscript = %{version}-%{release}
Provides: mapserver-java = %{version}-%{release}
Obsoletes: mapserver-java < %{version}-%{release}
Obsoletes: java-mapscript < %{version}-%{release}
%description -n libjavamapscript
The Java/Mapscript extension provides full map customization capabilities
within the Java programming language.
%package -n ruby-mapscript
Summary: Ruby/Mapscript map making extensions to Ruby
Group: Development/Languages/Ruby
Requires: ruby
BuildRequires: ruby-devel
BuildRequires: ruby-macros
Requires: %{libname} = %{version}-%{release}
Provides: mapserver-ruby = %{version}-%{release}
Obsoletes: mapserver-ruby < %{version}-%{release}
%description -n ruby-mapscript
The Ruby/Mapscript extension provides full map customization capabilities
within the Ruby programming language.
%package devel
Summary: Mapserver development files
Group: Development/Libraries/Other
Requires: %{name} = %{version}-%{release}
%description devel
The Mapserver development package provides necessary files to build
against the C Mapserver library.
%prep
%setup -q -n %{name}-%{fileversion}
%patch0 -p1
%build -n %{name}-%{fileversion}
cd ..
mkdir build
cd build
#Pre export the PREFIX ( having it on the command line doesn't expand correctly for
#dynamic postgresql location
export CMAKE_PREFIX_PATH="%{_includedir}:%{_includedir}/fastcgi:%(pg_config --includedir):%(pg_config --includedir-server):%(pg_config --libdir)"
export CFLAGS=$RPM_OPT_FLAGS
export CXXFLAGS=$RPM_OPT_FLAGS
#export LDFLAGS="-Wl,-Bsymbolic-functions $LDFLAGS" \
# -D CMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-Bsymbolic-functions" \
# -D CMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-Bsymbolic-functions" \
# -D CMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-Bsymbolic-functions" \
#specify all options and play with true/false
#so we always know which option are included in our build.
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_INSTALL_LIBDIR=%{_libdir} \
-DCMAKE_SKIP_RPATH=ON \
-DCMAKE_C_FLAGS="%{optflags}" \
-DCMAKE_CXX_FLAGS="%{optflags}" \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DLIB_SUFFIX=%{_libdir} \
-DCMAKE_BUILD_TYPE="Release" \
-DWITH_CAIRO=TRUE \
-DWITH_CLIENT_WFS=TRUE \
-DWITH_CLIENT_WMS=TRUE \
-DWITH_CURL=TRUE \
-DWITH_FCGI=TRUE \
-DWITH_FRIBIDI=TRUE \
-DWITH_GD=TRUE \
-DWITH_GDAL=TRUE \
-DWITH_GEOS=TRUE \
-DWITH_GIF=TRUE \
-DWITH_ICONV=TRUE \
-DWITH_JAVA=TRUE \
-DWITH_KML=TRUE \
-DWITH_LIBXML2=TRUE \
-DWITH_OGR=TRUE \
-DWITH_MYSQL=TRUE \
-DWITH_PERL=TRUE \
-DCUSTOM_PERL_SITE_ARCH_DIR="%{perl_vendorarch}" \
-DWITH_PHP=TRUE \
-DWITH_POSTGIS=TRUE \
-DWITH_PROJ=TRUE \
-DWITH_PYTHON=TRUE \
-DWITH_RUBY=TRUE \
-DWITH_SOS=TRUE \
-DWITH_THREAD_SAFETY=TRUE \
-DWITH_WCS=TRUE \
-DWITH_WMS=TRUE \
-DWITH_WFS=TRUE \
-DWITH_XMLMAPFILE=TRUE \
-DWITH_POINT_Z_M=TRUE \
-DWITH_APACHE_MODULE=FALSE \
-DWITH_SVGCAIRO=FALSE \
-DWITH_MYSQL=FALSE \
-DWITH_CSHARP=FALSE \
-DWITH_ORACLESPATIAL=FALSE \
-DWITH_ORACLE_PLUGIN=FALSE \
-DWITH_MSSQL2008=FALSE \
-DWITH_SDE=FALSE \
-DWITH_SDE_PLUGIN=FALSE \
-DWITH_EXEMPI=FALSE \
../%{name}-%{fileversion}/
## WARNING !!! using %%{?_smp_mflags} will break build
## This is not anymore true for 6x versions, if it happen then it's a bug :-)
make %{?jobs:-j%{jobs}}
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{_sbindir}
mkdir -p %{buildroot}/%{_cgibindir}
mkdir -p %{buildroot}%{_libdir}/php5/extensions
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}%{python_sitearch}/
mkdir -p %{buildroot}/%{_includedir}/%{name}
#Comment this look a bit wired to be usefull sub-dir should also needed
# agg, etc
cp *.h %{buildroot}/%{_includedir}/%{name}/
# fix some exec bits essentially on examples to make rpmlint happy
# and avoid rpm adding require
find ./mapscript/ -type f -iname "*.p[ly]" -exec chmod -x {} \;
find ./mapscript/ -type f -iname "*.rb" -exec chmod -x {} \;
find ./mapscript/ -type f -iname "*.dist" -exec chmod -x {} \;
cd ../build
%makeinstall DESTDIR="%{buildroot}"
cd ../%{name}-%{fileversion}
#@TODO FIX upstream this ugly hack work in progress
%ifarch x86_64
mv -v %{buildroot}/usr/lib/*.so* %{buildroot}%{_libdir}/
%endif
#@TODO shouldn't we use ln in post ?
cp -a %{buildroot}%{_bindir}/mapserv %{buildroot}%{_cgibindir}/mapserv
cp -a %{buildroot}%{_bindir}/legend %{buildroot}%{_cgibindir}/legend
cp -a %{buildroot}%{_bindir}/scalebar %{buildroot}%{_cgibindir}/scalebar
# install php config file
mkdir -p %{buildroot}%{_sysconfdir}/php5/conf.d/
cat > %{buildroot}%{_sysconfdir}/php5/conf.d/mapscript.ini <<EOF
; Enable %{name} extension module
#For 6.4 this is still an upstream bug
#extension=php_mapscript-%%{version}.so
extension=php_mapscript.so
EOF
# Important remove any RPATH in .so
#find %%{buildroot}/ -iname "*.so*" -type f -exec chrpath --delete {} \;
# remove vera fonts, these are provided system wide
#@todo then we should patch the fonts file example
rm -rf %{buildroot}%{_docdir}/%{name}/tests/vera
rm -rf %{buildroot}%{_docdir}/%{name}-%{version}/tests/vera
%clean
rm -rf %{buildroot}
%check
# make test
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc README COMMITERS GD-COPYING HISTORY.TXT
%doc MIGRATION_GUIDE.txt
%doc symbols tests
%doc fonts
%{_bindir}/shp2img
%{_bindir}/shptree
%{_bindir}/sortshp
%{_bindir}/tile4ms
%{_bindir}/mapserv
%{_bindir}/legend
%{_bindir}/scalebar
%{_bindir}/msencrypt
%{_bindir}/shptreetst
%{_bindir}/shptreevis
%{_cgibindir}/mapserv
%{_cgibindir}/legend
%{_cgibindir}/scalebar
%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/libmapserver.so.*
%files -n php-mapscript
%defattr(-,root,root)
%doc mapscript/php/README
%doc mapscript/php/examples
%config(noreplace) %{_sysconfdir}/php5/conf.d/mapscript.ini
%{_libdir}/php5/extensions/php_mapscript.so
%post -n php-mapscript
# Clean up any previous wrong version
if [ -e %{_libdir}/php5/extensions/php_mapscript.so ]; then
rm -f %{_libdir}/php5/extensions/php_mapscript.so
fi
if [ -e %{_sysconfdir}/php5/conf.d/%{name}.ini ]; then
rm -f %{_sysconfdir}/php5/conf.d/%{name}.ini
fi
%files -n perl-mapscript
%defattr(-,root,root)
%doc mapscript/perl/examples
%dir %{perl_vendorarch}/auto/mapscript
%{perl_vendorarch}/auto/mapscript/*
%{perl_vendorarch}/mapscript.pm
%files -n python-mapscript
%defattr(-,root,root)
%doc mapscript/python/README
%doc mapscript/python/examples
%doc mapscript/python/tests
%{python_sitearch}/*
%files -n libjavamapscript
%defattr(-,root,root)
%doc mapscript/java/README
%doc mapscript/java/examples
%doc mapscript/java/tests
%{_libdir}/libjavamapscript.so
%files -n ruby-mapscript
%defattr(-,root,root)
%doc mapscript/ruby/README
%doc mapscript/ruby/examples
#@todo fix that by using a proper way ?
%ifarch x86_64
%{_libdir}/ruby/%{rb_ver}/x86_64-linux/mapscript.so
%else
%{_libdir}/ruby/%{rb_ver}/i586-linux/mapscript.so
%endif
%files devel
%defattr(-,root,root)
%dir %{_includedir}/mapserver
%{_includedir}/mapserver/*
%{_libdir}/libmapserver.so
%changelog