From: Roel Janssen <roel@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH] gnu: graphviz: Enable Guile library.
Date: Tue, 10 May 2016 16:07:36 +0200 [thread overview]
Message-ID: <87vb2m6m6v.fsf@gnu.org> (raw)
In-Reply-To: <87r3daghtx.fsf@gnu.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-gnu-graphviz-Enable-Guile-library.patch --]
[-- Type: text/x-patch, Size: 2331 bytes --]
From 704d5eba566af8d90ec7f53e7fc11d989f85c5e6 Mon Sep 17 00:00:00 2001
From: Roel Janssen <roel@gnu.org>
Date: Tue, 10 May 2016 15:54:01 +0200
Subject: [PATCH 1/2] gnu: graphviz: Enable Guile library.
* gnu/packages/graphviz.scm (graphviz): Compile with Guile support.
---
gnu/packages/graphviz.scm | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/graphviz.scm b/gnu/packages/graphviz.scm
index 09f475b..489a71c 100644
--- a/gnu/packages/graphviz.scm
+++ b/gnu/packages/graphviz.scm
@@ -25,6 +25,7 @@
#:use-module (gnu packages gtk)
#:use-module (gnu packages xml)
#:use-module (gnu packages glib)
+ #:use-module (gnu packages guile)
#:use-module (gnu packages bison)
#:use-module (gnu packages image)
#:use-module (gnu packages autotools)
@@ -32,6 +33,7 @@
#:use-module (gnu packages fontutils)
#:use-module (gnu packages compression)
#:use-module (gnu packages gd)
+ #:use-module (gnu packages swig)
#:use-module ((guix licenses) #:select (lgpl2.0+ epl1.0)))
(define-public graphviz
@@ -69,12 +71,24 @@
(rename-file (string-append out "/share/graphviz/doc")
(string-append doc "/share/graphviz/doc"))
#t))
- %standard-phases))))
+ (alist-cons-after
+ 'move-docs 'create-gv-guile-link
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (lib (string-append out "/lib"))
+ (guile-lib-dir (string-append lib "/guile/2.0")))
+ (mkdir-p guile-lib-dir)
+ (system* "ln" "--symbolic"
+ (string-append lib "/graphviz/guile/libgv_guile.so")
+ (string-append guile-lib-dir "/libgv_guile.so"))))
+ %standard-phases)))))
(inputs
`(("libXrender" ,libxrender)
("libX11" ,libx11)
("gts" ,gts)
("gd" ,gd) ; FIXME: Our GD is too old
+ ("guile" ,guile-2.0)
+ ("swig" ,swig)
("pango" ,pango)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
--
2.7.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-graphviz-Add-graphviz-guile.patch --]
[-- Type: text/x-patch, Size: 3312 bytes --]
From a73293cb66f3978e60e1244124cd28b623d6c30c Mon Sep 17 00:00:00 2001
From: Roel Janssen <roel@gnu.org>
Date: Tue, 10 May 2016 15:55:52 +0200
Subject: [PATCH 2/2] gnu: graphviz: Add graphviz-guile.
* gnu/packages/graphviz.scm (graphviz): New variable.
---
gnu/packages/graphviz.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/graphviz.scm b/gnu/packages/graphviz.scm
index 489a71c..f9c49ef 100644
--- a/gnu/packages/graphviz.scm
+++ b/gnu/packages/graphviz.scm
@@ -20,7 +20,9 @@
(define-module (gnu packages graphviz)
#:use-module (guix packages)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
#:use-module (guix download)
+ #:use-module (gnu packages base)
#:use-module (gnu packages xorg)
#:use-module (gnu packages gtk)
#:use-module (gnu packages xml)
@@ -34,7 +36,7 @@
#:use-module (gnu packages compression)
#:use-module (gnu packages gd)
#:use-module (gnu packages swig)
- #:use-module ((guix licenses) #:select (lgpl2.0+ epl1.0)))
+ #:use-module ((guix licenses) #:select (gpl3+ lgpl2.0+ epl1.0)))
(define-public graphviz
(package
@@ -111,6 +113,50 @@ software engineering, database and web design, machine learning, and in visual
interfaces for other technical domains.")
(license epl1.0)))
+(define-public graphviz-guile
+ (package
+ (name "graphviz-guile")
+ (version "1.0")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/roelj/graphviz-guile/archive/v"
+ version ".tar.gz"))
+ (sha256
+ (base32 "1ccmr4isj85j7djg9m56n54rqq1z94bjmrrs6vv4qdcp6ihv3c3r"))
+ (file-name (string-append name "-" version ".tar.gz"))))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let ((tar (string-append (assoc-ref %build-inputs "tar") "/bin/tar"))
+ (PATH (string-append (assoc-ref %build-inputs "gzip") "/bin"))
+ (dest-dir (string-append %output "/share/guile/site/2.0"))
+ (gv (string-append (assoc-ref %build-inputs "graphviz")
+ "/lib/guile/2.0")))
+ (setenv "PATH" PATH)
+ (mkdir-p dest-dir)
+ (system* tar "xvf" (assoc-ref %build-inputs "source"))
+ (chdir "graphviz-guile-1.0")
+ ;; Use the absolute path to the graphviz library so that
+ ;; Guix can find it.
+ (substitute* "graphviz.scm"
+ (("libgv_guile.so") (string-append gv "/libgv_guile.so")))
+ (copy-file "graphviz.scm"
+ (string-append dest-dir "/graphviz.scm"))))))
+ (native-inputs
+ `(("tar" ,tar)
+ ("gzip" ,gzip)))
+ (propagated-inputs
+ `(("graphviz" ,graphviz)))
+ (home-page "https://github.com/roelj/graphviz-guile")
+ (synopsis "Graphviz module for Guile")
+ (description "This package provides a Graphviz module file for Guile. It
+uses the library provided by the Graphviz package.")
+ (license gpl3+)))
+
(define-public gts
(package
(name "gts")
--
2.7.4
[-- Attachment #3: Type: text/plain, Size: 1995 bytes --]
Ludovic Courtès writes:
> Roel Janssen <roel@gnu.org> skribis:
>
>> What is the preferred way to include the module file to the package?
>> Should I create another package with this file alone, and use it as a
>> propagated input for graphviz?
>
> Could you first submit it upstream?
Do you think they would be interested in this? I kind of get the
feeling that the language bindings are something generated
automatically, and manually adding things is not desired (for upstream).
>> I now have a graphviz-guile package with a graphviz.scm module file.
>>
>> Where should I link/copy/move libgv_guile.so?
>>
>> I tried:
>> $PACKAGE_OUTPUT/lib/
>> $PACKAGE_OUTPUT/lib/guile/2.0/
>> $PACKAGE_OUTPUT/lib/guile/2.0/extensions/
>>
>> But it seems my system only looks in:
>> /lib
>> /gnu/store/...-gcc-4.9.3-lib/lib/
>> /gnu/store/...-glibc-2.22/lib/
>> /gnu/store/...-guile-2.0.11/lib/
>
> ‘load-extension’ searches for shared objects in the extension directory:
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guix gexp)> (assoc-ref %guile-build-info 'extensiondir)
> $14 = "/home/ludo/soft/lib/guile/2.0/extensions"
> --8<---------------cut here---------------end--------------->8---
>
> … and in whatever ‘LTDL_LIBRARY_PATH’ points to
> (info "(libtool) Libltdl interface").
So I concluded that it is best to use an absolute path instead. I
substituted the path in the graphviz-guile.
The differences in size:
With patches:
store item total self
/gnu/store/r5rfvwpswgy271m3i03wy2pwwsk386k7-graphviz-2.38.0 292.2 61.9 21.2%
Without patches:
store item total self
/gnu/store/bc0qnp182ffi5p680na7kwhbyxkjaz3m-graphviz-2.38.0 266.0 61.8 23.3%
I could also attach the full output of `guix size graphviz`, before and
after.
Hopefully, my patches are fine..
Thank you for your time.
Kind regards,
Roel Janssen
next prev parent reply other threads:[~2016-05-10 14:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 10:17 [PATCH] gnu: graphviz: Enable Guile library Roel Janssen
2016-05-09 20:37 ` Ludovic Courtès
2016-05-09 20:54 ` Roel Janssen
2016-05-10 5:53 ` Danny Milosavljevic
2016-05-10 9:15 ` Roel Janssen
2016-05-10 13:08 ` Roel Janssen
2016-05-10 13:31 ` Ludovic Courtès
2016-05-10 14:07 ` Roel Janssen [this message]
2016-05-11 14:04 ` Ludovic Courtès
2016-05-11 14:48 ` Roel Janssen
2016-05-11 16:22 ` Ludovic Courtès
2016-05-11 21:55 ` Roel Janssen
2016-05-17 20:48 ` Ludovic Courtès
2016-05-17 21:31 ` Roel Janssen
2016-05-19 12:08 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vb2m6m6v.fsf@gnu.org \
--to=roel@gnu.org \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).