unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Installing scheme only programs
@ 2011-03-10  6:50 Diogo F. S. Ramos
  2011-03-10  9:57 ` Tristan Colgate-McFarlane
  2011-03-10 10:34 ` Thien-Thi Nguyen
  0 siblings, 2 replies; 12+ messages in thread
From: Diogo F. S. Ramos @ 2011-03-10  6:50 UTC (permalink / raw)
  To: guile-user

I have a program written entirely in guile's scheme and I use
autotools to distribute it.

Is there a guide to distribute guile programs?

I know that some languages have, but I can see any in the guile docs.

My biggest concern is about the .scm files that makes up my program.

For those who know autotools, I'm using pkgdata to install the files
and them I use (load "/path/to/.scm") from a simple executable
script. But it got me thinking that the .scm files are not exactly
data.

I was thinking that the 'module' facility of guile could be the
solution. I install them where guile's modules are installed and use
(use-modules) to load. But then again, my .scm are not exactly modules
because they are not, in any way, made for general purpose use.

I recently learn a technique where, during 'make', one 'cat' all the
sources files together, forming a big, single executable script. Doing
so, there is no need to install the .scm files, because they are all
inside the same executable file.

This technique needs a little care, but is definitely doable, as I did
a scratch of it and it works, although I felt that the bigger file
made my application take a little more time to start than separate
loaded files. I didn't do any benchmark, so don't take my word on it.

So, what do you guys think?

Is there a proper way to distribute and install scheme only programs?

-- 
Diogo F. S. Ramos



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

* Re: Installing scheme only programs
  2011-03-10  6:50 Installing scheme only programs Diogo F. S. Ramos
@ 2011-03-10  9:57 ` Tristan Colgate-McFarlane
  2011-03-10 17:42   ` Diogo F. S. Ramos
  2011-03-10 10:34 ` Thien-Thi Nguyen
  1 sibling, 1 reply; 12+ messages in thread
From: Tristan Colgate-McFarlane @ 2011-03-10  9:57 UTC (permalink / raw)
  To: Diogo F.S.Ramos; +Cc: guile-user

I use the following trick to get things into the guile site directory
(and still pass a make distcheck).

In configure.ac
GUILE_PROGS
GUILE_FLAGS
GUILE_SITE_DIR

GUILE_PREFIX=`$GUILE_CONFIG info prefix`
AC_SUBST(GUILE_PREFIX)

In src/Makefile.am:
SUFFIXES = .scm .go
.scm.go:
        $(top_srcdir)/build-environ $(GUILE_COMPILE) -o "$@" "$<"

guilesite = @GUILE_SITE@
guileprefix = @GUILE_PREFIX@
guilesitesuffix = `echo $(guilesite) | sed -e 's!^$(guileprefix)!!'`
guilesnmpdir =  $(exec_prefix)/$(guilesitesuffix)/snmp
guilesnmp_DATA = $(SCHEMESOURCES) $(GOBJECTS)

On Thu, 2011-03-10 at 03:50 -0300, Diogo F.S.Ramos wrote: 
> I have a program written entirely in guile's scheme and I use
> autotools to distribute it.
> 
> Is there a guide to distribute guile programs?
> 
> I know that some languages have, but I can see any in the guile docs.
> 
> My biggest concern is about the .scm files that makes up my program.
> 
> For those who know autotools, I'm using pkgdata to install the files
> and them I use (load "/path/to/.scm") from a simple executable
> script. But it got me thinking that the .scm files are not exactly
> data.
> 
> I was thinking that the 'module' facility of guile could be the
> solution. I install them where guile's modules are installed and use
> (use-modules) to load. But then again, my .scm are not exactly modules
> because they are not, in any way, made for general purpose use.
> 
> I recently learn a technique where, during 'make', one 'cat' all the
> sources files together, forming a big, single executable script. Doing
> so, there is no need to install the .scm files, because they are all
> inside the same executable file.
> 
> This technique needs a little care, but is definitely doable, as I did
> a scratch of it and it works, although I felt that the bigger file
> made my application take a little more time to start than separate
> loaded files. I didn't do any benchmark, so don't take my word on it.
> 
> So, what do you guys think?
> 
> Is there a proper way to distribute and install scheme only programs?
> 





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

* Re: Installing scheme only programs
  2011-03-10  6:50 Installing scheme only programs Diogo F. S. Ramos
  2011-03-10  9:57 ` Tristan Colgate-McFarlane
@ 2011-03-10 10:34 ` Thien-Thi Nguyen
  2011-03-10 17:46   ` Diogo F. S. Ramos
  2011-03-11 12:53   ` Ludovic Courtès
  1 sibling, 2 replies; 12+ messages in thread
From: Thien-Thi Nguyen @ 2011-03-10 10:34 UTC (permalink / raw)
  To: Diogo F. S. Ramos; +Cc: guile-user

() Diogo F. S. Ramos <diogofsr@gmail.com>
() Thu, 10 Mar 2011 03:50:29 -0300 (BRT)

   I recently learn a technique where, during 'make', one 'cat' all the
   sources files together, forming a big, single executable script. Doing
   so, there is no need to install the .scm files, because they are all
   inside the same executable file.

This is the technique used in RPX:

  http://www.gnuvola.org/software/rpx/

It generalizes "compilation" from simple concatentation to include other
program-specific transforms.  End result is two files to (un)install:

 - $(bindir)/rpx
 - $(infodir)/rpx.info

No fuss, no muss.

As for the distinction between "data" and "non-data", i tend to view anything
without the executable bit set as data, and all data as programs-in-waiting.
YMMV.



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

* Re: Installing scheme only programs
  2011-03-10  9:57 ` Tristan Colgate-McFarlane
@ 2011-03-10 17:42   ` Diogo F. S. Ramos
  0 siblings, 0 replies; 12+ messages in thread
From: Diogo F. S. Ramos @ 2011-03-10 17:42 UTC (permalink / raw)
  To: tcolgate; +Cc: guile-user

> I use the following trick to get things into the guile site directory
> (and still pass a make distcheck).
> 
> In configure.ac
> GUILE_PROGS
> GUILE_FLAGS
> GUILE_SITE_DIR
> 
> GUILE_PREFIX=`$GUILE_CONFIG info prefix`
> AC_SUBST(GUILE_PREFIX)
> 
> In src/Makefile.am:
> SUFFIXES = .scm .go
> .scm.go:
>         $(top_srcdir)/build-environ $(GUILE_COMPILE) -o "$@" "$<"
> 
> guilesite = @GUILE_SITE@
> guileprefix = @GUILE_PREFIX@
> guilesitesuffix = `echo $(guilesite) | sed -e 's!^$(guileprefix)!!'`
> guilesnmpdir =  $(exec_prefix)/$(guilesitesuffix)/snmp
> guilesnmp_DATA = $(SCHEMESOURCES) $(GOBJECTS)

Nice to know, thank you.

This reminds me of an issue that I'm having with guile-gnome, but I
guess it's a theme that would be appropriate to come in here.

I'm using the great m4 macros from guile.m4 to test if some guile
modules are installed. The thing is, while I can test for (gnome-2), I
can't for, say, (gnome gtk), because, as I understand it, (gnome-2)
prepares the paths to enable loading gnome modules, but, as I'm not
/using/ (gnome-2) at configure time, I can't locate them.

-- 
Diogo F. S. Ramos



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

* Re: Installing scheme only programs
  2011-03-10 10:34 ` Thien-Thi Nguyen
@ 2011-03-10 17:46   ` Diogo F. S. Ramos
  2011-03-11  2:18     ` nalaginrut
  2011-03-11  9:16     ` Thien-Thi Nguyen
  2011-03-11 12:53   ` Ludovic Courtès
  1 sibling, 2 replies; 12+ messages in thread
From: Diogo F. S. Ramos @ 2011-03-10 17:46 UTC (permalink / raw)
  To: ttn; +Cc: guile-user

>    I recently learn a technique where, during 'make', one 'cat' all the
>    sources files together, forming a big, single executable script. Doing
>    so, there is no need to install the .scm files, because they are all
>    inside the same executable file.
> 
> This is the technique used in RPX:
> 
>   http://www.gnuvola.org/software/rpx/
> 
> It generalizes "compilation" from simple concatentation to include other
> program-specific transforms.  End result is two files to (un)install:
> 
>  - $(bindir)/rpx
>  - $(infodir)/rpx.info
> 
> No fuss, no muss.

I'm liking this technique and I will experience a little more with it.

I wonder if there is a tool to, say, strip all comments from the
"binary", so it could be smaller. I guess such tool would not be that
hard to write, but I don't know.

But I guess, in the end, the way to go would be using the new
compilation technology from guile 2.0, although not for now, as I'm
running 1.8.

-- 
Diogo F. S. Ramos



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

* Re: Installing scheme only programs
  2011-03-10 17:46   ` Diogo F. S. Ramos
@ 2011-03-11  2:18     ` nalaginrut
  2011-03-11  4:50       ` dsmich
  2011-03-11  9:16     ` Thien-Thi Nguyen
  1 sibling, 1 reply; 12+ messages in thread
From: nalaginrut @ 2011-03-11  2:18 UTC (permalink / raw)
  To: Diogo F.S.Ramos; +Cc: guile-user

> I wonder if there is a tool to, say, strip all comments from the
> "binary", so it could be smaller. I guess such tool would not be that
> hard to write, but I don't know.

I think it's not a big deal if you just want to get rid of comments.I
always do it like this way:
======
sed "/;.*/d" filename
======


-- 
GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut




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

* Re: Installing scheme only programs
  2011-03-11  2:18     ` nalaginrut
@ 2011-03-11  4:50       ` dsmich
  2011-03-11  4:57         ` Diogo F. S. Ramos
  0 siblings, 1 reply; 12+ messages in thread
From: dsmich @ 2011-03-11  4:50 UTC (permalink / raw)
  To: NalaGinrut, Diogo F.S.Ramos; +Cc: guile-user


---- nalaginrut <nalaginrut@gmail.com> wrote: 
> > I wonder if there is a tool to, say, strip all comments from the
> > "binary", so it could be smaller. I guess such tool would not be that
> > hard to write, but I don't know.
> 
> I think it's not a big deal if you just want to get rid of comments.I
> always do it like this way:
> ======
> sed "/;.*/d" filename
> ======

Careful!  Guile now has the expression comment #;
That sed would be bad for something like   (list a #;b c)

-Dale




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

* Re: Installing scheme only programs
  2011-03-11  4:50       ` dsmich
@ 2011-03-11  4:57         ` Diogo F. S. Ramos
  2011-03-11  5:24           ` nalaginrut
  0 siblings, 1 reply; 12+ messages in thread
From: Diogo F. S. Ramos @ 2011-03-11  4:57 UTC (permalink / raw)
  To: NalaGinrut; +Cc: guile-user

>> > I wonder if there is a tool to, say, strip all comments from the
>> > "binary", so it could be smaller. I guess such tool would not be that
>> > hard to write, but I don't know.
>> 
>> I think it's not a big deal if you just want to get rid of comments.I
>> always do it like this way:
>> ======
>> sed "/;.*/d" filename
>> ======
> 
> Careful!  Guile now has the expression comment #;
> That sed would be bad for something like   (list a #;b c)

Thank you for the 'sed' recipe.

Unfortunately, it's deleting whole lines like:

  (foo bar) ;;this line is gone

-- 
Diogo F. S. Ramos



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

* Re: Installing scheme only programs
  2011-03-11  4:57         ` Diogo F. S. Ramos
@ 2011-03-11  5:24           ` nalaginrut
  0 siblings, 0 replies; 12+ messages in thread
From: nalaginrut @ 2011-03-11  5:24 UTC (permalink / raw)
  To: Diogo F.S.Ramos; +Cc: guile-user

> >> > I wonder if there is a tool to, say, strip all comments from the
> >> > "binary", so it could be smaller. I guess such tool would not be that
> >> > hard to write, but I don't know.
> >> 
> >> I think it's not a big deal if you just want to get rid of comments.I
> >> always do it like this way:
> >> ======
> >> sed "/;.*/d" filename
> >> ======
> > 
> > Careful!  Guile now has the expression comment #;
> > That sed would be bad for something like   (list a #;b c)
> 
> Thank you for the 'sed' recipe.
> 
> Unfortunately, it's deleting whole lines like:
> 
>   (foo bar) ;;this line is gone
> 

Well, I think it's a personal code style problem. I'd like to write
comments for a new line. Maybe 'sed  "s: ;.*::g" filename' is better.
Note there should be a space before ";" in case you are using a "#;" as
dismich said. But I think we must design a perfectly safe method. 
Anyway, I think it's a big deal now. :-)

To dismich: I don't know there's a "#;" now. Thanks for warning. And I'd
like to know what the "#;" means. :-)

-- 
GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut




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

* Re: Installing scheme only programs
  2011-03-10 17:46   ` Diogo F. S. Ramos
  2011-03-11  2:18     ` nalaginrut
@ 2011-03-11  9:16     ` Thien-Thi Nguyen
  1 sibling, 0 replies; 12+ messages in thread
From: Thien-Thi Nguyen @ 2011-03-11  9:16 UTC (permalink / raw)
  To: Diogo F. S. Ramos; +Cc: guile-user

() Diogo F. S. Ramos <diogofsr@gmail.com>
() Thu, 10 Mar 2011 14:46:02 -0300 (BRT)

   I wonder if there is a tool to, say, strip all comments from
   the "binary", so it could be smaller. I guess such tool would
   not be that hard to write, but I don't know.

It's not hard to write (that's what RPX does).  Guile itself has
"guile-tools punify".  See also Guile-BAUX:

  http://www.gnuvola.org/software/guile-baux/

which has additionally the recently added module ‘as-C-byte-array’,
specifically designed for this kind of embedding.  GNU Serveez uses it:

  http://git.savannah.gnu.org/cgit/serveez.git/commit/?h=next&id=5854cf1

Maybe when someone gets a chance, RPX will, too.



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

* Re: Installing scheme only programs
  2011-03-10 10:34 ` Thien-Thi Nguyen
  2011-03-10 17:46   ` Diogo F. S. Ramos
@ 2011-03-11 12:53   ` Ludovic Courtès
  2011-03-13  0:59     ` Thien-Thi Nguyen
  1 sibling, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2011-03-11 12:53 UTC (permalink / raw)
  To: guile-user

Hello,

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> () Diogo F. S. Ramos <diogofsr@gmail.com>
> () Thu, 10 Mar 2011 03:50:29 -0300 (BRT)
>
>    I recently learn a technique where, during 'make', one 'cat' all the
>    sources files together, forming a big, single executable script. Doing
>    so, there is no need to install the .scm files, because they are all
>    inside the same executable file.
>
> This is the technique used in RPX:
>
>   http://www.gnuvola.org/software/rpx/
>
> It generalizes "compilation" from simple concatentation to include other
> program-specific transforms.  End result is two files to (un)install:
>
>  - $(bindir)/rpx
>  - $(infodir)/rpx.info

But then doesn’t it prevent code reuse?

I don’t know to what extent this applies to RPX, but for instance, you
can’t just ‘(use-modules (rpx the-feature-you-want-to-use))’; you end up
doing ‘(use-modules (rpx))’ and potentially pulling more code than you
really want.

Thanks,
Ludo’.




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

* Re: Installing scheme only programs
  2011-03-11 12:53   ` Ludovic Courtès
@ 2011-03-13  0:59     ` Thien-Thi Nguyen
  0 siblings, 0 replies; 12+ messages in thread
From: Thien-Thi Nguyen @ 2011-03-13  0:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-user

() ludo@gnu.org (Ludovic Courtès)
() Fri, 11 Mar 2011 13:53:37 +0100

   But then doesn’t it prevent code reuse?

   I don’t know to what extent this applies to RPX, but for instance, you
   can’t just ‘(use-modules (rpx the-feature-you-want-to-use))’; you end up
   doing ‘(use-modules (rpx))’ and potentially pulling more code than you
   really want.

RPX is a program, not a library.  The modules it uses can be used by other
programs, certainly.  The other RPX-specific functionality should ideally be
split out (librarified) into their own modules for easier code reuse, i agree.
So far, no one has expressed interest, so reality trumps theory for now.



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

end of thread, other threads:[~2011-03-13  0:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-10  6:50 Installing scheme only programs Diogo F. S. Ramos
2011-03-10  9:57 ` Tristan Colgate-McFarlane
2011-03-10 17:42   ` Diogo F. S. Ramos
2011-03-10 10:34 ` Thien-Thi Nguyen
2011-03-10 17:46   ` Diogo F. S. Ramos
2011-03-11  2:18     ` nalaginrut
2011-03-11  4:50       ` dsmich
2011-03-11  4:57         ` Diogo F. S. Ramos
2011-03-11  5:24           ` nalaginrut
2011-03-11  9:16     ` Thien-Thi Nguyen
2011-03-11 12:53   ` Ludovic Courtès
2011-03-13  0:59     ` Thien-Thi Nguyen

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).