On 04/22/2015 07:57 AM, Jeroen Demeyer wrote:
> Hello,
> 
> The directory
> src/sage/graphs/planarity_c/
> is really a copy of an external package
> https://code.google.com/p/planarity/
> 
> Similarly,
> src/sage/graphs/graph_decompositions/rankwidth_c
> is really a copy of
> http://pholia.tdi.informatik.uni-frankfurt.de/~philipp/software/rw.shtml
> 
> What should we do with this? I think it's cleaner to move them out of 
> the Sage library. One solution is to make both of these into a real 
> package. But then we have to manually autotoolize these projects which 
> is not very fun.


Can't we work with upstream (the authors) to package these? I've
autotoolized the "rw" program -- the only thing left to do is separate
the compilation of the library (no dependencies) from the binary (needs
igraph).

This could be accomplished with a --no-executable flag or whatever, I
just ran out of time. I've CCed the package author.

To generate all the autotools junk, you now run,

  $ libtoolize; aclocal; autoconf; autoheader; automake --add-missing

And then ./configure && make to build it. Afterwards, "make dist" will
generate the package tarball for you.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
From 6b8d9f4c2cecb201ef617da0d667a9543e463b06 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <mich...@orlitzky.com>
Date: Wed, 22 Apr 2015 13:19:52 -0400
Subject: [PATCH 1/7] Update simplerw.c to support igraph >= 0.6.

Newer versions of the igraph library take an extra argument to the
igraph_get_adjacency() function. We pass zero as the additional
argument to retain backwards compatibility. Note: now compilation will
fail against igraph < 0.6.
---
 simplerw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/simplerw.c b/simplerw.c
index 1879906..b5db3fe 100644
--- a/simplerw.c
+++ b/simplerw.c
@@ -133,7 +133,7 @@ int read_graph(const char *format, const char * filename)
 		igraph_destroy(&igraph);
 		return(-1);
 	}
-	igraph_get_adjacency(&igraph, &imatrix, IGRAPH_GET_ADJACENCY_BOTH);
+	igraph_get_adjacency(&igraph, &imatrix, IGRAPH_GET_ADJACENCY_BOTH, 0);
 	igraph_destroy(&igraph);
 	if(igraph_matrix_nrow(&imatrix) > MAX_VERTICES)
 	{
-- 
2.0.5

From 415cdf780d6227a2f80430731844c2ea199b04a6 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <mich...@orlitzky.com>
Date: Wed, 22 Apr 2015 13:24:32 -0400
Subject: [PATCH 2/7] Add configure.ac and Makefile.am files to autotoolize the
 project.

This commit adds two very simple autotools files which allow the
project to be built in the standard way. To generate the autotools
stuff, one can now run through the standard choreography:

  $ aclocal; autoconf; autoheader; automake --add-missing

Afterwards, the usual

  $ ./configure && make

can be used to build the project.
---
 Makefile.am  |  7 +++++++
 configure.ac | 21 +++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 Makefile.am
 create mode 100644 configure.ac

diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..1d5f2bb
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,7 @@
+bin_PROGRAMS = rw
+
+rw_SOURCES = rw.c simplerw.c
+rw_CFLAGS = $(IGRAPH_CFLAGS)
+rw_LDFLAGS= $(IGRAPH_LIBS)
+
+dist_doc_DATA = README
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..f358ab2
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,21 @@
+AC_PREREQ([2.59])
+AC_INIT([rw], [0.4], [phil...@informatik.uni-frankfurt.de])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AC_PROG_CC
+AC_PROG_CC_C99
+
+dnl Not needed with automake >= 1.14.
+AM_PROG_CC_C_O
+
+AC_CONFIG_HEADERS([config.h])
+
+PKG_CHECK_MODULES(IGRAPH, igraph >= 0.6)
+AC_CHECK_HEADERS([stdint.h, stdlib.h, string.h])
+AC_TYPE_SIZE_T
+AC_FUNC_MALLOC
+
+AC_CONFIG_FILES([
+ Makefile
+])
+
+AC_OUTPUT
-- 
2.0.5

From a9da2cd067e9480e539ac533d073ca296415d87d Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <mich...@orlitzky.com>
Date: Wed, 22 Apr 2015 13:31:39 -0400
Subject: [PATCH 3/7] Update the README with new build instructions.

---
 README | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 0d57897..8782bf0 100644
--- a/README
+++ b/README
@@ -1,9 +1,32 @@
-This program calculates rank-width and rank-decompositions. It is based on ideas from "Computing rank-width exactly" by Sang-il Oum, "Sopra una formula numerica" by Ernesto Pascal, "Generation of a Vector from the Lexicographical Index" by B.P. Buckles and M. Lybanon and "Fast additions on masked integers" by Michael D. Adams and David S. Wise.
-On today's computers it works quite well up to graph sizes of about 28 nodes.
+This program calculates rank-width and rank-decompositions. It is
+based on ideas from "Computing rank-width exactly" by Sang-il Oum,
+"Sopra una formula numerica" by Ernesto Pascal, "Generation of a
+Vector from the Lexicographical Index" by B.P. Buckles and M. Lybanon
+and "Fast additions on masked integers" by Michael D. Adams and David
+S. Wise.  On today's computers it works quite well up to graph sizes
+of about 28 nodes.
 
-Assuming that libigraph is installed it can be compiled using e.g. "gcc -O2 --std=c99 -pedantic rw.c simplerw.c -ligraph".
+The files rw.h / rw.c provide a general mechanism for calculating
+rank-width and rank-decompositions. simplerw.c provides a simple
+command-line interface.
 
-It supports a number of input graph formats; there is an example graph included, for which rank-width and rank-decomposition can be calculated using "./a.out --edgelist igrid".
+The "igraph" library (from igraph.org) is required to build the
+project. The pkg-config utility should be able to find the igraph
+library on its own if igraph is installed. In that case, you can build
+the project by,
 
-rw.h / rw.c provide a general mechanism for calculating rank-width and rank-decompositions. simplerw.c provides a simple command-line interface.
+  $ ./configure
+  $ ./make
 
+This will result in a binary, named "rw", stored in the current directory.
+It supports a number of input graph formats; there is an example graph
+included, for which rank-width and rank-decomposition can be
+calculated using
+
+  $ ./rw --edgelist igrid
+
+Other formats are available, run
+
+  $ ./rw
+
+with no arguments to see a short usage description.
-- 
2.0.5

From be58869f327c1f45bb5f2871881128256d0dd9f9 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <mich...@orlitzky.com>
Date: Wed, 22 Apr 2015 13:31:53 -0400
Subject: [PATCH 4/7] Bump the version to 0.5 in configure.ac to reflect the
 recent changes.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index f358ab2..ed3b749 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.59])
-AC_INIT([rw], [0.4], [phil...@informatik.uni-frankfurt.de])
+AC_INIT([rw], [0.5], [phil...@informatik.uni-frankfurt.de])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AC_PROG_CC
 AC_PROG_CC_C99
-- 
2.0.5

From bd240e736425db3fd5f40d1059ed20b44c477ba3 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <mich...@orlitzky.com>
Date: Wed, 22 Apr 2015 13:41:33 -0400
Subject: [PATCH 5/7] Add missing rw.h to rw_SOURCES in Makefile.am.

---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 1d5f2bb..4a64d9f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 bin_PROGRAMS = rw
 
-rw_SOURCES = rw.c simplerw.c
+rw_SOURCES = rw.c rw.h simplerw.c
 rw_CFLAGS = $(IGRAPH_CFLAGS)
 rw_LDFLAGS= $(IGRAPH_LIBS)
 
-- 
2.0.5

From 9e0b35c0de96e4f6f13ba293d583b0181e84b083 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <mich...@orlitzky.com>
Date: Wed, 22 Apr 2015 13:44:45 -0400
Subject: [PATCH 6/7] Move the examples to the "examples" directory and update
 the docs. Ship the examples with the distribution tarball.

---
 "H\303\244ngematte"          | 25 --------------
 Makefile.am                  |  2 +-
 README                       |  2 +-
 "examples/H\303\244ngematte" | 25 ++++++++++++++
 examples/grid                | 14 ++++++++
 examples/igrid               | 78 ++++++++++++++++++++++++++++++++++++++++++++
 grid                         | 14 --------
 igrid                        | 78 --------------------------------------------
 8 files changed, 119 insertions(+), 119 deletions(-)
 delete mode 100644 "H\303\244ngematte"
 create mode 100644 "examples/H\303\244ngematte"
 create mode 100644 examples/grid
 create mode 100644 examples/igrid
 delete mode 100644 grid
 delete mode 100644 igrid

diff --git "a/H\303\244ngematte" "b/H\303\244ngematte"
deleted file mode 100644
index 0de42a9..0000000
--- "a/H\303\244ngematte"
+++ /dev/null
@@ -1,25 +0,0 @@
-0 1
-1 2
-1 3
-1 4
-2 3
-2 5
-3 4
-3 6
-4 7
-5 6
-5 8
-6 7
-6 9
-7 10
-8 9
-8 11
-9 10
-9 12
-10 13
-11 0
-11 12
-12 0
-12 13
-13 0
-
diff --git a/Makefile.am b/Makefile.am
index 4a64d9f..b4ffae5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,4 +4,4 @@ rw_SOURCES = rw.c rw.h simplerw.c
 rw_CFLAGS = $(IGRAPH_CFLAGS)
 rw_LDFLAGS= $(IGRAPH_LIBS)
 
-dist_doc_DATA = README
+dist_doc_DATA = README examples/*
diff --git a/README b/README
index 8782bf0..2cb2f1a 100644
--- a/README
+++ b/README
@@ -23,7 +23,7 @@ It supports a number of input graph formats; there is an example graph
 included, for which rank-width and rank-decomposition can be
 calculated using
 
-  $ ./rw --edgelist igrid
+  $ ./rw --edgelist examples/igrid
 
 Other formats are available, run
 
diff --git "a/examples/H\303\244ngematte" "b/examples/H\303\244ngematte"
new file mode 100644
index 0000000..0de42a9
--- /dev/null
+++ "b/examples/H\303\244ngematte"
@@ -0,0 +1,25 @@
+0 1
+1 2
+1 3
+1 4
+2 3
+2 5
+3 4
+3 6
+4 7
+5 6
+5 8
+6 7
+6 9
+7 10
+8 9
+8 11
+9 10
+9 12
+10 13
+11 0
+11 12
+12 0
+12 13
+13 0
+
diff --git a/examples/grid b/examples/grid
new file mode 100644
index 0000000..60818e2
--- /dev/null
+++ b/examples/grid
@@ -0,0 +1,14 @@
+0 1
+1 2
+3 4
+4 5
+6 7
+7 8
+0 3
+1 4
+2 5
+3 6
+4 7
+5 8
+
+
diff --git a/examples/igrid b/examples/igrid
new file mode 100644
index 0000000..a1fee8c
--- /dev/null
+++ b/examples/igrid
@@ -0,0 +1,78 @@
+0 1
+0 2
+0 3
+0 4
+1 2
+1 3
+1 4
+2 3
+2 4
+3 4
+
+1 5
+2 5
+2 6
+3 5
+3 6
+3 7
+4 5
+4 6
+4 7
+4 8
+
+5 6
+5 7
+5 8
+5 9
+6 7
+6 8
+6 9
+7 8
+7 9
+8 9
+
+6 10
+7 10
+7 11
+8 10
+8 11
+8 12
+9 10
+9 11
+9 12
+9 13
+
+10 11
+10 12
+10 13
+10 14
+11 12
+11 13
+11 14
+12 13
+12 14
+13 14
+
+11 15
+12 15
+12 16
+13 15
+13 16
+13 17
+14 15
+14 16
+14 17
+14 18
+
+15 16
+15 17
+15 18
+15 19
+16 17
+16 18
+16 19
+17 18
+17 19
+18 19
+
+
diff --git a/grid b/grid
deleted file mode 100644
index 60818e2..0000000
--- a/grid
+++ /dev/null
@@ -1,14 +0,0 @@
-0 1
-1 2
-3 4
-4 5
-6 7
-7 8
-0 3
-1 4
-2 5
-3 6
-4 7
-5 8
-
-
diff --git a/igrid b/igrid
deleted file mode 100644
index a1fee8c..0000000
--- a/igrid
+++ /dev/null
@@ -1,78 +0,0 @@
-0 1
-0 2
-0 3
-0 4
-1 2
-1 3
-1 4
-2 3
-2 4
-3 4
-
-1 5
-2 5
-2 6
-3 5
-3 6
-3 7
-4 5
-4 6
-4 7
-4 8
-
-5 6
-5 7
-5 8
-5 9
-6 7
-6 8
-6 9
-7 8
-7 9
-8 9
-
-6 10
-7 10
-7 11
-8 10
-8 11
-8 12
-9 10
-9 11
-9 12
-9 13
-
-10 11
-10 12
-10 13
-10 14
-11 12
-11 13
-11 14
-12 13
-12 14
-13 14
-
-11 15
-12 15
-12 16
-13 15
-13 16
-13 17
-14 15
-14 16
-14 17
-14 18
-
-15 16
-15 17
-15 18
-15 19
-16 17
-16 18
-16 19
-17 18
-17 19
-18 19
-
-
-- 
2.0.5

From eb95a4f8dcf917e4d241b97f66443c6f12632618 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <mich...@orlitzky.com>
Date: Wed, 22 Apr 2015 14:08:11 -0400
Subject: [PATCH 7/7] Build a library, "librw", that the main "rw" binary links
 against.

Rather than compile the binary and the library together (i.e. all of
the source files at once), create an intermediate library, and then
link the "rw" program to that. This allows other software to link
against the library of functions.

Note: the igraph dependency still exists in autoconf, even though it
is only needed for the binary and not the library.
---
 Makefile.am  | 11 ++++++++---
 configure.ac |  4 ++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b4ffae5..80886a3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,12 @@
-bin_PROGRAMS = rw
+# The "librw" library, contains all of the useful functions.
+lib_LTLIBRARIES = librw.la
+librw_la_SOURCES = rw.c rw.h
 
-rw_SOURCES = rw.c rw.h simplerw.c
+# The "rw" binary, built against the librw library above.
+bin_PROGRAMS = rw
+rw_SOURCES = simplerw.c
 rw_CFLAGS = $(IGRAPH_CFLAGS)
-rw_LDFLAGS= $(IGRAPH_LIBS)
+rw_LDFLAGS = $(IGRAPH_LIBS)
+rw_LDADD = $(lib_LTLIBRARIES)
 
 dist_doc_DATA = README examples/*
diff --git a/configure.ac b/configure.ac
index ed3b749..f0c1f9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,10 @@
 AC_PREREQ([2.59])
 AC_INIT([rw], [0.5], [phil...@informatik.uni-frankfurt.de])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AM_PROG_AR
+LT_PREREQ([2.4])
+LT_INIT
+
 AC_PROG_CC
 AC_PROG_CC_C99
 
-- 
2.0.5

Reply via email to