[polymake] Rebuild for Singular 3-1-6. Add configuration workarounds for Singular support.
Jerry James
jjames at fedoraproject.org
Wed May 28 22:25:16 UTC 2014
commit 80eaa735d1769bc428c50e4be6aa7f6555d9a7ae
Author: Jerry James <jamesjer at betterlinux.com>
Date: Wed May 28 16:25:03 2014 -0600
Rebuild for Singular 3-1-6.
Add configuration workarounds for Singular support.
libsingular-config | 72 +++++++++++++++++++++
polymake-singular.patch | 161 ++++++++++++++++++++++++++++------------------
polymake.spec | 27 +++++++--
3 files changed, 192 insertions(+), 68 deletions(-)
---
diff --git a/libsingular-config b/libsingular-config
new file mode 100755
index 0000000..435eac1
--- /dev/null
+++ b/libsingular-config
@@ -0,0 +1,72 @@
+#! /bin/sh
+
+prefix=/usr
+exec_prefix=/usr
+includedir=/usr/include/singular
+
+usage()
+{
+ cat <<EOF
+Usage: libsingular-config [OPTION]
+
+Known values for OPTION are:
+
+ --prefix show libsingular installation prefix
+ --libs print library linking information
+ --cflags print pre-processor and compiler flags
+ --help display this help and exit
+ --version output version information
+
+EOF
+
+ exit $1
+}
+
+if test $# -eq 0; then
+ usage 1
+fi
+
+cflags=false
+libs=false
+
+while test $# -gt 0; do
+ case "$1" in
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ case "$1" in
+ --prefix=*)
+ prefix=$optarg
+ ;;
+
+ --prefix)
+ echo $prefix
+ ;;
+
+ --version)
+ echo 1.15
+ exit 0
+ ;;
+
+ --help)
+ usage 0
+ ;;
+
+ --cflags)
+ echo -I$includedir
+ ;;
+
+ --libs)
+ echo -lsingular
+ ;;
+
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+exit 0
diff --git a/polymake-singular.patch b/polymake-singular.patch
index c84a300..2a26012 100644
--- a/polymake-singular.patch
+++ b/polymake-singular.patch
@@ -1,68 +1,103 @@
---- ./bundled/singular/apps/ideal/src/singularIdeal.cc.orig 2014-04-04 12:57:29.000000000 -0600
-+++ ./bundled/singular/apps/ideal/src/singularIdeal.cc 2014-04-07 11:24:49.447637191 -0600
-@@ -123,16 +123,16 @@ public:
- arg.rtyp=IDEAL_CMD;
- arg.data=(void *)idCopy(singIdeal);
- // call radical
-- BOOLEAN res=iiMake_proc(radical,NULL,&arg);
-- if (res) {
-+ leftv res=iiMake_proc(radical,NULL,&arg);
-+ if (!res) {
- errorreported = 0;
-- iiRETURNEXPR.Init();
-+ iiRETURNEXPR->Init();
- throw std::runtime_error("radical returned an error");
- }
-- SingularIdeal_wrap* radical_wrap = new SingularIdeal_impl((::ideal) (iiRETURNEXPR.Data()), singRing);
-+ SingularIdeal_wrap* radical_wrap = new SingularIdeal_impl((::ideal) (iiRETURNEXPR->Data()), singRing);
- // FIXME cleanup iiRETURNEXPR ?
-- iiRETURNEXPR.CleanUp();
-- iiRETURNEXPR.Init();
-+ iiRETURNEXPR->CleanUp();
-+ iiRETURNEXPR->Init();
- return radical_wrap;
- }
+--- ./bundled/singular/apps/ideal/include/singularInit.h.orig 2014-04-04 12:57:29.000000000 -0600
++++ ./bundled/singular/apps/ideal/include/singularInit.h 2014-05-28 12:00:00.000000000 -0600
+@@ -22,9 +22,9 @@
+ #define POLYMAKE_IDEAL_SINGULAR_INIT_H
+
+ // Singular includes
+-#include <Singular/libsingular.h>
+-#include "kernel/GBEngine/stairc.h"
+-#include "coeffs/mpr_complex.h"
++#include <libsingular.h>
++#include <singular/stairc.h>
++#include <singular/mpr_complex.h>
+
+ // polymake includes
+ #include "polymake/client.h"
+--- ./bundled/singular/apps/ideal/include/singularTermOrderData.h.orig 2014-04-04 12:57:29.000000000 -0600
++++ ./bundled/singular/apps/ideal/include/singularTermOrderData.h 2014-05-28 12:00:00.000000000 -0600
+@@ -23,7 +23,7 @@
+ #include "polymake/Polynomial.h"
+ //#include "polymake/internal/shared_object.h"
+
+-#include <Singular/libsingular.h>
++#include <libsingular.h>
-@@ -145,9 +145,9 @@ public:
- arg.rtyp=IDEAL_CMD;
- arg.data=(void *)idCopy(singIdeal);
- // call primdecSY
-- BOOLEAN res=iiMake_proc(primdecSY,NULL,&arg);
-- if(!res && (iiRETURNEXPR.Typ() == LIST_CMD)){
-- lists L = (lists)iiRETURNEXPR.Data();
-+ leftv res=iiMake_proc(primdecSY,NULL,&arg);
-+ if(res && (iiRETURNEXPR->Typ() == LIST_CMD)){
-+ lists L = (lists)iiRETURNEXPR->Data();
- Array<SingularIdeal_wrap*> result(L->nr+1);
- for(int j=0; j<=L->nr; j++){
- lists LL = (lists)L->m[j].Data();
-@@ -158,11 +158,11 @@ public:
- }
- }
- // FIXME cleanup returndata ?
-- iiRETURNEXPR.CleanUp();
-- iiRETURNEXPR.Init();
-+ iiRETURNEXPR->CleanUp();
-+ iiRETURNEXPR->Init();
- return result;
- } else {
-- iiRETURNEXPR.Init();
-+ iiRETURNEXPR->Init();
- throw std::runtime_error("Something went wrong for the primary decomposition");
+ namespace polymake {
+ namespace ideal {
+--- ./bundled/singular/apps/ideal/src/singularConvertTypes.cc.orig 2014-04-04 12:57:29.000000000 -0600
++++ ./bundled/singular/apps/ideal/src/singularConvertTypes.cc 2014-05-28 12:00:00.000000000 -0600
+@@ -57,7 +57,7 @@ number convert_Rational_to_number(const
+ mpz_set(num,numerator(r).get_rep());
+ mpz_init(denom);
+ mpz_set(denom,denominator(r).get_rep());
+- return nlInit2gmp(num,denom,NULL);
++ return nlInit2gmp(num,denom);
+ }
+
+
+@@ -90,7 +90,7 @@ poly convert_Polynomial_to_poly(const Po
+ p_SetExp(monomial,k+1,term->first[k],ring);
}
+ p_Setm(monomial,ring);
+- p = p_Sub(p, monomial,ring);
++ p = p_Add_q(p, p_Neg(monomial, ring), ring);
}
-@@ -184,11 +184,11 @@ public:
- int plevel = printlevel;
- printlevel=-1;
- // call solve
-- BOOLEAN res=iiMake_proc(solve,NULL,&arg);
-+ leftv res=iiMake_proc(solve,NULL,&arg);
- printlevel=plevel;
-- if(!res && (iiRETURNEXPR.Typ() == RING_CMD)){
-+ if(res && (iiRETURNEXPR->Typ() == RING_CMD)){
- // retrieve returned ring
-- ring solring = (ring)iiRETURNEXPR.Data();
-+ ring solring = (ring)iiRETURNEXPR->Data();
+ return p;
+ }
+--- ./bundled/singular/apps/ideal/src/singularIdeal.cc.orig 2014-04-04 12:57:29.000000000 -0600
++++ ./bundled/singular/apps/ideal/src/singularIdeal.cc 2014-05-28 12:00:00.000000000 -0600
+@@ -106,7 +106,7 @@ public:
+
+ SingularIdeal_wrap* initial_ideal() const {
+ check_ring(singRing);
+- ::ideal res = id_Head(singIdeal,IDRING(singRing));
++ ::ideal res = idHead(singIdeal);
+ SingularIdeal_wrap* initial = new SingularIdeal_impl(res,singRing);
+ id_Delete(&res,currRing);
+ return initial;
+@@ -191,12 +191,12 @@ public:
+ ring solring = (ring)iiRETURNEXPR.Data();
// avoid redefinition message
BITSET oldverb;
- SI_SAVE_OPT2(oldverb);
+- SI_SAVE_OPT2(oldverb);
+- si_opt_2 &= ~Sy_bit(V_REDEFINE);
++ oldverb = verbose;
++ verbose &= ~Sy_bit(V_REDEFINE);
+ // switch to the new returned ring
+ idhdl solRingHdl=enterid("solveRing", 0, RING_CMD, &IDROOT, FALSE);
+ IDRING(solRingHdl)=solring;
+- SI_RESTORE_OPT2(oldverb);
++ verbose = oldverb;
+ rSetHdl(solRingHdl);
+ // retrieve solution list SOL from the interpreter
+ idhdl sol = ggetid("SOL");
+--- ./bundled/singular/apps/ideal/src/singularInit.cc.orig 2014-04-04 12:57:29.000000000 -0600
++++ ./bundled/singular/apps/ideal/src/singularInit.cc 2014-05-28 12:00:00.000000000 -0600
+@@ -84,8 +84,8 @@ void init_singular()
+ cerr << "*** singular siInit done. ***" << endl;
+ #else
+ // make singular library loading quiet
+- si_opt_2 &= ~Sy_bit(V_LOAD_LIB);
+- si_opt_2 &= ~Sy_bit(V_REDEFINE);
++ verbose &= ~Sy_bit(V_LOAD_LIB);
++ verbose &= ~Sy_bit(V_REDEFINE);
+ #endif
+ singular_initialized = 1;
+ }
+--- ./bundled/singular/configure.pl.orig 2014-04-04 12:57:29.000000000 -0600
++++ ./bundled/singular/configure.pl 2014-05-28 12:00:00.000000000 -0600
+@@ -45,12 +45,12 @@ sub proceed {
+ chomp $singularprefix;
+ # yes we need it twice ...
+
+- $Libs = join(" ",$LDflags =~ m/(-l\w+)/g) . " -lpolys -lomalloc";
++ $Libs = join(" ",$LDflags =~ m/(-l\w+)/g) . " -lsingular";
+ $LDflags =~ s/ -l\w+//g;
+ $LDflags =~ s/-L(\S+)/-L$1 -Wl,-rpath,$1/g;
+
+ my $error=Polymake::Configure::build_test_program(<<"---", CXXflags => $CXXflags, LDflags => $LDflags, Libs => $Libs);
+-#include "Singular/libsingular.h"
++#include "libsingular.h"
+ #include <string>
+ int main() {
+ char* cpath = omStrDup("$singularprefix/lib/libSingular.$lib_ext");
diff --git a/polymake.spec b/polymake.spec
index 86eaf8f..a3080b7 100644
--- a/polymake.spec
+++ b/polymake.spec
@@ -8,14 +8,14 @@
# rebuilt, because each BRs the other and both are linked against the old
# version of the library. Use this to rebuild polymake without Singular
# support, rebuild Singular, then build polymake again with Singular support.
-%bcond_with singular
+%bcond_without singular
# Date of the "perpetual beta" subversion snapshot
#%%global svndate 20140326
Name: polymake
Version: 2.13
-Release: 2%{?svndate:.svn%{svndate}}%{?dist}
+Release: 3%{?svndate:.svn%{svndate}}%{?dist}
Summary: Algorithms on convex polytopes and polyhedra
License: GPLv2+
@@ -24,6 +24,8 @@ Source0: http://polymake.org/lib/exe/fetch.php/download/%{name}-%{version
# Man page written by Jerry James from text found in the sources. Therefore,
# the copyright and license are the same as for the sources.
Source1: %{name}.1
+# Fake libsingular-config file to fool the configuration scripts.
+Source2: libsingular-config
# This patch will not be sent upstream, since it is Fedora-specific. Link
# against existing system libraries instead of building them from source,
# and do not use -rpath.
@@ -33,8 +35,8 @@ Patch0: %{name}-fedora.patch
Patch1: %{name}-lrslib.patch
# Avoid -Werror=format-security failures.
Patch2: %{name}-format.patch
-# Adapt to the old version of Singular in Fedora. Remove this once the
-# Singular package is updated to version 3-1-6 or later.
+# Fedora-specific patch. Upstream code is written for Singular-3-1-6 + git,
+# but we have vanilla Singular-3-1-6. This patch adapts to the older Singular.
Patch3: %{name}-singular.patch
BuildRequires: bliss-devel
@@ -130,13 +132,24 @@ rm -fr external/{cdd,lrs}
sed -i "s|yal/||;s|symmetrygroupconstruction/||" \
bundled/group/apps/polytope/src/sympol_interface.cc
+# Adapt to the way the Fedora Singular package is assembled
+%if %{with singular}
+mkdir bin
+cp -p %{SOURCE2} bin
+sed -i 's,$singularprefix/lib/libSingular,%{_libdir}/libsingular,' \
+ bundled/singular/configure.pl
+%endif
+
%build
-export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/eigen3 -I%{_includedir}/singular -Wno-unused-local-typedefs"
+export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/eigen3 -Wno-unused-local-typedefs"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="$RPM_LD_FLAGS -Wl,--as-needed -ldl"
export Arch=%{_arch}
# NOT an autoconf-generated configure script; do not use %%configure.
./configure --build=%{_arch} --prefix=%{_prefix} --libdir=%{_libdir} \
+%if %{with singular}
+ --with-singular=$PWD \
+%endif
--libexecdir=%{polydir} --without-java --without-javaview
make %{?_smp_mflags} all
@@ -216,6 +229,10 @@ sed -i 's,%{buildroot},,' %{buildroot}%{polydir}/bundled/singular/conf.make
%doc doc/*
%changelog
+* Wed May 28 2014 Jerry James <loganjerry at gmail.com> - 2.13-3
+- Rebuild for Singular 3-1-6
+- Add configuration workarounds for Singular support
+
* Fri May 23 2014 Petr Machata <pmachata at redhat.com> - 2.13-2
- Rebuild for boost 1.55.0
More information about the scm-commits
mailing list