File qgis-ltr.spec of Package qgis-ltr

#
# spec file for package qgis
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 packagename qgis

Name:           qgis-ltr
Version:        3.4.12
Release:        0
Summary:        QGIS is a Geographic Information System (GIS)
License:        GPL-2.0
Group:          Productivity/Graphics/Visualization/Other
Url:            http://www.qgis.org/
Source:         %{name}-%{version}.tar.bz2
Source1:        %{name}.desktop
Source2:        %{name}.rpmlintrc
Source3:        qgis_sample_data.zip
BuildRequires:  bison
BuildRequires:  cmake >= 2.4
BuildRequires:  fdupes
BuildRequires:  FastCGI-devel
BuildRequires:  flex
BuildRequires:  gdal
BuildRequires:  gdal-devel >= 2
#BuildRequires:  grass
#BuildRequires:  grass-devel
BuildRequires:  gsl >= 1.6
BuildRequires:  gsl-devel
BuildRequires:  libexpat-devel
#%if 0%{?suse_version} >= 1215
#BuildRequires:  libhdf5-100
#%endif
#BuildRequires:  libhdf5-103
BuildRequires:  libspatialindex4-devel
BuildRequires:	libspatialite-devel
BuildRequires:  libspatialindex4
BuildRequires:  libqscintilla-devel
#BuildRequires:  libwx_gtk2u_qa-2_8-0-stl
BuildRequires:  libgeos-devel >= 2
BuildRequires:  libproj-devel
BuildRequires:  libqca2-devel
BuildRequires:  libqt4-devel >= 4.3
BuildRequires:  libqt4-qt3support >= 4.3
BuildRequires:  libQtWebKit-devel
BuildRequires:  python-dateutil
BuildRequires:  python-devel
BuildRequires:  python-qt4-devel
BuildRequires:  python-sip-devel
BuildRequires:  python-wxWidgets
BuildRequires:  postgresql-devel >= 8
BuildRequires:  qwt-devel >= 5
BuildRequires:  sqlite-devel >= 3.5
BuildRequires:  txt2tags
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-libXmu
BuildRequires:  -post-build-checks
Recommends:     gpsbabel
Suggests:       %{packagename}-sample-data
Obsoletes:      qgis qgis-master
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides: 		%{name} = %{version}
Requires: 		%{name}-providers = %{version}
Requires:       %{name}-core = %{version}
Requires:       %{name}-gui = %{version}
Requires:       %{name}-analysis = %{version}
#Requires:  	 %{name}-grass = %{version}
#Requires: 		 %{name}-networkanalysis = %{version}
#Requires:       %{name}-python = %{version}

%package analysis
Summary:        Analysis Libraries for QGIS
Group:          Development/Libraries/C and C++
Provides: 		%{name}-analysis = %{version}   
Requires:       %{name}-core = %{version}

%package core
Summary:        Core Libraries for QGIS
Group:          Development/Libraries/C and C++
Provides: 		%{name}-core = %{version}
 
%package devel
Summary:        Development Libraries for QGIS
Group:          Development/Libraries/C and C++
Provides: 		%{name}-devel = %{version}
Requires:       %{name}-core = %{version}
Requires:       %{name}-gui = %{version}
Requires:       %{name}-plugin-grass = %{version}
Requires:       %{name}-analysis = %{version}
Requires:       %{name}-networkanalysis = %{version}
Requires:       %{name}-server = %{version}
Requires:       %{name}-python = %{version}
Requires: 		%{name}-providers = %{version}

%package plugin-grass
Summary:        GUI Libraries for QGIS
Group:          Development/Libraries/C and C++
Provides: 	 	%{name}-plugin-grass = %{version}
Requires:       %{name}-core = %{version}

%package gui
Summary:        GUI Libraries for QGIS
Group:          Development/Libraries/C and C++
Provides:    	%{name}-gui = %{version}
Requires:       %{name}-core = %{version}

%package networkanalysis
Summary:        Networkanalysis Libraries for QGIS
Group:          Development/Libraries/C and C++
Provides: 	    %{name}-networkanalysis = %{version}
Requires:       %{name}-core = %{version}

%package providers
Summary:        Provider plugins for QGIS
Group:          Productivity/Graphics/Visualization/Other
Provides: 	    %{name}-providers = %{version}
Requires:       %{name}-core = %{version}
Requires:       %{name}-gui = %{version}

%package python 
Summary:        Python integration and plug-ins for QGIS
Group:          Productivity/Graphics/Visualization/Other
Provides: 	    %{name}-python = %{version}
Requires:       %{name}-core = %{version}
Requires:       %{name}-gui = %{version}
Requires:       %{name}-plugin-grass = %{version}
Requires: 	    %{name}-server = %{version}
Requires:       %{name}-networkanalysis = %{version}
#Requires:       python-matplotlib
Requires:       python-qscintilla-qt4
Requires:       python-qscintilla-qt4-sip
Requires:       python-psycopg2
Requires:       python-gdal
Requires:       python-qt4
Requires:       python-qt4-utils
#Requires:       python-qt4-devel
Requires:       python-sip
Requires:       python-xml
Requires:       python-wxWidgets

%package server 
Summary:        FCGI-based OGC web map server
Group:          Productivity/Graphics/Visualization/Other
Provides: 		%{name}-server = %{version}
Requires:       apache2-mod_fcgid
Requires:       %{name}-analysis = %{version}
Requires:       %{name}-core = %{version}
Requires:       %{name}-gui = %{version}
Requires: 		%{name}-providers = %{version}

%package sample-data
Summary:        QGIS sample data
Group:          Productivity/Graphics/Visualization/Other
Requires:       %{name} = %{version}

%define builddir build
%define sampledir sample-data
#%define _unpackaged_files_terminate_build 0

%description
QGIS is a user friendly Open Source Geographic Information System (GIS) 
that runs on Linux, Unix, Mac OSX, and Windows. QGIS supports vector, 
raster, OWS and database formats. QGIS is licensed under the GNU
General Public License. QGIS lets you browse and create map data on your
computer. It supports many common spatial data formats (e.g. ESRI ShapeFile,
geotiff). QGIS supports plugins to do things like display tracks from your GPS. 
This is the Long Time Release version of QGIS, maintained for at least 1 year.

%description analysis
This package contains Analysis Libraries for QGIS.

%description core
This package contains Core Libraries for QGIS.

%description devel
This package contains Development Libraries for QGIS 
including the C header files.

%description plugin-grass
This package contains GRASS Libraries for QGIS and GRASS support 
for QGIS required to interface with GRASS system.

%description gui
This package contains GUI Libraries for QGIS.

%description networkanalysis
This package contains Networkanalysis Libraries for QGIS.

%description providers
This package contains the provider plugins for QGIS and a collection 
of data providers to QGIS - architecture-independent files

%description python
This package contains Python integration and plug-ins for QGIS.

%description server
This FastCGI OGC web map server implements OGC WMS 1.3.0 and 1.1.1. 
The services are prepared as regular projects in QGIS. They're rendered using
the QGIS libraries. The server also supports SLD (Styled Layer Descriptor)
for styling. This package contains the shared server library.

%description sample-data
This package contains sample data with free raster, vector, gps files 
and a GRASS location from Alaska area. 

%prep
%setup -q -n %{name}-%{version}

%build
export CFLAGS="%{optflags}"
export QTDIR=/usr
export PATH=$PATH:$QTDIR/bin

%ifarch x86_64
%define lib lib64
%else
%define lib lib
%endif

cd ..
mkdir temp
cd temp

cmake -Wno-dev %{intsq} \
      -D CMAKE_INSTALL_PREFIX=%{_prefix} \
      -D CMAKE_BUILD_TYPE="Release" \
      -D QGIS_LIB_SUBDIR=%{lib} \
      -D WITH_BINDINGS=TRUE \
      -D WITH_QSPATIALITE=TRUE \
      -D WITH_PYSPATIALITE=TRUE \
      -D WITH_SERVER=TRUE \
      -D WITH_SERVER_PLUGINS=TRUE \
      -D MAPSERVER_SKIP_ECW=TRUE \
      -D POSTGRES_LIBRARY=%{_libdir}/libpq.so \
      -D QGIS_CGIBIN_SUBDIR=/srv/www/cgi-bin \
      -D QGIS_PLUGIN_SUBDIR=%{lib}/qgis \
      -D QGIS_MANUAL_SUBDIR=share/man \
      -D QWT_INCLUDE_DIR=/usr/include/qwt5 \
      -D CMAKE_SKIP_RPATH=OFF \
	../%{name}-%{version}/

#echo "for 'make' run first:"
export QTDIR=%{_prefix}
#echo "export PATH=$PATH:$QTDIR/bin"
export PATH=$PATH:$QTDIR/bin
#use multi-core & let that optionnal if jobs is specified as meta
make %{?jobs:-j%{jobs}}

%install
cd ../temp
%makeinstall

mkdir -p %{buildroot}%{_datadir}/applications
cp %{SOURCE1} %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/pixmaps
ln -s ../qgis/images/icons/qgis-icon.png %{buildroot}/%{_datadir}/pixmaps/qgis.png

# Do not update .desktop files
%suse_update_desktop_file -n %{name}

# Install sample data
pushd %{buildroot}%{_datadir}/qgis
unzip %{SOURCE3}
mv qgis_sample_data %{sampledir}
find %{sampledir} -depth \( -name .tmp -o -name .bash\* -o -name \*~ \) -exec rm -r {} \;
popd

%fdupes -s %{buildroot}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%{_bindir}/*
%{_libdir}/qt4/plugins/sqldrivers/libqsqlspatialite.so
%{_mandir}/man1/*
%{_datadir}/qgis/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/qgis.png
%{_prefix}/lib/qgis/qgis_help
%{_prefix}/lib/qgis/crssync
%exclude %{_prefix}/lib/debug/
%exclude %{_datadir}/qgis/python
%exclude %{_libdir}/libqgisgrass.so
%exclude %{_libdir}/libqgisgrass.so.*
%exclude %{_libdir}/qgis/libgrass*
%exclude %{_libdir}/libqgis_core.so*
%exclude %{_libdir}/libqgis_analysis.so*
%exclude %{_libdir}/libqgis_app.so*

%files analysis
%defattr(-,root,root)
%{_libdir}/libqgis_analysis.so*

%files core
%defattr(-,root,root)
%{_libdir}/libqgis_core.so*
%{_libdir}/libqgis_app.so*

%files devel
%defattr(-,root,root)
%{_prefix}/include/qgis/

%files plugin-grass
%defattr(644,root,root)
%{_libdir}/qgis/libgrass*
%{_libdir}/libqgisgrass7.so
%{_libdir}/libqgisgrass7.so.*
%defattr(755,root,root)
%{_prefix}/lib/qgis/grass/bin/qgis.g.browser7
%{_prefix}/lib/qgis/grass/modules/qgis.*

%files gui
%defattr(-,root,root)
%{_libdir}/libqgis_gui.so*

%files networkanalysis
%defattr(-,root,root)
%{_libdir}/libqgis_networkanalysis.so*

%files providers
%defattr(644,root,root)
%{_libdir}/qgis/libbasicauthmethod.so
%{_libdir}/qgis/libcoordinatecaptureplugin.so
%{_libdir}/qgis/libdelimitedtextprovider.so
%{_libdir}/qgis/libdxf2shpconverterplugin.so
%{_libdir}/qgis/libevis.so
%{_libdir}/qgis/libgdalprovider.so
%{_libdir}/qgis/libgeorefplugin.so
%{_libdir}/qgis/libgeometrycheckerplugin.so
%{_libdir}/qgis/libgeometrysnapperplugin.so
%{_libdir}/qgis/libgpsimporterplugin.so
%{_libdir}/qgis/libgpxprovider.so
%{_libdir}/qgis/libheatmapplugin.so
%{_libdir}/qgis/libidentcertauthmethod.so
%{_libdir}/qgis/libinterpolationplugin.so
%{_libdir}/qgis/libmemoryprovider.so
%{_libdir}/qgis/libmssqlprovider.so
%{_libdir}/qgis/libofflineeditingplugin.so
%{_libdir}/qgis/libogrprovider.so
%{_libdir}/qgis/liboracleplugin.so
%{_libdir}/qgis/libowsprovider.so
%{_libdir}/qgis/libpkcs12authmethod.so
%{_libdir}/qgis/libpkipathsauthmethod.so
%{_libdir}/qgis/libpostgresprovider.so
%{_libdir}/qgis/librasterterrainplugin.so
%{_libdir}/qgis/libroadgraphplugin.so
%{_libdir}/qgis/libspatialiteprovider.so
%{_libdir}/qgis/libspatialqueryplugin.so
%{_libdir}/qgis/libtopolplugin.so
%{_libdir}/qgis/libvirtuallayerprovider.so
%{_libdir}/qgis/libwcsprovider.so
%{_libdir}/qgis/libwfsprovider.so
%{_libdir}/qgis/libwmsprovider.so
%{_libdir}/qgis/libzonalstatisticsplugin.so
%{_libdir}/qt4/plugins/sqldrivers/libqsqlspatialite.so
%{_datadir}/qgis/resources
%{_datadir}/qgis/svg

%files python
%defattr(-,root,root)
%{_libdir}/libqgispython.so*
%{_datadir}/qgis/python

#%{python_sitearch}/qgis/
#%{python_sitearch}/PyQt4/uic/widget-plugins/

%files server
%defattr(-,root,root)
%doc src/server/admin.sld src/server/wms_metadata.xml
%{_libdir}/libqgis_server.so*
/srv/www/cgi-bin/admin.sld
/srv/www/cgi-bin/qgis_mapserv.fcgi
/srv/www/cgi-bin/schemaExtension.xsd
/srv/www/cgi-bin/wms_metadata.xml
#%config(noreplace) %{_sysconfdir}/httpd/conf.d/qgis-server.conf
#%{_libexecdir}/qgis/

%files sample-data
%defattr(644,root,root)
%{_datadir}/qgis/%{sampledir}

%post analysis -p /sbin/ldconfig
%postun analysis -p /sbin/ldconfig

%post core -p /sbin/ldconfig
%postun core -p /sbin/ldconfig

%post gui -p /sbin/ldconfig
%postun gui -p /sbin/ldconfig

%post plugin-grass -p /sbin/ldconfig
%postun plugin-grass -p /sbin/ldconfig

%post networkanalysis -p /sbin/ldconfig
%postun networkanalysis -p /sbin/ldconfig

%post providers -p /sbin/ldconfig
%postun providers -p /sbin/ldconfig

%post python -p /sbin/ldconfig
%postun python -p /sbin/ldconfig

%post server -p /sbin/ldconfig
%postun server -p /sbin/ldconfig

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by