summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-12-26 17:13:41 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-12-26 17:13:41 +0000
commit29d4b6f08cbec5b34717aa5b354124a202472da3 (patch)
tree8bdcc26798a5f4b298cb72f60375dca7ce433c9f
parentnew config.h replaces version.h (diff)
module load path is now configurable at build time
git-svn-id: https://svn.spreadspace.org/gcsd/trunk@76 ac14a137-c7f1-4531-abe0-07747231d213
-rw-r--r--TODO8
-rwxr-xr-xsrc/configure12
-rw-r--r--src/gcsd.c5
-rw-r--r--src/module_list.lua3
4 files changed, 21 insertions, 7 deletions
diff --git a/TODO b/TODO
index d40a11b..82501a9 100644
--- a/TODO
+++ b/TODO
@@ -1,13 +1,13 @@
* send response to requestor
* out-of-order responses
- * finish API for command & response dispatch tables
* add listener tables (for requests, responses and other messages)
- * improve module loader (configurable path)
+ * config-parser (file and improve parser for modules config)
+ * finish API for command & response dispatch tables
* module API etc. clean-up, finalize, freeze
- * config-parser
* add modules
- tcp
- udp
- unix
- inotify
- * exec module, add support for parameters \ No newline at end of file
+ * exec module, add support for parameters
+ * improve module loader (allow multiple search paths)
diff --git a/src/configure b/src/configure
index 5acbd2f..9b834ab 100755
--- a/src/configure
+++ b/src/configure
@@ -44,6 +44,7 @@ LUAC=''
PREFIX='/usr/local'
BINDIR=''
ETCDIR=''
+MODULESDIR=''
MANDIR=''
INSTALLMANPAGE=1
EXAMPLESDIR=''
@@ -54,7 +55,8 @@ print_usage() {
echo " --target=<TARGET> build target i.e. Linux (default: autodetect)"
echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)"
echo " --bindir=<DIR> the path to the bin directory (default: $PREFIX/bin)"
- echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc"
+ echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc)"
+ echo " --modulesdir=<DIR> the path to the gcsd modules (default: $PREFIX/lib/gcsd)"
echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)"
echo " --no-manpage dont't install manpage"
echo " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)"
@@ -77,6 +79,9 @@ do
--sysconfdir=*)
ETCDIR=${arg#--sysconfdir=}
;;
+ --modulesdir=*)
+ MODULESDIR=${arg#--modulesdir=}
+ ;;
--mandir=*)
MANDIR=${arg#--mandir=}
;;
@@ -215,6 +220,10 @@ if [ -z "$ETCDIR" ]; then
ETCDIR=$PREFIX/etc
fi
+if [ -z "$MODULESDIR" ]; then
+ MODULESDIR=$PREFIX/lib/gcsd
+fi
+
if [ -z "$MANDIR" ]; then
MANDIR=$PREFIX/share/man
fi
@@ -291,6 +300,7 @@ cat > config.h <<EOF
#define PREFIX "$PREFIX"
#define BINDIR "$BINDIR"
#define ETCDIR "$ETCDIR"
+#define MODULESDIR "$MODULESDIR"
#endif
EOF
diff --git a/src/gcsd.c b/src/gcsd.c
index c79ed51..acbab40 100644
--- a/src/gcsd.c
+++ b/src/gcsd.c
@@ -39,6 +39,7 @@
#include <lauxlib.h>
#include "datatypes.h"
+#include "config.h"
#include "options.h"
#include "string_list.h"
#include "log.h"
@@ -104,6 +105,10 @@ int init_defines(lua_State *L)
lua_pushinteger(L, 4);
lua_settable(L, -3);
+ lua_pushliteral(L, "MODULES_PATH");
+ lua_pushstring(L, MODULESDIR);
+ lua_settable(L, -3);
+
lua_setglobal(L, "defines");
return 0;
}
diff --git a/src/module_list.lua b/src/module_list.lua
index 053d9db..b5766aa 100644
--- a/src/module_list.lua
+++ b/src/module_list.lua
@@ -33,7 +33,6 @@
module_list = {}
module_list.classes = {}
-module_list.classes.__path = "./modules"
local mt = {}
function mt.__index(table, key)
local value = rawget(table, key)
@@ -41,7 +40,7 @@ function mt.__index(table, key)
log.printf(log.DEBUG, "load module class: %s", key)
- local filename = table.__path .. "/" .. key .. ".lua"
+ local filename = defines.MODULES_PATH .. "/" .. key .. ".lua"
local chunk, err = loadfile(filename)
if (not chunk) then
error("failed to load module: " .. err)