# Refer to the comment for Source0 below on how to obtain the source tarball
# The saved file has format enGits-engrid-$version-$ahead-g$shortcommit.tar.gz
%global commit e6d55f564c20a8d13bee6bba6280a32320f1bde2
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global ahead 264
# If ahead is 0, the tarball corresponds to a release version, otherwise to a git snapshot
%if %{ahead} > 0
%global snap .git%{shortcommit}
%endif
Name: engrid
Version: 1.4.0
Release: 6%{?snap}%{?dist}
Summary: Mesh generation tool
License: GPLv3+
URL: http://engits.eu/en/engrid
# wget --content-disposition https://github.com/enGits/engrid/tarball/$commit
Source0: https://github.com/enGits/engrid/tarball/%{commit}/enGits-engrid-%{version}-%{ahead}-g%{shortcommit}.tar.gz
# Taken from src/libengrid/resources/icons/G.png and resized to 64x64
Source1: engrid.png
# - Unbundle netgen
# - Link against netcdf_cxx
# - Link against vtk libraries
# - Don't link against QtNetwork
Patch0: engrid_build.patch
BuildRequires: desktop-file-utils
BuildRequires: qt-devel
BuildRequires: vtk-devel
BuildRequires: netgen-mesher-devel
BuildRequires: netcdf-cxx-devel
BuildRequires: tex(latex)
BuildRequires: texlive-helvetic texlive-ec
BuildRequires: tex(amsfonts.sty)
BuildRequires: tex(amsmath.sty)
BuildRequires: tex(amssymb.sty)
BuildRequires: tex(babel.sty)
BuildRequires: tex(boxedminipage.sty)
BuildRequires: tex(calc.sty)
BuildRequires: tex(color.sty)
BuildRequires: tex(fancyhdr.sty)
BuildRequires: tex(fontenc.sty)
BuildRequires: tex(graphicx.sty)
BuildRequires: tex(helvet.sty)
BuildRequires: tex(ifthen.sty)
BuildRequires: tex(inputenc.sty)
BuildRequires: tex(lastpage.sty)
BuildRequires: tex(layouts.sty)
BuildRequires: tex(natbib.sty)
BuildRequires: tex(setspace.sty)
BuildRequires: tex(titlesec.sty)
BuildRequires: tex(ucs.sty)
BuildRequires: tex(xspace.sty)
BuildRequires: tex(german.ldf)
# For blender version detection
BuildRequires: blender
Requires: hicolor-icon-theme
%description
enGrid is an open-source mesh generation software with CFD applications in mind.
enGrid uses the Netgen library for tetrahedral grid generation and an in-house
development for prismatic boundary layer grids. Internally, enGrid uses the VTK
data structures as well as the *.vtu file format.
%package blender
Summary: Blender scripts for enGrid
BuildArch: noarch
Requires: blender
%description blender
This package contains various Blender scripts for use with enGrid.
%package doc
Summary: Documentation and Tutorials for enGrid
BuildArch: noarch
%description doc
This package contains the documentation and tutorials for enGrid.
%prep
%autosetup -p1 -n enGits-engrid-%{shortcommit}
# Unbundle netgen
rm -rf src/ng_svn
# Fix bad permissions
chmod -x src/libengrid/egvtkinteractorstyle.h
chmod -x src/libengrid/egvtkinteractorstyle.cpp
chmod -x src/libengrid/createvolumemesh.cpp
%build
# Build application
pushd src
# export CXXFLAGS="$RPM_OPT_FLAGS"
export VTKINCDIR=%{_includedir}/vtk
export VTKLIBDIR=%{_libdir}/vtk
%_qt4_qmake CONFIG+=netcdf
make %{?_smp_mflags}
popd
# Build documentation
pushd manual
pdflatex main.tex
mv main.pdf manual.pdf
popd
%install
# Binary
install -Dpm 0755 src/engrid %{buildroot}%{_bindir}/engrid
# Shared library
install -Dpm 755 src/libengrid/libengrid.so.1.0.0 %{buildroot}%{_libdir}/libengrid.so.1.0.0
ln -s %{_libdir}/libengrid.so.1.0.0 %{buildroot}%{_libdir}/libengrid.so.1.0
ln -s %{_libdir}/libengrid.so.1.0.0 %{buildroot}%{_libdir}/libengrid.so.1
# Desktop file, icon
desktop-file-install \
--dir=%{buildroot}%{_datadir}/applications \
--set-icon=engrid \
--add-category=Science \
--remove-category=Education \
engrid.desktop
install -Dpm 0644 %{SOURCE1} %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/engrid.png
# Blender scripts
# Determine blender version
ver=`blender -v | grep -Eo '[0-9]\.[0-9]+'`
# Copy most recent version only
newest=`ls -1 src/blender_scripts/ | sort -n | tail -1`
install -dm 0755 %{buildroot}%{_datadir}/blender/$ver/scripts/addons
cp -a src/blender_scripts/$newest %{buildroot}%{_datadir}/blender/$ver/scripts/addons/engrid
# Manpage
install -Dpm 0644 debian/engrid.1 %{buildroot}%{_mandir}/man1/engrid.1
%post
/sbin/ldconfig
update-desktop-database &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%postun
/sbin/ldconfig
update-desktop-database &> /dev/null || :
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 licence.txt
%{_bindir}/engrid
%{_datadir}/applications/engrid.desktop
%{_datadir}/icons/hicolor/64x64/apps/engrid.png
%{_libdir}/libengrid.so.*
%{_mandir}/man1/engrid.1*
%files blender
%doc licence.txt
%{_datadir}/blender/*/scripts/addons/engrid/
%files doc
%doc licence.txt tutorials manual/manual.pdf
%changelog
* Thu Mar 19 2015 Orion Poplawski <orion@cora.nwra.com> - 1.4.0-6.gite6d55f5
- Rebuild for vtk 6.2.0
* Tue Oct 07 2014 Sandro Mani <manisandro@gmail.com> - 1.4.0-5.gite6d55f5
- Rebuild (netgen-mesher)
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.0-4.gite6d55f5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Wed Aug 06 2014 Sandro Mani <manisandro@gmail.com> - 1.4.0-3.gite6d55f5
- Install manpage
- Fix spurious executable permissions
* Wed Jul 30 2014 Sandro Mani <manisandro@gmail.com> - 1.4.0-2.gite6d55f5
- Don't rename license file
- Use desktop-file-install to set icon and fix category
- Add doc subpackage
- Add blender subpackage
- Update build patch to also link against vtk libraries, and not QtNetwork
* Thu Jun 19 2014 Sandro Mani <manisandro@gmail.com> - 1.4.0-1.gite6d55f5
- Initial package