mescc: Honor --includedir, --libdir.
* guix/git/mes.scm (mes): * module/mescc.scm (%includedir, %libdir): New variable. (mescc:main): Add them to options. * module/mescc/mescc.scm (mescc:preprocess, c->info): Add %includedir. (arch-find): Use %libdir instead of prefix-file. (prefix-file): Remove. * scripts/mescc.scm.in (%includedir, %libdir): Initialize from and set in environment. xx * module/mescc/mescc.scm :
This commit is contained in:
parent
fee620cf5b
commit
2c2f03c9e4
|
@ -38,6 +38,8 @@
|
||||||
|
|
||||||
(define %host-arch (or (getenv "%arch") %arch))
|
(define %host-arch (or (getenv "%arch") %arch))
|
||||||
(define %prefix (getenv "%prefix"))
|
(define %prefix (getenv "%prefix"))
|
||||||
|
(define %includedir (getenv "%includedir"))
|
||||||
|
(define %libdir (getenv "%libdir"))
|
||||||
(define %version (getenv "%version"))
|
(define %version (getenv "%version"))
|
||||||
|
|
||||||
(when (and=> (getenv "V") (lambda (v) (and (= (string-length v) 1) (> (string->number v) 1))))
|
(when (and=> (getenv "V") (lambda (v) (and (= (string-length v) 1) (> (string->number v) 1))))
|
||||||
|
@ -155,6 +157,8 @@ General help using GNU software: <http://gnu.org/gethelp/>
|
||||||
(args (append-map unclump-single args))
|
(args (append-map unclump-single args))
|
||||||
(options (parse-opts args))
|
(options (parse-opts args))
|
||||||
(options (acons 'prefix %prefix options))
|
(options (acons 'prefix %prefix options))
|
||||||
|
(options (acons 'includedir %includedir options))
|
||||||
|
(options (acons 'libdir %libdir options))
|
||||||
(arch (option-ref options 'arch %host-arch))
|
(arch (option-ref options 'arch %host-arch))
|
||||||
(options (if arch (acons 'arch arch options) options))
|
(options (if arch (acons 'arch arch options) options))
|
||||||
(dumpmachine? (option-ref options 'dumpmachine #f))
|
(dumpmachine? (option-ref options 'dumpmachine #f))
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
(dir (dirname input-file-name))
|
(dir (dirname input-file-name))
|
||||||
(defines (reverse (filter-map (multi-opt 'define) options)))
|
(defines (reverse (filter-map (multi-opt 'define) options)))
|
||||||
(includes (reverse (filter-map (multi-opt 'include) options)))
|
(includes (reverse (filter-map (multi-opt 'include) options)))
|
||||||
|
(includes (cons (option-ref options 'includedir #f) includes))
|
||||||
(includes (cons dir includes))
|
(includes (cons dir includes))
|
||||||
(prefix (option-ref options 'prefix ""))
|
(prefix (option-ref options 'prefix ""))
|
||||||
(machine (option-ref options 'machine "32"))
|
(machine (option-ref options 'machine "32"))
|
||||||
|
@ -87,9 +88,10 @@
|
||||||
((.E? file-name) (E->info options file-name))))
|
((.E? file-name) (E->info options file-name))))
|
||||||
|
|
||||||
(define (c->info options file-name)
|
(define (c->info options file-name)
|
||||||
(let* ((defines (reverse (filter-map (multi-opt 'define) options)))
|
(let* ((dir (dirname file-name))
|
||||||
|
(defines (reverse (filter-map (multi-opt 'define) options)))
|
||||||
(includes (reverse (filter-map (multi-opt 'include) options)))
|
(includes (reverse (filter-map (multi-opt 'include) options)))
|
||||||
(dir (dirname file-name))
|
(includes (cons (option-ref options 'includedir #f) includes))
|
||||||
(includes (cons dir includes))
|
(includes (cons dir includes))
|
||||||
(prefix (option-ref options 'prefix ""))
|
(prefix (option-ref options 'prefix ""))
|
||||||
(defines (cons (arch-get-define options) defines))
|
(defines (cons (arch-get-define options) defines))
|
||||||
|
@ -260,7 +262,7 @@
|
||||||
(arch (string-append (arch-get options) "-mes"))
|
(arch (string-append (arch-get options) "-mes"))
|
||||||
(path (cons* "."
|
(path (cons* "."
|
||||||
srcdir-lib
|
srcdir-lib
|
||||||
(prefix-file options "lib")
|
(option-ref options 'libdir "lib")
|
||||||
(filter-map (multi-opt 'library-dir) options)))
|
(filter-map (multi-opt 'library-dir) options)))
|
||||||
(arch-file-name (string-append arch "/" file-name))
|
(arch-file-name (string-append arch "/" file-name))
|
||||||
(verbose? (count-opt options 'verbose)))
|
(verbose? (count-opt options 'verbose)))
|
||||||
|
@ -272,12 +274,6 @@
|
||||||
(or file
|
(or file
|
||||||
(error (format #f "mescc: file not found: ~s" arch-file-name))))))
|
(error (format #f "mescc: file not found: ~s" arch-file-name))))))
|
||||||
|
|
||||||
(define (prefix-file options file-name)
|
|
||||||
(let ((prefix (option-ref options 'prefix "")))
|
|
||||||
(define (prefix-file o)
|
|
||||||
(if (string-null? prefix) o (string-append prefix "/" o)))
|
|
||||||
(prefix-file file-name)))
|
|
||||||
|
|
||||||
(define (assert-system* . args)
|
(define (assert-system* . args)
|
||||||
(let ((status (apply system* args)))
|
(let ((status (apply system* args)))
|
||||||
(when (not (zero? status))
|
(when (not (zero? status))
|
||||||
|
|
|
@ -38,7 +38,11 @@ GUILE_LOAD_PATH=@guile_site_dir@${GUILE_LOAD_PATH+:}${GUILE_LOAD_PATH}
|
||||||
export GUILE_LOAD_PATH
|
export GUILE_LOAD_PATH
|
||||||
|
|
||||||
MES=${MES-@prefix@/bin/mes}
|
MES=${MES-@prefix@/bin/mes}
|
||||||
bindir=${bindir-@bindir@/mes}
|
bindir=${bindir-@bindir@}
|
||||||
|
includedir=${includedir-@includedir@}
|
||||||
|
export includedir
|
||||||
|
libdir=${libdir-@libdir@}
|
||||||
|
export libdir
|
||||||
|
|
||||||
if [ ! -f $bindir/mescc.scm ]; then
|
if [ ! -f $bindir/mescc.scm ]; then
|
||||||
bindir=$(dirname $0)
|
bindir=$(dirname $0)
|
||||||
|
|
|
@ -24,17 +24,29 @@
|
||||||
(guile
|
(guile
|
||||||
(define %arch (car (string-split %host-type #\-)))))
|
(define %arch (car (string-split %host-type #\-)))))
|
||||||
|
|
||||||
(setenv "%prefix" (or (getenv "MES_PREFIX")
|
(define %prefix (or (getenv "MES_PREFIX")
|
||||||
(if (string-prefix? "@prefix" "@prefix@")
|
(if (string-prefix? "@prefix" "@prefix@")
|
||||||
""
|
""
|
||||||
"@prefix@")))
|
"@prefix@")))
|
||||||
|
|
||||||
(setenv "%version" (if (string-prefix? "@VERSION" "@VERSION@") "git"
|
(define %includedir (or (getenv "includedir")
|
||||||
|
(string-append %prefix "/include")))
|
||||||
|
|
||||||
|
(define %libdir (or (getenv "libdir")
|
||||||
|
(string-append %prefix "/lib")))
|
||||||
|
|
||||||
|
(define %version (if (string-prefix? "@VERSION" "@VERSION@") "git"
|
||||||
"@VERSION@"))
|
"@VERSION@"))
|
||||||
|
|
||||||
(setenv "%arch" (if (string-prefix? "@mes_cpu" "@mes_cpu@") %arch
|
(define %arch (if (string-prefix? "@mes_cpu" "@mes_cpu@") %arch
|
||||||
"@mes_cpu@"))
|
"@mes_cpu@"))
|
||||||
|
|
||||||
|
(setenv "%prefix" %prefix)
|
||||||
|
(setenv "%includedir" %includedir)
|
||||||
|
(setenv "%libdir" %libdir)
|
||||||
|
(setenv "%version" %version)
|
||||||
|
(setenv "%arch" %arch)
|
||||||
|
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(mes
|
(mes
|
||||||
(mes-use-module (mescc))
|
(mes-use-module (mescc))
|
||||||
|
|
Loading…
Reference in a new issue