File mapserver.spec of Package mapserver705

#spec file for package mapserver
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2014 Ioda-Net Sàrl, Charmoille, Switzerland. Bruno Friedmann (tigerfoot)
# Copyright (c) 2015 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 pristine package itself (unless the
# license for the pristine 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/
#


#
%define libname libmapserver2
%define python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
%define _cgibindir /srv/www/cgi-bin

Name:           mapserver
Version:        7.0.5
Release:        0
Summary:        Environment for building spatially-enabled internet applications
License:        MIT
Group:          Productivity/Networking/Web/Servers
Url:            http://www.mapserver.org
Source:         http://download.osgeo.org/mapserver/%{name}-%{version}.tar.gz
BuildRequires:  FastCGI-devel
BuildRequires:  apache2-devel
BuildRequires:  autoconf
BuildRequires:  cairo-devel
BuildRequires:  chrpath
BuildRequires:  cmake >= 2.4
BuildRequires:  freetype2
BuildRequires:  freetype2-devel
BuildRequires:  fribidi-devel
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  gd-devel >= 2.0.16
BuildRequires:  giflib-devel
BuildRequires:  krb5-devel
BuildRequires:  libcurl-devel
BuildRequires:  libexpat-devel
BuildRequires:  gdal-devel >= 1.10
BuildRequires:  libgeos-devel
BuildRequires:  libhdf4
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libproj-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxml2-devel
BuildRequires:  libxslt-devel
BuildRequires:  openjpeg2-devel
BuildRequires:  pam
BuildRequires:  pam-devel
BuildRequires:  postgresql-devel >= 9.1
BuildRequires:  proj
BuildRequires:  readline-devel
BuildRequires:  rpm
BuildRequires:  update-alternatives
BuildRequires:  xorg-x11-libXpm-devel
BuildRequires:  zlib-devel
BuildRequires:  harfbuzz-devel
Requires:       %{libname} = %{version}-%{release}
Requires:       FastCGI
Requires:       apache2
Requires:       fribidi
Requires:       librsvg
Requires:       mysql
Requires:       postgresql >= 9.1
Requires:       proj
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%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)

%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

%build

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="%{optflags} -fno-strict-aliasing"
export CXXFLAGS="%{optflags} -fno-strict-aliasing"

#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_SKIP_RPATH=ON \
        -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
        -DINSTALL_LIB_DIR=%{_libdir} \
        -DCMAKE_C_FLAGS_RELEASE="%{optflags} -fno-strict-aliasing" \
        -DCMAKE_CXX_FLAGS_RELEASE="%{optflags} -fno-strict-aliasing" \
        -DCMAKE_VERBOSE_MAKEFILE=ON \
        -DCMAKE_BUILD_TYPE="Release" \
        -DCMAKE_SKIP_INSTALL_RPATH=ON \
        -DCMAKE_SKIP_RPATH=ON \
        -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_KML=TRUE \
        -DWITH_LIBXML2=TRUE \
        -DWITH_OGR=TRUE \
        -DWITH_MYSQL=FALSE\
        -DCUSTOM_PERL_SITE_ARCH_DIR="%{perl_vendorarch}" \
        -DWITH_POSTGIS=TRUE \
        -DWITH_PROJ=TRUE \
        -DWITH_PYTHON=FALSE\
        -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 \
        ..

make %{?jobs:-j%{jobs}}

%check
# make test

%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 useful sub-dir should also needed
# agg, etc 
cp *.h %{buildroot}/%{_includedir}/%{name}/

cd build
%makeinstall DESTDIR="%{buildroot}"
cd ..

# Install our links
#@ todo : check
# Having them as link is good for bytes, but httpd_daemon should allow
# reading those symlinks which is not the default
ln -s %{_bindir}/mapserv %{buildroot}%{_cgibindir}/mapserv
ln -s %{_bindir}/legend %{buildroot}%{_cgibindir}/legend
ln -s %{_bindir}/scalebar %{buildroot}%{_cgibindir}/scalebar

# 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}

%post -n %{libname} -p /sbin/ldconfig

%postun -n %{libname} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README 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 devel
%defattr(-,root,root)
%dir %{_includedir}/mapserver
%{_includedir}/mapserver/*
%{_libdir}/libmapserver.so
/usr/share/mapserver

%changelog
openSUSE Build Service is sponsored by