guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: graphviz: Enable Guile library.


From: Roel Janssen
Subject: Re: [PATCH] gnu: graphviz: Enable Guile library.
Date: Mon, 09 May 2016 22:54:00 +0200
User-agent: mu4e 0.9.17; emacs 25.1.50.4

Ludovic Courtès writes:

> Roel Janssen <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]