From f45624ba340380a78970a1330620b6b15744ae87 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Fri, 20 Jan 2017 10:39:38 -0600 Subject: [PATCH] Add infrastructure for static files, etc --- .gitignore | 1 + Makefile.am | 1 + configure.ac | 10 ++++++-- env.in | 16 ------------ mudsync/package-config.scm.in | 47 +++++++++++++++++++++++++++++++++++ pre-inst-env.in | 5 +++- 6 files changed, 61 insertions(+), 19 deletions(-) delete mode 100644 env.in create mode 100644 mudsync/package-config.scm.in diff --git a/.gitignore b/.gitignore index 4312890..e857c64 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ install-sh /build-aux/missing /build-aux/test-driver /build-aux/texinfo.tex +/mudsync/package-config.scm diff --git a/Makefile.am b/Makefile.am index 583ce10..f9dfd9b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,6 +54,7 @@ SOURCES = \ mudsync/room.scm \ mudsync/run-game.scm \ mudsync/thing.scm \ + mudsync/package-config.scm \ mudsync.scm # TESTS = \ diff --git a/configure.ac b/configure.ac index 34ed107..2fb1d62 100644 --- a/configure.ac +++ b/configure.ac @@ -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 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 index 0000000..97fabf5 --- /dev/null +++ b/mudsync/package-config.scm.in @@ -0,0 +1,47 @@ +;;; Mudsync --- Live hackable MUD +;;; Copyright © 2017 Christopher Allan Webber +;;; +;;; 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 . + +(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@") + diff --git a/pre-inst-env.in b/pre-inst-env.in index 4bec38d..5b67513 100644 --- a/pre-inst-env.in +++ b/pre-inst-env.in @@ -2,7 +2,7 @@ # srt2vtt --- SRT to WebVTT converter # Copyright © 2015 David Thompson -# Copyright © 2015 Christopher Allan Webber +# Copyright © 2015, 2017 Christopher Allan Webber # # 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 -- 2.31.1