Blob Blame History Raw
%global fortiver 1.6.2
%global fortirel 8
%global lattever 1.7.2
%global latterel 2

Name:           latte-integrale
Version:        %{lattever}
Release:        %{latterel}%{?dist}
Summary:        Lattice point enumeration

License:        GPLv2+
URL:            https://www.math.ucdavis.edu/~latte/software.php
Source0:        https://www.math.ucdavis.edu/~latte/software/packages/latte_current/%{name}-%{version}.tar.gz
Source1:        4ti2.module.in
# Fix warnings that indicate possible runtime problems.
Patch0:         %{name}-warning.patch

BuildRequires:  cddlib-devel
BuildRequires:  cddlib-tools
BuildRequires:  glpk-devel
BuildRequires:  lrslib-utils
BuildRequires:  ntl-devel
BuildRequires:  sqlite-devel
BuildRequires:  TOPCOM

Requires:       cddlib-tools
Requires:       TOPCOM

# latte-integrale contains a copy of gnulib, which has been granted a bundling
# exception: https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries#Packages_granted_exceptions
Provides:       bundled(gnulib)

%description
LattE (Lattice point Enumeration) is a computer software dedicated to
the problems of counting lattice points and integration inside convex
polytopes.  LattE contains the first ever implementation of Barvinok's
algorithm.  The LattE macchiato version (by M. Köppe) incorporated
fundamental improvements and speed ups.  Now the latest version, LattE
integrale, has the ability to directly compute integrals of polynomial
functions over polytopes and in particular to do volume computations.

%package -n 4ti2
Version:        %{fortiver}
Release:        %{fortirel}%{?dist}
Summary:        A software package for problems on linear spaces
Requires:       4ti2-libs%{?_isa} = %{fortiver}-%{fortirel}%{?dist}
Requires:       environment-modules

%description -n 4ti2
A software package for algebraic, geometric and combinatorial problems
on linear spaces.

This package uses Environment Modules, to load the binaries onto
your PATH you will need to run module load 4ti2-x86_64

%package -n 4ti2-devel
Version:        %{fortiver}
Release:        %{fortirel}%{?dist}
Summary:        Headers needed to develop software that uses 4ti2
Requires:       4ti2-libs%{?_isa} = %{fortiver}-%{fortirel}%{?dist}
Requires:       gmp-devel%{?_isa}

%description -n 4ti2-devel
Headers and library files needed to develop software that uses 4ti2.

%package -n 4ti2-libs
Version:        %{fortiver}
Release:        %{fortirel}%{?dist}
Summary:        Library files for programs that use 4ti2

%description -n 4ti2-libs
Library files for programs that use 4ti2.

%prep
%setup -q

# Don't use bundled software; also delete the unused LiDIA files
rm -f cddlib* glpk* gmp* lidia* ntl*

# Unpack 4ti2 and latte-integrale
tar xzf 4ti2-%{fortiver}.tar.gz
tar xzf latte-int-%{lattever}.tar.gz

# Fix encodings
cd 4ti2-%{fortiver}
iconv -f ISO8859-1 -t UTF-8 NEWS > NEWS.utf8
touch -r NEWS NEWS.utf8
mv -f NEWS.utf8 NEWS

# Patch latte-integrale
cd ../latte-int-%{lattever}
%patch0

# Fix the cddlib search path, lrslib binary name
sed -e "s|cdd\.h|cddlib/cdd.h|" -e "s/lrs1/lrs/" -i configure

# Maybe fix the 4ti2 library search path
if [ %{__isa_bits} = "64" ]; then
  sed -i "s|{FORTYTWO_HOME}/lib|&64|" configure
fi

# Some tests fail because they timeout on slower processors.  Eliminate the
# timeouts and let koji kill us if a test infloops.
sed -i 's/ulimit -t $MAXRUNTIME; //' code/test-suite/test.pl.in

%build
# Build 4ti2 first
cd 4ti2-%{fortiver}
%configure --enable-shared --disable-static LIBS="-lgmpxx -lgmp" \
  CPPFLAGS="-D_GNU_SOURCE=1"

# Get rid of undesirable hardcoded rpaths; workaround libtool reordering
# -Wl,--as-needed after all the libraries.
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
    -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
    -e 's|CC="\(g..\)"|CC="\1 -Wl,--as-needed"|' \
    -i libtool

make %{?_smp_mflags}

# Do a fake install of 4ti2 for building latte-integrale
mkdir ../local
make install DESTDIR=$PWD/../local
sed -i "s,%{_libdir}/lib4ti2,$PWD/../local&," ../local%{_libdir}/*.la

# Now build latte-integrale itself
cd ../latte-int-%{lattever}
%configure --enable-DATABASE --enable-shared --disable-static \
  --with-4ti2=$PWD/../local/%{_prefix} \
  CPPFLAGS="-I%{_includedir}/cddlib -D_GNU_SOURCE=1 -DNTL_STD_CXX"

# Get rid of undesirable hardcoded rpaths; workaround libtool reordering
# -Wl,--as-needed after all the libraries.
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
    -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
    -e 's|CC="\(g..\)"|CC="\1 -Wl,--as-needed"|' \
    -i libtool

make %{?_smp_mflags}

%install
# Install 4ti2
cd 4ti2-%{fortiver}
%make_install
mkdir -p %{buildroot}%{_includedir}/tmp
mv %{buildroot}%{_includedir}/{4ti2,groebner,util,zsolve} \
   %{buildroot}%{_includedir}/tmp
mv %{buildroot}%{_includedir}/tmp %{buildroot}%{_includedir}/4ti2

# Move the 4ti2 binaries
mkdir -p %{buildroot}%{_libdir}/4ti2
mv %{buildroot}%{_bindir} %{buildroot}%{_libdir}/4ti2

# Make the environment-modules file
mkdir -p %{buildroot}%{_datadir}/Modules/modulefiles/
# Since we're doing our own substitution here, use our own definitions.
sed 's#@LIBDIR@#'%{_libdir}/4ti2'#g;' < %SOURCE1 >%{buildroot}%{_datadir}/Modules/modulefiles/4ti2-%{_arch} 

# Install latte-integrale
cd ../latte-int-%{lattever}
%make_install

# Some binaries have too-generic names
for bin in count integrate triangulate; do
  mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/latte-$bin
done

# We don't need or want libtool files
rm -f %{buildroot}%{_libdir}/*.la

# Internal libraries only; don't install the .so since there are no headers
rm -f %{buildroot}%{_libdir}/lib{latte,normalize}.so

# We don't want documentation and examples in _datadir
mkdir -p %{buildroot}%{_datadir}/doc
mv %{buildroot}%{_datadir}/4ti2/doc %{buildroot}%{_docdir}/4ti2
rmdir %{buildroot}%{_datadir}/4ti2
mv %{buildroot}%{_datadir}/latte-int _docs_staging

# Install missing documentation files
cp -p AUTHORS TODO _docs_staging

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n 4ti2-libs -p /sbin/ldconfig

%postun -n 4ti2-libs -p /sbin/ldconfig

%check
export LD_LIBRARY_PATH=$PWD/local/%{_libdir}:$PWD/latte-int-%{lattever}/code/latte/.libs

# Check 4ti2
cd 4ti2-%{fortiver}
make check

# Check LattE
cd ../latte-int-%{lattever}
make check

%files
%doc latte-int-%{lattever}/_docs_staging/*
%license latte-int-%{lattever}/COPYING
%{_bindir}/*
%{_libdir}/liblatte.so.*
%{_libdir}/libnormalize.so.*

%files -n 4ti2
%{_docdir}/4ti2/
%{_libdir}/4ti2/
%{_datadir}/Modules/modulefiles/4ti2-%{_arch}

%files -n 4ti2-devel
%{_includedir}/4ti2/
%{_libdir}/lib4ti2*.so
%{_libdir}/libzsolve*.so

%files -n 4ti2-libs
%doc 4ti2-%{fortiver}/NEWS 4ti2-%{fortiver}/README 4ti2-%{fortiver}/TODO
%license 4ti2-%{fortiver}/COPYING
%{_libdir}/lib4ti2*.so.*
%{_libdir}/libzsolve*.so.*

%changelog
* Thu Jan 15 2015 Jerry James <loganjerry@gmail.com> - 1.7.2-2
- Rebuild for ntl 8.1.0

* Mon Nov 10 2014 Jerry James <loganjerry@gmail.com> - 1.7.2-1
- New upstream release

* Tue Oct 28 2014 Jerry James <loganjerry@gmail.com> - 1.7.1-6
- Rebuild for ntl 6.2.1

* Thu Aug 21 2014 Jerry James <loganjerry@gmail.com> - 1.7.1-5
- Fix mass rebuild failure
- Fix license handling

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7.1-4.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Tue Jun 10 2014 Jerry James <loganjerry@gmail.com> - 1.7.1-4
- Rebuild to fix internal 4ti2 dependencies

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7.1-3.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Apr  2 2014 Jerry James <loganjerry@gmail.com> - 1.7.1-3
- Rebuild for ntl 6.1.0

* Tue Feb 11 2014 Jerry James <loganjerry@gmail.com> - 1.7.1-2
- There is a dist tag for a reason; use it on the 4ti2 packages

* Mon Feb 10 2014 Jerry James <loganjerry@gmail.com> - 1.7.1-1
- New upstream release
- Drop upstreamed 4ti2-glpk patch
- Fix documentation snafu caused by the docdir change

* Tue Jan  7 2014 Jerry James <loganjerry@gmail.com> - 1.7-2
- Bump and rebuild (releng ticket 5827)

* Mon Jan  6 2014 Jerry James <loganjerry@gmail.com> - 1.7-1
- New upstream release

* Tue Sep 10 2013 Jerry James <loganjerry@gmail.com> - 1.6-1
- New upstream release
- Drop upstreamed 4ti2-gaussian and 4ti2-gcc47 patches
- Remove incorrect Obsoletes/Provides for 4ti2

* Fri Aug  2 2013 Ville Skyttä <ville.skytta@iki.fi> - 1.5.3-10
- Use special %%doc to install docs in order to honor %%{_docdir_fmt}.

* Wed Jul 31 2013 Jerry James <loganjerry@gmail.com> - 1.5.3-9
- Add 4ti2-glpk.patch to fix build with new glpk

* Mon May  6 2013 Jerry James <loganjerry@gmail.com> - 1.5.3-8
- Add 4ti2-gaussian.patch to fix a segfault (bz 911437)
- Rename some too-generically named binaries (bz 913684)

* Sat Feb  2 2013 Jerry James <loganjerry@gmail.com> - 1.5.3-7
- Rebuild for new glpk

* Tue Jan 22 2013 Jerry James <loganjerry@gmail.com> - 1.5.3-6
- Build with _GNU_SOURCE defined to get long options, too
- Remove test timeouts so tests don't die spuriously on ARM (bz 893158)

* Mon Dec 10 2012 Jerry James <loganjerry@gmail.com> - 1.5.3-5
- Fix the name of the private bin directory too (bz 882574)

* Wed Dec  5 2012 Jerry James <loganjerry@gmail.com> - 1.5.3-4
- Fix the name of the environment module (bz 882574)

* Wed Nov 21 2012 Jerry James <loganjerry@gmail.com> - 1.5.3-3
- Add Obsoletes and Provides for the old 4ti2 package

* Mon Nov 19 2012 Jerry James <loganjerry@gmail.com> - 1.5.3-2
- Fix 4ti2 subpackage dependencies on 4ti2-libs
- Convert 4ti2's NEWS to utf-8
- Add missing doc files to the main package
- BR TOPCOM to get points2triangs and point2placingtriang

* Sat Oct  6 2012 Jerry James <loganjerry@gmail.com> - 1.5.3-1
- Initial RPM