Blob Blame History Raw
Name:      grass
Version:   6.2.3
Release:   1%{?dist}
Summary:   GRASS - Geographic Resources Analysis Support System
Group:     Applications/Engineering
License:   GPL
URL:       http://grass.itc.it/index.php
Source0:   http://grass.itc.it/grass62/source/grass-%{version}-fedora.tar.gz  
Source1:   grass.desktop
Source2:   http://grass.itc.it/images/grasslogo_vector_small.png
Patch0:    grass-pkgconf.patch
Patch1:    grass-shlib-soname.patch
Patch2:    grass-license.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  gettext
BuildRequires:  bison flex pkgconfig
BuildRequires:  desktop-file-utils libjpeg-devel
BuildRequires:  libtiff-devel libpng-devel freetype-devel
BuildRequires:  zlib-devel readline-devel ncurses-devel tk-devel 
BuildRequires:  unixODBC-devel mysql-devel postgresql-devel sqlite-devel
BuildRequires:  mesa-libGLU-devel mesa-libGLw-devel libXmu-devel lesstif-devel
BuildRequires:  proj-devel geos-devel blas-devel lapack-devel fftw2-devel gdal-devel

%description
GRASS (Geographic Resources Analysis Support System) 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.

%package libs
Summary: GRASS (Geographic Resources Analysis Support System) runtime libraries
Group: Applications/Engineering

%description libs
GRASS (Geographic Resources Analysis Support System) runtime libraries.

%package devel
Summary: GRASS (Geographic Resources Analysis Support System) development headers
Group: Applications/Engineering
Requires: %{name}-libs = %{version}-%{release}
Requires: pkgconfig
Requires: lesstif-devel
Requires: mesa-libGL-devel libX11-devel libXt-devel
Requires: gdal-devel proj-devel xorg-x11-proto-devel

%description devel
GRASS (Geographic Resources Analysis Support System) development headers.

%prep
%setup  -n %{name}-%{version}-fedora -q  
%patch0 -p0 -b .pkgconf~
%patch1 -p0 -b .shlibver~
%patch2 -p0 -b .license~

# readline requires ncurses, so workaround
# correct mysql_config query
sed -i 's|-lreadline|-lreadline -lcurses|g' configure
sed -i 's|--libmysqld-libs|--libs|g' configure

# preserve timestamp during install process
sed -i 's|^cp |cp -p |' tools/build_html_index.sh
sed -i 's|-cp |-cp -p |' Makefile

%build

# code may contain sensible buffer overflows triggered by gcc ssp flag (mustfixupstream).
CFLAGS=`echo %{optflags}|sed -e 's/-Wp,-D_FORTIFY_SOURCE=2 //g'`
# keep timestamp over install section
export INSTALL="%{__install} -c -p"
# correct linkage against libm.so
export LDFLAGS="-lm"
export CFLAGS

%configure \
   --enable-shared \
   --with-nls \
   --with-blas \
   --with-lapack \
   --with-fftw \
   --with-gdal \
   --with-proj \
   --with-proj-includes=%{_includedir} \
   --with-proj-libs=%{_libdir} \
   --with-proj-share=%{_libdir} \
   --with-readline \
   --with-readline-includes=%{_includedir}/readline \
   --with-readline-libs=%{_libdir} \
   --with-sqlite \
   --with-odbc \
   --with-odbc-libs=%{_libdir} \
   --with-odbc-includes=%{_includedir} \
   --with-mysql \
   --with-mysql-includes=%{_includedir}/mysql \
   --with-mysql-libs=%{_libdir}/mysql \
   --with-postgres  \
   --with-postgres-includes=%{_includedir}/pgsql \
   --with-postgres-libs=%{_libdir} \
   --with-freetype=yes \
   --with-freetype-includes=%{_includedir}/freetype2 \
   --with-glw \
   --with-glw-libs=%{_libdir} \
   --with-motif \
   --with-opengl \
   --with-x \
%ifarch x86_64 ia64 ppc64 s390x sparc64 alpha 
   --enable-64bit \
%endif
%ifarch sparcv9 sparc64
   --enable-64bit-vis \
%endif       
   --enable-largefile \
   --with-cxx \
   --with-python

# WARNING !!!
# dont use %{?_smp_mflags} its broken
make

%install
rm -rf %{buildroot}

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

# changing GISBASE in startup script to point to systems %{_libdir}%{name}-%{version}
mv  %{buildroot}%{_bindir}/grass62 %{buildroot}%{_bindir}/grass62.tmp
cat %{buildroot}%{_bindir}/grass62.tmp | \
    sed -e "1,\$s&^GISBASE.*&GISBASE=%{_libdir}/%{name}-%{version}&" | \
    cat - > %{buildroot}%{_bindir}/grass62
rm  %{buildroot}%{_bindir}/grass62.tmp
chmod +x %{buildroot}%{_bindir}/grass62

# fix docs lookup path
sed -i -e 's/$env(GISBASE)\/docs\//\/usr\/share\/doc\/%{name}-%{version}\/docs\//' \
    %{buildroot}%{_prefix}/%{name}-%{version}/etc/gis_set.tcl
sed -i -e 's/$env(GISBASE)\/docs\//\/usr\/share\/doc\/%{name}-%{version}\/docs\//' \
    %{buildroot}%{_prefix}/%{name}-%{version}/etc/gui.tcl
sed -i -e 's/$env(GISBASE)\/docs\//\/usr\/share\/doc\/%{name}-%{version}\/docs\//' \
    %{buildroot}%{_prefix}/%{name}-%{version}/etc/nviz2.2/scripts/nviz2.2_script
sed -i -e 's|C_BASE="$GISBASE"|C_BASE=\"\/usr\/share\/doc\/%{name}-%{version}\/docs"|g' \
    %{buildroot}%{_prefix}/%{name}-%{version}/scripts/g.manual
sed -i -e 's|%{name}-%{version}\/docs|%{name}-%{version}|g' \
    %{buildroot}%{_prefix}/%{name}-%{version}/scripts/g.manual

# make grass libraries available on the system
mv %{buildroot}%{_prefix}/grass-%{version}/lib/ %{buildroot}%{_libdir}

# make grass headers available on the system
mv %{buildroot}%{_prefix}/grass-%{version}/include %{buildroot}%{_prefix}/
rm %{buildroot}%{_includedir}/portable.h 

# make man pages aviable in system, convert some in utf8.
for manpage in {displaydrivers.1,r.sun.1,m.proj.1}; do
    iconv -f iso88592 -t utf8 \
        %{buildroot}%{_prefix}/grass-%{version}/man/man1/$manpage > \
        %{buildroot}%{_prefix}/grass-%{version}/man/man1/$manpage.tmp
     mv %{buildroot}%{_prefix}/grass-%{version}/man/man1/$manpage.tmp \
        %{buildroot}%{_prefix}/grass-%{version}/man/man1/$manpage
done
mkdir -p %{buildroot}%{_datadir}/man/
mv  %{buildroot}%{_prefix}/grass-%{version}/man/* %{buildroot}%{_mandir}
rm -rf %{buildroot}%{_prefix}/grass-%{version}/man
gzip -d ChangeLog_%{version}.gz
iconv -f iso88592 -t utf8 ChangeLog_%{version} | \
gzip -9 > ChangeLog_%{version}.gz

# make locales aviable in system, fix issue for pt_BR.
mkdir -p %{buildroot}%{_datadir}/locale/
mv %{buildroot}%{_prefix}/grass-%{version}/locale %{buildroot}%{_datadir}/
mv %{buildroot}%{_datadir}/locale/pt_br %{buildroot}%{_datadir}/locale/pt_BR

# pack lang sets
%find_lang grassmods
%find_lang grasslibs
cat grassmods.lang > %{name}.lang
cat grasslibs.lang >> %{name}.lang

# install pkg-config file
mkdir -p %{buildroot}%{_libdir}/pkgconfig
install -p -m 644 grass.pc %{buildroot}%{_libdir}/pkgconfig/

# install desktop icon
mkdir  %{buildroot}%{_datadir}/pixmaps/
install -p -m 644 %{SOURCE2} %{buildroot}%{_datadir}/pixmaps/grass.png
desktop-file-install --vendor="fedora" \
        --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}

# fixup spurious exec flags here
find %{buildroot} -name "*.tcl" -exec chmod +r-x '{}' \;
chmod -x dist.*/docs/html/nviz/help_frame.tcl
chmod -x %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/nviz2.2/scripts/nviz_params
chmod -x %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/nviz2.2/scripts/tclIndex
chmod -x %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/nviz2.2/scripts/panelIndex
chmod +x %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/gem/skeleton/post
chmod +x %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/gem/skeleton/uninstall
chmod +x %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/g.mapsets.tcl
chmod +x %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/dm/tksys.tcl
chmod +x %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/gm/tksys.tcl
chmod +x %{buildroot}%{_prefix}/grass-%{version}/docs/html/nviz/help_frame.tcl

# fixup few nviz script header, it will anyway allways executed by nviz
for nviz in {script_play,nviz2.2_script,script_tools,script_file_tools,script_get_line}; do
 cat %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/nviz2.2/scripts/$nviz \
  | grep -v '#!nviz' > %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/nviz2.2/scripts/$nviz.tmp 
 mv  %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/nviz2.2/scripts/$nviz.tmp \
     %{buildroot}%{_prefix}/grass-%{version}%{_sysconfdir}/nviz2.2/scripts/$nviz
done

# switch to the system wide docs to be FHS compliant
rm -rf %{buildroot}%{_prefix}/%{name}-%{version}/docs

# hide GISBASE into systems %{_libdir} insted, to be FHS compliant
mv %{buildroot}%{_prefix}/%{name}-%{version} %{buildroot}%{_libdir}/

# rename gem module loader to gem62
mv %{buildroot}%{_bindir}/gem %{buildroot}%{_bindir}/gem62


%clean
rm -rf %{buildroot}

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

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING GPL.TXT README README-fedora
%doc REQUIREMENTS.html CHANGES
%doc doc dist.*/docs
%{_bindir}/grass62
%{_bindir}/gem62
%dir %{_libdir}/%{name}-%{version}
%{_libdir}/%{name}-%{version}/*
%{_datadir}/applications/fedora-grass.desktop
%{_datadir}/pixmaps/grass.png
%{_mandir}/man1/*

%files libs
%doc AUTHORS COPYING GPL.TXT README
%defattr(-,root,root,-)
%{_libdir}/libgrass_*.so.*

%files devel
%defattr(-,root,root,-)
%doc AUTHORS COPYING GPL.TXT README TODO
%doc ChangeLog_%{version}.gz doc/raster doc/vector 
%exclude %{_libdir}/libgrass_*.a
%{_libdir}/pkgconfig/%{name}.pc
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*.h
%dir %{_includedir}/%{name}/dgl
%dir %{_includedir}/%{name}/rtree
%dir %{_includedir}/%{name}/vect
%{_includedir}/%{name}/dgl/*.h
%{_includedir}/%{name}/rtree/*.h
%{_includedir}/%{name}/vect/*.h
%{_libdir}/libgrass_*.so

%changelog
* Thu Dec 06 2007 Release Engineering <rel-eng at fedoraproject dot org> - 6.2.2-3
- Rebuild for deps

* Tue Aug 28 2007 Fedora Release Engineering <rel-eng at fedoraproject dot org> - 6.2.2-2
- Rebuild for selinux ppc32 issue.

* Wed Jul 25 2007 Balint Cristian <cbalint@redhat.com> 6.2.2-1
- new upstream stable version

* Thu Jun 07 2007 Balint Cristian <cbalint@redhat.com> 6.2.2-0.2.RC1
- fix version string in desktop file
- add RO lang to desktop file
- dropped one patch, seems fixed upstream.

* Fri Jun 01 2007 Balint Cristian <cbalint@redhat.com> 6.2.2-0.1.RC1
- 6.2.2 rc1 bugfix release
- fix docbase lookup path for g.manual

* Sat May 12 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-16
- fix koji build for ppc ppc64, dont use _host macro anymore.

* Sat May 12 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-15
- rebuild against new gdal

* Mon Apr 02 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-14
- remove bogus requirement in grass-libs
- rename gem loader to gem62

* Tue Mar 20 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-13
- see README-fedora for license fix in redistributed tarball
- r.terraflow plugin removal from -fedora tarball

* Fri Mar 13 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-12
- more spec review

* Fri Mar 13 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-11
- more spec review

* Fri Mar 13 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-10
- more spec review

* Fri Mar 2 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-9
- require missing libjpeg-devel

* Tue Feb 27 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-8
- more buildfixes, should build now in mock for any arches
- estetic changes in spec file

* Sat Feb 25 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-7
- fix mock build on any arch.

* Sat Feb 23 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-6
- fix mock build, more spec cleanup.
- fix docs lookup from g.manual
- disable fedora c flags, ssp break functionality for now.

* Sat Feb 23 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-5
- use macros if posible.

* Sat Feb 10 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-4
- fix more nits in specs
- fix require list.

* Fri Feb 09 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-3
- fix more nits in specs

* Wed Feb 07 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-2
- fix nits in specs
- disable static libs pack
- use macros in file lists if possible.

* Wed Feb 07 2007 Balint Cristian <cbalint@redhat.com> 6.2.1-1
- first build for fedora-extras
- enable all options for packages aviable in fedora
- fix buffer overflow problem during compile with ssp
- fix paths in pkconfig file
- add desktop icon
- relocate lang and man page folders in the right places
- sanitize shared library names, fix -soname versioning in libs.
- fix some non utf8 manpage
- fix pt_BR locale path
- fix some nviz script headers
- fix exec rights across some scripts, remove exec from tcl scripts
- move out GISBASE in lib and fixup script enviroment for this
- switch help-doc to datadir/doc/grass and fixit up in grass paths