From dd6b56bcb72ede1ac62ead336509f2a8643507f6 Mon Sep 17 00:00:00 2001 From: Peter Tillemans Date: Wed, 22 May 2024 22:27:17 +0200 Subject: [PATCH] bundling app --- .gitignore | 2 ++ .guix/modules/bloatrunner.scm | 36 ++++++++++++++++++++++++++- Makefile.am | 7 +++++- README.org | 4 +-- scripts/run-game.in => bloatrunner.in | 0 configure.ac | 2 +- 6 files changed, 46 insertions(+), 5 deletions(-) rename scripts/run-game.in => bloatrunner.in (100%) diff --git a/.gitignore b/.gitignore index b88b146..57f9a3c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ /*.log /.envrc /gnu/ +/bloatrunner +/*.tar.gz diff --git a/.guix/modules/bloatrunner.scm b/.guix/modules/bloatrunner.scm index dacda63..173f360 100644 --- a/.guix/modules/bloatrunner.scm +++ b/.guix/modules/bloatrunner.scm @@ -7,6 +7,7 @@ #:use-module (guix git-download) #:use-module (guix git) #:use-module (guix build-system gnu) + #:use-module (guix build guile-build-system) #:use-module (guix utils) #:use-module (gnu packages) #:use-module (gnu packages autotools) @@ -31,7 +32,40 @@ #:select? vcs-file?)) (build-system gnu-build-system) (arguments - '(#:make-flags '("GUILE_AUTO_COMPILE=0"))) + '(#:make-flags '("GUILE_AUTO_COMPILE=0") + + #:phases + (modify-phases %standard-phases + ;; (replace 'bootstrap + ;; (lambda _ + ;; ;; The 'bootstrap' script lacks a shebang, leading to "Exec + ;; ;; format error" with glibc 2.35. + ;; (invoke "autoreconf" "-vfi"))) + (add-after 'install-bin 'wrap-program + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; (use-modules (guix build guile-build-system)) + ;; Wrap the 'gitile' command to refer to the right modules. + (let* ((out (assoc-ref outputs "out")) + (chickadee (assoc-ref inputs "guile-chickadee")) + (deps (list out chickadee)) + (guile (assoc-ref inputs "guile")) + (effective (target-guile-effective-version)) + (mods (string-drop-right ;drop trailing colon + (string-join deps + (string-append "/share/guile/site/" + effective ":") + 'suffix) + 1)) + (objs (string-drop-right + (string-join deps + (string-append "/lib/guile/" effective + "/site-ccache:") + 'suffix) + 1))) + (wrap-program (string-append out "/bin/bloatrunner") + `("GUILE_LOAD_PATH" ":" prefix (,mods)) + `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs))))))) + )) (native-inputs (list autoconf automake pkg-config)) (inputs diff --git a/Makefile.am b/Makefile.am index 78c9cb7..f0ebf08 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,10 @@ nobase_go_DATA = $(GOBJECTS) guile_install_go_files = install-nobase_goDATA $(guile_install_go_files): install-nobase_modDATA -CLEANFILES = $(GOBJECTS) +bin_SCRIPTS = bloatrunner +CLEANFILES = $(bin_SCRIPTS) \ + $(GOBJECTS) + GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat SUFFIXES = .scm .go .scm.go: @@ -39,3 +42,5 @@ EXTRA_DIST = \ $(SOURCES) \ $(asset_files) \ README.org + + diff --git a/README.org b/README.org index 5f221a3..be67c67 100644 --- a/README.org +++ b/README.org @@ -105,7 +105,7 @@ To run the game from the source checkout, use the `pre-inst-env` wrapper script: ``` -./pre-inst-env run-game +./pre-inst-env bloatrunner ``` ** REPL-driven development @@ -126,7 +126,7 @@ errors so I can read the error and immediately see if it is fixed on saving. ``` -$ watchexec -e .scm ./pre-inst-env run-game +$ watchexec -e .scm ./pre-inst-env bloatrunner ``` diff --git a/scripts/run-game.in b/bloatrunner.in similarity index 100% rename from scripts/run-game.in rename to bloatrunner.in diff --git a/configure.ac b/configure.ac index a80974c..0343bc6 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,7 @@ AM_SILENT_RULES([yes]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env]) -AC_CONFIG_FILES([scripts/run-game], [chmod +x scripts/run-game]) +AC_CONFIG_FILES([bloatrunner], [chmod +x bloatrunner]) GUILE_PKG([3.0]) GUILE_PROGS