Blob Blame History Raw
Name:      grass
Version:   6.2.1
Release:   16%{?dist}
Summary:   GRASS - Geographic Resources Analysis Support System
Group:     Applications/Engineering
License:   GPL
Source1:   grass.desktop
Patch0:    grass-overflow.patch
Patch1:    grass-pkgconf.patch
Patch2:    grass-shlib-soname.patch
Patch3:    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

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.

%setup  -n %{name}-%{version}-fedora -q  
%patch0 -p0 -b .overflow~
%patch1 -p0 -b .pkgconf~
%patch2 -p0 -b .shlibver~
%patch3 -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/
sed -i 's|-cp |-cp -p |' Makefile


# configure without optimizations.
# 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
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 \
%ifarch sparcv9 sparc64
   --enable-64bit-vis \
   --enable-largefile \
   --with-cxx \

# dont use %{?_smp_mflags} its broken

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\//' \
sed -i -e 's/$env(GISBASE)\/docs\//\/usr\/share\/doc\/%{name}-%{version}\/docs\//' \
sed -i -e 's/$env(GISBASE)\/docs\//\/usr\/share\/doc\/%{name}-%{version}\/docs\//' \
sed -i -e 's|C_BASE="$GISBASE"|C_BASE=\"\/usr\/share\/doc\/%{name}-%{version}\/docs"|g' \

# 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 > \
     mv %{buildroot}%{_prefix}/grass-%{version}/man/man1/$manpage.tmp \
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 \

# 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

rm -rf %{buildroot}

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

%files -f %{name}.lang
%doc doc dist.*/docs
%dir %{_libdir}/%{name}-%{version}

%files libs

%files devel
%doc ChangeLog_%{version}.gz doc/raster doc/vector 
%exclude %{_libdir}/libgrass_*.a
%dir %{_includedir}/%{name}
%dir %{_includedir}/%{name}/dgl
%dir %{_includedir}/%{name}/rtree
%dir %{_includedir}/%{name}/vect

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

* Sat May 12 2007 Balint Cristian <> 6.2.1-15
- rebuild against new gdal

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

* Tue Mar 20 2007 Balint Cristian <> 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 <> 6.2.1-12
- more spec review

* Fri Mar 13 2007 Balint Cristian <> 6.2.1-11
- more spec review

* Fri Mar 13 2007 Balint Cristian <> 6.2.1-10
- more spec review

* Fri Mar 2 2007 Balint Cristian <> 6.2.1-9
- require missing libjpeg-devel

* Tue Feb 27 2007 Balint Cristian <> 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 <> 6.2.1-7
- fix mock build on any arch.

* Sat Feb 23 2007 Balint Cristian <> 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 <> 6.2.1-5
- use macros if posible.

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

* Fri Feb 09 2007 Balint Cristian <> 6.2.1-3
- fix more nits in specs

* Wed Feb 07 2007 Balint Cristian <> 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 <> 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