diff --git a/.gitignore b/.gitignore index e69de29..1957bce 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/polymake-2.12-rc3.tar.bz2 diff --git a/polymake-bliss.patch b/polymake-bliss.patch new file mode 100644 index 0000000..db2dd6f --- /dev/null +++ b/polymake-bliss.patch @@ -0,0 +1,649 @@ +--- ./apps/topaz/src/isomorphic_complexes.cc.orig 2011-04-13 01:51:10.000000000 -0600 ++++ ./apps/topaz/src/isomorphic_complexes.cc 2013-01-10 11:05:09.551105078 -0700 +@@ -34,7 +34,7 @@ find_facet_vertex_permutations(perl::Obj + return graph::find_row_col_permutation(M1,M2); + } + +-UserFunction4perl("CREDIT nauty\n\n" ++UserFunction4perl("CREDIT bliss\n\n" + "# @category Comparing\n" + "# Determine whether two given complexes are combinatorially isomorphic.\n" + "# The problem is reduced to graph isomorphism of the vertex-facet incidence graphs.\n" +--- ./apps/topaz/src/bistellar.cc.orig 2011-05-11 04:34:18.000000000 -0600 ++++ ./apps/topaz/src/bistellar.cc 2013-01-10 11:05:09.551105078 -0700 +@@ -381,7 +381,7 @@ UserFunction4perl("# @category Producing + "# @return SimplicialComplex", + &bistellar_simplification,"bistellar_simplification(SimplicialComplex { rounds => undef, abs => 0, obj => undef, relax => undef, heat => undef, constant => 0, allow_rev_move=> 0, min_n_facets => undef, verbose => undef, seed => undef, quiet => 0, distribution => undef })"); + +-UserFunction4perl("CREDIT nauty\n\n" ++UserFunction4perl("CREDIT bliss\n\n" + "# @category Comparing" + "# Tries to determine wheter two complexes are pl-homeomorphic by using" + "# bistellar flips and a simulated annealing strategy." +--- ./apps/graph/src/graph_compare.cc.orig 2010-12-12 16:36:28.000000000 -0700 ++++ ./apps/graph/src/graph_compare.cc 2013-01-10 11:05:09.560103386 -0700 +@@ -15,150 +15,137 @@ + $Project: polymake $$Id: graph_compare.cc 9991 2010-12-12 23:36:28Z gawrilow $ + */ + +-#define graph nauty_graph +-#define set nauty_set +-#define permutation nauty_permutation +- +-#include +- +-namespace { +-inline nauty_set* graph_row(nauty_graph *g, int v, int m) { return GRAPHROW(g,v,m); } +-} +- +-#undef GRAPHROW +-#undef graph +-#undef set +-#undef permutation +- ++#include ++#include + #include "polymake/graph/graph_compare.h" + + namespace polymake { namespace graph { +-namespace { +- +-DEFAULTOPTIONS_GRAPH(default_options); +-NautyGraph *in_processing=0; + +-} +- +-struct NautyGraph::impl { +- int n, m; +- nauty_graph *src_graph, *canon_graph; +- int *orbits, *canon_labels, *partitions; +- optionblk options; ++struct BlissGraph::impl { ++ bliss::AbstractGraph *src_graph; ++ unsigned int *canon_labels; ++ bool digraph; + +- explicit impl(int n_arg) +- : n(n_arg), m((n + WORDSIZE - 1) / WORDSIZE), +- src_graph(0), canon_graph(0), +- orbits(0), canon_labels(0), partitions(0) ++ explicit impl(int n_arg, bool dir) : digraph(dir) + { +- src_graph=new nauty_graph[n*m]; +- EMPTYSET(src_graph,n*m); +- canon_graph=new nauty_graph[n*m]; +- orbits=new int[n]; +- canon_labels=new int[n]; +- partitions=new int[n]; +- options=default_options; ++ if (dir) ++ src_graph = new bliss::Digraph(n_arg); ++ else ++ src_graph = new bliss::Graph(n_arg); ++ canon_labels=new unsigned int[n_arg]; + } + + ~impl() + { +- delete[] partitions; + delete[] canon_labels; +- delete[] orbits; +- delete[] canon_graph; +- delete[] src_graph; ++ delete src_graph; + } + +- static void store_autom(int n_autom, nauty_permutation *perm, int*, int, int, int n) ++ static void store_autom(void *graph, unsigned int n, const unsigned int *aut) + { +- in_processing->n_autom=n_autom; +- in_processing->autom.push_back( Array(n, perm) ); ++ BlissGraph *g=reinterpret_cast(graph); ++ g->n_autom++; ++ g->autom.push_back( Array(n, aut) ); + } + }; + +-NautyGraph::impl* NautyGraph::alloc_impl(int n, bool dir) ++BlissGraph::impl* BlissGraph::alloc_impl(int n, bool dir) + { +- impl* i=new impl(n); +- i->options.digraph=dir; +- i->options.getcanon=true; +- return i; ++ return new impl(n, dir); + } + +-NautyGraph::~NautyGraph() { delete p_impl; } ++BlissGraph::~BlissGraph() { delete p_impl; } + +-void NautyGraph::add_edge(int from, int to) ++void BlissGraph::add_edge(unsigned int from, unsigned int to) + { +- nauty_set *gv=graph_row(p_impl->src_graph, from, p_impl->m); +- ADDELEMENT(gv, to); ++ if (p_impl->digraph) { ++ bliss::Digraph *g = reinterpret_cast(p_impl->src_graph); ++ g->add_edge(from, to); ++ } else { ++ bliss::Graph *g = reinterpret_cast(p_impl->src_graph); ++ g->add_edge(from, to); ++ } + } + +-void NautyGraph::partition(int at) ++void BlissGraph::color(unsigned int at, unsigned int color) + { +- p_impl->options.defaultptn=false; +- std::fill(p_impl->partitions, p_impl->partitions+p_impl->n-1, 1); +- copy(entire(sequence(0,p_impl->n)), p_impl->canon_labels); +- p_impl->partitions[at-1]=0; +- p_impl->partitions[p_impl->n-1]=0; ++ if (p_impl->digraph) { ++ bliss::Digraph *g = reinterpret_cast(p_impl->src_graph); ++ g->change_color(at, color); ++ } else { ++ bliss::Graph *g = reinterpret_cast(p_impl->src_graph); ++ g->change_color(at, color); ++ } + } + +-int* NautyGraph::partitions() ++void BlissGraph::color(unsigned int from, unsigned int to, unsigned int color) + { +- p_impl->options.defaultptn=false; +- return p_impl->partitions; ++ if (p_impl->digraph) { ++ bliss::Digraph *g = reinterpret_cast(p_impl->src_graph); ++ for (unsigned int i = from; i < to; i++) ++ g->change_color(i, color); ++ } else { ++ bliss::Graph *g = reinterpret_cast(p_impl->src_graph); ++ for (unsigned int i = from; i < to; i++) ++ g->change_color(i, color); ++ } + } + +-int* NautyGraph::labels() ++void BlissGraph::partition(unsigned int at) + { +- return p_impl->canon_labels; ++ color(0U, at, 0U); ++ color(at, p_impl->src_graph->get_nof_vertices(), 1U); + } + +-void NautyGraph::finalize(bool gather_automorphisms) ++void BlissGraph::finalize(bool gather_automorphisms) + { +- statsblk stats; +- const int worksize=100*1024*1024; // 100MB +- nauty_set *workspace=new nauty_set[worksize]; ++ bliss::Stats stats; ++ size_t n=p_impl->src_graph->get_nof_vertices(); ++ const unsigned int *perm; ++ + if (gather_automorphisms) { +- p_impl->options.userautomproc=&impl::store_autom; +- in_processing=this; ++ n_autom=0; ++ perm=p_impl->src_graph->canonical_form(stats, &impl::store_autom, this); ++ } else { ++ perm=p_impl->src_graph->canonical_form(stats, NULL, NULL); + } +- nauty(p_impl->src_graph, p_impl->canon_labels, p_impl->partitions, 0, p_impl->orbits, +- &p_impl->options, &stats, workspace, worksize, p_impl->m, p_impl->n, p_impl->canon_graph); +- delete[] workspace; ++ std::memcpy(p_impl->canon_labels, perm, n * sizeof(unsigned int)); + } + +-bool NautyGraph::operator== (const NautyGraph& g2) const ++bool BlissGraph::operator== (const BlissGraph& g2) const + { +- if (p_impl->n != g2.p_impl->n) return false; +- nauty_set *cg1=p_impl->canon_graph, *cg1_end=cg1+p_impl->n*p_impl->m, *cg2=g2.p_impl->canon_graph; +- return std::equal(cg1, cg1_end, cg2); ++ size_t n=p_impl->src_graph->get_nof_vertices(); ++ return n == g2.p_impl->src_graph->get_nof_vertices() && ++ !std::memcmp(p_impl->canon_labels, g2.p_impl->canon_labels, ++ n * sizeof(unsigned int)); + } + +-Array NautyGraph::find_permutation(const NautyGraph& g2) const ++Array BlissGraph::find_permutation(const BlissGraph& g2) const + { + if (*this != g2) + throw no_match("not isomorphic"); + +- Array perm(p_impl->n); +- for (int *dst=perm.begin(), *lab1=p_impl->canon_labels, *lab1_end=lab1+p_impl->n, *lab2=g2.p_impl->canon_labels; ++ Array perm(p_impl->src_graph->get_nof_vertices()); ++ for (unsigned int *dst=perm.begin(), *lab1=p_impl->canon_labels, *lab1_end=lab1+p_impl->src_graph->get_nof_vertices(), *lab2=g2.p_impl->canon_labels; + lab1, Array > +-NautyGraph::find_permutations(const NautyGraph& g2, int n_cols) const ++std::pair< Array, Array > ++BlissGraph::find_permutations(const BlissGraph& g2, int n_cols) const + { + if (*this != g2) + throw no_match("not isomorphic"); + +- Array row_perm(p_impl->n-n_cols), col_perm(n_cols); ++ Array row_perm(p_impl->src_graph->get_nof_vertices()-n_cols), col_perm(n_cols); + +- int *lab1=p_impl->canon_labels, *lab1_end=lab1+n_cols, *lab2=g2.p_impl->canon_labels; +- for (int *dst=col_perm.begin(); lab1canon_labels, *lab1_end=lab1+n_cols, *lab2=g2.p_impl->canon_labels; ++ for (unsigned int *dst=col_perm.begin(); lab1canon_labels+p_impl->n; +- for (int *dst=row_perm.begin(); lab1canon_labels+p_impl->src_graph->get_nof_vertices(); ++ for (unsigned int *dst=row_perm.begin(); lab1 > autom; ++ std::list< Array > autom; + + static impl *alloc_impl(int n_nodes, bool is_directed); +- void add_edge(int from, int to); +- void partition(int at); +- int* partitions(); +- int* labels(); ++ void add_edge(unsigned int from, unsigned int to); ++ void color(unsigned int at, unsigned int color); ++ void color(unsigned int from, unsigned int to, unsigned int color); ++ void partition(unsigned int at); + void finalize(bool gather_automorphisms); + + template +@@ -70,10 +70,10 @@ class NautyGraph { + } + + public: +- NautyGraph() : p_impl(0) {} ++ BlissGraph() : p_impl(0) {} + + template +- explicit NautyGraph(const GenericGraph& G, bool gather_automorphisms=false) ++ explicit BlissGraph(const GenericGraph& G, bool gather_automorphisms=false) + : p_impl(alloc_impl(G.nodes(), G.is_directed)) + { + fill(G); +@@ -82,11 +82,11 @@ public: + + // non-symmetrical incidence matrix + template +- explicit NautyGraph(const GenericIncidenceMatrix& M, ++ explicit BlissGraph(const GenericIncidenceMatrix& M, + typename pm::disable_if::type gather_automorphisms=false) + : p_impl(alloc_impl(M.rows()+M.cols(), false)) + { +- int rnode=M.cols(); ++ unsigned int rnode=M.cols(); + partition(rnode); + for (typename Entire< Rows< Matrix > >::const_iterator r=entire(rows(M)); !r.at_end(); ++r, ++rnode) + for (typename Entire< typename Matrix::row_type >::const_iterator c=entire(*r); !c.at_end(); ++c) { +@@ -98,20 +98,20 @@ public: + + // symmetrical incidence matrix + template +- explicit NautyGraph(const GenericIncidenceMatrix& M, ++ explicit BlissGraph(const GenericIncidenceMatrix& M, + typename pm::enable_if::type gather_automorphisms=false) + : p_impl(alloc_impl(M.rows(), true)) + { + // there can be ones on the diagonal, which correspond loops in the graph; +- // nauty requires the graph to be declared as directed in this case ++ // bliss requires the graph to be declared as directed in this case + fill(M); + finalize(gather_automorphisms); + } + +- ~NautyGraph(); ++ ~BlissGraph(); + +- bool operator== (const NautyGraph& g2) const; +- bool operator!= (const NautyGraph& g2) const { return !operator==(g2); } ++ bool operator== (const BlissGraph& g2) const; ++ bool operator!= (const BlissGraph& g2) const { return !operator==(g2); } + + private: + static void incr_count(std::pair& p) +@@ -129,16 +129,16 @@ private: + + public: + template +- static bool prepare_colored(NautyGraph& NG1, const GenericGraph& G1, const Colors1& colors1, +- NautyGraph& NG2, const GenericGraph& G2, const Colors2& colors2); ++ static bool prepare_colored(BlissGraph& NG1, const GenericGraph& G1, const Colors1& colors1, ++ BlissGraph& NG2, const GenericGraph& G2, const Colors2& colors2); + template +- static bool prepare_colored(NautyGraph& NG, const GenericGraph& G, const Colors& colors); ++ static bool prepare_colored(BlissGraph& NG, const GenericGraph& G, const Colors& colors); + +- Array find_permutation(const NautyGraph& g2) const; +- std::pair< Array, Array > find_permutations(const NautyGraph& g2, int n_cols) const; ++ Array find_permutation(const BlissGraph& g2) const; ++ std::pair< Array, Array > find_permutations(const BlissGraph& g2, int n_cols) const; + + int n_automorphisms() const { return n_autom; } +- const std::list< Array >& automorphisms() const { return autom; } ++ const std::list< Array >& automorphisms() const { return autom; } + }; + + template inline +@@ -147,7 +147,7 @@ bool isomorphic(const GenericGraph inline +-Array find_node_permutation(const GenericGraph& G1, const GenericGraph& G2) ++Array find_node_permutation(const GenericGraph& G1, const GenericGraph& G2) + { + if (G1.is_directed != G2.is_directed) + throw no_match("graphs of different kind"); + if (G1.nodes() != G2.nodes()) + throw no_match("graphs of different size"); +- NautyGraph NG1(G1), NG2(G2); ++ BlissGraph NG1(G1), NG2(G2); + return NG1.find_permutation(NG2); + } + + template inline +-Array find_node_permutation(const GenericGraph& G1, const Colors1& colors1, ++Array find_node_permutation(const GenericGraph& G1, const Colors1& colors1, + const GenericGraph& G2, const Colors2& colors2) + { + if (G1.is_directed != G2.is_directed) + throw no_match("graphs of different kind"); + if (G1.nodes() != G2.nodes()) + throw no_match("graphs of different size"); +- NautyGraph NG1, NG2; +- if (NautyGraph::prepare_colored(NG1, G1, colors1, NG2, G2, colors2)) ++ BlissGraph NG1, NG2; ++ if (BlissGraph::prepare_colored(NG1, G1, colors1, NG2, G2, colors2)) + return NG1.find_permutation(NG2); + else + throw no_match("different colors"); + } + + template inline +-Array< Array > automorphisms(const GenericGraph& G) ++Array< Array > automorphisms(const GenericGraph& G) + { +- NautyGraph NG(G, true); +- return Array< Array >(NG.n_automorphisms(), NG.automorphisms().begin()); ++ BlissGraph NG(G, true); ++ return Array< Array >(NG.n_automorphisms(), NG.automorphisms().begin()); + } + + template inline +-Array< Array > automorphisms(const GenericGraph& G, const Colors& colors) ++Array< Array > automorphisms(const GenericGraph& G, const Colors& colors) + { +- NautyGraph NG; +- NautyGraph::prepare_colored(NG,G,colors); +- return Array< Array >(NG.n_automorphisms(), NG.automorphisms().begin()); ++ BlissGraph NG; ++ BlissGraph::prepare_colored(NG,G,colors); ++ return Array< Array >(NG.n_automorphisms(), NG.automorphisms().begin()); + } + + template inline +@@ -210,49 +210,49 @@ isomorphic(const GenericIncidenceMatrix< + if (M1.rows() != M2.rows() || M1.cols() != M2.cols()) + return false; + if (M1.rows()<=1) return true; +- NautyGraph NG1(M1), NG2(M2); ++ BlissGraph NG1(M1), NG2(M2); + return NG1==NG2; + } + + template inline +-typename pm::enable_if< Array, Matrix1::is_symmetric && Matrix2::is_symmetric>::type ++typename pm::enable_if< Array, Matrix1::is_symmetric && Matrix2::is_symmetric>::type + find_row_permutation(const GenericIncidenceMatrix& M1, const GenericIncidenceMatrix& M2) + { + if (M1.rows() != M2.rows()) + throw no_match("matrices of different dimensions"); +- NautyGraph NG1(M1), NG2(M2); ++ BlissGraph NG1(M1), NG2(M2); + return NG1.find_permutation(NG2); + } + + template inline +-typename pm::enable_if< std::pair< Array, Array >, !Matrix1::is_symmetric && !Matrix2::is_symmetric>::type ++typename pm::enable_if< std::pair< Array, Array >, !Matrix1::is_symmetric && !Matrix2::is_symmetric>::type + find_row_col_permutation(const GenericIncidenceMatrix& M1, const GenericIncidenceMatrix& M2) + { + if (M1.rows() != M2.rows() || M1.cols() != M2.cols()) + throw no_match("matrices of different dimensions"); +- NautyGraph NG1(M1), NG2(M2); ++ BlissGraph NG1(M1), NG2(M2); + return NG1.find_permutations(NG2, M1.cols()); + } + + template inline +-typename pm::enable_if< Array< Array >, Matrix::is_symmetric>::type ++typename pm::enable_if< Array< Array >, Matrix::is_symmetric>::type + automorphisms(const GenericIncidenceMatrix& M) + { +- NautyGraph NG(M, true); +- return Array< Array >(NG.n_automorphisms(), NG.automorphisms().begin()); ++ BlissGraph NG(M, true); ++ return Array< Array >(NG.n_automorphisms(), NG.automorphisms().begin()); + } + + template +-typename pm::disable_if< Array< std::pair< Array, Array > >, Matrix::is_symmetric>::type ++typename pm::disable_if< Array< std::pair< Array, Array > >, Matrix::is_symmetric>::type + automorphisms(const GenericIncidenceMatrix& M) + { +- NautyGraph NG(M, true); +- Array< std::pair< Array, Array > > result(NG.n_automorphisms()); +- std::list< Array >::const_iterator p=NG.automorphisms().begin(); ++ BlissGraph NG(M, true); ++ Array< std::pair< Array, Array > > result(NG.n_automorphisms()); ++ std::list< Array >::const_iterator p=NG.automorphisms().begin(); + const int n_rows=M.rows(), n_cols=M.cols(); + sequence rows(n_cols, n_rows), cols(0, n_cols); + +- for (Entire< Array< std::pair< Array, Array > > >::iterator r=entire(result); !r.at_end(); ++r, ++p) { ++ for (Entire< Array< std::pair< Array, Array > > >::iterator r=entire(result); !r.at_end(); ++r, ++p) { + r->first.append(n_rows, translate(select(*p,rows), -n_cols).begin()); + r->second.append(n_cols, select(*p,cols).begin()); + } +@@ -260,45 +260,31 @@ automorphisms(const GenericIncidenceMatr + } + + template +-bool NautyGraph::prepare_colored(NautyGraph& NG1, const GenericGraph& G1, const Colors1& colors1, +- NautyGraph& NG2, const GenericGraph& G2, const Colors2& colors2) ++bool BlissGraph::prepare_colored(BlissGraph& NG1, const GenericGraph& G1, const Colors1& colors1, ++ BlissGraph& NG2, const GenericGraph& G2, const Colors2& colors2) + { + const int n=G1.nodes(); + NG1.p_impl=alloc_impl(n, G1.is_directed); + NG2.p_impl=alloc_impl(n, G2.is_directed); + + typedef Map::type, +- std::pair > color_map_type; ++ unsigned int > color_map_type; + color_map_type color_map; ++ unsigned int color_num = 0U; + + for (typename Entire::const_iterator c=entire(colors1); !c.at_end(); ++c) +- incr_count(color_map[*c]); +- ++ if (!color_map.exists(*c)) ++ color_map[*c]=color_num++; + for (typename Entire::const_iterator c=entire(colors2); !c.at_end(); ++c) +- if (--color_map[*c].second < 0) +- return false; +- +- int *p1=NG1.partitions(), *l1=NG1.labels(), *l2=NG2.labels(); +- int start=0; +- +- for (typename color_map_type::iterator cm=color_map.begin(); !cm.at_end(); ++cm) { +- const int n_of_this_color=cm->second.first; +- cm->second.second=start; +- std::fill(p1, p1+n_of_this_color-1, 1); p1+=n_of_this_color; p1[-1]=0; +- start+=n_of_this_color; +- } +- p1=NG1.partitions(); +- +- std::copy(p1, p1+n, NG2.partitions()); ++ if (!color_map.exists(*c)) ++ color_map[*c]=color_num++; + + for (typename pm::ensure_features >::const_iterator +- c=ensure(colors1, (pm::cons*)0).begin(); !c.at_end(); ++c) +- l1[first_index(color_map[*c])]=c.index(); +- ++ c=ensure(colors1, (pm::cons*)0).begin(); !c.at_end(); ++c) ++ NG1.color(c.index(), color_map[*c]); + for (typename pm::ensure_features >::const_iterator + c=ensure(colors2, (pm::cons*)0).begin(); !c.at_end(); ++c) +- l2[second_index(color_map[*c])]=c.index(); +- ++ NG2.color(c.index(), color_map[*c]); + + NG1.fill(G1); NG1.finalize(false); + NG2.fill(G2); NG2.finalize(false); +@@ -306,31 +292,22 @@ bool NautyGraph::prepare_colored(NautyGr + } + + template +-bool NautyGraph::prepare_colored(NautyGraph& NG, const GenericGraph& G, const Colors& colors) ++bool BlissGraph::prepare_colored(BlissGraph& NG, const GenericGraph& G, const Colors& colors) + { + const int n=G.nodes(); + NG.p_impl=alloc_impl(n, G.is_directed); + +- typedef Map color_map_type; ++ typedef Map color_map_type; + color_map_type color_map; ++ unsigned int color_num = 0U; + + for (typename Entire::const_iterator c=entire(colors); !c.at_end(); ++c) +- ++color_map[*c]; +- +- +- int *p=NG.partitions(), *l=NG.labels(); +- int start=0; +- +- for (typename color_map_type::iterator cm=color_map.begin(); !cm.at_end(); ++cm) { +- const int n_of_this_color=cm->second; +- cm->second += start-n_of_this_color; +- start += n_of_this_color; +- std::fill(p, p+n_of_this_color-1, 1); p+=n_of_this_color; p[-1]=0; +- } ++ if (!color_map.exists(*c)) ++ color_map[*c]=color_num++; + + for (typename pm::ensure_features >::const_iterator + c=ensure(colors, (pm::cons*)0).begin(); !c.at_end(); ++c) +- l[color_map[*c]++]=c.index(); ++ NG.color(c.index(), color_map[*c]); + + NG.fill(G); NG.finalize(true); + return true; +--- ./apps/polytope/src/isomorphic_polytopes.cc.orig 2011-04-13 01:51:10.000000000 -0600 ++++ ./apps/polytope/src/isomorphic_polytopes.cc 2013-01-10 11:05:09.550105266 -0700 +@@ -40,7 +40,7 @@ find_facet_vertex_permutations(perl::Obj + return graph::find_row_col_permutation(M1,M2); + } + +-UserFunction4perl("CREDIT nauty\n\n" ++UserFunction4perl("CREDIT bliss\n\n" + "# @category Comparing" + "# Check whether the face lattices of two polytopes are isomorphic." + "# The problem is reduced to graph isomorphism of the vertex-facet incidence graphs." +--- ./apps/polytope/src/lattice_isomorphic_polytopes.cc.orig 2011-09-12 15:56:14.000000000 -0600 ++++ ./apps/polytope/src/lattice_isomorphic_polytopes.cc 2013-01-10 11:05:09.543106580 -0700 +@@ -88,7 +88,7 @@ Array< Array > lattice_automorphism + } + + +-UserFunction4perl("CREDIT nauty\n\n" ++UserFunction4perl("CREDIT bliss\n\n" + "# @category Comparing" + "# Tests whether two smooth lattice polytopes are lattice equivalent" + "# by comparing lattice distances between vertices and facets. " +--- ./apps/polytope/src/congruent_polytopes.cc.orig 2011-04-13 01:51:10.000000000 -0600 ++++ ./apps/polytope/src/congruent_polytopes.cc 2013-01-10 11:05:09.543106580 -0700 +@@ -59,7 +59,7 @@ Scalar congruent(perl::Object p1, perl:: + return graph::isomorphic(G1, dist1, G2, dist2) ? min1 : Scalar(0); + } + +-UserFunctionTemplate4perl("CREDIT nauty\n\n" ++UserFunctionTemplate4perl("CREDIT bliss\n\n" + "# @category Comparing" + "# Check whether two given polytopes //P1// and //P2// are congruent, i.e. whether" + "# there is an affine isomorphism between them that is induced by a (possibly scaled) orthogonal matrix." diff --git a/polymake-fedora.patch b/polymake-fedora.patch new file mode 100644 index 0000000..8bf9eaa --- /dev/null +++ b/polymake-fedora.patch @@ -0,0 +1,91 @@ +--- ./apps/group/src/Makefile.inc.orig 2011-04-11 10:17:49.000000000 -0600 ++++ ./apps/group/src/Makefile.inc 2013-02-27 15:10:34.341168779 -0700 +@@ -1,4 +1,4 @@ +- ExtraCXXFLAGS = -I$(ProjectTop)/external/permlib/include ++ ExtraCXXFLAGS = -I/usr/include/permlib + + # Local Variables: + # mode: Makefile +--- ./apps/polytope/src/Makefile.inc.orig 2012-01-13 15:32:36.000000000 -0700 ++++ ./apps/polytope/src/Makefile.inc 2013-02-27 15:10:34.340168780 -0700 +@@ -1,17 +1,12 @@ + ifndef ExtensionTop +- ExternalLibs := cdd lrs sympol +- +- lrs_interface$O : ExtraCXXFLAGS = -I$(ProjectTop)/external/lrs +- cdd_interface$O : ExtraCXXFLAGS = -I$(ProjectTop)/external/cdd/lib-src-gmp $(call addinclude, $(ProjectTop)/ext_lib/cdd/globals_gmp.h) +- cdd_float_interface$O : ExtraCXXFLAGS = -I$(ProjectTop)/external/cdd/lib-src +- +- ExtraCXXFLAGS += -I$(ProjectTop)/external/permlib/include +- sympol_interface$O : ExtraCXXFLAGS += -I$(ProjectTop)/external/sympol ++ lrs_interface$O : ExtraCXXFLAGS = -I/usr/include/lrslib ++ cdd_interface$O : ExtraCXXFLAGS = -I/usr/include/cddlib $(call addinclude, $(ProjectTop)/ext_lib/cdd/globals_gmp.h) ++ cdd_float_interface$O : ExtraCXXFLAGS = -I/usr/include/cddlib + +- LIBS += $(BuildDir)/external/lrs/liblrsgmp$A $(BuildDir)/external/cdd/libcddgmp$A $(BuildDir)/external/cdd/libcdd$A $(BuildDir)/external/sympol/libsympol$A ++ LIBS += -llrsgmp -lcddgmp -lcdd -lsympol + endif + +-ifneq ($(filter 4.4% 4.5%,${GCCversion}),) ++ifneq ($(filter 4.4% 4.5% 4.6% 4.7% 4.8%,${GCCversion}),) + core_point_algo$O rel_int_point$O pointed_part$O : ExtraCXXFLAGS += -fno-strict-aliasing + endif + +--- ./perl/polymake-config.orig 2011-05-30 16:51:45.000000000 -0600 ++++ ./perl/polymake-config 2013-02-27 15:14:32.177979991 -0700 +@@ -126,9 +126,6 @@ while (defined ($_=shift)) { + + } elsif ($_ eq "--ldflags") { + my $ldflags=$conf{LDflags}; +- if ($ldflags !~ /(?:^|\s)-L$conf{InstallLib}(?:\s|$)/) { +- $ldflags="-L$conf{InstallLib} $ldflags"; +- } + my $add_rpath=1; + open CF, ">$tmpfile.cc" or die "can't create temporary file $tmpfile.cc: $!\n"; + print CF "int main() { return 0; }\n"; +@@ -146,8 +143,6 @@ while (defined ($_=shift)) { + close CC; + if ($^O eq "darwin") { + $ldflags="$conf{ARCHFLAGS} $ldflags"; +- } elsif ($add_rpath) { +- $ldflags.=" -Wl,-rpath,$conf{InstallLib}"; + } + $ldflags=~s/^\s+//; $ldflags=~s/\s+$//; $ldflags=~s/\s{2,}/ /g; + if ($debug_asked=defined($debug)) { +--- ./support/corelib.make.orig 2012-03-02 15:37:49.000000000 -0700 ++++ ./support/corelib.make 2013-02-27 15:10:34.340168780 -0700 +@@ -90,7 +90,9 @@ ${CoreLib} : ${SharedObjects} ${Standalo + ifneq (${LDcallableFlags},none) + # no explicit dependence on XSObjects here because they are built in compile-xs using the Makefile generated by xsubpp + ${CallableLib} : ${SharedObjects} ${CallableSharedObjects} ${GlueObjects} ${CallableGlueObjects} ${XXSObjects} $(patsubst %,${SourceDir}/perl/%.xs,${XSModules}) +- ${CXX} ${LDcallableFlags} -o $@ ${SharedObjects} ${CallableSharedObjects} ${GlueObjects} ${CallableGlueObjects} ${XXSObjects} ${XSObjects} ${LDFLAGS} ${PERLccdlflags} -lmpfr -lgmp ${LIBXML2_LIBS} ${LIBS} -L${PERLarchlib}/CORE -lperl ++ ${CXX} ${LDcallableFlags} -o ${PerlExtDir}/libpolymake.so.@VERSION@ ${SharedObjects} ${CallableSharedObjects} ${GlueObjects} ${CallableGlueObjects} ${XXSObjects} ${XSObjects} ${LDFLAGS} ${PERLccdlflags} -Wl,-h,libpolymake.so.@MAJVER@ -lmpfr -lgmp ${LIBXML2_LIBS} ${LIBS} -L${PERLarchlib}/CORE -lperl ++ ln -s libpolymake.so.@VERSION@ ${PerlExtDir}/libpolymake.so.@MAJVER@ ++ ln -s libpolymake.so.@MAJVER@ $@ + else + ${CallableLib} : ${GlueObjects} ${XXSObjects} $(patsubst %,${SourceDir}/perl/%.xs,${XSModules}) + endif +--- ./support/configure.pl.orig 2012-03-02 02:26:14.000000000 -0700 ++++ ./support/configure.pl 2013-02-27 15:10:34.340168780 -0700 +@@ -488,10 +488,6 @@ if (defined $GMP) { + $CXXflags .= " -I$GMP/include"; + my $libdir=get_libdir($GMP, "gmp"); + $LDflags .= " -L$libdir"; +- if ( !$WithFink && exists $options{gmp}) { # this does not work for Mac OS 10.4 +- # non-standard location +- $LDflags .= " -Wl,-rpath,$libdir"; +- } + } + + my $MPFR=$options{mpfr}; +@@ -500,10 +496,6 @@ if (defined($MPFR) && $MPFR ne $GMP) { + $CXXflags .= " -I$MPFR/include"; + my $libdir=get_libdir($MPFR, "mpfr"); + $LDflags .= " -L$libdir"; +- if ( !$WithFink ) { # this does not work for Mac OS 10.4 +- # non-standard location +- $LDflags .= " -Wl,-rpath,$libdir"; +- } + } + + my $BOOST=$options{boost}; diff --git a/polymake-perl.patch b/polymake-perl.patch new file mode 100644 index 0000000..954eb3d --- /dev/null +++ b/polymake-perl.patch @@ -0,0 +1,343 @@ +--- ./lib/core/src/perl/Struct.xs.orig 2011-12-20 17:47:59.000000000 -0700 ++++ ./lib/core/src/perl/Struct.xs 2013-01-10 09:48:02.893665535 -0700 +@@ -223,13 +223,6 @@ OP* pp_method_call(pTHX) + return Perl_pp_method_named(aTHX); + } + +-static inline +-OP* method_named_op(OP *o) +-{ +- return ((o->op_flags & OPf_KIDS) && +- (o=cUNOPo->op_first->op_sibling) && (o=o->op_sibling) && o->op_type == OP_METHOD_NAMED) ? o : 0; +-} +- + static + OP* intercept_ck_aassign(pTHX_ OP* o) + { +@@ -238,7 +231,10 @@ OP* intercept_ck_aassign(pTHX_ OP* o) + lhs=cUNOPo->op_first->op_sibling; + if (lhs->op_type == OP_NULL) lhs=cUNOPx(lhs)->op_first; + while (lhs) { +- if (lhs->op_type == OP_ENTERSUB) lhs->op_private |= OPpENTERSUB_AASSIGN_LHS; ++ if (lhs->op_type == OP_ENTERSUB) { ++ OP* meth_op=method_named_op(lhs); ++ if (meth_op) meth_op->op_private |= MethodIsCalledOnLeftSideOfArrayAssignment; ++ } + lhs=lhs->op_sibling; + } + return o; +@@ -410,7 +406,7 @@ PPCODE: + o->op_ppaddr=&pp_method_call; + break; + default: +- o->op_ppaddr= PL_op->op_private & OPpENTERSUB_AASSIGN_LHS ? &pp_access : &pp_method_access; ++ o->op_ppaddr= (o->op_private & MethodIsCalledOnLeftSideOfArrayAssignment) ? &pp_access : &pp_method_access; + break; + } + } else { +@@ -425,7 +421,7 @@ PPCODE: + } + switch (next_op->op_type) { + default: +- if (!(o ? o->op_ppaddr == &pp_access : PL_op->op_private & OPpENTERSUB_AASSIGN_LHS)) { ++ if (!(o && o->op_ppaddr == &pp_access)) { + PUSHs(find_method(aTHX_ index, 0)); + break; + } +--- ./lib/core/src/perl/Object.xs.orig 2011-12-20 17:47:59.000000000 -0700 ++++ ./lib/core/src/perl/Object.xs 2013-01-10 09:41:58.985884887 -0700 +@@ -58,8 +58,12 @@ PPCODE: + PUSHs(AvARRAY(descr)[2]); + } + o->op_ppaddr=&Perl_pp_null; ++#if PerlVersion >= 5160 ++ /* remove the LVALUE flag */ ++ PL_op->op_private &= ~OPpLVAL_INTRO; ++#endif + +- } else if (PL_op->op_private & OPpENTERSUB_AASSIGN_LHS) { ++ } else if ((o=method_named_op(PL_op), o && (o->op_private & MethodIsCalledOnLeftSideOfArrayAssignment))) { + if (hide_args) Perl_croak(aTHX_ "unexpected scalar context within list assignment"); + EXTEND(SP,items+3); + /* AASSIGN expects two marks: the topmost delimits the lvalues, the next below it - the rvalues */ +@@ -69,6 +73,10 @@ PPCODE: + PUSHs(prop); + PUSHs(rhs); + PUSHs(AvARRAY(descr)[2]); ++#if PerlVersion >= 5160 ++ /* remove the LVALUE flag */ ++ PL_op->op_private &= ~OPpLVAL_INTRO; ++#endif + + } else { + EXTEND(SP,items+2+hide_args); +--- ./lib/core/src/perl/RefHash.xs.orig 2011-12-20 17:47:59.000000000 -0700 ++++ ./lib/core/src/perl/RefHash.xs 2013-01-10 09:46:13.844168283 -0700 +@@ -666,7 +666,11 @@ OP* check_pushhv(pTHX_ OP *o) + kid = kid->op_sibling; + if (kid->op_type == OP_RV2HV || kid->op_type == OP_PADHV) { + int arg_cnt=2; ++#if PerlVersion >= 5160 ++ op_lvalue(kid, o->op_type); ++#else + Perl_mod(aTHX_ kid, o->op_type); ++#endif + while ((kid=kid->op_sibling)) { + if (kid->op_type == OP_RV2HV || kid->op_type == OP_PADHV) { + Perl_list(aTHX_ kid); +--- ./lib/core/src/perl/Poly.xs.orig 2011-12-20 17:47:59.000000000 -0700 ++++ ./lib/core/src/perl/Poly.xs 2013-01-10 09:45:36.412035674 -0700 +@@ -91,6 +91,26 @@ OP* pp_first(pTHX) + RETURN; + } + ++#if PerlVersion >= 5160 ++static ++OP* safe_magic_lvalue_return_op(pTHX) ++{ ++ if (cxstack[cxstack_ix].blk_gimme==G_SCALAR) { ++ dSP; ++ OP* next_op; ++ SV* retval=TOPs; ++ U32 retval_flags= SvTEMP(retval) && SvREFCNT(retval)==1 ? SvMAGICAL(retval) : 0; ++ if (retval_flags) { ++ SvMAGICAL_off(retval); ++ next_op=Perl_pp_leavesub(aTHX); ++ SvFLAGS(retval) |= retval_flags; ++ return next_op; ++ } ++ } ++ return Perl_pp_leavesub(aTHX); ++} ++#endif ++ + MGVTBL pm_perl_array_flags_vtbl={ 0, 0, 0, 0, 0 }; + + static inline +@@ -255,7 +275,7 @@ PPCODE: + else + PUSHs(&PL_sv_no); + } else if (CvFLAGS(sub) & CVf_LVALUE) { +- if (!CvXSUB(sub) && CvROOT(sub)->op_type==OP_LEAVESUBLV) ++ if (!CvISXSUB(sub) && CvROOT(sub)->op_type==OP_LEAVESUBLV) + PUSHs(&PL_sv_no); /* not faked */ + else + PUSHs(&PL_sv_yes); +@@ -271,12 +291,21 @@ CODE: + { + CV *sub; + if (!SvROK(subref) || (sub=(CV*)SvRV(subref), SvTYPE(sub) != SVt_PVCV)) +- croak_xs_usage(cv, "\\&sub"); ++ croak_xs_usage(cv, "\\&sub [, TRUE_if_faked ]"); + CvFLAGS(sub) |= CVf_LVALUE | CVf_NODEBUG; +- if (!CvXSUB(sub) && (items==1 || !SvTRUE(ST(1)))) { ++ if (!CvISXSUB(sub)) { + OP *leave_op=CvROOT(sub); +- leave_op->op_type=OP_LEAVESUBLV; +- leave_op->op_ppaddr=PL_ppaddr[OP_LEAVESUBLV]; ++ if (items==1 || !SvTRUE(ST(1))) { ++ /* not faked */ ++ leave_op->op_type=OP_LEAVESUBLV; ++ leave_op->op_ppaddr=PL_ppaddr[OP_LEAVESUBLV]; ++ } ++#if PerlVersion >= 5160 ++ else { ++ /* nowadays perl is fond of copying return values if they show any magic */ ++ leave_op->op_ppaddr=&safe_magic_lvalue_return_op; ++ } ++#endif + } + } + +@@ -682,8 +711,7 @@ is_real_code(x) + PROTOTYPE: $ + PPCODE: + { +- if (SvROK(x) && (x=SvRV(x), SvTYPE(x) == SVt_PVCV) +- && (CvROOT((CV*)x) || CvXSUB((CV*)x))) ++ if (SvROK(x) && (x=SvRV(x), SvTYPE(x) == SVt_PVCV) && IsWellDefinedSub((CV*)x)) + return; /* keep the CV reference on the stack */ + XSRETURN_NO; + } +@@ -874,9 +902,7 @@ if (!SvROK(sub) || + if (SvTYPE(glob) != SVt_PVGV) + gv_init(glob, pkg_stash, name, namelen, GV_ADDMULTI); + +- if ((flags & 2) && +- (was_here=GvCV(glob)) && +- (CvROOT(was_here) || (CvXSUB(was_here)))) { ++ if ((flags & 2) && (was_here=GvCV(glob)) && IsWellDefinedSub(was_here)) { + if (GIMME_V != G_VOID) + PUSHs(sv_2mortal(newRV((SV*)was_here))); + +@@ -885,7 +911,7 @@ if (!SvROK(sub) || + if (CvANON(sub)) { + CvANON_off(sub); + CvGV_set((CV*)sub, glob); +- if (!CvXSUB(sub)) { ++ if (!CvISXSUB(sub)) { + SV *file=CopFILESV((COP*)CvSTART(sub)); + if (file && (!SvOK(file) || !SvPVX(file) || !strncmp(SvPVX(file), "(eval ", 6))) + sv_setpvf(file, "(%s::%.*s)", HvNAME(pkg_stash), (int)namelen, name); +--- ./lib/core/src/perl/createBootstrap.pl.orig 2011-10-30 16:36:53.000000000 -0600 ++++ ./lib/core/src/perl/createBootstrap.pl 2013-01-10 09:48:34.960079680 -0700 +@@ -1,6 +1,6 @@ +-# Copyright (c) 1997-2011 ++# Copyright (c) 1997-2012 + # Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Darmstadt, Germany) +-# http://www.polymake.de ++# http://www.polymake.org + # + # This program is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by the +@@ -27,7 +27,7 @@ foreach my $file (@ARGV) { + open my $C, $file or die "can't read $file: $!\n"; + my $ugly_cast= $] <= 5.008 && "(char*)"; + while (<$C>) { +- if (/^XS\((boot_(\w+))\);/) { ++ if (/^XS(?:_EXTERNAL)?\((boot_(\w+))\);/) { + $proto .= "$&\n"; + my $func=$1; + (my $pkg=$2) =~ s/_/:/g; +--- ./lib/core/src/perl/Ext.xs.orig 2011-12-20 17:47:59.000000000 -0700 ++++ ./lib/core/src/perl/Ext.xs 2013-01-10 09:40:42.551339010 -0700 +@@ -33,7 +33,11 @@ SV** pm_perl_get_cx_curpad(pTHX_ PERL_CO + goto FOUND; + case CXt_EVAL: + if (!CxTRYBLOCK(cx)) { ++#if PerlVersion >= 5120 ++ cv=cx->blk_eval.cv; ++#else + cv=PL_compcv; ++#endif + d=0; + goto FOUND; + } +--- ./lib/core/src/perl/CPlusPlus.xxs.orig 2011-12-20 17:47:59.000000000 -0700 ++++ ./lib/core/src/perl/CPlusPlus.xxs 2013-01-10 09:39:42.369023533 -0700 +@@ -479,7 +479,7 @@ SV* clone_assoc_container_magic_sv(pTHX_ + + int canned_container_access(pTHX_ SV *sv, MAGIC* mg, SV *nsv, const char *dummy, PM_svt_copy_klen_arg index) + { +- OPCODE opc=PL_op->op_type; ++ const OPCODE opc=PL_op ? PL_op->op_type : OP_AELEM; // assume a plain array access when called directly from the callable library + const container_vtbl* const t=(const container_vtbl*)mg->mg_virtual; + char *obj=mg->mg_ptr, *it; + const container_access_vtbl *acct=t->acc+(mg->mg_flags & value_read_only); +--- ./lib/core/src/perl/namespaces.xs.orig 2011-12-20 17:47:59.000000000 -0700 ++++ ./lib/core/src/perl/namespaces.xs 2013-01-10 09:50:40.332136877 -0700 +@@ -697,7 +697,7 @@ GV* try_stored_lexical_gv(pTHX_ GV *var_ + break; + case SVt_PVCV: { + CV *cv=GvCV(imp_gv); +- if (cv && (CvROOT(cv) || CvXSUB(cv))) return imp_gv; ++ if (cv && IsWellDefinedSub(cv)) return imp_gv; + }} + } + } +@@ -779,7 +779,7 @@ GV* test_imported_gv(GV *gv, I32 type, i + if (ignore_methods && CvMETHOD(cv)) + /* may not discover methods in object-less call */ + return (GV*)-1UL; +- if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) ++ if (IsWellDefinedSub(cv) || GvASSUMECV(gv)) + /* If only promised - let's try later, or die if the next op is ENTERSUB. + For inherited static methods return the gv from the basis class! */ + return GvCVGEN(gv) ? CvGV(cv) : gv; +@@ -823,7 +823,7 @@ GV* lookup_name_in_list(pTHX_ HV *stash, + if (dotLOOKUP && (lookp=AvARRAY(dotLOOKUP))) { + for (endp=lookp+AvFILLp(dotLOOKUP); lookp<=endp; ++lookp) + if ((imp_gv=lookup_name_in_stash(aTHX_ (HV*)SvRV(*lookp), name, namelen, type, ignore_methods))) { +- if (type != SVt_PVCV || CvROOT(GvCV(imp_gv)) || CvXSUB(GvCV(imp_gv))) { ++ if (type != SVt_PVCV || IsWellDefinedSub(GvCV(imp_gv))) { + if (!var_gv) { + var_gv=*(GV**)hv_fetch(stash, name, namelen, TRUE); + if (SvTYPE(var_gv) != SVt_PVGV) +@@ -1227,7 +1227,7 @@ OP* intercept_pp_gv(pTHX) + lookup(aTHX_ var_gv, SVt_PVHV, &next_op, next_op); + break; + case OP_RV2CV: +- if ((cv=GvCV(var_gv)) && (next_op->op_next->op_type != OP_REFGEN || CvROOT(cv) || CvXSUB(cv))) ++ if ((cv=GvCV(var_gv)) && (next_op->op_next->op_type != OP_REFGEN || IsWellDefinedSub(cv))) + break; + lookup(aTHX_ var_gv, SVt_PVCV, &next_op, 0); + break; +@@ -1354,7 +1354,13 @@ OP* intercept_pp_aelemfast(pTHX) + { + OP *next_op=PL_op; + next_op->op_ppaddr=def_pp_AELEMFAST; +- if (!(next_op->op_flags & OPf_SPECIAL)) { ++#if PerlVersion < 5150 ++ if (!(next_op->op_flags & OPf_SPECIAL)) ++#else ++ /* since perl 5.16 AELEMFAST_LEX is a separate op */ ++ if (next_op->op_type != OP_AELEMFAST_LEX) ++#endif ++ { + GV *var_gv=cGVOP_gv; + const char *name; + if (!GvIMPORTED_AV(var_gv)) { +--- ./lib/core/include/perl/Ext.h.orig 2011-12-20 17:47:59.000000000 -0700 ++++ ./lib/core/include/perl/Ext.h 2013-01-10 09:37:30.278808742 -0700 +@@ -1,6 +1,6 @@ +-/* Copyright (c) 1997-2011 ++/* Copyright (c) 1997-2012 + Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Darmstadt, Germany) +- http://www.polymake.de ++ http://www.polymake.org + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the +@@ -67,6 +67,8 @@ EXTERN_C AV* Perl_av_fake(pTHX_ I32 size + + #if PerlVersion >= 5100 + # define ReturnsToOp(cx) (cx)->blk_sub.retop ++/* CvROOT and CvXSUB are in the same union */ ++# define IsWellDefinedSub(x) (CvROOT(x)) + # define PL_lex_brackets (PL_parser->lex_brackets) + # define PL_lex_state (PL_parser->lex_state) + # define PL_lex_inwhat (PL_parser->lex_inwhat) +@@ -81,6 +83,7 @@ EXTERN_C AV* Perl_av_fake(pTHX_ I32 size + # define PL_nextval (PL_parser->nextval) + #else + # define ReturnsToOp(cx) PL_retstack[(cx)->blk_oldretsp-1] ++# define IsWellDefinedSub(x) (CvROOT(x) || CvXSUB(x)) + # ifndef SvRV_set + # define SvRV_set(ref,what) SvRV(ref)=(what) + # endif +@@ -134,8 +137,8 @@ EXTERN_C AV* Perl_av_fake(pTHX_ I32 size + #define LEX_KNOWNEXT 0 + #define LEX_NORMAL 10 + +-/* check whether this private flag is free for each new perl release */ +-#define OPpENTERSUB_AASSIGN_LHS 1 ++/* check whether this private flag is not used in OP_METHOD_NAMED for each new perl release */ ++#define MethodIsCalledOnLeftSideOfArrayAssignment 1 + + START_EXTERN_C + +@@ -191,6 +194,13 @@ void write_protect_off(pTHX_ SV *x) + { + if (x != &PL_sv_undef) SvREADONLY_off(x); + } ++ ++/* for given OP_ENTERSUB, find the corresponding OP_METHOD_NAMED, or return NULL */ ++static inline ++OP* method_named_op(OP *o) ++{ ++ return ((o->op_flags & OPf_KIDS) && (o=cLISTOPo->op_last) && o->op_type == OP_METHOD_NAMED) ? o : 0; ++} + #endif + + static inline +--- ./lib/callable/src/perl/Main.cc.orig 2012-01-11 07:07:49.000000000 -0700 ++++ ./lib/callable/src/perl/Main.cc 2013-01-10 09:38:15.750704364 -0700 +@@ -70,7 +70,7 @@ void emergency_cleanup() + # define addlibs "" + #endif + #if POLYMAKE_DEBUG +-# define scr_debug1 "$DebugLevel=1;" ++# define scr_debug1 "$DebugLevel=1; $DB::single=1;" + # define scr_debug2 "sub stop_here { print STDERR \"@_\\n\" if @_ } my $loaded=1;\n" + #else + # define scr_debug1 "" diff --git a/polymake.1 b/polymake.1 new file mode 100644 index 0000000..50fc2a7 --- /dev/null +++ b/polymake.1 @@ -0,0 +1,81 @@ +.TH "polymake" "1" "@VERSION@" "Polymake" "User Commands" +.SH "NAME" +polymake \- convex polytopes and polyhedra +.SH "SYNOPSIS" +.B polymake +[\fIOPTIONS\fP] [\fIARGUMENTS\fP] +.SH "DESCRIPTION" +.PP +This program provides algorithms that manipulate convex polytopes and +polyhedra. When run without arguments, an interactive shell is started. +.SH "ARGUMENTS" +.TP +\fB\-\-help\fP +Show a help message and exit. +.TP +\fB\-\-version\fP +Print the version number and copyright notice, and exit. +.TP +[\fB\-\-script\fP] [\fIapplication\fP::]\fIscript_file\fP +Execute the script stored in \fIscript_file\fP. If the \fIapplication\fP +prefix is specified, that application is loaded and the script file is looked +up in its script directory. +.TP +\fB\-\-script\fP [\fIapplication\fP::]\fIscript_file\fP \fIarguments\fP ... +Execute the script, passing the arguments in @ARGV. +.TP +\fB\-\-iscript\fP [\fIapplication\fP::]\fIscript_file\fP \fIarguments\fP ... +Execute the script, which may contain interactive commands. +.TP +\fB'code'\fP +Interpret the string as a perl expression. +.TP +\fB\-\fP +Read and execute commands from standard input. +.TP +\fBfile\fP PROPERTY | METHOD [ ... ] +Legacy mode (resembling polymake <= 2.3): Read the object from the data file, +print the properties, or run the user methods. +.TP +\fB\-\-touch\fP \fIfile\fP [ \fIfile\fP ... ] +Read the files and write them out; useful for converting from older polymake +versions. +.SH "OPTIONS" +.TP +\fB\-A\fP \fIapplication_name\fP +Start with this application, ignoring the \fI$default_application\fP and +\fI@start_applications\fP settings. +.TP +\fB\-d\fP +Produce some debug output; can be repeated to increase the debug level. +.TP +\fB\-v\fP +Verbose output; can be repeated to increase the verbosity level. This is an +obsolete option. Use custom variables $Verbose::* to gain more detailed +control. +.TP +\fB\-\-reconfigure\fP +Rerun the autoconfiguration sections in all rule files. +.TP +\fB\-\-config\-path\fP "DIR;..." +Import settings from global configuration files in the given directories. If +the last DIR in the list starts with ~/, use it instead of ~/.polymake to keep +the private settings. The default is "user", using only the private +configuration located at $POLYMAKE_USER_DIR or ~/.polymake. +.TP +\fB\-\-no\-config\fP +Equivalent to \-\-config\-path=none. Don't read any configuration files. +Don't try to configure rules automatically. Don't load rule files requiring +auto-configuration. +.TP +\fB\-\-ignore\-config\fP +Equivalent to \-\-config\-path=ignore. Don't read any configuration files. +Skip auto-configuration routines in the rule files. +.TP +\fB\-n\fP +Dry run mode: show the production rules that would be applied to the object, +but don't actually run any. This is only applicable in compatibility mode. +.TP +\fB\-T\fP \fIsec\fP +Set a time limit for the execution of production rules. This option currently +has no effect. diff --git a/polymake.spec b/polymake.spec new file mode 100644 index 0000000..9f3075a --- /dev/null +++ b/polymake.spec @@ -0,0 +1,215 @@ +# TESTING NOTE: "make test" does not work, because the test drivers are not +# distributed with the released sources. A Subversion repository containing +# all of the sources, including the test drivers, was made available recently. +# Once the next release of polymake occurs, we will extract the necessary test +# drivers from subversion and produce a check script. + +# Release candidates are sometimes promoted to release without removing the tag +%global rctag -rc3 + +Name: polymake +Version: 2.12 +Release: 4%{?dist} +Summary: Algorithms on convex polytopes and polyhedra + +License: GPLv2+ +URL: http://polymake.org/ +Source0: http://polymake.org/lib/exe/fetch.php/download/%{name}-%{version}%{rctag}.tar.bz2 +# 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 +# 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. +Patch0: %{name}-fedora.patch +# This patch was sent upstream 1 Mar 2012. Polymake uses nauty, which has a +# non-free license. This patch converts polymake to bliss, which is free. +Patch1: %{name}-bliss.patch +# Patch from upstream: adapt the sources to perl >= 5.15. +Patch2: %{name}-perl.patch + +BuildRequires: bliss-devel +BuildRequires: cddlib-devel +BuildRequires: libxml2-devel +BuildRequires: lrslib-devel +BuildRequires: mpfr-devel +BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: perl(Term::ReadLine::Gnu) +BuildRequires: perl(XML::LibXSLT) +BuildRequires: perl(XML::SAX::Base) +BuildRequires: perl(XML::Writer) +BuildRequires: sympol-devel +BuildRequires: xhtml1-dtds + +Requires: perl(:MODULE_COMPAT_%{perl_version}) + +%global sover %(echo %{version} | cut -d. -f1-2) +%global major %(echo %{version} | cut -d. -f1) +%global polydir %{_libdir}/%{name} + +# Don't expose private shared objects or private perl interfaces +%global __provides_exclude perl +%global __provides_exclude_from ^%{polydir}/.*\\.so$ + +# Don't Require the private perl interfaces that we don't Provide. +%global __requires_exclude namespaces +%global __requires_exclude %{__requires_exclude}|BackgroundViewer +%global __requires_exclude %{__requires_exclude}|Geomview +%global __requires_exclude %{__requires_exclude}|Graphviz +%global __requires_exclude %{__requires_exclude}|InteractiveViewer +%global __requires_exclude %{__requires_exclude}|Java +%global __requires_exclude %{__requires_exclude}|JReality +%global __requires_exclude %{__requires_exclude}|Metapost +%global __requires_exclude %{__requires_exclude}|Polymake +%global __requires_exclude %{__requires_exclude}|Postscript +%global __requires_exclude %{__requires_exclude}|Povray +%global __requires_exclude %{__requires_exclude}|Sketch +%global __requires_exclude %{__requires_exclude}|SplitsTree +%global __requires_exclude %{__requires_exclude}|Visual + +%description +Polymake is a tool to study the combinatorics and the geometry of convex +polytopes and polyhedra. It is also capable of dealing with simplicial +complexes, matroids, polyhedral fans, graphs, tropical objects, and so +forth. + +Polymake can use various computational packages if they are installed. +Those available from Fedora are: 4ti2, azove, gfan, latte-integrale, +normaliz, ocaml-tplib-tools, qhull, Singular, TOPCOM, and vinci. + +Polymake can interface with various visualization packages if they are +installed. Install one or more of the tools from the following list: +evince, geomview, graphviz, gv, and okular. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +This package contains header files and libraries for developing +plugins (applications) that use %{name}. + +%package doc +Summary: Documentation for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description doc +This package contains documentation for %{name}. + +%prep +%setup -q +%patch0 +%patch1 +%patch2 + +# Make sure we don't build against the bundled libraries. +# Don't delete the jreality directory, though, or the installer crashes. +rm -fr external/{cdd,lrs,nauty,permlib,sympol} + +# Don't force -O3 +sed -i "s/-O3//" support/configure.pl + +# Give the main library an soname (markers added by the -libs patch) +sed -i "s/@VERSION@/%{sover}/;s/@MAJVER@/%{major}/" support/corelib.make + +# Adapt to a newer version of sympol +sed -i "s|yal/||;s|symmetrygroupconstruction/||" \ + apps/polytope/src/sympol_interface.cc + +%build +export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/eigen3" +export CXXFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/eigen3" +export LDFLAGS="$RPM_LD_FLAGS -Wl,--as-needed" +export Arch=%{_arch} +# NOT an autoconf-generated configure script; do not use %%configure. +./configure --build=%{_arch} --prefix=%{_prefix} --libdir=%{_libdir} \ + --libexecdir=%{polydir} --without-java +make %{?_smp_mflags} all + +# Help the debuginfo generator find generated files +cd build.%{_arch} +cp -p perlx-*linux-*/CPlusPlus.xxs lib/CPlusPlus.xxs +cp -p perlx-*linux-*/CPlusPlus.cc lib/CPlusPlus.xxs.c + +%install +# Don't recompile the main library with DESTDIR compiled in +sed -i "/conf\.make/d" support/corelib.make + +# The release-docs target copies docs to their installed locations +export Arch=%{_arch} +make install release-docs DESTDIR=%{buildroot} + +# The apps have undefined weak symbols. However, fixing that kills the +# documentation building step for reasons I can't seem to track down. So +# instead, we wait until after the docs have been generated, then relink. +sed -e 's|^Libs :=.*|& -L$(wildcard ${BuildDir}/perlx-*-linux-*) -lpolymake|' \ + -i support/app.make +sed -e 's|-lgmp ${LIBS}|& -L${PerlExtDir} -lpolymake|' \ + -e 's|^${CoreLib} :.*|& ${CallableLib}|' \ + -i support/corelib.make +rm -f build.%{_arch}/lib/*.so +make %{?_smp_mflags} all +chmod 0755 %{buildroot}%{polydir}/lib/*.so +cp -p build.%{_arch}/lib/*.so %{buildroot}%{polydir}/lib + +# Fix up the shared library links +mv %{buildroot}%{_libdir}/lib%{name}.so \ + %{buildroot}%{_libdir}/lib%{name}.so.%{version} +ln -s lib%{name}.so.%{version} %{buildroot}%{_libdir}/lib%{name}.so.%{major} +ln -s lib%{name}.so.%{major} %{buildroot}%{_libdir}/lib%{name}.so + +# Install the man page +mkdir -p %{buildroot}%{_mandir}/man1 +sed "s/@VERSION@/%{version}/" %{SOURCE1} > %{buildroot}%{_mandir}/man1/%{name}.1 +touch -r %{SOURCE1} %{buildroot}%{_mandir}/man1/%{name}.1 + +# We don't want the documentation in /usr/share/polymake +mv %{buildroot}%{_datadir}/%{name}/doc . + +# Remove stuff that shouldn't be installed +rm -fr %{buildroot}%{_datadir}/%{name}/apps/*/src \ + %{buildroot}%{_datadir}/%{name}/java_build \ + %{buildroot}%{polydir}/perlx/*/*/auto/Polymake/Ext/{.packlist,Ext.bs} \ + %{buildroot}%{polydir}/lib/jreality + +# Fix permissions +chmod 0755 %{buildroot}%{_bindir}/* +chmod 0755 %{buildroot}%{_libdir}/lib* +find %{buildroot}%{polydir} -name \*.so | xargs chmod 0755 + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%doc COPYING +%{_bindir}/%{name} +%{_mandir}/man1/%{name}.1* +%{_libdir}/lib%{name}.so.* +%{polydir}/ +%{_datadir}/%{name}/ +%exclude %{_datadir}/%{name}/lib/ + +%files devel +%{_bindir}/%{name}-config +%{_includedir}/%{name}/ +%{_datadir}/%{name}/lib/ +%{_libdir}/lib%{name}.so + +%files doc +%doc doc/* + +%changelog +* Wed Feb 27 2013 Jerry James - 2.12-4 +- Remove rpath and -L%%{_libdir} from polymake-config --ldflags output + +* Thu Jan 24 2013 Jerry James - 2.12-3 +- Also need to filter perl(Graphviz) + +* Wed Jan 23 2013 Jerry James - 2.12-2 +- Change -libs patch to also remove -rpath arguments +- Filter Provides/Requires to hide private perl interfaces +- Remove the broken check script and explain why + +* Thu Jan 10 2013 Jerry James - 2.12-1 +- Initial RPM diff --git a/sources b/sources index e69de29..d6b3ca6 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +f07ecafc7a946001c38cdd20e6434b09 polymake-2.12-rc3.tar.bz2