build: Resurrect running mescc from elsewhere.

After setting-up a buld environment, running something like

   ~/src/mes/wip/pre-inst-env mescc -v -v ~/src/mes/wip/scaffold/main.c

works again.

TODO: Make this less complex.

 * The mescc-lib (and gcc-lib) build directories do not help;
   these were introduced to support `wip-autotools'.
 * We used to opt for short *PATH variables: "." rather than
   /gnu/store/.... or /home/janneke/src/mes/master to avoid
   filling the MES arena. XXX Has this been solved?
 * In the Guix bootstrap, we run module/mescc.scm directly
       $MES -e '(mescc)' module/mescc.scm

   ...so that's why these overrides started to appear in multiple
   places.

* build-aux/pre-inst-env.in (MES_UNINSTALLED): New variable.
* scripts/mescc.in (includedir,libdir): Use it to override these.
* module/mescc/mescc.scm (arch-find): Use it to add <lib>-messc.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-08-30 15:00:26 +02:00
parent 0650e08744
commit be87ada6b5
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
3 changed files with 22 additions and 4 deletions

View File

@ -48,6 +48,9 @@ export bindir
GUIX_PACKAGE_PATH="$abs_top_srcdir/guix${GUIX_PACKAGE_PATH:+:}$GUIX_PACKAGE_PATH"
export GUIX_PACKAGE_PATH
MES_UNINSTALLED=1
export MES_UNINSTALLED
LANG=
LC_ALL=

View File

@ -267,11 +267,21 @@
(define* (arch-find options file-name #:key kernel)
(let* ((srcdest (or (getenv "srcdest") ""))
(srcdir-lib (string-append srcdest "lib"))
(srcdir-mescc-lib (string-append srcdest "mescc-lib"))
(libdir (option-ref options 'libdir "lib"))
(libdir-mescc (string-append
(dirname (option-ref options 'libdir "lib"))
"/mescc-lib"))
(arch (string-append (arch-get options) "-mes"))
(path (cons* "."
srcdir-lib
(option-ref options 'libdir "lib")
(filter-map (multi-opt 'library-dir) options)))
(path (append (if (getenv "MES_UNINSTALLED")
(list srcdir-mescc-lib
srcdir-lib
libdir-mescc)
'())
(list libdir)
(or (and=> (getenv "LIBRARY_PATH")
(cut string-split <> #\:)) '())
(filter-map (multi-opt 'library-dir) options)))
(arch-file-name (string-append arch "/" file-name))
(arch-file-name (if kernel (string-append kernel "/" arch-file-name)
arch-file-name))

View File

@ -37,6 +37,11 @@ export MES_PREFIX
GUILE_LOAD_PATH=@guile_site_dir@${GUILE_LOAD_PATH+:}${GUILE_LOAD_PATH}
export GUILE_LOAD_PATH
if test -n "$MES_UNINSTALLED"; then
includedir=${includedir-${abs_top_srcdir}/include}
libdir=${libdir-${abs_top_builddir}/lib}
fi
MES=${MES-@prefix@/bin/mes}
bindir=${bindir-@bindir@}
includedir=${includedir-@includedir@}