Add infrastructure for static files, etc
authorChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 20 Jan 2017 16:39:38 +0000 (10:39 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 20 Jan 2017 16:39:38 +0000 (10:39 -0600)
.gitignore
Makefile.am
configure.ac
env.in [deleted file]
mudsync/package-config.scm.in [new file with mode: 0644]
pre-inst-env.in

index 431289086ee7a6d127c8e30252b51d21f03f18e3..e857c64c47ebfd473ad5d6d6896a73ea5ff392bb 100644 (file)
@@ -32,3 +32,4 @@ install-sh
 /build-aux/missing
 /build-aux/test-driver
 /build-aux/texinfo.tex
+/mudsync/package-config.scm
index 583ce10fff64c0ebb78cf51813bfde5c8a7d6d5b..f9dfd9be6e0e09a7e7191cc9d3e334c5ce4a2934 100644 (file)
@@ -54,6 +54,7 @@ SOURCES =  \
        mudsync/room.scm \
        mudsync/run-game.scm \
        mudsync/thing.scm \
+       mudsync/package-config.scm \
        mudsync.scm
 
 # TESTS =                                                      \
index 34ed107a52977ce384a8aaf57c5f308ed8789513..2fb1d62d5976afa66a92516c2581d3a37490e301 100644 (file)
@@ -10,7 +10,13 @@ m4_ifdef([GUILE_PROGS],
 
 GUILE_PROGS
 
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([env], [chmod +x env])
+dnl Prepare a version of $datadir that does not contain references to
+dnl shell variables.  (Borrowed from Sly, which borrowed from Guix...)
+package_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
+package_datadir="`eval eval echo $datadir | sed -e "s|NONE|$package_prefix|g"`"
+AC_SUBST([package_datadir])
+
+
+AC_CONFIG_FILES([Makefile mudsync/package-config.scm])
 AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
 AC_OUTPUT
diff --git a/env.in b/env.in
deleted file mode 100644 (file)
index a681bdc..0000000
--- a/env.in
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-## Also borrowed from guile-opengl, which is GPLv3+
-
-GUILE_LOAD_PATH=@abs_top_srcdir@:$GUILE_LOAD_PATH
-if test "@abs_top_srcdir@" != "@abs_top_builddir@"; then
-    GUILE_LOAD_PATH=@abs_top_builddir@:$GUILE_LOAD_PATH
-fi
-GUILE_LOAD_COMPILED_PATH=@abs_top_builddir@:$GUILE_LOAD_PATH
-PATH=@abs_top_builddir@/bin:$PATH
-
-export GUILE_LOAD_PATH
-export GUILE_LOAD_COMPILED_PATH
-export PATH
-
-exec "$@"
diff --git a/mudsync/package-config.scm.in b/mudsync/package-config.scm.in
new file mode 100644 (file)
index 0000000..97fabf5
--- /dev/null
@@ -0,0 +1,47 @@
+;;; Mudsync --- Live hackable MUD
+;;; Copyright © 2017 Christopher Allan Webber <cwebber@dustycloud.org>
+;;;
+;;; This file is part of Mudsync.
+;;;
+;;; Mudsync is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; Mudsync is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with Mudsync.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (mudsync package-config)
+  #:export (%datadir
+            scope-datadir web-static-filepath
+
+            %mudsync-package-name %mudsync-version))
+
+(define %datadir
+  (or (getenv "MUDSYNC_DATADIR")
+      "@package_datadir@/@PACKAGE_NAME@"))
+
+(define (scope-datadir filename)
+  (string-append %datadir filename))
+
+(define (web-static-filepath filename)
+  (scope-datadir (string-append "/web-static" filename)))
+
+
+(define %mudsync-package-name
+  "@PACKAGE_NAME@")
+
+(define %mudsync-version
+  "@PACKAGE_VERSION@")
+
+;; (define %mudsync-bug-report-address
+;;   "@PACKAGE_BUGREPORt")
+
+;; (define %mudsync-home-page-url
+;;   "@PACKAGE_URL@")
+
index 4bec38d2f967d108e0ae3d8e07b340fd0a750904..5b675138dbef7185e72932a60ad2c039af0e0742 100644 (file)
@@ -2,7 +2,7 @@
 
 # srt2vtt --- SRT to WebVTT converter
 # Copyright © 2015 David Thompson <davet@gnu.org>
-# Copyright © 2015 Christopher Allan Webber <cwebber@dustycloud.org>
+# Copyright © 2015, 2017 Christopher Allan Webber <cwebber@dustycloud.org>
 #
 # srt2vtt is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,6 +24,9 @@ GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_
 GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}:$GUILE_LOAD_PATH"
 export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
 
+MUDSYNC_DATADIR="$abs_top_builddir/data"
+export MUDSYNC_DATADIR
+
 PATH="$abs_top_builddir/scripts:$PATH"
 export PATH