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)
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 27df98f..fdb13a2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,8 +11,6 @@ EOLIAN_FLAGS = \
11 -I$(srcdir)/lib/ecore \ 11 -I$(srcdir)/lib/ecore \
12 -I$(srcdir)/lib/ecore_con 12 -I$(srcdir)/lib/ecore_con
13 13
14ELUA_GEN_FLAGS =
15
16DIST_SUBDIRS = 14DIST_SUBDIRS =
17SUBDIRS = 15SUBDIRS =
18 16
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 7929314..3bb894a 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -225,3 +225,16 @@ endif
225EXTRA_DIST += \ 225EXTRA_DIST += \
226tests/ecore/modem.wav \ 226tests/ecore/modem.wav \
227tests/ecore/sms.ogg 227tests/ecore/sms.ogg
228
229if HAVE_ELUA
230
231ecore_eolian_lua = $(ecore_eolian_files:%.eo=%.eo.lua)
232
233generated_ecore_lua_all = $(ecore_eolian_lua)
234
235CLEANFILES += $(generated_ecore_lua_all)
236
237installed_ecoreluadir = $(datadir)/elua/modules/ecore
238nodist_installed_ecorelua_DATA = $(generated_ecore_lua_all)
239
240endif
diff --git a/src/Makefile_Ecore_Audio.am b/src/Makefile_Ecore_Audio.am
index 4aee102..e87ffb4 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
75endif 75endif
76 76
77endif 77endif
78
79if HAVE_ELUA
80
81ecore_audio_eolian_lua = $(ecore_audio_eolian_files:%.eo=%.eo.lua)
82
83generated_ecore_audio_lua_all = $(ecore_audio_eolian_lua)
84
85CLEANFILES += $(generated_ecore_audio_lua_all)
86
87installed_ecoreaudioluadir = $(datadir)/elua/modules/ecore_audio
88nodist_installed_ecoreaudiolua_DATA = $(generated_ecore_audio_lua_all)
89
90endif
diff --git a/src/Makefile_Ecore_Con.am b/src/Makefile_Ecore_Con.am
index dbeb331..e482ca4 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
68lib_ecore_con_libecore_con_la_LIBADD = @ECORE_CON_LIBS@ @EVIL_LIBS@ 68lib_ecore_con_libecore_con_la_LIBADD = @ECORE_CON_LIBS@ @EVIL_LIBS@
69lib_ecore_con_libecore_con_la_DEPENDENCIES = @ECORE_CON_INTERNAL_LIBS@ 69lib_ecore_con_libecore_con_la_DEPENDENCIES = @ECORE_CON_INTERNAL_LIBS@
70lib_ecore_con_libecore_con_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ 70lib_ecore_con_libecore_con_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
71
72if HAVE_ELUA
73
74ecore_con_eolian_lua = $(ecore_con_eolian_files:%.eo=%.eo.lua)
75
76generated_ecore_con_lua_all = $(ecore_con_eolian_lua)
77
78CLEANFILES += $(generated_ecore_con_lua_all)
79
80installed_ecoreconluadir = $(datadir)/elua/modules/ecore_con
81nodist_installed_ecoreconlua_DATA = $(generated_ecore_con_lua_all)
82
83endif
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index c92372f..e7cc6dd 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -281,3 +281,16 @@ CLEANFILES += tests/edje/data/test_layout.edj \
281endif 281endif
282 282
283EXTRA_DIST += $(EDJE_DATA_FILES) 283EXTRA_DIST += $(EDJE_DATA_FILES)
284
285if HAVE_ELUA
286
287edje_eolian_lua = $(edje_eolian_files:%.eo=%.eo.lua)
288
289generated_edje_lua_all = $(edje_eolian_lua)
290
291CLEANFILES += $(generated_edje_lua_all)
292
293installed_edjeluadir = $(datadir)/elua/modules/edje
294nodist_installed_edjelua_DATA = $(generated_edje_lua_all)
295
296endif
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index 3081514..5533dce 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -40,3 +40,16 @@ dist_installed_eflheaders_DATA = \
40 40
41installed_eflinterfacesdir = $(includedir)/efl-@VMAJ@/interfaces 41installed_eflinterfacesdir = $(includedir)/efl-@VMAJ@/interfaces
42nodist_installed_eflinterfaces_DATA = $(efl_eolian_files_h) 42nodist_installed_eflinterfaces_DATA = $(efl_eolian_files_h)
43
44if HAVE_ELUA
45
46efl_eolian_lua = $(efl_eolian_files:%.eo=%.eo.lua)
47
48generated_efl_lua_all = $(efl_eolian_lua)
49
50CLEANFILES += $(generated_efl_lua_all)
51
52installed_eflluadir = $(datadir)/elua/modules/efl
53nodist_installed_efllua_DATA = $(generated_efl_lua_all)
54
55endif
diff --git a/src/Makefile_Elua.am b/src/Makefile_Elua.am
index 1c170e4..21b1dd7 100644
--- a/src/Makefile_Elua.am
+++ b/src/Makefile_Elua.am
@@ -10,7 +10,7 @@ bin_elua_elua_SOURCES = \
10 10
11bin_elua_elua_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ELUA_CFLAGS@ \ 11bin_elua_elua_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ELUA_CFLAGS@ \
12 -DLOCALE_DIR=\"@LOCALE_DIR@\" \ 12 -DLOCALE_DIR=\"@LOCALE_DIR@\" \
13 -DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \ 13 -DPACKAGE_SRC_DIR=\"$(abs_top_srcdir)\" \
14 -DPACKAGE_BIN_DIR=\"$(bindir)\" \ 14 -DPACKAGE_BIN_DIR=\"$(bindir)\" \
15 -DPACKAGE_DATA_DIR=\"$(datadir)/elua\" 15 -DPACKAGE_DATA_DIR=\"$(datadir)/elua\"
16 16
diff --git a/src/Makefile_Elua_Helper.am b/src/Makefile_Elua_Helper.am
index 63fbbf5..d677144 100644
--- a/src/Makefile_Elua_Helper.am
+++ b/src/Makefile_Elua_Helper.am
@@ -1,8 +1,8 @@
1if HAVE_ELUA_BIN 1if HAVE_ELUA_BIN
2ELUA_GEN = @elua_bin@ 2ELUA_GEN = @elua_bin@ :lualian
3_ELUA_GEN_DEP = @elua_bin@ 3_ELUA_GEN_DEP = @elua_bin@
4else 4else
5ELUA_GEN = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT} 5ELUA_GEN = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT} :lualian
6_ELUA_GEN_DEP = bin/elua/elua${EXEEXT} 6_ELUA_GEN_DEP = bin/elua/elua${EXEEXT}
7endif 7endif
8 8
@@ -12,7 +12,7 @@ am__v_ELUA_0 = @echo " ELUA " $@;
12 12
13SUFFIXES += .lua 13SUFFIXES += .lua
14 14
15%.lua: %.eo ${_ELUA_GEN_DEP} 15%.eo.lua: %.eo ${_ELUA_GEN_DEP}
16 $(AM_V_ELUA)$(ELUA_GEN) :lualian $(ELUA_GEN_FLAGS) -o $@ $< 16 $(AM_V_ELUA)$(ELUA_GEN) -o $@ $<
17 17
18CLEANFILES += $(BUILT_SOURCES) 18CLEANFILES += $(BUILT_SOURCES)
diff --git a/src/Makefile_Emotion.am b/src/Makefile_Emotion.am
index 242a671..1b51d0f 100644
--- a/src/Makefile_Emotion.am
+++ b/src/Makefile_Emotion.am
@@ -257,3 +257,16 @@ tests/emotion/data/video_frame_top.png \
257tests/emotion/data/whb.png \ 257tests/emotion/data/whb.png \
258tests/emotion/data/window_inner_shadow.png \ 258tests/emotion/data/window_inner_shadow.png \
259modules/emotion/generic/README 259modules/emotion/generic/README
260
261if HAVE_ELUA
262
263emotion_eolian_lua = $(emotion_eolian_files:%.eo=%.eo.lua)
264
265generated_emotion_lua_all = $(emotion_eolian_lua)
266
267CLEANFILES += $(generated_emotion_lua_all)
268
269installed_emotionluadir = $(datadir)/elua/modules/emotion
270nodist_installed_emotionlua_DATA = $(generated_emotion_lua_all)
271
272endif
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 44fa534..3d6acd2 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -1965,3 +1965,15 @@ tests/evas/images/Light_exif_90.jpg \
1965tests/evas/images/Light_exif_transverse.jpg \ 1965tests/evas/images/Light_exif_transverse.jpg \
1966tests/evas/images/Light_exif_270.jpg 1966tests/evas/images/Light_exif_270.jpg
1967 1967
1968if HAVE_ELUA
1969
1970evas_eolian_lua = $(evas_eolian_files:%.eo=%.eo.lua)
1971
1972generated_evas_lua_all = $(evas_eolian_lua)
1973
1974CLEANFILES += $(generated_evas_lua_all)
1975
1976installed_evasluadir = $(datadir)/elua/modules/evas
1977nodist_installed_evaslua_DATA = $(generated_evas_lua_all)
1978
1979endif
diff --git a/src/bin/elua/apps/lualian.lua b/src/bin/elua/apps/lualian.lua
index d32ec27..4ffbf58 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)
18 else 18 else
19 printv(" Output file: printing to stdout...") 19 printv(" Output file: printing to stdout...")
20 end 20 end
21 lualian.generate(fname, opts["L"], fstream) 21 lualian.generate(fname, fstream)
22end 22end
23 23
24getopt.parse { 24getopt.parse {
@@ -37,7 +37,6 @@ getopt.parse {
37 { "I", "include", true, help = "Include a directory.", metavar = "DIR", 37 { "I", "include", true, help = "Include a directory.", metavar = "DIR",
38 list = {} 38 list = {}
39 }, 39 },
40 { "L", "library", true, help = "Specify a C library name." },
41 { "o", "output", true, help = "Specify output file name(s), by " 40 { "o", "output", true, help = "Specify output file name(s), by "
42 .. "default goes to stdout.", 41 .. "default goes to stdout.",
43 list = {} 42 list = {}
@@ -49,20 +48,15 @@ getopt.parse {
49 end, 48 end,
50 done_cb = function(parser, opts, args) 49 done_cb = function(parser, opts, args)
51 if not opts["h"] then 50 if not opts["h"] then
52 if not opts["L"] then 51 for i, v in ipairs(opts["I"] or {}) do
53 io.stderr:write("library name not specified\n") 52 lualian.include_dir(v)
54 getopt.help(parser, io.stderr) 53 end
55 else 54 if os.getenv("EFL_RUN_IN_TREE") then
56 for i, v in ipairs(opts["I"] or {}) do 55 lualian.system_directory_scan()
57 lualian.include_dir(v) 56 end
58 end 57 lualian.load_eot_files()
59 if os.getenv("EFL_RUN_IN_TREE") then 58 for i, fname in ipairs(args) do
60 lualian.system_directory_scan() 59 gen_file(opts, i, fname)
61 end
62 lualian.load_eot_files()
63 for i, fname in ipairs(args) do
64 gen_file(opts, i, fname)
65 end
66 end 60 end
67 end 61 end
68 end 62 end
diff --git a/src/bin/elua/main.c b/src/bin/elua/main.c
index 5aea7e1..2ed8893 100644
--- a/src/bin/elua/main.c
+++ b/src/bin/elua/main.c
@@ -136,9 +136,9 @@ elua_register_require(lua_State *L)
136 elua_appload_ref = luaL_ref(L, LUA_REGISTRYINDEX); 136 elua_appload_ref = luaL_ref(L, LUA_REGISTRYINDEX);
137 if (getenv("EFL_RUN_IN_TREE")) 137 if (getenv("EFL_RUN_IN_TREE"))
138 { 138 {
139 corepath = PACKAGE_BUILD_DIR "/src/bin/elua/core"; 139 corepath = PACKAGE_SRC_DIR "/src/bin/elua/core";
140 modpath = PACKAGE_BUILD_DIR "/src/bin/elua/modules"; 140 modpath = PACKAGE_SRC_DIR "/src/bin/elua/modules";
141 appspath = PACKAGE_BUILD_DIR "/src/bin/elua/apps"; 141 appspath = PACKAGE_SRC_DIR "/src/bin/elua/apps";
142 } 142 }
143 else 143 else
144 { 144 {
@@ -466,9 +466,9 @@ elua_main(lua_State *L)
466 { 466 {
467 Arg_Data *v = malloc(sizeof(Arg_Data)); 467 Arg_Data *v = malloc(sizeof(Arg_Data));
468 v->type = ARG_LIBDIR; 468 v->type = ARG_LIBDIR;
469 v->value = PACKAGE_BUILD_DIR "/src/bindings/luajit"; 469 v->value = PACKAGE_SRC_DIR "/src/bindings/luajit";
470 largs = eina_list_append(largs, v); 470 largs = eina_list_append(largs, v);
471 coref = PACKAGE_BUILD_DIR "/src/bin/elua/core"; 471 coref = PACKAGE_SRC_DIR "/src/bin/elua/core";
472 } 472 }
473 else if (!(coref = coredir)) 473 else if (!(coref = coredir))
474 { 474 {
diff --git a/src/bin/elua/modules/lualian.lua b/src/bin/elua/modules/lualian.lua
index 5d3908b..a8425ef 100644
--- a/src/bin/elua/modules/lualian.lua
+++ b/src/bin/elua/modules/lualian.lua
@@ -502,10 +502,9 @@ end
502} 502}
503 503
504local File = Node:clone { 504local File = Node:clone {
505 __ctor = function(self, fname, klass, libname, ch) 505 __ctor = function(self, fname, klass, ch)
506 self.fname = fname:match(".+/(.+)") or fname 506 self.fname = fname:match(".+/(.+)") or fname
507 self.klass = klass 507 self.klass = klass
508 self.libname = libname
509 self.children = ch 508 self.children = ch
510 end, 509 end,
511 510
@@ -531,33 +530,27 @@ local util = require("util")
531local ffi = require("ffi") 530local ffi = require("ffi")
532local eo = require("eo") 531local eo = require("eo")
533 532
534local M = ... 533local M, __lib = ...
535 534
536local __lib
537local __class 535local __class
538local __body 536local __body
539 537
540local init = function() 538local init = function()
541 __lib = util.lib_load("%s")
542 __class = __lib.%s_class_get() 539 __class = __lib.%s_class_get()
543 eo.class_register("%s", %s, __body, __class) 540 eo.class_register("%s", %s, __body, __class)
544]]):format(self.fname, kn, self.libname, ckls.prefix, knu, paru)) 541]]):format(self.fname, kn, ckls.prefix, knu, paru))
545 542
546 if ckls.mixins then for i, v in ipairs(ckls.mixins) do 543 if ckls.mixins then for i, v in ipairs(ckls.mixins) do
547 s:write((" eo.class_mixin(\"%s\", \"%s\")\n"):format(knu, 544 s:write((" eo.class_mixin(\"%s\", \"%s\")\n"):format(knu,
548 v:gsub("%.", "_"))) 545 v:gsub("%.", "_")))
549 end end 546 end end
550 547
551 s:write(([[ 548 s:write([[
552end
553
554local shutdown = function()
555 util.lib_unload("%s")
556end 549end
557 550
558cutil.init_module(init, shutdown) 551cutil.init_module(init, function() end)
559 552
560]]):format(self.libname)) 553]])
561 554
562 self:gen_children(s) 555 self:gen_children(s)
563 556
@@ -651,7 +644,7 @@ M.system_directory_scan = function()
651 return eolian.system_directory_scan() 644 return eolian.system_directory_scan()
652end 645end
653 646
654M.generate = function(fname, libname, fstream) 647M.generate = function(fname, fstream)
655 if not eolian.eo_file_parse(fname) then 648 if not eolian.eo_file_parse(fname) then
656 error("Failed parsing file: " .. fname) 649 error("Failed parsing file: " .. fname)
657 end 650 end
@@ -670,7 +663,7 @@ M.generate = function(fname, libname, fstream)
670 else 663 else
671 error(klass:full_name_get() .. ": unknown type") 664 error(klass:full_name_get() .. ": unknown type")
672 end 665 end
673 File(fname, klass, libname, { cl }):generate(fstream or io.stdout) 666 File(fname, klass, { cl }):generate(fstream or io.stdout)
674end 667end
675 668
676return M 669return M