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
Jerry James ba7c267
# Release candidates are sometimes promoted to release without removing the tag
Jerry James ba7c267
%global rctag -rc3
Jerry James ba7c267
Jerry James ba7c267
Name:           polymake
Jerry James ba7c267
Version:        2.12
Jerry James ba7c267
Release:        4%{?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/
Jerry James ba7c267
Source0:        http://polymake.org/lib/exe/fetch.php/download/%{name}-%{version}%{rctag}.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 ba7c267
# This patch was sent upstream 1 Mar 2012.  Polymake uses nauty, which has a
Jerry James ba7c267
# non-free license.  This patch converts polymake to bliss, which is free.
Jerry James ba7c267
Patch1:         %{name}-bliss.patch
Jerry James ba7c267
# Patch from upstream: adapt the sources to perl >= 5.15.
Jerry James ba7c267
Patch2:         %{name}-perl.patch
Jerry James ba7c267
Jerry James ba7c267
BuildRequires:  bliss-devel
Jerry James ba7c267
BuildRequires:  cddlib-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 ba7c267
BuildRequires:  sympol-devel
Jerry James ba7c267
BuildRequires:  xhtml1-dtds
Jerry James ba7c267
Jerry James ba7c267
Requires:       perl(:MODULE_COMPAT_%{perl_version})
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.
Jerry James ba7c267
%global __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 ba7c267
%patch2
Jerry James ba7c267
Jerry James ba7c267
# Make sure we don't build against the bundled libraries.
Jerry James ba7c267
# Don't delete the jreality directory, though, or the installer crashes.
Jerry James ba7c267
rm -fr external/{cdd,lrs,nauty,permlib,sympol}
Jerry James ba7c267
Jerry James ba7c267
# Don't force -O3
Jerry James ba7c267
sed -i "s/-O3//" support/configure.pl
Jerry James ba7c267
Jerry James ba7c267
# Give the main library an soname (markers added by the -libs patch)
Jerry James ba7c267
sed -i "s/@VERSION@/%{sover}/;s/@MAJVER@/%{major}/" support/corelib.make
Jerry James ba7c267
Jerry James ba7c267
# Adapt to a newer version of sympol
Jerry James ba7c267
sed -i "s|yal/||;s|symmetrygroupconstruction/||" \
Jerry James ba7c267
    apps/polytope/src/sympol_interface.cc
Jerry James ba7c267
Jerry James ba7c267
%build
Jerry James ba7c267
export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/eigen3"
Jerry James ba7c267
export CXXFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/eigen3"
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} \
Jerry James ba7c267
  --libexecdir=%{polydir} --without-java
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}
Jerry James ba7c267
cp -p perlx-*linux-*/CPlusPlus.xxs lib/CPlusPlus.xxs
Jerry James ba7c267
cp -p perlx-*linux-*/CPlusPlus.cc lib/CPlusPlus.xxs.c
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
# Fix up the shared library links
Jerry James ba7c267
mv %{buildroot}%{_libdir}/lib%{name}.so \
Jerry James ba7c267
   %{buildroot}%{_libdir}/lib%{name}.so.%{version}
Jerry James ba7c267
ln -s lib%{name}.so.%{version} %{buildroot}%{_libdir}/lib%{name}.so.%{major}
Jerry James ba7c267
ln -s lib%{name}.so.%{major} %{buildroot}%{_libdir}/lib%{name}.so
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
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
%doc COPYING
Jerry James ba7c267
%{_bindir}/%{name}
Jerry James ba7c267
%{_mandir}/man1/%{name}.1*
Jerry James ba7c267
%{_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/
Jerry James ba7c267
%{_libdir}/lib%{name}.so
Jerry James ba7c267
Jerry James ba7c267
%files doc
Jerry James ba7c267
%doc doc/*
Jerry James ba7c267
Jerry James ba7c267
%changelog
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