diff --git a/Makefile b/Makefile index 95de901c..b20da8f1 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,7 @@ gluon_prepared_stamp := $(BOARD_BUILDDIR)/prepared include $(INCLUDE_DIR)/target.mk -gluon-tools: $(STAGING_DIR_HOST)/bin/stat +gluon-tools: $(STAGING_DIR_HOST)/bin/stat package/lua/host/install prepare-tmpinfo: FORCE mkdir -p tmp/info @@ -237,7 +237,7 @@ prepare-image: FORCE cp $(KERNEL_BUILD_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf $(BOARD_KDIR)/ +$(SUBMAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUONDIR)/include/Makefile.image prepare KDIR="$(BOARD_KDIR)" -CheckSite := (perl $(GLUON_SITEDIR)/site.conf 2>&1) > /dev/null || (echo 'Your site configuration did not pass validation; please verify yourself with `perl site.conf` and fix the problems.';false) +CheckSite := $(STAGING_DIR_HOST)/bin/lua $(GLUONDIR)/scripts/load_site.lua || (echo 'Your site configuration did not pass validation.';false) prepare: FORCE @$(CheckSite) diff --git a/include/gluon.mk b/include/gluon.mk index 53756857..fbf1698f 100644 --- a/include/gluon.mk +++ b/include/gluon.mk @@ -36,7 +36,9 @@ export CONFIG_VERSION_REPO GLUON_SITE_CODE := $(shell $(GLUONDIR)/scripts/site.sh site_code) export GLUON_SITE_CODE -GLUON_RELEASE ?= $(shell $(GLUONDIR)/scripts/site.sh release) +ifeq ($(GLUON_RELEASE),) +$(error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line.) +endif export GLUON_RELEASE endif diff --git a/scripts/configure.pl b/scripts/configure.pl index 973786b6..58242e17 100755 --- a/scripts/configure.pl +++ b/scripts/configure.pl @@ -10,7 +10,7 @@ sub nightly { } -our $CONFIG = do $ENV{GLUONDIR} . '/site/site.conf'; +our $CONFIG = do $ENV{GLUONDIR} . '/site/site.conf.pl'; my $script = shift @ARGV; do $script; diff --git a/scripts/load_site.lua b/scripts/load_site.lua new file mode 100644 index 00000000..8192774d --- /dev/null +++ b/scripts/load_site.lua @@ -0,0 +1,7 @@ +local function loader() + coroutine.yield('return ') + coroutine.yield(io.open(os.getenv('GLUONDIR') .. '/site/site.conf'):read('*a')) +end + +-- setfenv doesn't work with Lua 5.2 anymore, but we're using 5.1 +config = setfenv(assert(load(coroutine.wrap(loader), 'site.conf')), {})() diff --git a/scripts/site.sh b/scripts/site.sh index 2da61cdf..82b55451 100755 --- a/scripts/site.sh +++ b/scripts/site.sh @@ -2,5 +2,4 @@ export GLUONDIR="$(dirname "$0")/.." -RESULT=$(echo "@$1@" | $GLUONDIR/scripts/configure.pl $GLUONDIR/scripts/generate.pl) -test ! "$RESULT" = "@$1@" && echo $RESULT +"$GLUONDIR"/openwrt/staging_dir/host/bin/lua -e "dofile(os.getenv('GLUONDIR') .. '/scripts/load_site.lua') print(assert(config.$1))" 2>/dev/null