From 2f72303e6c4da75acca3d2db2640e6366bcae5e3 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 15 Dec 2019 10:10:23 +0100 Subject: [PATCH] build: Have configure respect GUILE_LOAD_PATH for mes to find Nyacc. * configure: Substitute GUILE_LOAD_PATH from %load-path. * configure.sh: Likewise. * build-aux/config.make.in: Add GUILE_LOAD_PATH as subtitution variable. * build-aux/config.sh.in: Likewise. * mes/module/mes/guile.mes (%load-path): New variable. --- build-aux/config.make.in | 1 + build-aux/config.sh.in | 1 + configure | 6 +++++- configure.sh | 1 + mes/module/mes/guile.mes | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build-aux/config.make.in b/build-aux/config.make.in index 0bedf911..1e250e5e 100644 --- a/build-aux/config.make.in +++ b/build-aux/config.make.in @@ -28,6 +28,7 @@ GIT:=@GIT@ GUILD:=@GUILD@ GUILE:=@GUILE@ GUILE_EFFECTIVE_VERSION:=@GUILE_EFFECTIVE_VERSION@ +GUILE_LOAD_PATH:=@GUILE_LOAD_PATH@ GUIX:=@GUIX@ HELP2MAN:=@HELP2MAN@ HEX2:=@HEX2@ diff --git a/build-aux/config.sh.in b/build-aux/config.sh.in index affc2d60..4e2953e5 100644 --- a/build-aux/config.sh.in +++ b/build-aux/config.sh.in @@ -29,6 +29,7 @@ GIT="@GIT@" GUILD="@GUILD@" GUILE="@GUILE@" GUILE_EFFECTIVE_VERSION="@GUILE_EFFECTIVE_VERSION@" +GUILE_LOAD_PATH="@GUILE_LOAD_PATH@" GUIX="@GUIX@" HELP2MAN="@HELP2MAN@" HEX2="@HEX2@" diff --git a/configure b/configure index d1acfebb..a7b701af 100755 --- a/configure +++ b/configure @@ -388,6 +388,7 @@ Some influential environment variables: LDFLAGS C linker flags GUILE guile command GUILD guild command + GUILE_LOAD_PATH guile load path; where to find Nyacc MES_FOR_BUILD build system MES [can be mes or guile] " PACKAGE VERSION (getenv "prefix"))) @@ -410,6 +411,8 @@ Some influential environment variables: (includedir (option-ref options 'includedir "${prefix}/include")) (libdir (option-ref options 'libdir "${prefix}/lib")) (pkgdatadir (string-append datadir "/mes")) + (guile-load-path (if (and (pair? %load-path) (equal? (car %load-path) ".")) (cdr %load-path) + %load-path)) (guile-effective-version (effective-version)) (guile-site-dir (if (equal? prefix ".") (canonicalize-path ".") (string-append prefix "/share/guile/site/" guile-effective-version))) @@ -614,7 +617,6 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) ("@mandir@" . ,mandir) ("@sysconfdir@" . ,sysconfdir) - ("@GUILE_EFFECTIVE_VERSION@" . ,(effective-version)) ("@colors@" . ,(if disable-colors? "no" "yes")) ("@V@" . ,(if disable-silent-rules? "1" "0")) @@ -625,6 +627,8 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) ("@DOT@" . ,(or (file-name "dot" deps) "")) ("@GIT@" . ,(or (file-name "git" deps) "")) ("@GUILE@" . ,guile) + ("@GUILE_EFFECTIVE_VERSION@" . ,(effective-version)) + ("@GUILE_LOAD_PATH@" . ,(string-join guile-load-path ":")) ("@GUIX@" . ,(or (file-name "guix" deps) "")) ("@HELP2MAN@" . ,(or (file-name "help2man" deps) "")) ("@MAKEINFO@" . ,(or (file-name "makeinfo" deps) "")) diff --git a/configure.sh b/configure.sh index 5b5a4a93..086c18e2 100755 --- a/configure.sh +++ b/configure.sh @@ -151,6 +151,7 @@ subst () { -e s,"@pkgdatadir@,$pkgdatadir,"\ -e s,"@sysconfdir@,$sysconfdir,"\ -e s,"@GUILE_EFFECTIVE_VERSION@,$GUILE_EFFECTIVE_VERSION,"\ + -e s,"@GUILE_LOAD_PATH@,$GUILE_LOAD_PATH,"\ -e s,"@V@,$V,"\ -e s,"@AR@,$AR,"\ -e s,"@BASH@,$BASH,"\ diff --git a/mes/module/mes/guile.mes b/mes/module/mes/guile.mes index 00524d00..42ac445e 100644 --- a/mes/module/mes/guile.mes +++ b/mes/module/mes/guile.mes @@ -32,6 +32,8 @@ (mes-use-module (mes display)) (mes-use-module (mes simple-format)) +(define %load-path (or (and=> (getenv "GUILE_LOAD_PATH") (lambda (x) (string-split x #\:))) '())) + (define (drain-input port) (read-string)) (define (read-line . rest)