8fe3486
%{!?tcl_version: %global tcl_version %(echo 'puts $tcl_version' | tclsh)}
8fe3486
%{!?tcl_sitearch: %global tcl_sitearch %{_libdir}/tcl%{tcl_version}}
8fe3486
8fe3486
# Define a macro for calling ../configure instead of ./configure
8fe3486
%global dconfigure %(printf %%s '%configure' | sed 's!\./configure!../configure!g')
8fe3486
8fe3486
Name:           netgen-mesher
679c1a8
# Remember to adjust NGLIB_SO_VERSION in netgen-5.3.1_build.patch
1acaccb
Version:        5.3.1
679c1a8
Release:        2%{?dist}
8fe3486
Summary:        Automatic mesh generation tool
8fe3486
8fe3486
License:        LGPLv2
8fe3486
URL:            http://sourceforge.net/projects/netgen-mesher/
accac45
Source0:        http://sourceforge.net/projects/netgen-mesher/files/netgen-mesher/5.3/netgen-%{version}.tar.gz
8fe3486
Source1:        netgen-mesher.png
8fe3486
Source2:        netgen-mesher.desktop
8fe3486
# Fix various configure.ac and Makefiles issues:
8fe3486
# - Fix configure.ac to correctly detect dependencies
8fe3486
# - Fix makefile for togl
8fe3486
# - Rename shared libaries, the original names are often way too generic
8fe3486
# - Add missing libraries to LIBADD
8fe3486
# - Fix nglib invalid soname
1acaccb
Patch0:         netgen-5.3.1_build.patch
8fe3486
# Some fixes to the code (taken from salome netgen plugin)
accac45
Patch1:         netgen-5.3.0_fixes.patch
8fe3486
# Fix build against recent metis
accac45
Patch2:         netgen-5.3.0_metis.patch
8fe3486
# Set a default NETGENDIR appropriate for the fedora packaging
accac45
Patch3:         netgen-5.3.0_netgendir.patch
8fe3486
# Remove some MSC_VER ifdefs (why are they there?)
accac45
Patch4:         netgen-5.3.0_msc-ver.patch
8fe3486
# Make some includes relative (needed for when headers are in -private subpackage)
accac45
Patch5:         netgen-5.3.0_relative-includes.patch
8fe3486
8fe3486
BuildRequires:  autoconf automake libtool
8fe3486
BuildRequires:  tk-devel
8fe3486
BuildRequires:  OCE-devel
8fe3486
BuildRequires:  libjpeg-turbo-devel
8fe3486
BuildRequires:  tcl-togl-devel
8fe3486
BuildRequires:  metis-devel
8fe3486
BuildRequires:  openmpi-devel
86651b3
BuildRequires:  mpich-devel
8fe3486
BuildRequires:  mesa-libGLU-devel
8fe3486
BuildRequires:  libXmu-devel
8fe3486
BuildRequires:  desktop-file-utils
accac45
BuildRequires:  dos2unix
8fe3486
8fe3486
Requires:       %{name}-common = %{version}-%{release}
8fe3486
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
8fe3486
8fe3486
%description
8fe3486
NETGEN is an automatic 3d tetrahedral mesh generator. It accepts input from
8fe3486
constructive solid geometry (CSG) or boundary representation (BRep) from STL
8fe3486
file format. The connection to a geometry kernel allows the handling of IGES
8fe3486
and STEP files. NETGEN contains modules for mesh optimization and hierarchical
8fe3486
mesh refinement.
8fe3486
8fe3486
%package        common
8fe3486
Summary:        Common files for netgen
8fe3486
Requires:       hicolor-icon-theme
8fe3486
Requires:       tix
8fe3486
BuildArch:      noarch
8fe3486
8fe3486
%description    common
8fe3486
Common files for netgen.
8fe3486
8fe3486
%package        libs
8fe3486
Summary:        Netgen libraries
8fe3486
8fe3486
%description    libs
8fe3486
Netgen libraries.
8fe3486
8fe3486
%package        devel
8fe3486
Summary:        Development files for netgen
8fe3486
Requires:       %{name}%{?_isa} = %{version}-%{release}
8fe3486
8fe3486
%description    devel
8fe3486
Development files for netgen.
8fe3486
8fe3486
%package        devel-private
8fe3486
Summary:        Private headers of netgen
8fe3486
Requires:       %{name}-devel%{?_isa} = %{version}-%{release}
8fe3486
8fe3486
%description    devel-private
8fe3486
Private headers of netgen, needed to build certain netgen based software
8fe3486
packages.
8fe3486
8fe3486
###############################################################################
8fe3486
8fe3486
%package        openmpi
8fe3486
Summary:        Netgen compiled against openmpi
8fe3486
# Require explicitly for dir ownership and to guarantee the pickup of the right runtime
8fe3486
Requires:       openmpi
8fe3486
Requires:       %{name}-common = %{version}-%{release}
8fe3486
Requires:       %{name}-openmpi-libs%{?_isa} = %{version}-%{release}
8fe3486
8fe3486
%description    openmpi
8fe3486
Netgen compiled against openmpi.
8fe3486
8fe3486
%package        openmpi-libs
8fe3486
Summary:        Netgen libraries compiled against openmpi
8fe3486
8fe3486
%description    openmpi-libs
8fe3486
Netgen libraries compiled against openmpi.
8fe3486
8fe3486
%package        openmpi-devel
8fe3486
Summary:        Development files for Netgen compiled against openmpi
8fe3486
# Require explicitly for dir ownership
8fe3486
Requires:       openmpi-devel
8fe3486
Requires:       %{name}-openmpi%{?_isa} = %{version}-%{release}
8fe3486
8fe3486
%description    openmpi-devel
8fe3486
Development files for Netgen compiled against openmpi.
8fe3486
8fe3486
###############################################################################
8fe3486
8fe3486
%package        mpich
8fe3486
Summary:        Netgen compiled against mpich
8fe3486
# Require explicitly for dir ownership and to guarantee the pickup of the right runtime
8fe3486
Requires:       mpich
8fe3486
Requires:       %{name}-common = %{version}-%{release}
8fe3486
Requires:       %{name}-mpich-libs%{?_isa} = %{version}-%{release}
8fe3486
8fe3486
%description    mpich
8fe3486
Netgen compiled against mpich.
8fe3486
8fe3486
%package        mpich-libs
8fe3486
Summary:        Netgen libraries compiled against mpich
8fe3486
8fe3486
%description    mpich-libs
8fe3486
Netgen libraries compiled against mpich.
8fe3486
8fe3486
%package        mpich-devel
8fe3486
Summary:        Development files for Netgen compiled against mpich
8fe3486
# Require explicitly for dir ownership
8fe3486
Requires:       mpich-devel
8fe3486
Requires:       %{name}-mpich%{?_isa} = %{version}-%{release}
8fe3486
8fe3486
%description    mpich-devel
8fe3486
Development files for Netgen compiled against mpich.
8fe3486
8fe3486
###############################################################################
8fe3486
8fe3486
%prep
accac45
%setup -q -n netgen-%{version}
accac45
accac45
# Convert line endings
accac45
find . -type f -exec dos2unix {} \;
accac45
accac45
%patch0 -p1
accac45
%patch1 -p1
accac45
%patch2 -p1
accac45
%patch3 -p1
accac45
%patch4 -p1
accac45
%patch5 -p1
8fe3486
8fe3486
8fe3486
%build
8fe3486
autoreconf -ifv
8fe3486
### serial version ###
8fe3486
mkdir serial
8fe3486
(cd serial
8fe3486
%dconfigure --enable-occ --with-togl=%{tcl_sitearch}/Togl1.7 --enable-jpeglib \
8fe3486
           --includedir=%{_includedir}/%{name} --datadir=%{_datadir}/%{name}
8fe3486
#          --enable-ffmpeg
8fe3486
# Fix unused-direct-shlib-dependency
8fe3486
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
8fe3486
make %{?_smp_mflags}
8fe3486
)
8fe3486
8fe3486
### openmpi version ###
8fe3486
%{_openmpi_load}
8fe3486
export CXX=mpicxx
8fe3486
mkdir openmpi
8fe3486
(cd openmpi
8fe3486
%dconfigure --enable-occ --with-togl=%{tcl_sitearch}/Togl1.7 --enable-jpeglib --enable-parallel \
8fe3486
           --bindir=$MPI_BIN --libdir=$MPI_LIB --includedir=$MPI_INCLUDE/%{name} --datadir=%{_datadir}/%{name}
8fe3486
#          --enable-ffmpeg
8fe3486
# Fix unused-direct-shlib-dependency
8fe3486
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
8fe3486
make %{?_smp_mflags}
8fe3486
)
8fe3486
%{_openmpi_unload}
8fe3486
8fe3486
### mpich version ###
8fe3486
%{_mpich_load}
8fe3486
export CXX=mpicxx
8fe3486
mkdir mpich
8fe3486
(cd mpich
8fe3486
%dconfigure --enable-occ --with-togl=%{tcl_sitearch}/Togl1.7 --enable-jpeglib --enable-parallel \
8fe3486
           --bindir=$MPI_BIN --libdir=$MPI_LIB --includedir=$MPI_INCLUDE/%{name} --datadir=%{_datadir}/%{name}
8fe3486
#          --enable-ffmpeg
8fe3486
# Fix unused-direct-shlib-dependency
8fe3486
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
8fe3486
make %{?_smp_mflags}
8fe3486
)
8fe3486
%{_mpich_unload}
8fe3486
8fe3486
8fe3486
%install
8fe3486
%define writepkgconfig() \
8fe3486
install -d -m 0755 %{buildroot}/$MPI_LIB/pkgconfig; \
8fe3486
cat > %{buildroot}/$MPI_LIB/pkgconfig/%{name}.pc << EOF\
8fe3486
prefix=%{_prefix}\
8fe3486
exec_prefix=${prefix}\
8fe3486
libdir=$MPI_LIB\
8fe3486
includedir=$MPI_INCLUDE/%{name}\
8fe3486
\
8fe3486
Name: %{name}\
8fe3486
Description:  %{summary}\
8fe3486
Version: %{version}\
09745f5
Libs: -L\\\${libdir} -lnglib\
8fe3486
Libs.private: -lngcgs -lnggeom2d -lngmesh -lngocc -lngstl\
09745f5
Cflags: -I\\\${includedir}\
8fe3486
EOF\
8fe3486
%{nil}
8fe3486
8fe3486
### openmpi version ###
8fe3486
%{_openmpi_load}
8fe3486
%make_install -C openmpi
8fe3486
%writepkgconfig
8fe3486
# Avoid conflicts with netgen, remove data files (are correctly installed below)
8fe3486
mv %{buildroot}/$MPI_BIN/netgen %{buildroot}/$MPI_BIN/%{name}
8fe3486
rm -f %{buildroot}/$MPI_BIN/*.tcl rm -f %{buildroot}/$MPI_BIN/*.ocf
8fe3486
%{_openmpi_unload}
8fe3486
8fe3486
### mpich version ###
8fe3486
%{_mpich_load}
8fe3486
%make_install -C mpich
8fe3486
%writepkgconfig
8fe3486
# Avoid conflicts with netgen, remove data files (are correctly installed below)
8fe3486
mv %{buildroot}/$MPI_BIN/netgen %{buildroot}/$MPI_BIN/%{name}
8fe3486
rm -f %{buildroot}/$MPI_BIN/*.tcl rm -f %{buildroot}/$MPI_BIN/*.ocf
8fe3486
%{_mpich_unload}
8fe3486
8fe3486
### serial version ###
8fe3486
%make_install -C serial
8fe3486
export MPI_LIB=%{_libdir}
8fe3486
export MPI_INCLUDE=%{_includedir}
8fe3486
%writepkgconfig
8fe3486
# Avoid conflicts with netgen, move data files to correct place
8fe3486
mv %{buildroot}/%{_bindir}/netgen %{buildroot}/%{_bindir}/%{name}
8fe3486
mv %{buildroot}%{_bindir}/*.tcl %{buildroot}%{_bindir}/*.ocf %{buildroot}%{_datadir}/%{name}
8fe3486
chmod -x %{buildroot}%{_datadir}/%{name}/*.tcl %{buildroot}%{_datadir}/%{name}/*.ocf
8fe3486
8fe3486
find %{buildroot} -name '*.la' -exec rm -f {} ';'
8fe3486
8fe3486
# Install icon and desktop file
8fe3486
install -Dpm 0644 %SOURCE1 %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
8fe3486
desktop-file-install --dir %{buildroot}/%{_datadir}/applications/ %SOURCE2
8fe3486
8fe3486
# Delete the doc folder, the files are in %%doc below
8fe3486
rm -rf %{buildroot}/%{_datadir}/doc
8fe3486
8fe3486
# Install private headers
8fe3486
(
8fe3486
cd libsrc
8fe3486
find \( -name *.hpp -or -name *.hxx -or -name *.h -or -name *.ixx -or -name *.jxx \) -exec install -Dpm 0644 {} %{buildroot}%{_includedir}/%{name}/private/{} \;
8fe3486
)
8fe3486
8fe3486
8fe3486
%post common
8fe3486
update-desktop-database &> /dev/null || :
8fe3486
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
8fe3486
8fe3486
%postun common
8fe3486
update-desktop-database &> /dev/null || :
8fe3486
if [ $1 -eq 0 ] ; then
8fe3486
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
8fe3486
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
8fe3486
fi
8fe3486
8fe3486
%posttrans common
8fe3486
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
8fe3486
8fe3486
8fe3486
%post libs -p /sbin/ldconfig
8fe3486
8fe3486
%postun libs -p /sbin/ldconfig
8fe3486
8fe3486
8fe3486
%post openmpi-libs -p /sbin/ldconfig
8fe3486
8fe3486
%postun openmpi-libs -p /sbin/ldconfig
8fe3486
8fe3486
8fe3486
%post mpich-libs -p /sbin/ldconfig
8fe3486
8fe3486
%postun mpich-libs -p /sbin/ldconfig
8fe3486
8fe3486
8fe3486
%files common
8fe3486
%doc AUTHORS doc/ng4.pdf
8fe3486
%{_datadir}/%{name}/
8fe3486
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
8fe3486
%{_datadir}/applications/%{name}.desktop
8fe3486
8fe3486
%files
8fe3486
%{_bindir}/*
8fe3486
8fe3486
%files libs
8fe3486
%{_libdir}/*.so.*
8fe3486
8fe3486
%files devel
8fe3486
%{_includedir}/%{name}
8fe3486
%exclude %{_includedir}/%{name}/private
8fe3486
%{_libdir}/*.so
8fe3486
%{_libdir}/pkgconfig/%{name}.pc
8fe3486
8fe3486
%files devel-private
8fe3486
%{_includedir}/%{name}/private
8fe3486
8fe3486
%files openmpi
8fe3486
%{_libdir}/openmpi/bin/*
8fe3486
8fe3486
%files openmpi-libs
8fe3486
%{_libdir}/openmpi/lib/*.so.*
8fe3486
8fe3486
%files openmpi-devel
8fe3486
%{_includedir}/openmpi*/%{name}
8fe3486
%{_libdir}/openmpi/lib/*.so
8fe3486
%{_libdir}/openmpi/lib/pkgconfig/%{name}.pc
8fe3486
8fe3486
%files mpich
8fe3486
%{_libdir}/mpich/bin/*
8fe3486
8fe3486
%files mpich-libs
8fe3486
%{_libdir}/mpich/lib/*.so.*
8fe3486
8fe3486
%files mpich-devel
8fe3486
%{_includedir}/mpich*/%{name}
8fe3486
%{_libdir}/mpich/lib/*.so
8fe3486
%{_libdir}/mpich/lib/pkgconfig/%{name}.pc
8fe3486
8fe3486
8fe3486
%changelog
679c1a8
* Tue Oct 07 2014 Sandro Mani <manisandro@gmail.com> - 5.3.1-2
679c1a8
- Fix soname, use -release instead of -version-info
679c1a8
1acaccb
* Mon Oct 06 2014 Sandro Mani <manisandro@gmail.com> - 5.3.1-1
1acaccb
- Update to 5.3.1
1acaccb
accac45
* Mon Sep 01 2014 Sandro Mani <manisandro@gmail.com> - 5.3.0-1
accac45
- Update to 5.3.0
accac45
7890d57
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1-11
7890d57
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
7890d57
d714f69
* Tue Jul 29 2014 Sandro Mani <manisandro@gmail.com> - 5.1-10
d714f69
- Rebuild (OCE)
d714f69
86651b3
* Thu Jun 19 2014 Sandro Mani <manisandro@gmail.com> - 5.1-9
86651b3
- Add missing mpich-devel BR
86651b3
09745f5
* Thu Jun 19 2014 Sandro Mani <manisandro@gmail.com> - 5.1-8
09745f5
- Fix escaping of pkg-config variables
09745f5
8fe3486
* Sat Jun 14 2014 Sandro Mani <manisandro@gmail.com> - 5.1-7
8fe3486
- Rename subpackage private -> devel-private
8fe3486
8fe3486
* Sat Jun 14 2014 Sandro Mani <manisandro@gmail.com> - 5.1-6
8fe3486
- Add netgen-5.1_relative-includes.patch
8fe3486
8fe3486
* Sat Jun 14 2014 Sandro Mani <manisandro@gmail.com> - 5.1-5
8fe3486
- Add subpackage for private headers
8fe3486
- Add patches from salome
8fe3486
- Make common package noarch
8fe3486
- Add missing %%{?_isa}
8fe3486
8fe3486
* Fri Jun 13 2014 Sandro Mani <manisandro@gmail.com> - 5.1-4
8fe3486
- Update netgen-5.1_build.patch
8fe3486
- Add netgen-5.1_msc-ver.patch
8fe3486
8fe3486
* Thu Jun 12 2014 Sandro Mani <manisandro@gmail.com> - 5.1-3
8fe3486
- Fix libgnlib soname
8fe3486
8fe3486
* Thu Jun 12 2014 Sandro Mani <manisandro@gmail.com> - 5.1-2
8fe3486
- Split off libraries in libs subpackages
8fe3486
- Rename shared libraries to less generic names
8fe3486
8fe3486
* Thu Jun 12 2014 Sandro Mani <manisandro@gmail.com> - 5.1-1
8fe3486
- Initial package