File grass.spec of Package grass

# spec file for package grass
# Copyright (c) 2013 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

%define	shortver 64

Name:           grass
Version:        6.4.3
Release:        1
License:        GPL-2.0
Summary:        GRASS - Geographic Resources Analysis Support System
Group:          Productivity/Scientific/Other
Source:         grass-%{version}.tar.gz
Source1:        grass.rpmlintrc
Requires:       unixODBC
Requires:       xterm
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       python >= 2.4
Requires:       python-numpy
Requires:       python-opengl
Requires:       python-wxWidgets >= 2.8
Requires:       python-xml
Requires:       readline
Requires:       proj
%if 0%{?suse_version} <= 1030
BuildRequires:  python-elementtree
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  libgdal-devel >= 1.6.0
BuildRequires:  libgeos-devel >= 3
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  man
BuildRequires:  proj
BuildRequires:  readline-devel
BuildRequires:  netcdf-devel
BuildRequires:  libproj-devel
BuildRequires:  libtiff-devel
BuildRequires:  mysql-devel
BuildRequires:  ncurses-devel >= 5.5
BuildRequires:  postgresql-devel
BuildRequires:  sqlite-devel
BuildRequires:  tcl-devel
BuildRequires:  tk-devel
BuildRequires:	blas-devel
BuildRequires:  unixODBC-devel
BuildRequires:  xorg-x11-Mesa-devel
BuildRequires:  xorg-x11-libXmu-devel
BuildRequires:  zlib-devel
%if 0%{?suse_version} >= 1010 && 0%{?suse_version} < 1130
BuildRequires:  fftw-devel
BuildRequires:  fftw3-devel
BuildRequires:  -post-build-checks
BuildRequires:  fdupes
BuildRequires:  python-devel >= 2.4
BuildRequires:  python-opengl
BuildRequires:  python-wxWidgets >= 2.8
BuildRequires:  python-xml
BuildRequires:  wxWidgets-devel >= 2.8
%if 0%{?suse_version} >= 1140
%define _use_internal_dependency_generator 0
%define __find_requires %wx_requires
Obsoletes:      grass7
%if 0%{?suse_version} >= 1210
%define _use_internal_dependency_generator 0
%define our_find_requires %{_builddir}/%{name}-%{version}/find_requires

%package docs
Summary:        Documentation for grass
Group:          Productivity/Scientific/Other
Requires:       grass = %{version}

%package devel
Summary:        Development files for grass
Group:          Productivity/Scientific/Other
Requires:       grass = %{version}

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

%description docs
This package contains the HTML documentation files for grass

%setup -q -n grass-%{version}

sed -i s/%{grasver}//g include/Make/
sed -i s/%{grasver}//g
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:
CFLAGS="-O2" ./configure \
	--prefix=%{_prefix} \
	--enable-shared \
	--enable-largefile \
	--with-proj-share=/usr/share/proj \
	--with-cxx \
	--with-blas \
	--with-gdal=/usr/bin/gdal-config \
	--with-postgres --with-postgres-includes=/usr/include/pgsql \
	--with-mysql --with-mysql-includes=/usr/include/mysql \
	--with-fftw \
	--with-readline \
	--with-netcdf \
	--with-curses \
	--with-geos \
	--with-nls \
	--with-sqlite \
	--with-freetype \
	--with-freetype-includes=/usr/include/freetype2 \
	--with-wxwidgets \
	--with-odbc \

%if 0%{?suse_version} >= 1210
cat <<EOF >%{our_find_requires}
exec %{__find_requires} | /bin/egrep -v '^nviz$'
exit 0
chmod +x %{our_find_requires}
%define __find_requires %{our_find_requires}

make prefix=%{_prefix} BINDIR=%{_bindir} PREFIX=%{_prefix} %{?_smp_mflags}

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

# changing GISBASE in startup script (deleting %{buildroot} from path)
sed -i s:%{buildroot}::g %{buildroot}%{_bindir}/grass%{shortver}
ln -sf grass%{shortver} %{buildroot}%{_bindir}/grass

# make grass libraries available on the system
install -d %{buildroot}%{_sysconfdir}/
echo %{grasslib} >> %{buildroot}%{_sysconfdir}/{version}.conf
pushd %{buildroot}%{grassdir}/man
  gzip */*
pushd %{buildroot}%{grassdir}/etc/gem/skeleton/
chmod +x uninstall
chmod +x post

%fdupes -s %{buildroot}

%files devel

%files docs

%exclude %{grassdir}/tools/g.html2man
#%exclude %{grasslib}/*[a-zA-Z].so

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig