unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* configuring apps for guile
@ 2020-02-12 13:54 Matt Wette
  2020-02-12 14:04 ` Matt Wette
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Matt Wette @ 2020-02-12 13:54 UTC (permalink / raw)
  To: guile-user

Hi All,

Over the last year I have been dealing with issues getting a 
configure.ac put together
for my guile app.  It needs to install .scm and .go files into the place 
guile expects to
see them: (%site-ccache-dir) and %load-path.   If I compile for my 
ubuntu system then
the installed go files need to go in a non-standard place:
   /usr/lib/x86_64-linux-gnu/guile/2.2/site-ccache
If I compile for the guix context then the expectation is that the files 
are installed in
  $prefix/lib/guile/2.2/site-ccache

Here is my solution.  What do you think?  If $prefix is the same as used 
to build guile
then I use the directories from $guile.  Otherwise, I use the default.  
This now works on
ubuntu and guix.

 From configure.ac:

guile_build_prefix=`$GUILE -c "(display (assq-ref %guile-build-info 
'prefix))"`

if test "$guile_build_prefix" == "$prefix"; then
   echo "using paths for installed guile"
   GUILE_SITE_DIR
   GUILE_SITE_GO_DIR
   GUILE_DATA_DIR
else
   echo "using default paths for guile"
   GUILE_SITE=$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION
GUILE_SITE_GO=$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache
   GUILE_DATA=$prefix/share
   AC_SUBST([GUILE_SITE])
   AC_SUBST([GUILE_SITE_GO])
   AC_SUBST([GUILE_DATA])
fi

GUILE_SITE_DIR is defined in guile.m4, the others are in my own package m4.






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

* Re: configuring apps for guile
  2020-02-12 13:54 configuring apps for guile Matt Wette
@ 2020-02-12 14:04 ` Matt Wette
  2020-02-13  6:59   ` Jeremy Korwin-Zmijowski
  2020-02-13 21:59 ` Jan Wedekind
  2020-02-16 14:48 ` Ludovic Courtès
  2 siblings, 1 reply; 11+ messages in thread
From: Matt Wette @ 2020-02-12 14:04 UTC (permalink / raw)
  To: guile-user



On 2/12/20 5:54 AM, Matt Wette wrote:
> Here is my solution.  What do you think?  If $prefix is the same as 
> used to build guile
> then I use the directories from $guile.  Otherwise, I use the 
> default.  This now works on
> ubuntu and guix.
>

CorrectIon: "directories from $guile" means from paths generated from, 
for example,
      guile -c "((display (assq-ref %guile-build-info 'site-ccache-dir))"

Matt



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

* Re: configuring apps for guile
  2020-02-12 14:04 ` Matt Wette
@ 2020-02-13  6:59   ` Jeremy Korwin-Zmijowski
  0 siblings, 0 replies; 11+ messages in thread
From: Jeremy Korwin-Zmijowski @ 2020-02-13  6:59 UTC (permalink / raw)
  To: Matt Wette, guile-user

Le mercredi 12 février 2020 à 06:04 -0800, Matt Wette a écrit :
> 
> On 2/12/20 5:54 AM, Matt Wette wrote:
> > Here is my solution.  What do you think?  If $prefix is the same
> > as 
> > used to build guile
> > then I use the directories from $guile.  Otherwise, I use the 
> > default.  This now works on
> > ubuntu and guix.
> > 
> 
> CorrectIon: "directories from $guile" means from paths generated
> from, 
> for example,
>       guile -c "((display (assq-ref %guile-build-info 'site-ccache-
> dir))"
> 
> Matt
> 

Hello Matt !
I am on my way to build a Guile app then I will try to package it for
Guix. I may end up trying this and come back with feedback (if not too
far in time haha), thanks for sharing.

Jérémy




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

* Re: configuring apps for guile
  2020-02-12 13:54 configuring apps for guile Matt Wette
  2020-02-12 14:04 ` Matt Wette
@ 2020-02-13 21:59 ` Jan Wedekind
  2020-02-16 14:48 ` Ludovic Courtès
  2 siblings, 0 replies; 11+ messages in thread
From: Jan Wedekind @ 2020-02-13 21:59 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-user

On Wed, 12 Feb 2020, Matt Wette wrote:

> Hi All,
>
> Over the last year I have been dealing with issues getting a configure.ac put 
> together
> for my guile app.  It needs to install .scm and .go files into the place 
> guile expects to
> see them: (%site-ccache-dir) and %load-path.   If I compile for my ubuntu 
> system then
> the installed go files need to go in a non-standard place:
>   /usr/lib/x86_64-linux-gnu/guile/2.2/site-ccache
> If I compile for the guix context then the expectation is that the files are 
> installed in
>  $prefix/lib/guile/2.2/site-ccache
>
> Here is my solution.  What do you think?  If $prefix is the same as used to 
> build guile
> then I use the directories from $guile.  Otherwise, I use the default.  This 
> now works on
> ubuntu and guix.
>
> From configure.ac:
>
> guile_build_prefix=`$GUILE -c "(display (assq-ref %guile-build-info 
> 'prefix))"`
>
> if test "$guile_build_prefix" == "$prefix"; then
>   echo "using paths for installed guile"
>   GUILE_SITE_DIR
>   GUILE_SITE_GO_DIR
>   GUILE_DATA_DIR
> else
>   echo "using default paths for guile"
>   GUILE_SITE=$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION
> GUILE_SITE_GO=$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache
>   GUILE_DATA=$prefix/share
>   AC_SUBST([GUILE_SITE])
>   AC_SUBST([GUILE_SITE_GO])
>   AC_SUBST([GUILE_DATA])
> fi
>
> GUILE_SITE_DIR is defined in guile.m4, the others are in my own package m4.
>

I use guile.m4 from the FSF [1]. It gets invoked in configure.ac as 
follows [2].

   GUILE_PROGS
   GUILE_FLAGS
   GUILE_SITE_DIR
   GUILE_EXT_DIR
   GUILE_CACHE_DIR

See [3] for Automake file. Basically the useful variables from guile.m4 
are: GUILE_SITE, GUILE_EXT, GUILE_CACHE.

Regards
Jan

[1]: https://gitlab.com/wedesoft/aiscm/-/blob/master/m4/guile.m4
[2]: https://gitlab.com/wedesoft/aiscm/-/blob/master/configure.ac#L236
[3]: https://gitlab.com/wedesoft/aiscm/-/blob/master/aiscm/Makefile.am


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

* Re: configuring apps for guile
  2020-02-12 13:54 configuring apps for guile Matt Wette
  2020-02-12 14:04 ` Matt Wette
  2020-02-13 21:59 ` Jan Wedekind
@ 2020-02-16 14:48 ` Ludovic Courtès
  2020-02-16 15:28   ` Matt Wette
  2 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2020-02-16 14:48 UTC (permalink / raw)
  To: Matt Wette; +Cc: Guile User

Hello Matt,

Matt Wette <matt.wette@gmail.com> skribis:

> From configure.ac:
>
> guile_build_prefix=`$GUILE -c "(display (assq-ref %guile-build-info
> 'prefix))"`
>
> if test "$guile_build_prefix" == "$prefix"; then
>   echo "using paths for installed guile"
>   GUILE_SITE_DIR
>   GUILE_SITE_GO_DIR
>   GUILE_DATA_DIR
> else
>   echo "using default paths for guile"
>   GUILE_SITE=$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION
> GUILE_SITE_GO=$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache
>   GUILE_DATA=$prefix/share
>   AC_SUBST([GUILE_SITE])
>   AC_SUBST([GUILE_SITE_GO])
>   AC_SUBST([GUILE_DATA])
> fi

I would recommend not even bothering with the first part of the ‘if’,
and instead always default to install files under $prefix (more
precisely: under $datadir and $libdir).

The bits I’ve been using are:

configure.ac:

  dnl We require guile.m4, from Guile.  Make sure it's available.
  m4_pattern_forbid([^GUILE_P])
  m4_pattern_allow([^GUILE_PKG_ERRORS])

  GUILE_PKG([3.0 2.2 2.0])
  GUILE_PROGS

Makefile.am:

  moddir = $(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION)
  godir  = $(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache

  SOURCES = a.scm b.scm c.scm
  GOBJECTS = $(SOURCES:%.scm=%.go)
  nobase_mod_DATA = $(SOURCES)
  nobase_go_DATA = $(GOBJECTS)

I believe Hall¹ does the right thing, making it easier to get started
with all this!

Thanks,
Ludo’.

¹ https://gitlab.com/a-sassmannshausen/guile-hall



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

* Re: configuring apps for guile
  2020-02-16 14:48 ` Ludovic Courtès
@ 2020-02-16 15:28   ` Matt Wette
  2020-02-16 15:43     ` Matt Wette
  2020-02-16 17:57     ` Ludovic Courtès
  0 siblings, 2 replies; 11+ messages in thread
From: Matt Wette @ 2020-02-16 15:28 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guile User

On 2/16/20 6:48 AM, Ludovic Courtès wrote:
> Hello Matt,
>
> Matt Wette <matt.wette@gmail.com> skribis:
>
>>  From configure.ac:
>>
>> guile_build_prefix=`$GUILE -c "(display (assq-ref %guile-build-info
>> 'prefix))"`
>>
>> if test "$guile_build_prefix" == "$prefix"; then
>>    echo "using paths for installed guile"
>>    GUILE_SITE_DIR
>>    GUILE_SITE_GO_DIR
>>    GUILE_DATA_DIR
>> else
>>    echo "using default paths for guile"
>>    GUILE_SITE=$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION
>> GUILE_SITE_GO=$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache
>>    GUILE_DATA=$prefix/share
>>    AC_SUBST([GUILE_SITE])
>>    AC_SUBST([GUILE_SITE_GO])
>>    AC_SUBST([GUILE_DATA])
>> fi
> I would recommend not even bothering with the first part of the ‘if’,
> and instead always default to install files under $prefix (more
> precisely: under $datadir and $libdir).
>
> The bits I’ve been using are:
>
> configure.ac:
>
>    dnl We require guile.m4, from Guile.  Make sure it's available.
>    m4_pattern_forbid([^GUILE_P])
>    m4_pattern_allow([^GUILE_PKG_ERRORS])
>
>    GUILE_PKG([3.0 2.2 2.0])
>    GUILE_PROGS
>
> Makefile.am:
>
>    moddir = $(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION)
>    godir  = $(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache
>
>    SOURCES = a.scm b.scm c.scm
>    GOBJECTS = $(SOURCES:%.scm=%.go)
>    nobase_mod_DATA = $(SOURCES)
>    nobase_go_DATA = $(GOBJECTS)
>
> I believe Hall¹ does the right thing, making it easier to get started
> with all this!
>
> Thanks,
> Ludo’.
>
> ¹ https://gitlab.com/a-sassmannshausen/guile-hall
>

What if you have a system that gives this (e.g., Ubuntu 18.04):

mwette$ /usr/bin/guile -c "(display (assq-ref %guile-build-info 
'prefix)) (newline)"
/usr

mwette$ /usr/bin/guile -c "(display (%site-ccache-dir)) (newline)"
/usr/lib/x86_64-linux-gnu/guile/2.2/site-ccache

I'm not sure that guile will find .go files installed in 
/usr/lib/guile/2.2/site-ccache.





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

* Re: configuring apps for guile
  2020-02-16 15:28   ` Matt Wette
@ 2020-02-16 15:43     ` Matt Wette
  2020-02-16 15:44       ` Matt Wette
  2020-02-16 17:57     ` Ludovic Courtès
  1 sibling, 1 reply; 11+ messages in thread
From: Matt Wette @ 2020-02-16 15:43 UTC (permalink / raw)
  To: guile-user

On 2/16/20 7:28 AM, Matt Wette wrote:
> On 2/16/20 6:48 AM, Ludovic Courtès wrote:
>>
>>    moddir = $(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION)
>>    godir  = $(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache
>>
> What if you have a system that gives this (e.g., Ubuntu 18.04):
>
> mwette$ /usr/bin/guile -c "(display (assq-ref %guile-build-info 
> 'prefix)) (newline)"
> /usr
>
> mwette$ /usr/bin/guile -c "(display (%site-ccache-dir)) (newline)"
> /usr/lib/x86_64-linux-gnu/guile/2.2/site-ccache
>
> I'm not sure that guile will find .go files installed in 
> /usr/lib/guile/2.2/site-ccache.
>
>

And for me, things get more bizarre.  If I have another guile installed 
in my path
under /opt/local I get

   mwette$ /usr/bin/guile -c "(display (%site-ccache-dir)) (newline)"
   /opt/local/lib/guile/2.2/site-ccache


I have no clue how that is happening.  I assume these paths are hardcoded.

Just to be sure:

   mwette$ env | grep GUILE
   GUILE_WARN_DEPRECATED=detailed
   GUILE_LOAD_PATH=/home/mwette/opt/guile





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

* Re: configuring apps for guile
  2020-02-16 15:43     ` Matt Wette
@ 2020-02-16 15:44       ` Matt Wette
  0 siblings, 0 replies; 11+ messages in thread
From: Matt Wette @ 2020-02-16 15:44 UTC (permalink / raw)
  To: guile-user



On 2/16/20 7:43 AM, Matt Wette wrote:
> And for me, things get more bizarre.  If I have another guile 
> installed in my path
> under /opt/local I get
>
>   mwette$ /usr/bin/guile -c "(display (%site-ccache-dir)) (newline)"
>   /opt/local/lib/guile/2.2/site-ccache
>

I think this has something to do with /etc/alternatives.   A bit 
frustrating.

Matt




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

* Re: configuring apps for guile
  2020-02-16 15:28   ` Matt Wette
  2020-02-16 15:43     ` Matt Wette
@ 2020-02-16 17:57     ` Ludovic Courtès
  2020-02-16 18:12       ` Matt Wette
  1 sibling, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2020-02-16 17:57 UTC (permalink / raw)
  To: Matt Wette; +Cc: Guile User

Hi,

Matt Wette <matt.wette@gmail.com> skribis:

> What if you have a system that gives this (e.g., Ubuntu 18.04):
>
> mwette$ /usr/bin/guile -c "(display (assq-ref %guile-build-info
> 'prefix)) (newline)"
> /usr
>
> mwette$ /usr/bin/guile -c "(display (%site-ccache-dir)) (newline)"
> /usr/lib/x86_64-linux-gnu/guile/2.2/site-ccache
>
> I'm not sure that guile will find .go files installed in
> /usr/lib/guile/2.2/site-ccache.

I guess you would run:

  ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu

in that case.

Does that make sense?

Ludo’.



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

* Re: configuring apps for guile
  2020-02-16 17:57     ` Ludovic Courtès
@ 2020-02-16 18:12       ` Matt Wette
  2020-02-17  9:21         ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Matt Wette @ 2020-02-16 18:12 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guile User

On 2/16/20 9:57 AM, Ludovic Courtès wrote:
> Hi,
>
> Matt Wette <matt.wette@gmail.com> skribis:
>
>> What if you have a system that gives this (e.g., Ubuntu 18.04):
>>
>> mwette$ /usr/bin/guile -c "(display (assq-ref %guile-build-info
>> 'prefix)) (newline)"
>> /usr
>>
>> mwette$ /usr/bin/guile -c "(display (%site-ccache-dir)) (newline)"
>> /usr/lib/x86_64-linux-gnu/guile/2.2/site-ccache
>>
>> I'm not sure that guile will find .go files installed in
>> /usr/lib/guile/2.2/site-ccache.
> I guess you would run:
>
>    ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
>
> in that case.
>
> Does that make sense?
>
> Ludo’.
Yes, but some naive person (like me, for example) would never guess
that is what is required.  (I ran into this installing bytestructures, 
IIRC).
And the info is in pkgconfig/guile-2.2.pc, but still requires chasing down
that resource.   Still thinking about it ...

Thanks, Ludo.

Matt




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

* Re: configuring apps for guile
  2020-02-16 18:12       ` Matt Wette
@ 2020-02-17  9:21         ` Ludovic Courtès
  0 siblings, 0 replies; 11+ messages in thread
From: Ludovic Courtès @ 2020-02-17  9:21 UTC (permalink / raw)
  To: Matt Wette; +Cc: Guile User

Hi,

Matt Wette <matt.wette@gmail.com> skribis:

> On 2/16/20 9:57 AM, Ludovic Courtès wrote:
>> Hi,
>>
>> Matt Wette <matt.wette@gmail.com> skribis:
>>
>>> What if you have a system that gives this (e.g., Ubuntu 18.04):
>>>
>>> mwette$ /usr/bin/guile -c "(display (assq-ref %guile-build-info
>>> 'prefix)) (newline)"
>>> /usr
>>>
>>> mwette$ /usr/bin/guile -c "(display (%site-ccache-dir)) (newline)"
>>> /usr/lib/x86_64-linux-gnu/guile/2.2/site-ccache
>>>
>>> I'm not sure that guile will find .go files installed in
>>> /usr/lib/guile/2.2/site-ccache.
>> I guess you would run:
>>
>>    ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
>>
>> in that case.
>>
>> Does that make sense?
>>
>> Ludo’.
> Yes, but some naive person (like me, for example) would never guess
> that is what is required.  (I ran into this installing bytestructures,
> IIRC).
> And the info is in pkgconfig/guile-2.2.pc, but still requires chasing down
> that resource.   Still thinking about it ...

Perhaps what ‘configure.ac’ could do is provide a hint when there’s a
mismatch.

In some packages I have:

  GUILE_SITE_DIR

  pkgdatadir="$datadir/$PACKAGE_NAME"
  if test "x$guilemoduledir" = "x"; then
    guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
    guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
  else
    guileobjectdir="$guilemoduledir"
  fi
  AC_SUBST([guilemoduledir])
  AC_SUBST([guileobjectdir])

  if test "$guilemoduledir" != "$GUILE_SITE"; then
     # Guile won't be able to locate the module "out of the box", so
     # warn the user.
     AC_MSG_WARN([`guilemoduledir' ($guilemoduledir) is different from `GUILE_SITE' ($GUILE_SITE).])
     AC_MSG_WARN([Make sure to adjust the `GUILE_LOAD_PATH' environment variable accordingly,])
     AC_MSG_WARN([or re-run `configure' with `--with-guilemoduledir=$GUILE_SITE'.])
  fi

The bottom line is that ‘configure’ can’t guess what the user wants.

Ludo’.



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

end of thread, other threads:[~2020-02-17  9:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-12 13:54 configuring apps for guile Matt Wette
2020-02-12 14:04 ` Matt Wette
2020-02-13  6:59   ` Jeremy Korwin-Zmijowski
2020-02-13 21:59 ` Jan Wedekind
2020-02-16 14:48 ` Ludovic Courtès
2020-02-16 15:28   ` Matt Wette
2020-02-16 15:43     ` Matt Wette
2020-02-16 15:44       ` Matt Wette
2020-02-16 17:57     ` Ludovic Courtès
2020-02-16 18:12       ` Matt Wette
2020-02-17  9:21         ` Ludovic Courtès

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