all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#64446] [PATCH] gnu: Add bliss.
@ 2023-07-03 21:21 David Elsing
  2023-07-26 16:10 ` Andreas Enge
  2023-07-26 16:22 ` [bug#64446] [PATCH] " Andreas Enge
  0 siblings, 2 replies; 6+ messages in thread
From: David Elsing @ 2023-07-03 21:21 UTC (permalink / raw)
  To: 64446; +Cc: David Elsing, andreas, efraim, bavier

* gnu/packages/maths.scm (bliss): New variable.
---
The Makefile is rudimentary, so it is easier to call g++ directly.
I did not include GMP, as it is only used to express group sizes exactly.
 gnu/packages/maths.scm | 87 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 653e76027a..ff0aa6170b 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -8529,3 +8529,90 @@ (define-public scilab
 optimization, and modeling, simulation of explicit and implicit dynamical
 systems and symbolic manipulations.")
     (license license:cecill)))                    ;CeCILL v2.1
+
+(define-public bliss
+  (package
+    (name "bliss")
+    (version "0.73")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://www.tcs.hut.fi/Software/bliss/bliss-"
+                                  version ".zip"))
+              (sha256
+               (base32
+                "110ggzyn4fpsq3haisv7pzkgfs5x1m7802r4n5cas30l0hlg6yzm"))))
+    (outputs (list "out" "doc"))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:tests? #f ; No tests
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-string-macro
+            (lambda _
+              (substitute* "bliss.cc"
+                (("\"__DATE__\"") "\" __DATE__ \""))))
+          ;; Move headers under the bliss/ prefix
+          (add-after 'unpack 'move-headers
+            (lambda _
+              (substitute* (find-files "." "\\.(h|hh|cc)$")
+                (("#include \"(.*)\"" all path)
+                 (string-append "#include <bliss/" path ">")))
+              (mkdir-p "bliss")
+              (for-each
+               (lambda (file)
+                 (rename-file file
+                              (string-append "bliss/" (basename file))))
+               (find-files "." "\\.(h|hh)$"))))
+          (add-after 'move-headers 'disable-gmp
+            (lambda _
+              (substitute* "bliss/bignum.hh"
+                (("defined\\(BLISS_USE_GMP\\)") "0"))))
+          (delete 'configure)
+          (replace 'build
+            (lambda _
+              (let ((source-files
+                     '("defs" "graph" "partition" "orbit" "uintseqhash" "heap"
+                       "timer" "utils")))
+                (for-each
+                 (lambda (file)
+                   (display (string-append "Compiling " file "\n"))
+                   (invoke "g++" "-I." "-fPIC" "-c" "-o"
+                           (string-append file ".o")
+                           (string-append file ".cc")))
+                 source-files)
+                (let ((object-files
+                       (map (lambda (file) (string-append file ".o"))
+                            source-files)))
+                  (display (string-append "Linking shared library\n"))
+                  (apply invoke "g++" "-I." "-fPIC" "-shared"
+                         "-o" "libbliss.so"
+                         "bliss_C.cc"
+                         object-files)
+                  (display (string-append "Building bliss\n"))
+                  (apply invoke "g++" "-I." "-o" "bliss.out" "bliss.cc"
+                         "-L." "-lbliss"
+                         (string-append "-Wl,-rpath=" #$output:out "/lib")
+                         object-files)))))
+          (add-after 'build 'build-doc
+            (lambda _
+              (substitute* "Doxyfile"
+                (("INPUT *=.*") "INPUT = . bliss\n"))
+              (invoke "doxygen")))
+          (replace 'install
+            (lambda _
+              (install-file "libbliss.so" (string-append #$output:out "/lib"))
+              (mkdir-p (string-append #$output:out "/bin/"))
+              (copy-file "bliss.out" (string-append #$output:out "/bin/bliss"))
+              (copy-recursively "bliss"
+                                (string-append #$output:out "/include/bliss"))
+              (copy-recursively
+               "html" (string-append #$output:doc "/share/doc/"
+                                     #$name "-" #$version "/html")))))))
+    (native-inputs (list doxygen unzip))
+    (home-page "http://www.tcs.hut.fi/Software/bliss/index.shtml")
+    (synopsis "Tool for computing automorphism groups and canonical labelings of graphs")
+    (description "@code{bliss} is a library for computing automorphism groups
+and canonical forms of graphs.  It has both a command line user interface as
+well as C++ and C programming language APIs.")
+    (license license:lgpl3)))
-- 
2.40.1





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#64446] [PATCH] gnu: Add bliss.
  2023-07-03 21:21 [bug#64446] [PATCH] gnu: Add bliss David Elsing
@ 2023-07-26 16:10 ` Andreas Enge
  2023-09-20 22:14   ` David Elsing
  2023-07-26 16:22 ` [bug#64446] [PATCH] " Andreas Enge
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Enge @ 2023-07-26 16:10 UTC (permalink / raw)
  To: David Elsing; +Cc: 64446, efraim, bavier

Hello,

I have spent quite a long time on this package, trying to simplify your
recipe.

Am Mon, Jul 03, 2023 at 09:21:32PM +0000 schrieb David Elsing:
> +          (add-after 'unpack 'fix-string-macro
> +            (lambda _
> +              (substitute* "bliss.cc"
> +                (("\"__DATE__\"") "\" __DATE__ \""))))

This so far is only a warning with newer gcc versions, so we do not really
need it.

> +          ;; Move headers under the bliss/ prefix
> +          (add-after 'unpack 'move-headers
> +            (lambda _
> +              (substitute* (find-files "." "\\.(h|hh|cc)$")
> +                (("#include \"(.*)\"" all path)
> +                 (string-append "#include <bliss/" path ">")))
> +              (mkdir-p "bliss")
> +              (for-each
> +               (lambda (file)
> +                 (rename-file file
> +                              (string-append "bliss/" (basename file))))
> +               (find-files "." "\\.(h|hh)$"))))

All surprising phases need more comments for their rationale.
I added this:
          ;; Move headers under the bliss/ prefix. This is a Guix choice,
          ;; since the header names are sufficiently generic to cause
          ;; confusions with other packages ("heap.hh").

> +          (add-after 'move-headers 'disable-gmp
> +            (lambda _
> +              (substitute* "bliss/bignum.hh"
> +                (("defined\\(BLISS_USE_GMP\\)") "0"))))

This looks like it is not needed if using the Makefile.

> +          (replace 'build

Here I am not convinced. You end up rewriting the Makefile in Guile.
The Makefile works, but it tries to create a binary "bliss", which
collides with the new file for the headers. This could be solved by
moving the content of the 'move-headers phase between the installation
of the bliss binary (after which it can be deleted) and the installation
of the headers.

Moreover, the Makefile does not create a dynamic, but only a static
library, and your build phase adds a dynamic library. Is this our role
as packagers?

According to the time stamps of the files inside the .zip, the software
dates from 2015 and is apparently unmaintained (otherwise I would have
suggested to get in touch with the developers to improve the Makefile).

So I wonder whether this software meets the quality standards for inclusion
into Guix.

Hm, I just found a new version here:
   https://users.aalto.fi/~tjunttil/bliss/index.html :
"Compiling
In Linux and macOS, one can use GNU Make to compile the bliss executable, as well as the static and shared libraries, with (...)"!

And the author is here:
   https://users.aalto.fi/~tjunttil/

Would you like to give it another try, David? And maybe discuss with the
author whether they would be willing to implement the bliss/ subdirectory
for the headers? (Given that there are now separate src/ and build/
subdirectories that would be quite easy.) And add an "install" target?

Andreas





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#64446] [PATCH] gnu: Add bliss.
  2023-07-03 21:21 [bug#64446] [PATCH] gnu: Add bliss David Elsing
  2023-07-26 16:10 ` Andreas Enge
@ 2023-07-26 16:22 ` Andreas Enge
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Enge @ 2023-07-26 16:22 UTC (permalink / raw)
  To: David Elsing; +Cc: 64446, efraim, bavier

Am Mon, Jul 03, 2023 at 09:21:32PM +0000 schrieb David Elsing:
> +    (outputs (list "out" "doc"))

Oh, and I think the documentation is sufficiently small to be kept in the
same package.

Andreas





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#64446] [PATCH] gnu: Add bliss.
  2023-07-26 16:10 ` Andreas Enge
@ 2023-09-20 22:14   ` David Elsing
  2023-09-20 22:19     ` [bug#64446] [PATCH v2] " David Elsing
  0 siblings, 1 reply; 6+ messages in thread
From: David Elsing @ 2023-09-20 22:14 UTC (permalink / raw)
  To: Andreas Enge; +Cc: 64446, efraim, bavier

Andreas Enge <andreas@enge.fr> writes:

Hello,

thanks for your comments! I noticed that igraph actually contains a
bundled copy of bliss which uses GMP, so I added it as a dependency
here.

>           ;; Move headers under the bliss/ prefix. This is a Guix choice,
>           ;; since the header names are sufficiently generic to cause
>           ;; confusions with other packages ("heap.hh").
In igraph, the bundled copy also has the files under the bliss/ prefix,
so I think it's good we do the same.

> Would you like to give it another try, David? And maybe discuss with the
> author whether they would be willing to implement the bliss/ subdirectory
> for the headers? (Given that there are now separate src/ and build/
> subdirectories that would be quite easy.) And add an "install" target?
I updated the package using the CMake build files in the new version.

During unbundling bliss from igraph, I saw that it also contains
a copy of CXSparse, which led me to split SuiteSparse into its
subpackages: https://issues.guix.gnu.org/66129.

When updating the igraph package, it would be good to use the
suitesparse-cxsparse package right away, so I did not include it yet.
The build with the bliss package succeeds however.

Cheers,
David




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#64446] [PATCH v2] gnu: Add bliss.
  2023-09-20 22:14   ` David Elsing
@ 2023-09-20 22:19     ` David Elsing
  2023-10-11 17:11       ` bug#64446: " Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: David Elsing @ 2023-09-20 22:19 UTC (permalink / raw)
  To: 64446; +Cc: David Elsing

* gnu/packages/maths.scm (bliss): New variable.
---
 gnu/packages/maths.scm | 85 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 6141c09886..76ac34a5d9 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -8567,3 +8567,88 @@ (define-public ruy
 architecture.")
       (license license:asl2.0))))
 
+(define-public bliss
+  (package
+    (name "bliss")
+    (version "0.77")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://users.aalto.fi/~tjunttil/bliss/downloads/bliss-"
+                    version ".zip"))
+              (sha256
+               (base32
+                "193jb63kdwfas2cf61xj3fgkvhb6v2mnbwwpr0jas3zk6j0bkj5c"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      ;; There are no tests
+      #:tests? #f
+      #:configure-flags #~(list "-DUSE_GMP=ON") ; Used by igraph
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; Ensure that GMP is used, otherwise the BigNum type changes.
+          (add-after 'unpack 'define-use-gmp
+            (lambda _
+              (substitute* "src/bignum.hh"
+                (("#pragma once.*" all)
+                 (string-append all "#define BLISS_USE_GMP")))))
+          ;; Move headers under the bliss/ prefix. This is a Guix choice,
+          ;; since there are no upstream installation instructions and the
+          ;; header names are sufficiently generic to cause confusions with
+          ;; other packages (e.g. "heap.hh").
+          (add-after 'define-use-gmp 'move-headers
+            (lambda _
+              (substitute* (find-files "src")
+                (("#include \"(.*)\"" _ path)
+                 (string-append "#include <bliss/" path ">")))
+              (mkdir-p "include/bliss")
+              (for-each
+               (lambda (file)
+                 (rename-file file
+                              (string-append "include/bliss/" (basename file))))
+               (find-files "src" "\\.(h|hh)$"))
+              (substitute* "Doxyfile"
+                (("INPUT *=.*") "INPUT = bliss"))))
+          (add-after 'move-headers 'patch-cmake
+            (lambda _
+              (let ((port (open-file "CMakeLists.txt" "a")))
+                (display
+                 (apply
+                  string-append
+                  ;; Install the executable and the shared library.
+                  "install(TARGETS bliss)\n"
+                  "install(TARGETS bliss-executable)\n"
+                  "install(DIRECTORY include/bliss DESTINATION include)\n"
+                  "target_link_libraries(bliss PUBLIC ${GMP_LIBRARIES})\n"
+                  ;; Missing include directories.
+                  (map
+                   (lambda (name)
+                     (string-append
+                      "target_include_directories(" name " PUBLIC\n"
+                      "${CMAKE_CURRENT_SOURCE_DIR}/include"
+                      " ${GMP_INCLUDE_DIR})\n"))
+                   '("bliss" "bliss_static" "bliss-executable")))
+                 port)
+                (close-port port))))
+          (add-after 'build 'build-doc
+            (lambda _
+              (mkdir "doc")
+              (with-directory-excursion "doc"
+                (let ((srcdir (string-append "../../bliss-" #$version)))
+                  (copy-recursively (string-append srcdir "/include/bliss")
+                                    "bliss")
+                  (invoke "doxygen" (string-append srcdir "/Doxyfile"))))))
+          (add-after 'install 'install-doc
+            (lambda _
+              (copy-recursively
+               "doc/html" (string-append #$output "/share/doc/"
+                                     #$name "-" #$version "/html")))))))
+    (native-inputs (list doxygen graphviz unzip))
+    (propagated-inputs (list gmp))
+    (home-page "https://users.aalto.fi/~tjunttil/bliss/index.html")
+    (synopsis "Tool for computing automorphism groups and canonical labelings of graphs")
+    (description "@code{bliss} is a library for computing automorphism groups
++and canonical forms of graphs.  It has both a command line user interface as
++well as C++ and C programming language APIs.")
+    (license license:lgpl3)))
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#64446: [PATCH v2] gnu: Add bliss.
  2023-09-20 22:19     ` [bug#64446] [PATCH v2] " David Elsing
@ 2023-10-11 17:11       ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2023-10-11 17:11 UTC (permalink / raw)
  To: David Elsing; +Cc: Andreas Enge, 64446-done

Hi,

David Elsing <david.elsing@posteo.net> skribis:

> * gnu/packages/maths.scm (bliss): New variable.

I believe this version addresses the concerns Andreas raised.  Applied!

Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-11 17:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 21:21 [bug#64446] [PATCH] gnu: Add bliss David Elsing
2023-07-26 16:10 ` Andreas Enge
2023-09-20 22:14   ` David Elsing
2023-09-20 22:19     ` [bug#64446] [PATCH v2] " David Elsing
2023-10-11 17:11       ` bug#64446: " Ludovic Courtès
2023-07-26 16:22 ` [bug#64446] [PATCH] " Andreas Enge

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.