diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-06-20 11:01:20 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-06-20 11:01:20 -0400 |
commit | a7a569ce5f6d6d0c48a43b766a283beec7fa2f02 (patch) | |
tree | 7c5209a76badd5825a8d876f592b4bde6bcaf732 | |
parent | dade9f4849438cf1a62db6ac273934872083c233 (diff) | |
download | lite-xl-plugin-manager-a7a569ce5f6d6d0c48a43b766a283beec7fa2f02.tar.gz lite-xl-plugin-manager-a7a569ce5f6d6d0c48a43b766a283beec7fa2f02.zip |
Removed xxd as a dependnecy.
-rwxr-xr-x | build.sh | 3 | ||||
-rw-r--r-- | meson.build | 18 | ||||
-rw-r--r-- | src/lpm.c | 6 |
3 files changed, 9 insertions, 18 deletions
@@ -39,8 +39,7 @@ fi # Build the pre-packaged lua file into the executbale. if [[ "$@" == *"-DLPM_STATIC"* ]]; then [[ ! -e "lua.exe" ]] && gcc -Ilib/lua -o lua.exe lib/lua/onelua.c -lm - ./lua.exe -e 'io.open("src/lpm.luac", "wb"):write(string.dump(assert(loadfile("src/lpm.lua"))))' - xxd -i src/lpm.luac > src/lpm.lua.c + ./lua.exe -e 'f = string.dump(assert(loadfile("src/lpm.lua"))) io.open("src/lpm.lua.c", "wb"):write("unsigned char lpm_luac[] = \"" .. f:gsub(".", function (c) return string.format("\\x%02X",string.byte(c)) end) .. "\";unsigned int lpm_luac_len = " .. #f .. ";")' fi [[ $OSTYPE != 'msys'* && $CC != *'mingw'* && $CC != "emcc" ]] && CFLAGS="$CFLAGS -DLUA_USE_LINUX" && LDFLAGS="$LDFLAGS -ldl" diff --git a/meson.build b/meson.build index b4a8a04..32664cc 100644 --- a/meson.build +++ b/meson.build @@ -34,25 +34,17 @@ if not microtar_dep.found() endif lpm_source = files('src/lpm.c') -cargs = [] +cflags = [] if get_option('static') lua_exe = find_program('lua') - xxd_exe = find_program('xxd') - lpm_luac = configure_file( + lpm_source += configure_file( capture: false, - command: [lua_exe, '-e', 'io.open("@OUTPUT0@", "wb"):write(string.dump(assert(loadfile("@INPUT0@"))))'], + command: [lua_exe, '-e', 'f = string.dump(assert(loadfile("@INPUT0@"))) io.open("@OUTPUT0@", "wb"):write("unsigned char lpm_luac[] = \"" .. f:gsub(".", function (c) return string.format("\\\x%02X",string.byte(c)) end) .. "\";unsigned int lpm_luac_len = " .. #f .. ";")'], input: files('src/lpm.lua'), - output: 'lpm.luac' - ) - - lpm_source += configure_file( - capture: true, - command: [xxd_exe, '-i', '@INPUT@'], - input: lpm_luac, output: 'lpm.lua.c' ) - + cflags += '-DLPM_STATIC' endif -executable('lpm', lpm_source, dependencies: [zlib_dep, mbedtls_dep, libgit2_dep, libzip_dep, lua_dep, microtar_dep])
\ No newline at end of file +executable('lpm', lpm_source, dependencies: [zlib_dep, mbedtls_dep, libgit2_dep, libzip_dep, lua_dep, microtar_dep], c_args: cflags) @@ -1133,8 +1133,8 @@ static const luaL_Reg system_lib[] = { #ifdef LPM_STATIC - extern const char src_lpm_luac[]; - extern unsigned int src_lpm_luac_len; + extern const char lpm_luac[]; + extern unsigned int lpm_luac_len; #endif int main(int argc, char* argv[]) { @@ -1165,7 +1165,7 @@ int main(int argc, char* argv[]) { #ifndef LPM_STATIC if (luaL_loadfile(L, "src/lpm.lua") || lua_pcall(L, 0, 1, 0)) { #else - if (luaL_loadbuffer(L, src_lpm_luac, src_lpm_luac_len, "lpm.lua") || lua_pcall(L, 0, 1, 0)) { + if (luaL_loadbuffer(L, lpm_luac, lpm_luac_len, "lpm.lua") || lua_pcall(L, 0, 1, 0)) { #endif fprintf(stderr, "internal error when starting the application: %s\n", lua_tostring(L, -1)); return -1; |