summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-05-21 19:49:59 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-05-21 19:53:13 -0400
commitcc59c11398cb9feff3eb1cb14bab664cc2d1ca2e (patch)
tree89d7be487ac5829275dfe41c1929e2fc3e407cf5
parent6e1e00e7438acc477c5574935b3ecb9c140d0a22 (diff)
Add pre-inst-env script.
* configure.ac: Add pre-inst-env as config file. * pre-inst-env.in: New file. * 2d/config.scm.in (%pkgdatadir): Use GUILE_2D_PKGDATADIR environment variable, if defined. * README.org: Document pre-inst-env script. * .gitignore: Ignore pre-inst-env.
-rw-r--r--.gitignore1
-rw-r--r--2d/config.scm.in3
-rw-r--r--README.org8
-rw-r--r--configure.ac1
-rw-r--r--pre-inst-env.in33
5 files changed, 41 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 31270d7..dd561c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,4 @@ Makefile.in
/doc/guile-2d.html
/doc/guile-2d.t2p
/2d/config.scm
+/pre-inst-env
diff --git a/2d/config.scm.in b/2d/config.scm.in
index 725bcda..e62a2b1 100644
--- a/2d/config.scm.in
+++ b/2d/config.scm.in
@@ -24,4 +24,5 @@
(define-module (2d config)
#:export (%pkgdatadir))
-(define %pkgdatadir "@pkgdatadir@")
+(define %pkgdatadir
+ (or (getenv "GUILE_2D_PKGDATADIR") "@pkgdatadir@"))
diff --git a/README.org b/README.org
index c1a4245..4502cbc 100644
--- a/README.org
+++ b/README.org
@@ -286,12 +286,12 @@
guile simple.scm
#+END_SRC
- To run an example using the modules in the source directory (useful
- when developing):
+ To run an example without installing guile-2d (useful when
+ developing):
#+BEGIN_SRC sh
cd examples
- guile -L .. simple.scm
+ ../pre-inst-env guile simple.scm
#+END_SRC
To quit an example:
@@ -300,7 +300,7 @@
** Using the Sandbox
If you want to quickly create a guile-2d environment and start
- experimenting, run the =sandbox= script. It will import many
+ experimenting, run =./pre-inst-env sandbox=. It will import many
useful modules, start a REPL server, open a window, and start the
game loop. Simply connect to the REPL server and start hacking!
diff --git a/configure.ac b/configure.ac
index 01f74b7..e0cc30f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,7 @@ fi
AC_CONFIG_FILES([Makefile doc/Makefile examples/Makefile data/Makefile])
AC_CONFIG_FILES([env], [chmod +x env])
+AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
PKG_CHECK_MODULES([SDL], [sdl <= 1.3 sdl >= 1.2])
PKG_CHECK_MODULES([SDL_tff], [SDL_ttf >= 2.0])
diff --git a/pre-inst-env.in b/pre-inst-env.in
new file mode 100644
index 0000000..f614211
--- /dev/null
+++ b/pre-inst-env.in
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# guile-2d
+# Copyright © 2014 David Thompson <dthompson2@worcester.edu>
+#
+# guile-2d 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.
+#
+# This program 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 this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd`"
+abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd`"
+
+GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
+GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}:$GUILE_LOAD_PATH"
+export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
+
+PATH="$abs_top_builddir:$PATH"
+export PATH
+
+GUILE_2D_PKGDATADIR="$abs_top_builddir/data"
+export GUILE_2D_PKGDATADIR
+
+exec "$@"