summarylogtreecommitdiffstats
path: root/sagemath-bliss-0.77.patch
blob: 4f95bcedf6350ec2fbbb7587ac5db0e2b3645143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
diff --git a/build/pkgs/bliss/SPKG.rst b/build/pkgs/bliss/SPKG.rst
index 236b87a199..77407f16ac 100644
--- a/build/pkgs/bliss/SPKG.rst
+++ b/build/pkgs/bliss/SPKG.rst
@@ -10,20 +10,19 @@ canonical forms of graphs.
 License
 -------
 
-LGPL
+LGPL3
 
 
 Upstream Contact
 ----------------
 
-Bliss is currently being maintained by Tommi Junttila and Petteri Kaski.
+Bliss is currently being maintained by Tommi Junttila at
 
-http://www.tcs.tkk.fi/Software/bliss/index.html
+https://users.aalto.fi/~tjunttil/bliss/index.html
+
+Bliss used to be maintained by Tommi Junttila and Petteri Kaski up to version 0.73 at
 
-We apply patches generated from https://github.com/mkoeppe/bliss (branch
-apply_debian_patches) as our upstream. This tracks the patches from the
-Debian package, adding an autotools build system and adjusting the
-include file locations.
+http://www.tcs.tkk.fi/Software/bliss/index.html
 
 Dependencies
 ------------
diff --git a/build/pkgs/bliss/checksums.ini b/build/pkgs/bliss/checksums.ini
index e97d89587b..0c1ebf647b 100644
--- a/build/pkgs/bliss/checksums.ini
+++ b/build/pkgs/bliss/checksums.ini
@@ -1,4 +1,5 @@
-tarball=bliss-VERSION.tar.gz
-sha1=1da8f098046824fbfff4c64c337e28b2a082f74f
-md5=452aea8737d3c4ad0d8ff39180be8004
-cksum=2193930007
+tarball=bliss-VERSION.zip
+sha1=c91c9dcbc11d66ffbcf6415e09ebe793df37be2a
+md5=5707cbfd9fd00980571c64ab3584c505
+cksum=1626493724
+upstream_url=https://users.aalto.fi/~tjunttil/bliss/downloads/bliss-VERSION.zip
diff --git a/build/pkgs/bliss/dependencies b/build/pkgs/bliss/dependencies
index 3546cda461..66d6773d90 100644
--- a/build/pkgs/bliss/dependencies
+++ b/build/pkgs/bliss/dependencies
@@ -1,4 +1,4 @@
-# no dependencies
+| cmake
 
 ----------
 All lines of this file are ignored except the first.
diff --git a/build/pkgs/bliss/package-version.txt b/build/pkgs/bliss/package-version.txt
index e93ee1376f..9e1e206c41 100644
--- a/build/pkgs/bliss/package-version.txt
+++ b/build/pkgs/bliss/package-version.txt
@@ -1 +1 @@
-0.73+debian-1+sage-2016-08-02.p0
+0.77
diff --git a/build/pkgs/bliss/patches/bliss-0.77-install.patch b/build/pkgs/bliss/patches/bliss-0.77-install.patch
new file mode 100644
index 0000000000..caab14aa40
--- /dev/null
+++ b/build/pkgs/bliss/patches/bliss-0.77-install.patch
@@ -0,0 +1,32 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 01ed093..cfdb0a6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -62,3 +62,27 @@ if(USE_GMP)
+   target_link_libraries(bliss-executable ${GMP_LIBRARIES})
+ endif(USE_GMP)
+ set_target_properties(bliss-executable PROPERTIES OUTPUT_NAME bliss)
++
++include(GNUInstallDirs)
++
++set(
++  BLISS_HEADERS
++  src/bliss_C.h
++  src/uintseqhash.hh
++  src/abstractgraph.hh
++  src/stats.hh
++  src/digraph.hh
++  src/defs.hh
++  src/heap.hh
++  src/graph.hh
++  src/partition.hh
++  src/kqueue.hh
++  src/utils.hh
++  src/orbit.hh
++  src/timer.hh
++  src/bignum.hh
++)
++
++install(TARGETS bliss-executable RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
++install(TARGETS bliss LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(FILES ${BLISS_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bliss)
diff --git a/build/pkgs/bliss/spkg-install.in b/build/pkgs/bliss/spkg-install.in
index aaf4c3037b..4124a2338e 100644
--- a/build/pkgs/bliss/spkg-install.in
+++ b/build/pkgs/bliss/spkg-install.in
@@ -1,4 +1,4 @@
 cd src
-sdh_configure --disable-gmp
+sdh_cmake -DUSE_GMP=OFF -DCMAKE_VERBOSE_MAKEFILE=ON
 sdh_make
 sdh_make_install
diff --git a/build/pkgs/bliss/spkg-src b/build/pkgs/bliss/spkg-src
deleted file mode 100755
index 90073233b7..0000000000
--- a/build/pkgs/bliss/spkg-src
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# creates the tarball in the current dir, to be moved to ../../../upstream
-#
-# adapted from cliquer/spkg-src
-
-die () {
-    echo >&2 "$@"
-    exit 1
-}
-
-rm -rf bliss/
-git clone -b sage_package https://github.com/mkoeppe/bliss.git  || die "Failed to git clone"
-cd bliss/
-
-VERSION=`autoconf --trace='AC_INIT:$2'`
-libtoolize || die "Failed to autoreconf"
-autoreconf -fi || die "Failed to autoreconf"
-automake --add-missing --copy || die "automake failed"
-./configure || die "configure failed"
-
-rm -f bliss-$VERSION.tar.gz
-make dist || die "make dist failed"
-mv bliss-$VERSION.tar.gz ../
-cd ..
-rm -rf bliss/
-
-
diff --git a/src/sage/graphs/bliss.pyx b/src/sage/graphs/bliss.pyx
index bf15833664..4f4e0ee3ca 100644
--- a/src/sage/graphs/bliss.pyx
+++ b/src/sage/graphs/bliss.pyx
@@ -47,22 +47,23 @@ cdef extern from "bliss/graph.hh" namespace "bliss":
     cdef cppclass Graph(AbstractGraph):
         Graph(const unsigned int)
         void add_edge(const unsigned int, const unsigned int)
-        void find_automorphisms(Stats&, void (*)(void* , unsigned int,
-                    const unsigned int*), void*)
         void change_color(const unsigned int, const unsigned int)
-        const unsigned int* canonical_form(Stats&, void (*)(void*,unsigned int,
-                    const unsigned int*), void*)
+        const unsigned int* canonical_form(Stats&)
+
+cdef extern from "bliss/digraph.hh" namespace "bliss":
 
     cdef cppclass Digraph(AbstractGraph):
         Digraph(const unsigned int)
         void add_edge(const unsigned int, const unsigned int)
-        void find_automorphisms(Stats&, void (*)(void* , unsigned int,
-                    const unsigned int*), void*)
         void change_color(const unsigned int, const unsigned int)
-        const unsigned int* canonical_form(Stats&, void (*)(void*,unsigned int,
-                    const unsigned int*), void*)
+        const unsigned int* canonical_form(Stats&)
         unsigned int get_hash()
 
+cdef extern from "bliss_find_automorphisms.h":
+
+    void bliss_find_automorphisms(Graph*, void (*)(void*, unsigned int, const unsigned int*), void*, Stats&)
+    void bliss_find_automorphisms(Digraph*, void (*)(void*, unsigned int, const unsigned int*), void*, Stats&)
+
 
 cdef int encoding_numbits(int n):
     r"""
@@ -124,9 +125,6 @@ cdef void add_gen(void *user_param, unsigned int n, const unsigned int *aut):
 
     sig_free(done)
 
-cdef void empty_hook(void *user_param , unsigned int n, const unsigned int *aut):
-    return
-
 #####################################################
 # constructing bliss graphs from edge lists
 #####################################################
@@ -345,10 +343,10 @@ cdef canonical_form_from_edge_list(int Vnr, list Vout, list Vin, int Lnr=1, list
 
     if directed:
         d = bliss_digraph_from_labelled_edges(Vnr, Lnr, Vout, Vin, labels, partition)
-        aut = d.canonical_form(s, empty_hook, NULL)
+        aut = d.canonical_form(s)
     else:
         g = bliss_graph_from_labelled_edges(Vnr, Lnr, Vout, Vin, labels, partition)
-        aut = g.canonical_form(s, empty_hook, NULL)
+        aut = g.canonical_form(s)
 
     for i in range(len(Vout)):
         x = Vout[i]
@@ -640,11 +638,11 @@ cdef automorphism_group_gens_from_edge_list(int Vnr, Vout, Vin, int Lnr=1, label
 
     if directed:
         d = bliss_digraph_from_labelled_edges(Vnr, Lnr, Vout, Vin, labels, partition)
-        d.find_automorphisms(s, add_gen, <void*>data)
+        bliss_find_automorphisms(d, add_gen, <void*>data, s)
         del d
     else:
         g = bliss_graph_from_labelled_edges(Vnr, Lnr, Vout, Vin, labels, partition)
-        g.find_automorphisms(s, add_gen, <void*>data)
+        bliss_find_automorphisms(g, add_gen, <void*>data, s)
         del g
 
     return [[cyc for cyc in gen if cyc[0] is not None] for gen in gens]
diff --git a/src/sage/graphs/bliss_find_automorphisms.h b/src/sage/graphs/bliss_find_automorphisms.h
new file mode 100644
index 0000000000..a2c084a163
--- /dev/null
+++ b/src/sage/graphs/bliss_find_automorphisms.h
@@ -0,0 +1,22 @@
+#include <bliss/graph.hh>
+#include <bliss/digraph.hh>
+
+inline void bliss_find_automorphisms(bliss::Graph *graph, void (*hook)(void *user_param, unsigned int n, const unsigned int *aut), void *hook_user_param, bliss::Stats s)
+{
+  auto report_aut = [&](unsigned int n, const unsigned int *aut) -> void {
+    if(hook)
+      (*hook)(hook_user_param, n, aut);
+  };
+
+  graph->find_automorphisms(s, report_aut);
+}
+
+inline void bliss_find_automorphisms(bliss::Digraph *graph, void (*hook)(void *user_param, unsigned int n, const unsigned int *aut), void *hook_user_param, bliss::Stats s)
+{
+  auto report_aut = [&](unsigned int n, const unsigned int *aut) -> void {
+    if(hook)
+      (*hook)(hook_user_param, n, aut);
+  };
+
+  graph->find_automorphisms(s, report_aut);
+}