use conventional exectuble integration methods

This commit is contained in:
Axel Kittenberger 2011-05-04 13:03:58 +00:00
parent 36d9cfe547
commit 7531409809
3 changed files with 11 additions and 18 deletions

View File

@ -45,20 +45,13 @@ else
# or compiles it into the binary
lsyncd_LDADD += luac.o
objarch: | lsyncd.o
objdump -f lsyncd.o | grep architecture | \
sed -e "s/,.*$$//" -e "s/[^ ]* \(.*\)/\1/" > $@ || rm $@
objtarget: | lsyncd.o
objdump -f lsyncd.o | grep "file format" | \
sed -e "s/.* \(.*\)/\1/" > $@ || rm $@
luac.o: luac.out objarch objtarget
objcopy --input-target=binary \
--output-target=`cat objtarget` \
--binary-architecture=`cat objarch` $< $@
luac.o: luac.c
luac.out: lsyncd.lua
luac $<
luac.c: lsyncd.lua bin2carray.lua
lua ./bin2carray.lua lsyncd.lua luac luac.c
endif

View File

@ -25,7 +25,8 @@ if fout == nil then
end
fout:write("/* created by "..arg[0].." from file "..arg[1].." */\n")
fout:write("const unsigned char "..arg[2].."[] = {\n")
fout:write("#include <stddef.h>\n")
fout:write("const unsigned char "..arg[2].."_out[] = {\n")
while true do
local block = fin:read(16)
if block == nil then
@ -40,7 +41,7 @@ while true do
end
fout:write("\n")
end
fout:write("};");
fout:write("};\n\nsize_t "..arg[2].."_size = sizeof("..arg[2].."_out);\n");
fin:close();
fout:close();

View File

@ -45,8 +45,8 @@
* The Lua part of lsyncd if compiled into the binary.
*/
#ifndef LSYNCD_DEFAULT_RUNNER_FILE
extern char _binary_luac_out_start;
extern char _binary_luac_out_end;
extern unsigned char * luac_out;
extern size_t luac_size;
#endif
/**
@ -1837,8 +1837,7 @@ main1(int argc, char *argv[])
} else {
#ifndef LSYNCD_DEFAULT_RUNNER_FILE
/* loads the runner from binary */
if (luaL_loadbuffer(L, &_binary_luac_out_start,
&_binary_luac_out_end - &_binary_luac_out_start, "lsyncd.lua"))
if (luaL_loadbuffer(L, luac_out, luac_size, "lsyncd.lua"))
{
printlogf(L, "Error",
"error loading precompiled lsyncd.lua runner: %s",