diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile.am | 48 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | pre-inst-env.in | 1 | ||||
-rwxr-xr-x | scripts/run-game | 3 | ||||
-rwxr-xr-x | scripts/super-bloom.in | 12 | ||||
-rw-r--r-- | super-bloom/common.scm | 13 | ||||
-rw-r--r-- | super-bloom/config.scm.in | 18 | ||||
-rw-r--r-- | super-bloom/dirt-ball.scm | 2 | ||||
-rw-r--r-- | super-bloom/flower.scm | 2 | ||||
-rw-r--r-- | super-bloom/game.scm | 10 | ||||
-rw-r--r-- | super-bloom/player.scm | 2 | ||||
-rw-r--r-- | super-bloom/splash.scm | 2 | ||||
-rw-r--r-- | super-bloom/water.scm | 2 |
15 files changed, 100 insertions, 30 deletions
@@ -9,3 +9,5 @@ /config.status /configure /pre-inst-env +/scripts/super-bloom +/super-bloom/config.scm diff --git a/Makefile.am b/Makefile.am index 5b33176..3840af1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,22 @@ +# Handle substitution of fully-expanded Autoconf variables. +do_subst = $(SED) \ + -e 's,[@]GUILE[@],$(GUILE),g' \ + -e 's,[@]guilemoduledir[@],$(guilemoduledir),g' \ + -e 's,[@]guileobjectdir[@],$(guileobjectdir),g' \ + -e 's,[@]datadir[@],$(datadir),g' + +scripts/super-bloom: scripts/super-bloom.in Makefile + $(AM_V_at)rm -f $@ $@-t + $(AM_V_at)$(MKDIR_P) "$(@D)" + $(AM_V_GEN)$(do_subst) < "$(srcdir)/$@.in" > "$@-t" + $(AM_V_at)chmod a+x,a-w "$@-t" && mv -f "$@-t" "$@" + +super-bloom/config.scm: super-bloom/config.scm.in Makefile + $(AM_V_at)rm -f $@ $@-t + $(AM_V_at)$(MKDIR_P) "$(@D)" + $(AM_V_GEN)$(do_subst) < "$(srcdir)/$@.in" > "$@-t" + $(AM_V_at)chmod a-w "$@-t" && mv -f "$@-t" "$@" + GOBJECTS = $(SOURCES:%.scm=%.go) nobase_mod_DATA = $(SOURCES) nobase_go_DATA = $(GOBJECTS) @@ -20,6 +39,7 @@ moddir=$(prefix)/share/guile/site/$(GUILE_EFFECTIVE_VERSION) godir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache SOURCES = \ + super-bloom/config.scm \ super-bloom/common.scm \ super-bloom/actor.scm \ super-bloom/water.scm \ @@ -30,16 +50,22 @@ SOURCES = \ super-bloom/splash.scm \ super-bloom/main.scm -EXTRA_DIST = \ - $(SOURCES) \ - COPYING \ - README.md \ - guix.scm \ +bin_SCRIPTS = \ + scripts/super-bloom + +audiodir = $(pkgdatadir)/audio +dist_audio_DATA = \ assets/audio/absorb.wav \ assets/audio/explosion.wav \ assets/audio/spray.wav \ - assets/audio/watered.wav \ - assets/fonts/monogram_extended.ttf \ + assets/audio/watered.wav + +fontsdir = $(pkgdatadir)/fonts +dist_fonts_DATA = \ + assets/fonts/monogram_extended.ttf + +imagesdir = $(pkgdatadir)/images +dist_images_DATA = \ assets/images/background.png \ assets/images/chickadee.png \ assets/images/dirt-ball.png \ @@ -48,5 +74,9 @@ EXTRA_DIST = \ assets/images/player.png \ assets/images/trail-particle.png \ assets/images/water.png \ - assets/images/water-particle.png \ - scripts/run-game + assets/images/water-particle.png + +EXTRA_DIST = \ + COPYING \ + README.md \ + guix.scm @@ -43,5 +43,5 @@ make -j$(nproc) To run the game from the source checkout, use the `pre-inst-env` wrapper script: ``` -./pre-inst-env run-game +./pre-inst-env super-bloom ``` diff --git a/configure.ac b/configure.ac index cb264af..779d240 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -dnl -*- Autoconf -*- +# -*- Autoconf -*- AC_INIT(super-bloom, 0.1.0) AC_CONFIG_SRCDIR(super-bloom) @@ -8,6 +8,9 @@ AM_SILENT_RULES([yes]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env]) +#AC_CONFIG_FILES([super-bloom/config.scm]) + +AC_PROG_SED GUILE_PKG([3.0]) GUILE_PROGS @@ -15,4 +18,10 @@ GUILE_PROGS GUILE_MODULE_REQUIRED([chickadee]) GUILE_MODULE_REQUIRED([catbird]) +# Installation directories for .scm and .go files. +guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION" +guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache" +AC_SUBST([guilemoduledir]) +AC_SUBST([guileobjectdir]) + AC_OUTPUT diff --git a/pre-inst-env.in b/pre-inst-env.in index 881f142..71c4641 100644 --- a/pre-inst-env.in +++ b/pre-inst-env.in @@ -6,5 +6,6 @@ abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd`" export GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH" export GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}:$GUILE_LOAD_PATH" export PATH="$abs_top_builddir/scripts:$PATH" +export SUPERBLOOM_DATADIR="$abs_top_builddir/assets" exec "$@" diff --git a/scripts/run-game b/scripts/run-game deleted file mode 100755 index 15bbf9d..0000000 --- a/scripts/run-game +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec guile -c '(use-modules (super-bloom main)) (launch-game)' diff --git a/scripts/super-bloom.in b/scripts/super-bloom.in new file mode 100755 index 0000000..1e9a41b --- /dev/null +++ b/scripts/super-bloom.in @@ -0,0 +1,12 @@ +#!@GUILE@ \ +--no-auto-compile -s +!# + +;; Add installed modules to load path. +(define-syntax-rule (push! elt v) (set! v (cons elt v))) +(push! "@guilemoduledir@" %load-path) +(push! "@guileobjectdir@" %load-compiled-path) + +;; Launch game. +(use-modules (super-bloom main)) +(launch-game) diff --git a/super-bloom/common.scm b/super-bloom/common.scm index 0e55b90..7dd50a1 100644 --- a/super-bloom/common.scm +++ b/super-bloom/common.scm @@ -20,6 +20,7 @@ #:use-module (chickadee audio) #:use-module (chickadee graphics text) #:use-module (oop goops) + #:use-module (super-bloom config) #:export (%default-width %default-height %game-width @@ -45,22 +46,22 @@ (define %game-height:float (exact->inexact %game-height)) (define (scope-datadir file-name) - (let ((prefix (or (getenv "SUPERBLOOM_DATADIR") (getcwd)))) + (let ((prefix (or (getenv "SUPERBLOOM_DATADIR") %datadir))) (string-append prefix "/" file-name))) -(define-asset (monogram-font (file (scope-datadir "assets/fonts/monogram_extended.ttf"))) +(define-asset (monogram-font (file (scope-datadir "fonts/monogram_extended.ttf"))) (load-font file 12 #:smooth? #f)) -(define-asset (explosion-sound (file (scope-datadir "assets/audio/explosion.wav"))) +(define-asset (explosion-sound (file (scope-datadir "audio/explosion.wav"))) (load-audio file)) -(define-asset (absorb-sound (file (scope-datadir "assets/audio/absorb.wav"))) +(define-asset (absorb-sound (file (scope-datadir "audio/absorb.wav"))) (load-audio file)) -(define-asset (watered-sound (file (scope-datadir "assets/audio/watered.wav"))) +(define-asset (watered-sound (file (scope-datadir "audio/watered.wav"))) (load-audio file)) -(define-asset (spray-sound (file (scope-datadir "assets/audio/spray.wav"))) +(define-asset (spray-sound (file (scope-datadir "audio/spray.wav"))) (load-audio file)) (define (random:float n) diff --git a/super-bloom/config.scm.in b/super-bloom/config.scm.in new file mode 100644 index 0000000..861087a --- /dev/null +++ b/super-bloom/config.scm.in @@ -0,0 +1,18 @@ +;;; Copyright 2023 David Thompson +;;; +;;; Licensed under the Apache License, Version 2.0 (the "License"); +;;; you may not use this file except in compliance with the License. +;;; You may obtain a copy of the License at +;;; +;;; http://www.apache.org/licenses/LICENSE-2.0 +;;; +;;; Unless required by applicable law or agreed to in writing, software +;;; distributed under the License is distributed on an "AS IS" BASIS, +;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;;; See the License for the specific language governing permissions and +;;; limitations under the License. + +(define-module (super-bloom config) + #:export (%datadir)) + +(define %datadir "@datadir@/super-bloom") diff --git a/super-bloom/dirt-ball.scm b/super-bloom/dirt-ball.scm index 43c8d4c..2d8b361 100644 --- a/super-bloom/dirt-ball.scm +++ b/super-bloom/dirt-ball.scm @@ -31,7 +31,7 @@ #:export (<dirt-ball> dead?)) -(define-asset (dirt-ball-tileset (file (scope-datadir "assets/images/dirt-ball.png"))) +(define-asset (dirt-ball-tileset (file (scope-datadir "images/dirt-ball.png"))) (load-tileset file 32 32)) (define-class <dirt-ball> (<actor>) diff --git a/super-bloom/flower.scm b/super-bloom/flower.scm index 78e8f03..ff3e25a 100644 --- a/super-bloom/flower.scm +++ b/super-bloom/flower.scm @@ -38,7 +38,7 @@ (define %max-water 1) -(define-asset (flower-tileset (file (scope-datadir "assets/images/flower.png"))) +(define-asset (flower-tileset (file (scope-datadir "images/flower.png"))) (load-tileset file 48 48)) ;; Every growth-interval, the flower gains 1 growth point (accumulated diff --git a/super-bloom/game.scm b/super-bloom/game.scm index 5cdb6a9..12da7e1 100644 --- a/super-bloom/game.scm +++ b/super-bloom/game.scm @@ -39,19 +39,19 @@ #:export (<super-bloom-mode> reset-game!)) -(define-asset (background-texture (file (scope-datadir "assets/images/background.png"))) +(define-asset (background-texture (file (scope-datadir "images/background.png"))) (load-image file)) -(define-asset (chickadee-texture (file (scope-datadir "assets/images/chickadee.png"))) +(define-asset (chickadee-texture (file (scope-datadir "images/chickadee.png"))) (load-image file)) -(define-asset (water-particle-texture (file (scope-datadir "assets/images/water-particle.png"))) +(define-asset (water-particle-texture (file (scope-datadir "images/water-particle.png"))) (load-image file)) -(define-asset (trail-particle-texture (file (scope-datadir "assets/images/trail-particle.png"))) +(define-asset (trail-particle-texture (file (scope-datadir "images/trail-particle.png"))) (load-image file)) -(define-asset (explosion-particle-texture (file (scope-datadir "assets/images/explosion-particle.png"))) +(define-asset (explosion-particle-texture (file (scope-datadir "images/explosion-particle.png"))) (load-image file)) (define (make-game-quadtree) diff --git a/super-bloom/player.scm b/super-bloom/player.scm index adc9c68..c3271fd 100644 --- a/super-bloom/player.scm +++ b/super-bloom/player.scm @@ -43,7 +43,7 @@ (define %max-water 1) -(define-asset (player-tileset (file (scope-datadir "assets/images/player.png"))) +(define-asset (player-tileset (file (scope-datadir "images/player.png"))) (load-tileset file 32 32)) (define-class <player> (<actor>) diff --git a/super-bloom/splash.scm b/super-bloom/splash.scm index 6f7432b..2d93bcf 100644 --- a/super-bloom/splash.scm +++ b/super-bloom/splash.scm @@ -35,7 +35,7 @@ #:use-module (super-bloom game) #:export (<splash-screen-mode>)) -(define-asset (chickadee-texture (file (scope-datadir "assets/images/chickadee.png"))) +(define-asset (chickadee-texture (file (scope-datadir "images/chickadee.png"))) (load-image file)) (define-class <splash-screen-mode> (<major-mode>)) diff --git a/super-bloom/water.scm b/super-bloom/water.scm index d2533fd..94b90a3 100644 --- a/super-bloom/water.scm +++ b/super-bloom/water.scm @@ -31,7 +31,7 @@ absorb! on-splash)) -(define-asset (water-tileset (file (scope-datadir "assets/images/water.png"))) +(define-asset (water-tileset (file (scope-datadir "images/water.png"))) (load-tileset file 32 32)) (define-class <water> (<actor>) |