M README.md +6 -2
@@ 13,18 13,22 @@ Dependencies
**Building**
+
Clone and cd into the repo
hg clone https://hg.sr.ht/~cloudninja/ljp
cd ljp
To build the provided example
- ./examplebuild.sh
+ cp example/main.lua inc/.
+ ninja -C build
./build/ljp
If you provide your own Lua scripts in `inc` they will be processed into header files and compiled into the binary.
- ./compbuild.sh
+ ninja -C build
./build/ljp
+I'm still figuring out build system stuff, so it may be a little broken but it should at least work.
+
Assuming you don't touch `preload.lua` you can retrieve those files (from `main.lua`, read the example and `preload.lua` to understand) from luajit later.
M clean.sh +1 -0
@@ 1,2 1,3 @@
#!/usr/bin/bash
rm inc/*.h
+rm build/ljp
M +2 -9
@@ 1,13 1,7 @@
#!/usr/bin/bash
#loop through .lua files, xxd -i $name.lua > $name.h
#then add extern unsigned char $name_lua[]; to the header file
#then add extern unsigned int $name_lua_len; to the header file
#chdir to inc
#create an array of names without extensions
array=()
cd ..
./clean.sh
cd inc
for file in *.lua
do
@@ 19,7 13,6 @@ do
echo $str2 >> $name.h
array+=($name)
done
#make one header file with includes
for i in "${array[@]}"
do
echo "#include \"$i.h\"" >> lua_files.h
M example/main.lua +3 -3
@@ 1,3 1,3 @@
---This file will pull its' own data back out of the binary and print it
-local str = igs("main_lua")
-print(str)
+local str = igs("test_lua")
+
+print("test_lua: " .. str)
M meson.build +6 -5
@@ 1,13 1,14 @@
project('ljp','c')
cc = meson.get_compiler('c')
-
-inc = include_directories('inc')
luajit_dep = dependency('luajit')
sources = [
-'src/main.c',
+ 'src/main.c',
]
-add_project_link_arguments('-rdynamic', language: 'c')
+add_project_link_arguments('-rdynamic', language : 'c')
+inc = include_directories('inc')
+compheader = declare_dependency(sources: custom_target('compheader', output: 'lua_files.h', command: ['sh','../compheader.sh']))
+bin = executable('ljp', sources, include_directories: inc, dependencies: [luajit_dep,compheader])
-executable('ljp', sources, include_directories : inc, dependencies: [luajit_dep])
+