From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roel Janssen Subject: Re: [PATCH] gnu: graphviz: Enable Guile library. Date: Tue, 10 May 2016 16:07:36 +0200 Message-ID: <87vb2m6m6v.fsf@gnu.org> References: <87shxrpmbj.fsf@gnu.org> <87h9e7nf2i.fsf@gnu.org> <87a8jzc5qv.fsf@gnu.org> <20160510075324.110436e7@scratchpost.org> <8737pq8e9j.fsf@gnu.org> <87r3daghtx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b08KM-0003w3-SJ for guix-devel@gnu.org; Tue, 10 May 2016 10:08:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b08KJ-00074Y-QS for guix-devel@gnu.org; Tue, 10 May 2016 10:07:57 -0400 In-reply-to: <87r3daghtx.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: Guix-devel --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-gnu-graphviz-Enable-Guile-library.patch >From 704d5eba566af8d90ec7f53e7fc11d989f85c5e6 Mon Sep 17 00:00:00 2001 From: Roel Janssen 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-gnu-graphviz-Add-graphviz-guile.patch >From a73293cb66f3978e60e1244124cd28b623d6c30c Mon Sep 17 00:00:00 2001 From: Roel Janssen 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Ludovic Courtès writes: > Roel Janssen 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 --=-=-=--