File saga-gis.spec of Package saga-gis

#
# spec file for package saga-gis
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#

Summary:        SAGA GIS - System for Automated Geoscientific Analyses
License:        GPL-2.0-or-later AND LGPL-2.1-or-later
Group:          Applications/GIS
Name:           saga-gis
Version:        9.7.2
Release:        0
URL:            https://saga-gis.sourceforge.io/en/index.html
Source:         https://downloads.sourceforge.net/project/saga-gis/SAGA%20-%209/SAGA%20-%20%{version}/saga-%{version}.tar.gz
# PATCH-FIX-UPSTREAM proper python 3 detection
Patch1:         fix-python-detection.patch
BuildRequires:  appstream-glib-devel
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  fftw3-devel
BuildRequires:  gcc-c++
BuildRequires:  git
BuildRequires:  hdf5-devel
BuildRequires:  libcurl-devel
BuildRequires:  libgdal-devel >= 1.8.0
BuildRequires:  libgomp1
BuildRequires:  libharu-devel
BuildRequires:  libjasper-devel
BuildRequires:  libsvm-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  opencv-devel
BuildRequires:  PDAL-devel
BuildRequires:  postgresql-devel
BuildRequires:  postgresql-server-devel
BuildRequires:  proj-devel
BuildRequires:  %{pythons}
BuildRequires:  %{python_module devel}
BuildRequires:  qhull-devel
BuildRequires:  swig
BuildRequires:  unixODBC-devel
BuildRequires:  vigra-devel
# SAGA needs the no-STL version
BuildRequires:  wxWidgets-3_2-nostl-devel

%description
SAGA (System for Automated Geoscientific Analyses) provides (geo-)scientists
an effective but easy learnable and user friendly platform for the implementation
of geoscientific methods using SAGA's API. SAGA is written in C++ programming
language and follows an object oriented approach.

%package devel
Summary:        Development files for SAGA
Group:          Development/Libraries
Requires:       %{name} = %{version}

%description devel
SAGA (System for Automated Geoscientific Analyses) provides (geo-)scientists
an effective but easy learnable and user friendly platform for the implementation
of geoscientific methods using SAGA's API. SAGA is written in C++ programming
language and follows an object oriented approach.

This package includes the development files for SAGA GIS.

%package -n python3-%{name}
Summary:        Python bindings for SAGA
Group:          Development/Libraries
Requires:       %{name} = %{version}

%description -n python3-%{name}
SAGA (System for Automated Geoscientific Analyses) provides (geo-)scientists
an effective but easy learnable and user friendly platform for the implementation
of geoscientific methods using SAGA's API. SAGA is written in C++ programming
language and follows an object oriented approach.

This package includes the Python bindings for SAGA GIS.

%prep
%setup -q -n saga-%{version}/%{name}
%patch -p0 -P 1

#fix line endings: SAGA used mixed dos and unix endings
dos2unix src/accessories/toolchains/*.xml
dos2unix src/accessories/python/*.py
dos2unix src/accessories/python/data/*.py
dos2unix src/accessories/python/tools/*.py

%build
%cmake -DWITH_GUI=ON \
    -DWITH_TOOLS=ON \
    -DWITH_DPI_AWARENESS=ON \
    -DWITH_CLIPPER_ONE=OFF \
    -DWITH_LIFETIME_TRACKER=ON \
    -DWITH_PYTHON=ON \
    -DWITH_DEV_TOOLS=OFF \
    -DWITH_EXCERCISES=OFF \
    -DWITH_TOOLS_PDAL=ON \
    -DWITH_TOOLS_GDAL=ON \
    -DWITH_TOOLS_OPENCV=ON \
    -DWITH_TOOLS_VIGRA=ON \
    -DWITH_SYSTEM_SVM=ON \
    -DWITH_TOOLS_POSTGRES=ON \
    -DWITH_TOOLS_HPDF=ON \
    -DWITH_TOOLS_PROJ=ON \
    -DWITH_FIRE_SPREADING=ON \
    -DWITH_MRMR=ON

%cmake_build

%install

%cmake_install
desktop-file-validate %{buildroot}/%{_datadir}/applications/org.saga_gis.saga_gui.desktop
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/org.saga_gis.saga_gui.appdata.xml

# Remove 8x8, 72x72 and 80x80 icons
rm -rf %{buildroot}%{_datadir}/icons/hicolor/{8x8,72x72,80x80}/
rm -rf %{buildroot}%{_datadir}/pixmaps

%python3_fix_shebang
%fdupes %{buildroot}

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

%files
%defattr(- ,root, root, -)
%doc readme.md
%license src/*gpl.txt

%dir %{_datadir}/saga
%{_datadir}/saga/*
%{_datadir}/icons/hicolor/*/apps/saga.png
%{_datadir}/applications/org.saga_gis.saga_gui.desktop
%{_datadir}/metainfo/org.saga_gis.saga_gui.appdata.xml
%{_mandir}/man1/saga*.gz

%defattr(- ,root, root, -)
%{_bindir}/saga_*
%{_libdir}/*.so.*
%dir %{_libdir}/saga
%{_libdir}/saga/*.so

%files devel
%{_includedir}/*
%{_libdir}/*.so

%files -n python3-%{name}
%dir %{python3_sitearch}
%{python3_sitearch}/*

%changelog
openSUSE Build Service is sponsored by