From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roel Janssen Subject: Re: [PATCH] gnu: graphviz: Enable Guile library. Date: Mon, 09 May 2016 22:54:00 +0200 Message-ID: <87a8jzc5qv.fsf@gnu.org> References: <87shxrpmbj.fsf@gnu.org> <87h9e7nf2i.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azsCG-0003Yp-5G for guix-devel@gnu.org; Mon, 09 May 2016 16:54:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azsCA-00080e-Kx for guix-devel@gnu.org; Mon, 09 May 2016 16:54:31 -0400 In-reply-to: <87h9e7nf2i.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 Ludovic Courtès writes: > Roel Janssen skribis: > >> I would like to add graphviz's Guile interface to the package >> definition. This introduces two new (top-level) dependencies to the >> graphviz package: guile and swig. >> >> An example of the Guile interface: >> (load-extension (string-append (getenv "HOME") "/.guix-profile/lib/graphviz/guile/libgv_guile.so") "SWIG_init") > > Doesn’t Graphviz provide a module that does this? Would be more > convenient. Not that I'm aware of (and I looked for it..). I think this is because it is automatically generated using SWIG. I had to experiment a bit to find out that the functions exposed in Guile did not have a namespace (gv.). I could create a module for it, and then move libgc_guile.so to lib/guile/2.0/extensions/. There are functions called "rm" and "write" which are obviously already used for other purposes in Scheme. These functions will have to be renamed or just left out of the Scheme module. I must look again in the Guile manual to find out more about exporting a function as a different name. >> ;; Define the graph's nodes and edges. >> (define my-graph (graph "G")) >> (edge >> (node my-graph "A") >> (node my-graph "B")) >> >> ;; Set a lay-out and render it to a file. >> (layout my-graph "dot") >> (render my-graph "svg" "/home/roel/my-graph.svg") > > Indeed, I wonder why we didn’t try before. :-) There's also a function to read a string in the dot language format. Would it be desired to have something like: guix graph gcc --format=pdf >> The patch is fairly straightforward, since all that is needed is include >> the dependencies to the inputs: > > Could you check the output of ‘guix size’ before and after the change? I will do that. Thanks for your time. Kind regards, Roel Janssen