summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-11-12 12:16:11 -0500
committerDavid Thompson <dthompson2@worcester.edu>2015-11-12 12:16:11 -0500
commit5aaf7dcb4da8b0622df8443de833a41afe7c3aca (patch)
treef0cfaea1ccf3158f7f12175f22f9c7e3cc100961
parentefbd5d797af6ca36a61f225dc02ade47e8dfd175 (diff)
config: Fix data directory.
This was all messed up: - 'pkgdatadir' wasn't something that could be substituted via autoconf - I was still using "GUILE_2D" in the data dir env var name Now it's all better and Sly data should be able to be found from the pre-installation environment *and* the installation prefix. * configure.ac (sly_prefix, sly_datadir): New variables. * pre-inst-env.in: Set SLY_DATADIR. * sly/config.scm.in (%pkgdatadir): Delete. (%datadir): New variable. Use SLY_DATADIR env var or the configured datadir. * sly/render/font.scm (load-default-font): Use %datadir. * sly/render/shader.scm (load-default-shader): Likewise.
-rw-r--r--configure.ac7
-rw-r--r--pre-inst-env.in4
-rw-r--r--sly/config.scm.in8
-rw-r--r--sly/render/font.scm2
-rw-r--r--sly/render/shader.scm6
5 files changed, 16 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 0b2ba97..853a051 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,13 @@ AC_CONFIG_FILES([sly/config.scm])
AC_CONFIG_FILES([sandbox], [chmod +x sandbox])
AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
+# Prepare a version of $datadir that does not contain references to
+# shell variables.
+sly_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
+sly_datadir="`eval eval echo $datadir | sed -e "s|NONE|$guix_prefix|g"`"
+AC_SUBST([sly_datadir])
+AC_SUBST([sly_prefix])
+
GUILE_PROGS([2.0.11])
GUILE_MODULE_REQUIRED([sdl sdl])
GUILE_MODULE_REQUIRED([sdl mixer])
diff --git a/pre-inst-env.in b/pre-inst-env.in
index e677322..bf3588a 100644
--- a/pre-inst-env.in
+++ b/pre-inst-env.in
@@ -27,7 +27,7 @@ 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
+SLY_DATADIR="$abs_top_builddir/data"
+export SLY_DATADIR
exec "$@"
diff --git a/sly/config.scm.in b/sly/config.scm.in
index 012483e..3a455cf 100644
--- a/sly/config.scm.in
+++ b/sly/config.scm.in
@@ -1,5 +1,5 @@
;;; Sly
-;;; Copyright (C) 2014 David Thompson <dthompson2@worcester.edu>
+;;; Copyright (C) 2014, 2015 David Thompson <dthompson2@worcester.edu>
;;;
;;; Sly is free software: you can redistribute it and/or modify it
;;; under the terms of the GNU Lesser General Public License as
@@ -22,12 +22,12 @@
;;; Code:
(define-module (sly config)
- #:export (%pkgdatadir
+ #:export (%datadir
%libfreeimage
%libgslcblas))
-(define %pkgdatadir
- (or (getenv "GUILE_2D_PKGDATADIR") "@pkgdatadir@"))
+(define %datadir
+ (or (getenv "SLY_DATADIR") "@sly_prefix@@sly_datadir@/sly"))
(define %libfreeimage
"@LIBFREEIMAGE@")
diff --git a/sly/render/font.scm b/sly/render/font.scm
index dace505..433e4bc 100644
--- a/sly/render/font.scm
+++ b/sly/render/font.scm
@@ -64,7 +64,7 @@
(define* (load-default-font #:optional (point-size 12))
"Load the Sly default TTF font. POINT-SIZE is an optional
argument with a default value of 12."
- (load-font (string-append %pkgdatadir "/fonts/DejaVuSans.ttf") point-size))
+ (load-font (string-append %datadir "/fonts/DejaVuSans.ttf") point-size))
(define (flip-pixels-vertically pixels width height)
"Create a new bytevector that reverses the rows in PIXELS, a WIDTH x
diff --git a/sly/render/shader.scm b/sly/render/shader.scm
index cb3828d..b736560 100644
--- a/sly/render/shader.scm
+++ b/sly/render/shader.scm
@@ -382,10 +382,8 @@ within SHADER-PROGRAM."
(memoize
(lambda ()
(load-shader-program
- (string-append %pkgdatadir
- "/shaders/default-vertex.glsl")
- (string-append %pkgdatadir
- "/shaders/default-fragment.glsl")
+ (string-append %datadir "/shaders/default-vertex.glsl")
+ (string-append %datadir "/shaders/default-fragment.glsl")
`((mvp "mvp" ,identity-transform)
(color "color" ,white)
(texture? "use_texture" #f))