From 2912e4f5ff445e2e0417808fcdd92ccd9e379045 Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Mon, 4 Jan 2010 20:48:12 +0800 Subject: The sandbox/ directory is created when any sandbox make target is run. --- Makefile | 6 ++++-- misc/env.sh | 23 +++++++++++++++++++++++ sandbox/env.sh | 13 ------------- 3 files changed, 27 insertions(+), 15 deletions(-) create mode 100755 misc/env.sh delete mode 100755 sandbox/env.sh diff --git a/Makefile b/Makefile index 626d21e..27185f6 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,7 @@ test-uzbl-browser: uzbl-browser test-uzbl-core-sandbox: uzbl-core make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data + cp -np ./{misc,sandbox}/env.sh source ./sandbox/env.sh && uzbl-core --uri http://www.uzbl.org --verbose make DESTDIR=./sandbox uninstall rm -rf ./sandbox/usr @@ -74,6 +75,7 @@ test-uzbl-browser-sandbox: uzbl-browser make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-browser make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data + cp -np ./{misc,sandbox}/env.sh source ./sandbox/env.sh && uzbl-cookie-daemon restart -nv & source ./sandbox/env.sh && uzbl-event-manager restart -nav & source ./sandbox/env.sh && uzbl-browser --uri http://www.uzbl.org --verbose @@ -88,9 +90,9 @@ clean: rm -f events.o rm -f callbacks.o rm -f inspector.o - find examples/ -name "*.pyc" -delete + find ./examples/ -name "*.pyc" -delete cd ./tests/; $(MAKE) clean - rm -rf ./sandbox/{examples,usr}/ + rm -rf ./sandbox/ install: install-uzbl-core install-uzbl-browser install-uzbl-tabbed diff --git a/misc/env.sh b/misc/env.sh new file mode 100755 index 0000000..4eec525 --- /dev/null +++ b/misc/env.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# This script is copied in to the sandbox/ directory during any sandbox make +# target and is used to create an isolated environment for uzbl-core, +# uzbl-browser and uzbl-tabbed to be run and tested. + +# It would be better to use something more flexible like $(dirname $0) but I +# couldn't get to work nicely from the Makefile: +# - Sourcing file gives $0 == /bin/sh +# - Executing limits scope of variables too much (even with exporting) +# Maybe we should spawn processes from here with an 'exec' at the end? + +# Re-define our home location inside the sandbox dir. +export HOME=./sandbox/home + +# Export default XDG_{DATA,CACHE,..}_HOME locations inside the sandbox +# directory according to defaults in the xdg specification. +# +export XDG_DATA_HOME=$HOME/.local/share +export XDG_CACHE_HOME=$HOME/.cache +export XDG_CONFIG_HOME=$HOME/.config + +# Now update the path to include our sandbox bin directory. +export PATH="./sandbox/usr/local/bin:$PATH" diff --git a/sandbox/env.sh b/sandbox/env.sh deleted file mode 100755 index 122a7f2..0000000 --- a/sandbox/env.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# it would be better to use something more flexible like $(dirname $0) but i -# couldn't get to work nicely from the Makefile: -# - sourcing file gives $0 == /bin/sh -# - executing limits scope of variables too much (even with exporting) -# maybe we should spawn processes from here with an 'exec' at the end? - -export HOME=./sandbox/home -export XDG_DATA_HOME=$HOME/.local/share -export XDG_CACHE_HOME=$HOME/.cache -export XDG_CONFIG_HOME=$HOME/.config -#export PATH="./sandbox/usr/local/share/uzbl/examples/data/scripts/:$PATH" # needed when running uzbl-browser from here? don't think so.. -export PATH="./sandbox/usr/local/bin:$PATH" # needed to run uzbl-browser etc from here -- cgit v1.2.3