File grass.spec of Package grass

#
# spec file for package grass
#
# Copyright (c) 2017 SUSE LINUX 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	shortver 74

Name:           grass
Version:        7.4.1
Release:        1
License:        GPL-2.0+
Summary:        GRASS GIS - Geographic Resources Analysis Support System
Url:            http://grass.osgeo.org/
Group:          Productivity/Scientific/Other
# Use unmodified upstream source
Source:         https://grass.osgeo.org/grass74/source/%{name}-%{version}.tar.gz
Source1:        https://grass.osgeo.org/grass74/source/%{name}-%{version}.md5sum
Source2:        grass.rpmlintrc
# From https://trac.osgeo.org/grass/raw-attachment/ticket/3331/floats2.diff
#Patch0:         upstream-issue-3331-floats2.patch
Requires:       proj >= 4.8.0
Requires:       sqlite >= 3
Requires:       unixODBC
Requires:       xterm
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1010 && 0%{?suse_version} < 1130
Requires:       fftw
%else
Requires:       fftw3
%endif
Requires:       grass-docs
Requires:       python >= 2.6
Requires:       python-numpy
Requires:       python-dateutil
#Requires:       python-opengl
Requires:       python-wxWidgets >= 2.8
Requires:       python-xml
%if 0%{?suse_version} <= 1030
BuildRequires:  python-elementtree
%endif
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  libgdal-devel >= 2
BuildRequires:  libgeos-devel >= 3
#BuildRequires:  libhdf5-103
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  man
BuildRequires:  proj
#BuildRequires:  netcdf-devel
BuildRequires:  libproj-devel
BuildRequires:  libtiff-devel
BuildRequires:  mysql-devel
BuildRequires:  ncurses-devel >= 5.5
BuildRequires:  postgresql-devel
BuildRequires:  sqlite-devel
BuildRequires:  blas-devel
BuildRequires:  lapack-devel
#BuildRequires:  liblas-devel
BuildRequires:  unixODBC-devel
BuildRequires:  xorg-x11-Mesa-devel
BuildRequires:  zlib-devel
%if 0%{?suse_version} >= 1010 && 0%{?suse_version} < 1130
BuildRequires:  fftw-devel
%else
BuildRequires:  fftw3-devel
%endif
BuildRequires:  -post-build-checks
BuildRequires:  fdupes
BuildRequires:  libXmu-devel
BuildRequires:  python-numpy
BuildRequires:  python-dateutil
BuildRequires:  perl
BuildRequires:  python-devel >= 2.6
#BuildRequires:  python-opengl
BuildRequires:  python-xml
# Post Leap 42 / TW
%if 0%{?suse_version} > 1325
BuildRequires:  python-wxWidgets-devel >= 3.0
BuildRequires:  wxWidgets-devel >= 3.0
%else
# Don't work for SLE why ?
# BuildRequires:  python-wxWidgets >= 2.8
BuildRequires:  wxWidgets-devel >= 2.8
%define _use_internal_dependency_generator 0
%define __find_requires %wx_requires
%endif


Obsoletes:      grass7

%package docs
Summary:        Documentation for GRASS GIS 7
Group:          Documentation/Other
Requires:       grass = %{version}

%package devel
Summary:        Development files for GRASS GIS 7
Group:          Development/Libraries/C and C++
Requires:       grass = %{version}

%description
GRASS (Geographic Resources Analysis Support System), commonly
referred to as GRASS, is a Geographic Information System
(GIS) used for geospatial data management and analysis, image
processing, graphics/maps production, spatial modeling, and
visualization. GRASS is currently used in academic and commercial
settings around the world, as well as by many governmental agencies
and environmental consulting companies.

%description devel
This package contains the development files for GRASS GIS

%description docs
This package contains the HTML documentation files for GRASS GIS

%prep
%setup -q -n grass-%{version}
#%patch0 -p1
# see comments in issue also remove 
find . -iname "lextab.py*" -ls -delete

%define grasver -@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@
%define grasver2 '-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE}'

sed -i s/%{grasver}//g include/Make/Platform.make.in
sed -i s/%{grasver}//g grass.pc.in
sed -i s/%{grasver2}//g configure
sed -i s/%{grasver2}//g Makefile

%define _prefix /opt
%define grassdir %{_prefix}/grass
%define grasslib %{_prefix}/grass/lib

#configure with shared libs:
# Pick for upstream travis, normal optflags are not supported
export CFLAGS="-O2 -Werror=implicit-function-declaration"

./configure \
	--prefix=%{_prefix} \
	--enable-shared \
	--enable-socket \
	--enable-largefile \
	--with-blas \
	--with-cairo --with-cairo-ldflags=-lfontconfig \
	--with-curses \
	--with-cxx \
	--with-fftw \
    --without-hdf \
	--with-freetype --with-freetype-includes=/usr/include/freetype2 \
	--with-gdal=/usr/bin/gdal-config \
	--with-geos \
	--with-lapack \
	--with-motif \
	--with-mysql --with-mysql-includes=/usr/include/mysql \
	--with-nls \
	--with-odbc \
	--with-proj-share=/usr/share/proj \
	--with-python \
	--with-sqlite \
	--with-wxwidgets \
    --with-postgres --with-postgres-includes=/usr/include/pgsql \
    
%build
make prefix=%{_prefix} BINDIR=%{_bindir} PREFIX=%{_prefix} %{?_smp_mflags}

%install
make prefix=%{buildroot}%{_prefix} BINDIR=%{buildroot}%{_bindir} \
PREFIX=%{buildroot}%{_prefix} install

# Program sets LD_LIBRARY_PATH pointing to in-source path
# resulting in wrong requires, prevent that
rm -rf dist.*

# changing GISBASE in startup script (deleting %%{buildroot} from path)
sed -i s:%{buildroot}::g %{buildroot}%{_bindir}/grass%{shortver}
sed -i s:%{buildroot}::g %{buildroot}%{grassdir}/include/Make/Grass.make
sed -i s:%{buildroot}::g %{buildroot}%{grassdir}/include/Make/Platform.make
sed -i s:%{buildroot}::g %{buildroot}%{grassdir}/etc/fontcap
ln -sf grass%{shortver} %{buildroot}%{_bindir}/grass

# make grass libraries available on the system
install -d %{buildroot}%{_sysconfdir}/ld.so.conf.d
echo %{grasslib} >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/grass-%{version}.conf

%fdupes -s %{buildroot}%{grassdir}

%files devel
%defattr(-,root,root)
%{grassdir}/include
%{grasslib}/*.a

%files docs
%defattr(-,root,root)
%{grassdir}/docs
#%{grassdir}/man

%files
%defattr(-,root,root)
%{_sysconfdir}/ld.so.conf.d/grass-%{version}.conf
%{grassdir}/bin/*
%{grassdir}/etc/*
%{grassdir}/gui/*
%{grassdir}/scripts/*
%{grassdir}/share/applications/grass.desktop
#%{grassdir}/share/appdata/grass.appdata.xml
%{grassdir}/share/metainfo/org.osgeo.grass.appdata.xml
%{grassdir}/share/icons/hicolor/*
#%%{grassdir}/bwidget/*
%lang(ar) %{grassdir}/locale/ar/LC_MESSAGES/*.mo
%lang(cs) %{grassdir}/locale/cs/LC_MESSAGES/*.mo
%lang(de) %{grassdir}/locale/de/LC_MESSAGES/*.mo
%lang(el) %{grassdir}/locale/el/LC_MESSAGES/*.mo
%lang(es) %{grassdir}/locale/es/LC_MESSAGES/*.mo
%lang(fr) %{grassdir}/locale/fr/LC_MESSAGES/*.mo
%lang(fi) %{grassdir}/locale/fi/LC_MESSAGES/*.mo
#%lang(id) %{grassdir}/locale/id/LC_MESSAGES/*.mo
%lang(hu) %{grassdir}/locale/hu/LC_MESSAGES/*.mo
%lang(id_ID) %{grassdir}/locale/id_ID/LC_MESSAGES/*.mo
%lang(it) %{grassdir}/locale/it/LC_MESSAGES/*.mo
%lang(ja) %{grassdir}/locale/ja/LC_MESSAGES/*.mo
%lang(ko) %{grassdir}/locale/ko/LC_MESSAGES/*.mo
%lang(lv) %{grassdir}/locale/lv/LC_MESSAGES/*.mo
%lang(ml) %{grassdir}/locale/ml/LC_MESSAGES/*.mo
#%%lang(mr) %%{grassdir}/locale/mr/LC_MESSAGES/*.mo
%lang(pl) %{grassdir}/locale/pl/LC_MESSAGES/*.mo
%lang(pt) %{grassdir}/locale/pt/LC_MESSAGES/*.mo
%lang(pt_BR) %{grassdir}/locale/pt_BR/LC_MESSAGES/*.mo
%lang(ru) %{grassdir}/locale/ru/LC_MESSAGES/*.mo
%lang(ro) %{grassdir}/locale/ro/LC_MESSAGES/*.mo
%lang(si) %{grassdir}/locale/si/LC_MESSAGES/*.mo
%lang(sl) %{grassdir}/locale/sl/LC_MESSAGES/*.mo
%lang(ta) %{grassdir}/locale/ta/LC_MESSAGES/*.mo
%lang(th) %{grassdir}/locale/th/LC_MESSAGES/*.mo
%lang(tr) %{grassdir}/locale/tr/LC_MESSAGES/*.mo
%lang(uk) %{grassdir}/locale/uk/LC_MESSAGES/*.mo
%lang(vi) %{grassdir}/locale/vi/LC_MESSAGES/*.mo
%lang(zh) %{grassdir}/locale/zh/LC_MESSAGES/*.mo

%{grassdir}/tools/*.py*
%{grassdir}/tools/g.echo
%{grassdir}/driver/*
%{grassdir}/fonts/*
%{grasslib}/*.so
%{_bindir}/grass*
%{grassdir}/config.status
%{grassdir}/AUTHORS
%{grassdir}/translators.csv
%{grassdir}/translation_status.json
%{grassdir}/contributors*
%{grassdir}/CHANGES
%{grassdir}/COPYING
%{grassdir}/GPL.TXT
%{grassdir}/REQUIREMENTS.html
%{grassdir}/CITING
%{grassdir}/INSTALL
%exclude %{grassdir}/demolocation
%defattr(755,root,root)

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by