4ad1335
# FIXME: polymake supposedly has Singular support, but it needs an older
4ad1335
# version of Singular than we have in Fedora.  See if it can be ported to the
4ad1335
# newer version with moderate effort.
4ad1335
Jerry James ba7c267
# TESTING NOTE: "make test" does not work, because the test drivers are not
Jerry James ba7c267
# distributed with the released sources.  A Subversion repository containing
Jerry James ba7c267
# all of the sources, including the test drivers, was made available recently.
Jerry James ba7c267
# Once the next release of polymake occurs, we will extract the necessary test
Jerry James ba7c267
# drivers from subversion and produce a check script.
Jerry James ba7c267
4ad1335
# Date of the "perpetual beta" subversion snapshot
Jerry James 74d8a20
%global svndate 20131128
Jerry James ba7c267
Jerry James ba7c267
Name:           polymake
Jerry James ba7c267
Version:        2.12
6304c47
Release:        13.svn%{svndate}%{?dist}
Jerry James ba7c267
Summary:        Algorithms on convex polytopes and polyhedra
Jerry James ba7c267
Jerry James ba7c267
License:        GPLv2+
Jerry James ba7c267
URL:            http://polymake.org/
4ad1335
#Source0:        http://polymake.org/lib/exe/fetch.php/download/%%{name}-%%{version}%%{rctag}.tar.bz2
4ad1335
# Sources taken from the polymake "perpetual beta".  Create the tarball thusly:
4ad1335
#   svn checkout --username "guest" --password "" http://polymake.mathematik.tu-darmstadt.de/svn/polymake/snapshots/%{svndate} polymake-%{version}
4ad1335
#   rm -fr polymake-%{version}/.svn polymake-%{version}/external/{cdd,lrs}
4ad1335
#   rm -fr polymake-%{version}/bundled/jreality/external/jreality/.svn
4ad1335
#   tar cjf polymake-%{version}.tar.bz2 polymake-%{version}
4ad1335
Source0:        %{name}-%{version}.tar.bz2
Jerry James ba7c267
# Man page written by Jerry James from text found in the sources.  Therefore,
Jerry James ba7c267
# the copyright and license are the same as for the sources.
Jerry James ba7c267
Source1:        %{name}.1
Jerry James ba7c267
# This patch will not be sent upstream, since it is Fedora-specific.  Link
Jerry James ba7c267
# against existing system libraries instead of building them from source,
Jerry James ba7c267
# and do not use -rpath.
Jerry James ba7c267
Patch0:         %{name}-fedora.patch
Jerry James aeaf3f3
# This patch was sent upstream 20 Mar 2013.  Fix a call to an lrslib function
Jerry James aeaf3f3
# that segfaults when given a NULL argument.
4ad1335
Patch1:         %{name}-lrslib.patch
Jerry James 215e348
# Avoid -Werror=format-security failures.
Jerry James 215e348
Patch2:         %{name}-format.patch
Jerry James ba7c267
Jerry James ba7c267
BuildRequires:  bliss-devel
4ad1335
BuildRequires:  boost-devel
Jerry James ba7c267
BuildRequires:  cddlib-devel
4ad1335
BuildRequires:  cmake
Jerry James 74d8a20
BuildRequires:  libnormaliz-devel
Jerry James ba7c267
BuildRequires:  libxml2-devel
Jerry James ba7c267
BuildRequires:  lrslib-devel
Jerry James ba7c267
BuildRequires:  mpfr-devel
Jerry James ba7c267
BuildRequires:  perl(ExtUtils::MakeMaker)
Jerry James ba7c267
BuildRequires:  perl(Term::ReadLine::Gnu)
Jerry James ba7c267
BuildRequires:  perl(XML::LibXSLT)
Jerry James ba7c267
BuildRequires:  perl(XML::SAX::Base)
Jerry James ba7c267
BuildRequires:  perl(XML::Writer)
Jerry James 74d8a20
BuildRequires:  ppl-devel
Jerry James ba7c267
BuildRequires:  sympol-devel
Jerry James ba7c267
BuildRequires:  xhtml1-dtds
Jerry James ba7c267
Jerry James ba7c267
Requires:       perl(:MODULE_COMPAT_%{perl_version})
Jerry James 5d77b35
Requires:       perl = 4:%{perl_version}
Jerry James 5d77b35
Requires:       perl(Term::ReadLine::Gnu)
Jerry James ba7c267
Jerry James ba7c267
%global sover   %(echo %{version} | cut -d. -f1-2)
Jerry James ba7c267
%global major   %(echo %{version} | cut -d. -f1)
Jerry James ba7c267
%global polydir %{_libdir}/%{name}
Jerry James ba7c267
Jerry James ba7c267
# Don't expose private shared objects or private perl interfaces
Jerry James ba7c267
%global __provides_exclude perl
Jerry James ba7c267
%global __provides_exclude_from ^%{polydir}/.*\\.so$
Jerry James ba7c267
Jerry James ba7c267
# Don't Require the private perl interfaces that we don't Provide.
6304c47
%global __requires_exclude perl\\\(it\\\)
6304c47
%global __requires_exclude %{__requires_exclude}|namespaces
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|BackgroundViewer
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Geomview
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Graphviz
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|InteractiveViewer
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Java
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|JReality
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Metapost
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Polymake
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Postscript
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Povray
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Sketch
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|SplitsTree
Jerry James ba7c267
%global __requires_exclude %{__requires_exclude}|Visual
Jerry James ba7c267
Jerry James ba7c267
%description
Jerry James ba7c267
Polymake is a tool to study the combinatorics and the geometry of convex
Jerry James ba7c267
polytopes and polyhedra.  It is also capable of dealing with simplicial
Jerry James ba7c267
complexes, matroids, polyhedral fans, graphs, tropical objects, and so
Jerry James ba7c267
forth.
Jerry James ba7c267
Jerry James ba7c267
Polymake can use various computational packages if they are installed.
Jerry James ba7c267
Those available from Fedora are: 4ti2, azove, gfan, latte-integrale,
Jerry James ba7c267
normaliz, ocaml-tplib-tools, qhull, Singular, TOPCOM, and vinci.
Jerry James ba7c267
Jerry James ba7c267
Polymake can interface with various visualization packages if they are
Jerry James ba7c267
installed.  Install one or more of the tools from the following list:
Jerry James ba7c267
evince, geomview, graphviz, gv, and okular.
Jerry James ba7c267
Jerry James ba7c267
%package devel
Jerry James ba7c267
Summary:        Development files for %{name}
Jerry James ba7c267
Requires:       %{name}%{?_isa} = %{version}-%{release}
Jerry James ba7c267
Jerry James ba7c267
%description devel
Jerry James ba7c267
This package contains header files and libraries for developing
Jerry James ba7c267
plugins (applications) that use %{name}.
Jerry James ba7c267
Jerry James ba7c267
%package doc
Jerry James ba7c267
Summary:        Documentation for %{name}
Jerry James ba7c267
Requires:       %{name}%{?_isa} = %{version}-%{release}
Jerry James ba7c267
Jerry James ba7c267
%description doc
Jerry James ba7c267
This package contains documentation for %{name}.
Jerry James ba7c267
Jerry James ba7c267
%prep
Jerry James ba7c267
%setup -q
Jerry James ba7c267
%patch0
Jerry James ba7c267
%patch1
Jerry James 215e348
%patch2
Jerry James ba7c267
Jerry James ba7c267
# Make sure we don't build against the bundled libraries.
4ad1335
rm -fr external/{cdd,lrs}
Jerry James ba7c267
Jerry James ba7c267
# Adapt to a newer version of sympol
Jerry James ba7c267
sed -i "s|yal/||;s|symmetrygroupconstruction/||" \
4ad1335
    bundled/group/apps/polytope/src/sympol_interface.cc
Jerry James ba7c267
Jerry James ba7c267
%build
4ad1335
export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/eigen3 -Wno-unused-local-typedefs"
4ad1335
export CXXFLAGS="$CFLAGS"
Jerry James ba7c267
export LDFLAGS="$RPM_LD_FLAGS -Wl,--as-needed"
Jerry James ba7c267
export Arch=%{_arch}
Jerry James ba7c267
# NOT an autoconf-generated configure script; do not use %%configure.
Jerry James ba7c267
./configure --build=%{_arch} --prefix=%{_prefix} --libdir=%{_libdir} \
4ad1335
  --libexecdir=%{polydir} --without-java --without-javaview
Jerry James ba7c267
make %{?_smp_mflags} all
Jerry James ba7c267
Jerry James ba7c267
# Help the debuginfo generator find generated files
Jerry James ba7c267
cd build.%{_arch}
4ad1335
cp -p perlx-*linux-*/CPlusPlus.xxs lib/core/CPlusPlus.xxs
4ad1335
cp -p perlx-*linux-*/CPlusPlus.cc lib/core/CPlusPlus.cc
Jerry James ba7c267
Jerry James ba7c267
%install
Jerry James ba7c267
# Don't recompile the main library with DESTDIR compiled in
Jerry James ba7c267
sed -i "/conf\.make/d" support/corelib.make
Jerry James ba7c267
Jerry James ba7c267
# The release-docs target copies docs to their installed locations
Jerry James ba7c267
export Arch=%{_arch}
Jerry James ba7c267
make install release-docs DESTDIR=%{buildroot}
Jerry James ba7c267
Jerry James ba7c267
# The apps have undefined weak symbols.  However, fixing that kills the
Jerry James ba7c267
# documentation building step for reasons I can't seem to track down.  So
Jerry James ba7c267
# instead, we wait until after the docs have been generated, then relink.
Jerry James ba7c267
sed -e 's|^Libs :=.*|& -L$(wildcard ${BuildDir}/perlx-*-linux-*) -lpolymake|' \
Jerry James ba7c267
    -i support/app.make
Jerry James ba7c267
sed -e 's|-lgmp ${LIBS}|& -L${PerlExtDir} -lpolymake|' \
Jerry James ba7c267
    -e 's|^${CoreLib} :.*|& ${CallableLib}|' \
Jerry James ba7c267
    -i support/corelib.make
Jerry James ba7c267
rm -f build.%{_arch}/lib/*.so
Jerry James ba7c267
make %{?_smp_mflags} all
Jerry James ba7c267
chmod 0755 %{buildroot}%{polydir}/lib/*.so
Jerry James ba7c267
cp -p build.%{_arch}/lib/*.so %{buildroot}%{polydir}/lib
Jerry James ba7c267
Jerry James ba7c267
# Install the man page
Jerry James ba7c267
mkdir -p %{buildroot}%{_mandir}/man1
Jerry James ba7c267
sed "s/@VERSION@/%{version}/" %{SOURCE1} > %{buildroot}%{_mandir}/man1/%{name}.1
Jerry James ba7c267
touch -r %{SOURCE1} %{buildroot}%{_mandir}/man1/%{name}.1
Jerry James ba7c267
Jerry James ba7c267
# We don't want the documentation in /usr/share/polymake
Jerry James ba7c267
mv %{buildroot}%{_datadir}/%{name}/doc .
Jerry James ba7c267
Jerry James ba7c267
# Remove stuff that shouldn't be installed
Jerry James ba7c267
rm -fr %{buildroot}%{_datadir}/%{name}/apps/*/src \
Jerry James ba7c267
  %{buildroot}%{_datadir}/%{name}/java_build \
Jerry James ba7c267
  %{buildroot}%{polydir}/perlx/*/*/auto/Polymake/Ext/{.packlist,Ext.bs} \
Jerry James ba7c267
  %{buildroot}%{polydir}/lib/jreality
Jerry James ba7c267
Jerry James ba7c267
# Fix permissions
Jerry James ba7c267
chmod 0755 %{buildroot}%{_bindir}/*
Jerry James ba7c267
chmod 0755 %{buildroot}%{_libdir}/lib*
Jerry James ba7c267
find %{buildroot}%{polydir} -name \*.so | xargs chmod 0755
Jerry James ba7c267
4ad1335
# Remove the buildroot from configuration files
4ad1335
sed -i 's,%{buildroot},,' %{buildroot}%{polydir}/bundled/bliss/conf.make
4ad1335
sed -i 's,%{buildroot},,' %{buildroot}%{polydir}/bundled/group/conf.make
Jerry James 74d8a20
sed -i 's,%{buildroot},,' %{buildroot}%{polydir}/bundled/libnormaliz/conf.make
Jerry James 74d8a20
sed -i 's,%{buildroot},,' %{buildroot}%{polydir}/bundled/ppl/conf.make
4ad1335
Jerry James ba7c267
%post -p /sbin/ldconfig
Jerry James ba7c267
Jerry James ba7c267
%postun -p /sbin/ldconfig
Jerry James ba7c267
Jerry James ba7c267
%files
Jerry James ba7c267
%{_bindir}/%{name}
Jerry James ba7c267
%{_mandir}/man1/%{name}.1*
4ad1335
%{_libdir}/lib%{name}*.so.*
Jerry James ba7c267
%{polydir}/
Jerry James ba7c267
%{_datadir}/%{name}/
Jerry James ba7c267
%exclude %{_datadir}/%{name}/lib/
Jerry James ba7c267
Jerry James ba7c267
%files devel
Jerry James ba7c267
%{_bindir}/%{name}-config
Jerry James ba7c267
%{_includedir}/%{name}/
Jerry James ba7c267
%{_datadir}/%{name}/lib/
4ad1335
%{_libdir}/lib%{name}*.so
Jerry James ba7c267
Jerry James ba7c267
%files doc
Jerry James ba7c267
%doc doc/*
Jerry James ba7c267
Jerry James ba7c267
%changelog
6304c47
* Sat Jan 18 2014 Jerry James <loganjerry@gmail.com> - 2.12-13.svn20131128
6304c47
- Update Requires filters
6304c47
Jerry James 74d8a20
* Fri Jan 17 2014 Jerry James <loganjerry@gmail.com> - 2.12-12.svn20131128
Jerry James 74d8a20
- Update to latest "perpetual beta" for bug fixes
Jerry James 74d8a20
- Enable building new ppl and libnormaliz extensions
Jerry James 74d8a20
Jerry James f884958
* Wed Jan  8 2014 Jerry James <loganjerry@gmail.com> - 2.12-11.svn20130813
Jerry James f884958
- Rebuild for perl 5.18.2
Jerry James 215e348
- Add -format patch to fix -Werror=format-security failure
Jerry James f884958
4ad1335
* Wed Aug 14 2013 Jerry James <loganjerry@gmail.com> - 2.12-10.svn20130813
4ad1335
- Update to latest "perpetual beta" for perl 5.18 compatibility (bz 992813)
4ad1335
e5f4d16
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-9
e5f4d16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
e5f4d16
78278d2
* Wed Jul 24 2013 Petr Pisar <ppisar@redhat.com> - 2.12-8
78278d2
- Perl 5.18 rebuild
78278d2
f14dd5b
* Sun Jul 21 2013 Rich Mattes <richmattes@gmail.com> - 2.12-7
f14dd5b
- Rebuild for eigen3-3.1.3
f14dd5b
Jerry James 5d77b35
* Wed May 15 2013 Jerry James <loganjerry@gmail.com> - 2.12-6
Jerry James 5d77b35
- Require version of perl used to build (bz 963486)
Jerry James 5d77b35
- perl(Term::ReadLine::Gnu) dependency is not autogenerated (bz 963486)
Jerry James 5d77b35
Jerry James aeaf3f3
* Wed Mar 20 2013 Jerry James <loganjerry@gmail.com> - 2.12-5
Jerry James aeaf3f3
- Add -lrslib patch to fix a segfault (bz 923269)
Jerry James aeaf3f3
Jerry James ba7c267
* Wed Feb 27 2013 Jerry James <loganjerry@gmail.com> - 2.12-4
Jerry James ba7c267
- Remove rpath and -L%%{_libdir} from polymake-config --ldflags output
Jerry James ba7c267
Jerry James ba7c267
* Thu Jan 24 2013 Jerry James <loganjerry@gmail.com> - 2.12-3
Jerry James ba7c267
- Also need to filter perl(Graphviz)
Jerry James ba7c267
Jerry James ba7c267
* Wed Jan 23 2013 Jerry James <loganjerry@gmail.com> - 2.12-2
Jerry James ba7c267
- Change -libs patch to also remove -rpath arguments
Jerry James ba7c267
- Filter Provides/Requires to hide private perl interfaces
Jerry James ba7c267
- Remove the broken check script and explain why
Jerry James ba7c267
Jerry James ba7c267
* Thu Jan 10 2013 Jerry James <loganjerry@gmail.com> - 2.12-1
Jerry James ba7c267
- Initial RPM