Blob Blame Raw
%global completion_path %(pkg-config --variable=completionsdir bash-completion)

Name:      gtatool
Version:   1.5.2
Release:   1%{?dist}
Summary:   Commandline tool to manipulate GTAs
Group:     Applications/Engineering
License:   GPLv3+
URL:       http://gta.nongnu.org/gtatool.html
Source0:   http://download.savannah.nongnu.org/releases/gta/%{name}-%{version}.tar.xz

# Response to the failing ImageMagick test
# Doesn't solve the problem
# http://git.savannah.gnu.org/cgit/gta.git/patch/?id=8a4cba71a35fa19eb58c111d6a376e181f642ae0
#Patch1:    %{name}-1.5.0-imagemagick-test.patch

BuildRequires: bash-completion
BuildRequires: dcmtk-devel
BuildRequires: desktop-file-utils
BuildRequires: gdal-devel
BuildRequires: ImageMagick-c++-devel
BuildRequires: libgta-devel
BuildRequires: libsndfile-devel
BuildRequires: matio-devel
BuildRequires: muParser-devel
BuildRequires: netcdf-devel
BuildRequires: netpbm-devel
BuildRequires: OpenEXR-devel
BuildRequires: openjpeg-devel
%if 0%{?fedora} > 17
BuildRequires: pcl-devel
%endif
BuildRequires: pkgconfig
BuildRequires: pfstools-devel
BuildRequires: qt4-devel

Requires(post): info
Requires(preun): info

%description
Gtatool is a command line tool to manipulate GTAs.

It provides a set of commands that manipulate GTAs on various levels:
array element components, array dimensions, whole arrays, and streams of arrays.
For example, you can add components to array elements, merge separate arrays
into combined arrays in different ways, apply global transformations to array
data, reorder the array data, and much more.

Additionally, gtatool can import from and export to many other file formats, see
the sub-packages!


%package gui
Summary:        Graphical interface of %{name}
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description gui
This sub-package contains the graphical interface of %{name}.


%package dcmtk
Summary:        Module to import/export via dcmtk
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description dcmtk
This sub-package contains the necessary module to import and export
medical image data in DICOM format via dcmtk.


%package gdal
Summary:        Module to import/export via gdal
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description gdal
This sub-package contains the necessary module to import and export
remote sensing data via the gdal library.


%package hdr
Summary:        Module to import/export high dynamic range data
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description hdr
This sub-package contains the necessary module to import and export
high dynamic range images or data via OpenEXR and pfstools.


%package imagemagick
Summary:        Module to import/export traditional image formats
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description imagemagick
This sub-package contains the necessary module to import and export
traditional image formats via imagemagick.


%package matlab
Summary:        Module to import/export matlab files
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description matlab
This sub-package contains the necessary module to import and export
matlab files via matio.


%package netcdf
Summary:        Module to import/export traditional netcdf files
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description netcdf
This sub-package contains the necessary module to import and export
netcdf files, including HDF4 and 5.


%if 0%{?fedora} > 17
%package pcd
Summary:        Module to import/export point cloud data
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description pcd
This sub-package contains the necessary module to import and export
point cloud data via pcl.
%endif


%package sndfile
Summary:        Module to import/export sound data
Group:          Applications/Engineering
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description sndfile
This sub-package contains the necessary module to import and export
sound data via libsndfile.


%prep
%setup -q
#%patch1 -p2 -b .~imagemagick-test

%build
# Stupid way to avoid overwriting the original LDFLAGS.
# __global_ldflags might do instead
export LDFLAGS_ADD="-L%{_libdir}/dcmtk"
export CFLAGS="%{optflags} -I%{_includedir}/netpbm"
export CXXFLAGS="%{optflags} -I%{_includedir}/netpbm"

# 1994 ply files are bundled; rply could take over, but the API is different
# pvm uses files from vvv; No package is currently available in Fedora
%configure LDFLAGS="$LDFLAGS $LDFLAGS_ADD" \
    --without-ffmpeg \
    --without-ply \
    --without-pvm

make V=1 LDFLAGS="$LDFLAGS $LDFLAGS_ADD" %{?_smp_mflags}


%install
make install DESTDIR=%{buildroot}

desktop-file-validate %{buildroot}/%{_datadir}/applications/gta_gui.desktop

# Remove info directory, created by make install
rm -rf %{buildroot}%{_infodir}/dir

# Completion scripts are loaded on demand from bash-completion 1.99 on
#TODO: Upstream

mkdir -p %{buildroot}%{completion_path}
mv %{buildroot}%{_sysconfdir}/bash_completion.d/gta-completion.bash %{buildroot}%{completion_path}/gta


%check
# Imagemagick test fails randomly in F16 and 17, but succeeds in F18
# It's connected to ImageMagick only, as it succeeds with a rebuild
# of F18's ImageMagick in F16.
# Reported on the gta mailing list on Feb 3 2013
# Make them informational for the time being
make check || exit 0


%post
/sbin/install-info %{_infodir}/gta.info* %{_infodir}/dir || :

%post gui
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%preun
if [ $1 = 0 ] ; then
  /sbin/install-info --delete %{_infodir}/gta.info* %{_infodir}/dir || :
fi

%postun gui
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files 
%doc COPYING AUTHORS README
%{_bindir}/gta
%dir %{_libdir}/%{name}/
%{_libdir}/%{name}/component-compute.so
%{_libdir}/%{name}/conv-csv.so
%{_libdir}/%{name}/conv-jpeg.so
%{_libdir}/%{name}/conv-datraw.so
%{_libdir}/%{name}/conv-netpbm.so
%{_libdir}/%{name}/conv-rat.so
%{_libdir}/%{name}/conv-raw.so
%{_infodir}/gta.info*
%{_mandir}/man1/gta.1*

%dir %{completion_path}
%{completion_path}/gta

%files gui
%{_libdir}/%{name}/gui.so
%{_datadir}/applications/gta_gui.desktop
%{_datadir}/icons/hicolor/*/*

%files dcmtk
%{_libdir}/%{name}/conv-dcmtk.so

%files gdal
%{_libdir}/%{name}/conv-gdal.so

%files hdr
%{_libdir}/%{name}/conv-pfs.so
%{_libdir}/%{name}/conv-exr.so

%files imagemagick
%{_libdir}/%{name}/conv-magick.so

%files matlab
%{_libdir}/%{name}/conv-mat.so

%files netcdf
%{_libdir}/%{name}/conv-netcdf.so

%if 0%{?fedora} > 17
%files pcd
%{_libdir}/%{name}/conv-pcd.so
%endif

%files sndfile
%{_libdir}/%{name}/conv-sndfile.so


%changelog
* Tue Apr 30 2013 Volker Fröhlich <volker27@gmx.at> 1.5.2-1
- New upstream release

* Sat Mar 30 2013 Volker Fröhlich <volker27@gmx.at> 1.5.1-3
- Remove gcc-c++ as BR
- Disable pvm and ply, due to bundle issues
- Put the bash completion script in the proper place for dynamical loading

* Wed Feb 13 2013 Volker Fröhlich <volker27@gmx.at> 1.5.1-2
- pcd sub-package conditional for F17, due to version constraint in pcl

* Sun Feb 10 2013 Volker Fröhlich <volker27@gmx.at> 1.5.1-1
- New upstream release
- Remove now included tex info patch
- Remove now included changes of pcl_config and desktop file
- Own bash_completion.d for the newly introduced completion file

* Fri Feb  1 2013 Volker Fröhlich <volker27@gmx.at> 1.5.0-1
- Initial package for Fedora