Skip to content

Commit

Permalink
Merge pull request mighty-gerbils#410 from vyzo/build-system
Browse files Browse the repository at this point in the history
Build system improvements
  • Loading branch information
vyzo authored Nov 14, 2019
2 parents bcca79f + 8b147fd commit 0b1d2d9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
25 changes: 21 additions & 4 deletions src/gerbil/runtime/gx-gambc.scm
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,32 @@
(apply cons-expander-load-path paths))

(define (cons-library-load-path . paths)
(let* ((current (&current-module-libpath))
(paths (map path-normalize paths)))
(let ((current (&current-module-libpath))
(paths (map path-normalize paths)))
(&current-module-libpath (append paths current))))

(define (cons-expander-load-path . paths)
(let* ((current (gx#current-expander-module-library-path))
(paths (map path-normalize paths)))
(let ((current (gx#current-expander-module-library-path))
(paths (map path-normalize paths)))
(gx#current-expander-module-library-path (append paths current))))

(define (with-cons-load-path thunk . paths)
(apply with-cons-library-load-path
(lambda () (apply with-cons-expander-load-path thunk paths))
paths))

(define (with-cons-library-load-path thunk . paths)
(let ((current (&current-module-libpath))
(paths (map path-normalize paths)))
(parameterize ((&current-module-libpath (append paths current)))
(thunk))))

(define (with-cons-expander-load-path thunk . paths)
(let ((current (gx#current-expander-module-library-path))
(paths (map path-normalize paths)))
(parameterize ((gx#current-expander-module-library-path (append paths current)))
(thunk))))

;; stuffs
(define (_gx#expand-source src)
(define (expand src)
Expand Down
8 changes: 5 additions & 3 deletions src/std/build-script.ss
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
(["spec"]
(pretty-print build-spec))
(["deps"]
(cons-load-path @srcdir)
(let (build-deps (make-depgraph/spec @build-spec))
(call-with-output-file "build-deps" (cut write build-deps <>))))
(with-cons-load-path
(lambda ()
(let (build-deps (make-depgraph/spec @build-spec))
(call-with-output-file "build-deps" (cut write build-deps <>))))
@srcdir))
(["compile"]
(let (depgraph (call-with-input-file "build-deps" read))
(make srcdir: @srcdir
Expand Down
10 changes: 6 additions & 4 deletions src/std/make.ss
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
prefix: (prefix #f)
force: (force? #f)
optimize: (optimize #f)
debug: (debug? #f)
debug: (debug #f)
static: (static #f)
static-debug: (static-debug #f)
verbose: (verbose #f)
depgraph: (depgraph #f))
(let* ((gerbil-path (getenv "GERBIL_PATH" "~/.gerbil"))
Expand All @@ -47,8 +48,9 @@
(bindir (or bindir (path-expand "bin" gerbil-path)))
(settings [srcdir: srcdir libdir: libdir bindir: bindir
prefix: prefix force: force?
optimize: optimize debug: debug?
static: static verbose: verbose])
optimize: optimize debug: debug
static: static static-debug: static-debug
verbose: verbose])
(buildset (if (not force?)
(filter (cut build? <> settings depgraph) buildspec)
buildspec))
Expand Down Expand Up @@ -505,7 +507,7 @@
[invoke-gsc: #t
output-file: binpath
verbose: (pgetq verbose: settings)
debug: (pgetq debug: settings)
debug: (pgetq static-debug: settings)
(if gsc-opts [gsc-options: gsc-opts] []) ...])
(gxc-compile mod gsc-opts [static: #t settings ...] #f)
(message "... compile static exe " mod " -> " (path-strip-directory binpath))
Expand Down

0 comments on commit 0b1d2d9

Please sign in to comment.