mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-12 14:17:47 +00:00
use conventional exectuble integration methods
This commit is contained in:
parent
36d9cfe547
commit
7531409809
17
Makefile.am
17
Makefile.am
@ -45,20 +45,13 @@ else
|
|||||||
# or compiles it into the binary
|
# or compiles it into the binary
|
||||||
lsyncd_LDADD += luac.o
|
lsyncd_LDADD += luac.o
|
||||||
|
|
||||||
objarch: | lsyncd.o
|
luac.o: luac.c
|
||||||
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.out: lsyncd.lua
|
luac.out: lsyncd.lua
|
||||||
luac $<
|
luac $<
|
||||||
|
|
||||||
|
luac.c: lsyncd.lua bin2carray.lua
|
||||||
|
lua ./bin2carray.lua lsyncd.lua luac luac.c
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ if fout == nil then
|
|||||||
end
|
end
|
||||||
|
|
||||||
fout:write("/* created by "..arg[0].." from file "..arg[1].." */\n")
|
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
|
while true do
|
||||||
local block = fin:read(16)
|
local block = fin:read(16)
|
||||||
if block == nil then
|
if block == nil then
|
||||||
@ -40,7 +41,7 @@ while true do
|
|||||||
end
|
end
|
||||||
fout:write("\n")
|
fout:write("\n")
|
||||||
end
|
end
|
||||||
fout:write("};");
|
fout:write("};\n\nsize_t "..arg[2].."_size = sizeof("..arg[2].."_out);\n");
|
||||||
|
|
||||||
fin:close();
|
fin:close();
|
||||||
fout:close();
|
fout:close();
|
||||||
|
7
lsyncd.c
7
lsyncd.c
@ -45,8 +45,8 @@
|
|||||||
* The Lua part of lsyncd if compiled into the binary.
|
* The Lua part of lsyncd if compiled into the binary.
|
||||||
*/
|
*/
|
||||||
#ifndef LSYNCD_DEFAULT_RUNNER_FILE
|
#ifndef LSYNCD_DEFAULT_RUNNER_FILE
|
||||||
extern char _binary_luac_out_start;
|
extern unsigned char * luac_out;
|
||||||
extern char _binary_luac_out_end;
|
extern size_t luac_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1837,8 +1837,7 @@ main1(int argc, char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
#ifndef LSYNCD_DEFAULT_RUNNER_FILE
|
#ifndef LSYNCD_DEFAULT_RUNNER_FILE
|
||||||
/* loads the runner from binary */
|
/* loads the runner from binary */
|
||||||
if (luaL_loadbuffer(L, &_binary_luac_out_start,
|
if (luaL_loadbuffer(L, luac_out, luac_size, "lsyncd.lua"))
|
||||||
&_binary_luac_out_end - &_binary_luac_out_start, "lsyncd.lua"))
|
|
||||||
{
|
{
|
||||||
printlogf(L, "Error",
|
printlogf(L, "Error",
|
||||||
"error loading precompiled lsyncd.lua runner: %s",
|
"error loading precompiled lsyncd.lua runner: %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user