summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-10-06 11:32:25 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-10-06 13:28:09 +0100
commitf33101ea8cd7564aaf1f30c3280110c9c1f8d46d (patch)
tree7506ee821f4d1b9d23a3f2d9bb18d9df66cb75ab /src
parentb2afff23cb66a1c08ae36cd4bc7c45b43ba27700 (diff)
downloadefl-f33101ea8cd7564aaf1f30c3280110c9c1f8d46d.tar.gz
elua/autotools: generate .eo.lua files out of all eo files at build time
Also change the generator a bit so that it doesn't rely on lib name information and fix the runtime to properly source lua files within tree.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Makefile_Ecore.am13
-rw-r--r--src/Makefile_Ecore_Audio.am13
-rw-r--r--src/Makefile_Ecore_Con.am13
-rw-r--r--src/Makefile_Edje.am13
-rw-r--r--src/Makefile_Efl.am13
-rw-r--r--src/Makefile_Elua.am2
-rw-r--r--src/Makefile_Elua_Helper.am8
-rw-r--r--src/Makefile_Emotion.am13
-rw-r--r--src/Makefile_Evas.am12
-rw-r--r--src/bin/elua/apps/lualian.lua26
-rw-r--r--src/bin/elua/main.c10
-rw-r--r--src/bin/elua/modules/lualian.lua23
13 files changed, 118 insertions, 43 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 27df98fe44..fdb13a2976 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,8 +11,6 @@ EOLIAN_FLAGS = \
-I$(srcdir)/lib/ecore \
-I$(srcdir)/lib/ecore_con
-ELUA_GEN_FLAGS =
-
DIST_SUBDIRS =
SUBDIRS =
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 792931484e..3bb894a943 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -225,3 +225,16 @@ endif
EXTRA_DIST += \
tests/ecore/modem.wav \
tests/ecore/sms.ogg
+
+if HAVE_ELUA
+
+ecore_eolian_lua = $(ecore_eolian_files:%.eo=%.eo.lua)
+
+generated_ecore_lua_all = $(ecore_eolian_lua)
+
+CLEANFILES += $(generated_ecore_lua_all)
+
+installed_ecoreluadir = $(datadir)/elua/modules/ecore
+nodist_installed_ecorelua_DATA = $(generated_ecore_lua_all)
+
+endif
diff --git a/src/Makefile_Ecore_Audio.am b/src/Makefile_Ecore_Audio.am
index 4aee10204a..e87ffb408a 100644
--- a/src/Makefile_Ecore_Audio.am
+++ b/src/Makefile_Ecore_Audio.am
@@ -75,3 +75,16 @@ lib/ecore_audio/ecore_audio_sndfile_vio.c
endif
endif
+
+if HAVE_ELUA
+
+ecore_audio_eolian_lua = $(ecore_audio_eolian_files:%.eo=%.eo.lua)
+
+generated_ecore_audio_lua_all = $(ecore_audio_eolian_lua)
+
+CLEANFILES += $(generated_ecore_audio_lua_all)
+
+installed_ecoreaudioluadir = $(datadir)/elua/modules/ecore_audio
+nodist_installed_ecoreaudiolua_DATA = $(generated_ecore_audio_lua_all)
+
+endif
diff --git a/src/Makefile_Ecore_Con.am b/src/Makefile_Ecore_Con.am
index dbeb331f33..e482ca4a75 100644
--- a/src/Makefile_Ecore_Con.am
+++ b/src/Makefile_Ecore_Con.am
@@ -68,3 +68,16 @@ lib_ecore_con_libecore_con_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_CO
lib_ecore_con_libecore_con_la_LIBADD = @ECORE_CON_LIBS@ @EVIL_LIBS@
lib_ecore_con_libecore_con_la_DEPENDENCIES = @ECORE_CON_INTERNAL_LIBS@
lib_ecore_con_libecore_con_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
+
+if HAVE_ELUA
+
+ecore_con_eolian_lua = $(ecore_con_eolian_files:%.eo=%.eo.lua)
+
+generated_ecore_con_lua_all = $(ecore_con_eolian_lua)
+
+CLEANFILES += $(generated_ecore_con_lua_all)
+
+installed_ecoreconluadir = $(datadir)/elua/modules/ecore_con
+nodist_installed_ecoreconlua_DATA = $(generated_ecore_con_lua_all)
+
+endif
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index c92372f186..e7cc6dd63a 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -281,3 +281,16 @@ CLEANFILES += tests/edje/data/test_layout.edj \
endif
EXTRA_DIST += $(EDJE_DATA_FILES)
+
+if HAVE_ELUA
+
+edje_eolian_lua = $(edje_eolian_files:%.eo=%.eo.lua)
+
+generated_edje_lua_all = $(edje_eolian_lua)
+
+CLEANFILES += $(generated_edje_lua_all)
+
+installed_edjeluadir = $(datadir)/elua/modules/edje
+nodist_installed_edjelua_DATA = $(generated_edje_lua_all)
+
+endif
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index 30815146d7..5533dce961 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -40,3 +40,16 @@ dist_installed_eflheaders_DATA = \
installed_eflinterfacesdir = $(includedir)/efl-@VMAJ@/interfaces
nodist_installed_eflinterfaces_DATA = $(efl_eolian_files_h)
+
+if HAVE_ELUA
+
+efl_eolian_lua = $(efl_eolian_files:%.eo=%.eo.lua)
+
+generated_efl_lua_all = $(efl_eolian_lua)
+
+CLEANFILES += $(generated_efl_lua_all)
+
+installed_eflluadir = $(datadir)/elua/modules/efl
+nodist_installed_efllua_DATA = $(generated_efl_lua_all)
+
+endif
diff --git a/src/Makefile_Elua.am b/src/Makefile_Elua.am
index 1c170e4dd9..21b1dd72fc 100644
--- a/src/Makefile_Elua.am
+++ b/src/Makefile_Elua.am
@@ -10,7 +10,7 @@ bin_elua_elua_SOURCES = \
bin_elua_elua_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ELUA_CFLAGS@ \
-DLOCALE_DIR=\"@LOCALE_DIR@\" \
- -DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
+ -DPACKAGE_SRC_DIR=\"$(abs_top_srcdir)\" \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/elua\"
diff --git a/src/Makefile_Elua_Helper.am b/src/Makefile_Elua_Helper.am
index 63fbbf5969..d677144bcf 100644
--- a/src/Makefile_Elua_Helper.am
+++ b/src/Makefile_Elua_Helper.am
@@ -1,8 +1,8 @@
if HAVE_ELUA_BIN
-ELUA_GEN = @elua_bin@
+ELUA_GEN = @elua_bin@ :lualian
_ELUA_GEN_DEP = @elua_bin@
else
-ELUA_GEN = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT}
+ELUA_GEN = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT} :lualian
_ELUA_GEN_DEP = bin/elua/elua${EXEEXT}
endif
@@ -12,7 +12,7 @@ am__v_ELUA_0 = @echo " ELUA " $@;
SUFFIXES += .lua
-%.lua: %.eo ${_ELUA_GEN_DEP}
- $(AM_V_ELUA)$(ELUA_GEN) :lualian $(ELUA_GEN_FLAGS) -o $@ $<
+%.eo.lua: %.eo ${_ELUA_GEN_DEP}
+ $(AM_V_ELUA)$(ELUA_GEN) -o $@ $<
CLEANFILES += $(BUILT_SOURCES)
diff --git a/src/Makefile_Emotion.am b/src/Makefile_Emotion.am
index 242a671081..1b51d0f996 100644
--- a/src/Makefile_Emotion.am
+++ b/src/Makefile_Emotion.am
@@ -257,3 +257,16 @@ tests/emotion/data/video_frame_top.png \
tests/emotion/data/whb.png \
tests/emotion/data/window_inner_shadow.png \
modules/emotion/generic/README
+
+if HAVE_ELUA
+
+emotion_eolian_lua = $(emotion_eolian_files:%.eo=%.eo.lua)
+
+generated_emotion_lua_all = $(emotion_eolian_lua)
+
+CLEANFILES += $(generated_emotion_lua_all)
+
+installed_emotionluadir = $(datadir)/elua/modules/emotion
+nodist_installed_emotionlua_DATA = $(generated_emotion_lua_all)
+
+endif
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 44fa5340c4..3d6acd225f 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -1965,3 +1965,15 @@ tests/evas/images/Light_exif_90.jpg \
tests/evas/images/Light_exif_transverse.jpg \
tests/evas/images/Light_exif_270.jpg
+if HAVE_ELUA
+
+evas_eolian_lua = $(evas_eolian_files:%.eo=%.eo.lua)
+
+generated_evas_lua_all = $(evas_eolian_lua)
+
+CLEANFILES += $(generated_evas_lua_all)
+
+installed_evasluadir = $(datadir)/elua/modules/evas
+nodist_installed_evaslua_DATA = $(generated_evas_lua_all)
+
+endif
diff --git a/src/bin/elua/apps/lualian.lua b/src/bin/elua/apps/lualian.lua
index d32ec27a7a..4ffbf58ee1 100644
--- a/src/bin/elua/apps/lualian.lua
+++ b/src/bin/elua/apps/lualian.lua
@@ -18,7 +18,7 @@ local gen_file = function(opts, i, fname)
else
printv(" Output file: printing to stdout...")
end
- lualian.generate(fname, opts["L"], fstream)
+ lualian.generate(fname, fstream)
end
getopt.parse {
@@ -37,7 +37,6 @@ getopt.parse {
{ "I", "include", true, help = "Include a directory.", metavar = "DIR",
list = {}
},
- { "L", "library", true, help = "Specify a C library name." },
{ "o", "output", true, help = "Specify output file name(s), by "
.. "default goes to stdout.",
list = {}
@@ -49,20 +48,15 @@ getopt.parse {
end,
done_cb = function(parser, opts, args)
if not opts["h"] then
- if not opts["L"] then
- io.stderr:write("library name not specified\n")
- getopt.help(parser, io.stderr)
- else
- for i, v in ipairs(opts["I"] or {}) do
- lualian.include_dir(v)
- end
- if os.getenv("EFL_RUN_IN_TREE") then
- lualian.system_directory_scan()
- end
- lualian.load_eot_files()
- for i, fname in ipairs(args) do
- gen_file(opts, i, fname)
- end
+ for i, v in ipairs(opts["I"] or {}) do
+ lualian.include_dir(v)
+ end
+ if os.getenv("EFL_RUN_IN_TREE") then
+ lualian.system_directory_scan()
+ end
+ lualian.load_eot_files()
+ for i, fname in ipairs(args) do
+ gen_file(opts, i, fname)
end
end
end
diff --git a/src/bin/elua/main.c b/src/bin/elua/main.c
index 5aea7e18f2..2ed8893629 100644
--- a/src/bin/elua/main.c
+++ b/src/bin/elua/main.c
@@ -136,9 +136,9 @@ elua_register_require(lua_State *L)
elua_appload_ref = luaL_ref(L, LUA_REGISTRYINDEX);
if (getenv("EFL_RUN_IN_TREE"))
{
- corepath = PACKAGE_BUILD_DIR "/src/bin/elua/core";
- modpath = PACKAGE_BUILD_DIR "/src/bin/elua/modules";
- appspath = PACKAGE_BUILD_DIR "/src/bin/elua/apps";
+ corepath = PACKAGE_SRC_DIR "/src/bin/elua/core";
+ modpath = PACKAGE_SRC_DIR "/src/bin/elua/modules";
+ appspath = PACKAGE_SRC_DIR "/src/bin/elua/apps";
}
else
{
@@ -466,9 +466,9 @@ elua_main(lua_State *L)
{
Arg_Data *v = malloc(sizeof(Arg_Data));
v->type = ARG_LIBDIR;
- v->value = PACKAGE_BUILD_DIR "/src/bindings/luajit";
+ v->value = PACKAGE_SRC_DIR "/src/bindings/luajit";
largs = eina_list_append(largs, v);
- coref = PACKAGE_BUILD_DIR "/src/bin/elua/core";
+ coref = PACKAGE_SRC_DIR "/src/bin/elua/core";
}
else if (!(coref = coredir))
{
diff --git a/src/bin/elua/modules/lualian.lua b/src/bin/elua/modules/lualian.lua
index 5d3908bb25..a8425ef33a 100644
--- a/src/bin/elua/modules/lualian.lua
+++ b/src/bin/elua/modules/lualian.lua
@@ -502,10 +502,9 @@ end
}
local File = Node:clone {
- __ctor = function(self, fname, klass, libname, ch)
+ __ctor = function(self, fname, klass, ch)
self.fname = fname:match(".+/(.+)") or fname
self.klass = klass
- self.libname = libname
self.children = ch
end,
@@ -531,33 +530,27 @@ local util = require("util")
local ffi = require("ffi")
local eo = require("eo")
-local M = ...
+local M, __lib = ...
-local __lib
local __class
local __body
local init = function()
- __lib = util.lib_load("%s")
__class = __lib.%s_class_get()
eo.class_register("%s", %s, __body, __class)
-]]):format(self.fname, kn, self.libname, ckls.prefix, knu, paru))
+]]):format(self.fname, kn, ckls.prefix, knu, paru))
if ckls.mixins then for i, v in ipairs(ckls.mixins) do
s:write((" eo.class_mixin(\"%s\", \"%s\")\n"):format(knu,
v:gsub("%.", "_")))
end end
- s:write(([[
-end
-
-local shutdown = function()
- util.lib_unload("%s")
+ s:write([[
end
-cutil.init_module(init, shutdown)
+cutil.init_module(init, function() end)
-]]):format(self.libname))
+]])
self:gen_children(s)
@@ -651,7 +644,7 @@ M.system_directory_scan = function()
return eolian.system_directory_scan()
end
-M.generate = function(fname, libname, fstream)
+M.generate = function(fname, fstream)
if not eolian.eo_file_parse(fname) then
error("Failed parsing file: " .. fname)
end
@@ -670,7 +663,7 @@ M.generate = function(fname, libname, fstream)
else
error(klass:full_name_get() .. ": unknown type")
end
- File(fname, klass, libname, { cl }):generate(fstream or io.stdout)
+ File(fname, klass, { cl }):generate(fstream or io.stdout)
end
return M