+++ /dev/null
-LUAC = luac
-LUAC_OPTIONS = -s
-LUA_TARGET ?= source
-
-LUA_MODULEDIR = /usr/lib/lua
-LUA_LIBRARYDIR = /usr/lib/lua
-
-LUCI_MODULEDIR = $(LUA_MODULEDIR)/luci
-LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci
-LUCI_I18NDIR = $(LUA_MODULEDIR)/luci/i18n
-
-UVL_SCHEMEDIR = host/lib/uci/schema
-
-HTDOCS = /www
-
-LUA=$(shell which lua)
+++ /dev/null
-OS ?= $(shell uname)
-
-LUA_SHLIBS = $(shell pkg-config --silence-errors --libs lua5.1 || pkg-config --silence-errors --libs lua-5.1 || pkg-config --silence-errors --libs lua)
-LUA_LIBS = $(if $(LUA_SHLIBS),$(LUA_SHLIBS),$(firstword $(wildcard /usr/lib/liblua.a /usr/local/lib/liblua.a /opt/local/lib/liblua.a)))
-LUA_CFLAGS = $(shell pkg-config --silence-errors --cflags lua5.1 || pkg-config --silence-errors --cflags lua-5.1 || pkg-config --silence-errors --cflags lua)
-
-CC = gcc
-AR = ar
-RANLIB = ranlib
-CFLAGS = -O2
-FPIC = -fPIC
-EXTRA_CFLAGS = --std=gnu99
-WFLAGS = -Wall -pedantic
-CPPFLAGS =
-COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(WFLAGS)
-ifeq ($(OS),Darwin)
- SHLIB_FLAGS = -bundle -undefined dynamic_lookup
-else
- SHLIB_FLAGS = -shared
-endif
-LINK = $(CC) $(LDFLAGS)
-
+++ /dev/null
-#!/bin/sh
-export LD_LIBRARY_PATH="$1/usr/lib:$LD_LIBRARY_PATH"
-[ `uname -s` = "Darwin" ] && export DYLD_LIBRARY_PATH="$1/usr/lib:$DYLD_LIBRARY_PATH"
-export PATH="$1/bin:$1/usr/bin:$PATH"
-export LUA_PATH="$1/$2/?.lua;$1/$2/?/init.lua;;"
-export LUA_CPATH="$1/$3/?.so;;"
-export LUCI_SYSROOT="$1"
-$4
+++ /dev/null
-#!/usr/bin/lua
-
-dofile "../../build/setup.lua"
-
-require "luci.cacheloader"
-require "luci.sgi.cgi"
-luci.dispatcher.indexcache = "/tmp/luci-indexcache"
-luci.sgi.cgi.run()
+++ /dev/null
-dofile "build/setup.lua"
-require "luci.lucid".start()
+++ /dev/null
-MAKEPATH:=$(dir $(lastword $(MAKEFILE_LIST)))
--include $(MAKEPATH)config.mk
--include $(MAKEPATH)gccconfig.mk
-
-.PHONY: all build compile luacompile luasource clean luaclean
-
-all: build
-
-build: luabuild gccbuild
-
-luabuild: lua$(LUA_TARGET)
-
-gccbuild: compile
-compile:
-
-clean: luaclean
-
-luasource:
- mkdir -p dist$(LUA_MODULEDIR)
- mkdir -p dist$(LUCI_MODULEDIR)
- mkdir -p dist$(HTDOCS)
- cp -pR root/* dist 2>/dev/null || true
- cp -pR luasrc/* dist$(LUCI_MODULEDIR) 2>/dev/null || true
- cp -pR lua/* dist$(LUA_MODULEDIR) 2>/dev/null || true
- cp -pR htdocs/* dist$(HTDOCS) 2>/dev/null || true
- for i in $$(find dist -name .svn -o -name .gitignore); do rm -rf $$i || true; done
- ifneq ($(PO),)
- mkdir -p dist$(LUCI_I18NDIR)
- for file in $(PO); do \
- cp $(HOST)/lua-po/$$file.$(if $(PO_LANG),$(PO_LANG),*).* dist$(LUCI_I18NDIR)/ 2>/dev/null || true; \
- done
- endif
-
-
-luadiet: luasource
- for i in $$(find dist -type f -name '*.lua'); do LUA_PATH="../../contrib/luasrcdiet/lua/?.lua" $(LUA) ../../contrib/luasrcdiet/lua/LuaSrcDiet.lua --maximum $$i -o $$i.diet && mv $$i.diet $$i; done
-
-luastrip: luasource
- for i in $$(find dist -type f -name '*.lua'); do perl -e 'undef $$/; open( F, "< $$ARGV[0]" ) || die $$!; $$src = <F>; close F; $$src =~ s/--\[\[.*?\]\](--)?//gs; $$src =~ s/^\s*--.*?\n//gm; open( F, "> $$ARGV[0]" ) || die $$!; print F $$src; close F' $$i; done
-
-luacompile: luasource
- for i in $$(find dist -name *.lua -not -name debug.lua| sort); do if ! $(LUAC) $(LUAC_OPTIONS) -o $$i $$i; then echo "Error compiling $$i"; exit 1; fi; done
-
-luaclean:
- rm -rf dist
-
+++ /dev/null
-local SYSROOT = os.getenv("LUCI_SYSROOT")
-
--- override uci access
-local uci_core = require "uci"
-local uci_model = require "luci.model.uci"
-
-uci_model.cursor = function(config, save)
- return uci_core.cursor(config or SYSROOT .. "/etc/config", save or SYSROOT .. "/tmp/.uci")
-end
-
-uci_model.cursor_state = function()
- return uci_core.cursor(SYSROOT .. "/etc/config", SYSROOT .. "/var/state")
-end
-
-uci_model.inst = uci_model.cursor()
-uci_model.inst_state = uci_model.cursor_state()
-
--- allow any password in local sdk
-local sys = require "luci.sys"
-sys.user.checkpasswd = function() return true end
-sys.user.getpasswd = function() return "x" end
-
--- dummy sysinfo on Darwin
-require "nixio"
-
-if not nixio.sysinfo then
- function nixio.sysinfo()
- return {
- bufferram = 0,
- freehigh = 0,
- freeram = 0,
- freeswap = 0,
- loads = { 0.0, 0.0, 0.0 },
- mem_unit = 1024,
- procs = 0,
- sharedram = 0,
- totalhigh = 0
- }
- end
-end
-
--- override nixio.fs.access() to check sysroot first
-local _access = nixio.fs.access
-function nixio.fs.access(file)
- return _access(SYSROOT .. "/" .. file) or _access(file)
-end