Add flags to run both luajit and lua
This commit is contained in:
parent
198642b0cf
commit
6f9926b582
|
@ -62,9 +62,11 @@ lite_build_package_windows () {
|
||||||
if [ "$portable" == "-portable" ]; then
|
if [ "$portable" == "-portable" ]; then
|
||||||
local bindir="$pdir"
|
local bindir="$pdir"
|
||||||
local datadir="$pdir/data"
|
local datadir="$pdir/data"
|
||||||
|
local suffix=""
|
||||||
else
|
else
|
||||||
local bindir="$pdir/bin"
|
local bindir="$pdir/bin"
|
||||||
local datadir="$pdir/share/lite-xl"
|
local datadir="$pdir/share/lite-xl"
|
||||||
|
local suffix="-msys"
|
||||||
fi
|
fi
|
||||||
mkdir -p "$bindir"
|
mkdir -p "$bindir"
|
||||||
mkdir -p "$datadir"
|
mkdir -p "$datadir"
|
||||||
|
@ -77,7 +79,7 @@ lite_build_package_windows () {
|
||||||
cp "$build/src/lite.exe" "$bindir"
|
cp "$build/src/lite.exe" "$bindir"
|
||||||
strip --strip-all "$bindir/lite.exe"
|
strip --strip-all "$bindir/lite.exe"
|
||||||
pushd ".package-build"
|
pushd ".package-build"
|
||||||
local package_name="lite-xl-$os-$arch$portable.zip"
|
local package_name="lite-xl-$os-$arch$suffix.zip"
|
||||||
zip "$package_name" -r "lite-xl"
|
zip "$package_name" -r "lite-xl"
|
||||||
mv "$package_name" ..
|
mv "$package_name" ..
|
||||||
popd
|
popd
|
||||||
|
@ -188,7 +190,12 @@ lite_build_package () {
|
||||||
|
|
||||||
lite_copy_third_party_modules () {
|
lite_copy_third_party_modules () {
|
||||||
local build="$1"
|
local build="$1"
|
||||||
|
for count in 1 2 3 4 5; do
|
||||||
curl --insecure -L "https://github.com/rxi/lite-colors/archive/master.zip" -o "$build/rxi-lite-colors.zip"
|
curl --insecure -L "https://github.com/rxi/lite-colors/archive/master.zip" -o "$build/rxi-lite-colors.zip"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
mkdir -p "$build/third/data/colors" "$build/third/data/plugins"
|
mkdir -p "$build/third/data/colors" "$build/third/data/plugins"
|
||||||
unzip "$build/rxi-lite-colors.zip" -d "$build"
|
unzip "$build/rxi-lite-colors.zip" -d "$build"
|
||||||
mv "$build/lite-colors-master/colors" "$build/third/data"
|
mv "$build/lite-colors-master/colors" "$build/third/data"
|
||||||
|
@ -221,7 +228,7 @@ if [ -z ${use_branch+set} ]; then
|
||||||
use_branch="$(git rev-parse --abbrev-ref HEAD)"
|
use_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_dir=".build-$arch"
|
build_dir=".rbuild-$arch"
|
||||||
|
|
||||||
if [ -z ${pgo+set} ]; then
|
if [ -z ${pgo+set} ]; then
|
||||||
lite_build "$build_dir"
|
lite_build "$build_dir"
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
function table.pack(...)
|
local has_jit_module = pcall(require, "jit")
|
||||||
|
if has_jit_module then
|
||||||
|
-- when using luajit the function table.pack/unpack are not available
|
||||||
|
function table.pack(...)
|
||||||
return {n=select('#',...), ...}
|
return {n=select('#',...), ...}
|
||||||
|
end
|
||||||
|
|
||||||
|
table.unpack = unpack
|
||||||
end
|
end
|
||||||
|
|
||||||
table.unpack = unpack
|
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,10 @@ cc = meson.get_compiler('c')
|
||||||
libm = cc.find_library('m', required : false)
|
libm = cc.find_library('m', required : false)
|
||||||
libdl = cc.find_library('dl', required : false)
|
libdl = cc.find_library('dl', required : false)
|
||||||
|
|
||||||
|
lite_cargs = []
|
||||||
if get_option('luajit')
|
if get_option('luajit')
|
||||||
lua_dep = dependency('luajit', required : false)
|
lua_dep = dependency('luajit', required : false)
|
||||||
|
lite_cargs += '-DLITE_USE_LUAJIT'
|
||||||
if not lua_dep.found()
|
if not lua_dep.found()
|
||||||
lua_subproject = subproject('luajit', default_options: ['portable=true', 'default_library=static', 'app=false'])
|
lua_subproject = subproject('luajit', default_options: ['portable=true', 'default_library=static', 'app=false'])
|
||||||
lua_dep = lua_subproject.get_variable('lua_dep')
|
lua_dep = lua_subproject.get_variable('lua_dep')
|
||||||
|
@ -22,7 +24,6 @@ endif
|
||||||
|
|
||||||
sdl_dep = dependency('sdl2', method: 'config-tool')
|
sdl_dep = dependency('sdl2', method: 'config-tool')
|
||||||
|
|
||||||
lite_cargs = []
|
|
||||||
if get_option('portable')
|
if get_option('portable')
|
||||||
lite_datadir = 'data'
|
lite_datadir = 'data'
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef LITE_USE_LUAJIT
|
||||||
|
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
@ -61,4 +63,4 @@ void luaL_setmetatable (lua_State *L, const char *tname) {
|
||||||
luaL_getmetatable(L, tname);
|
luaL_getmetatable(L, tname);
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
|
|
||||||
|
#ifdef LITE_USE_LUAJIT
|
||||||
|
|
||||||
#define luaL_newlibtable(L, l) \
|
#define luaL_newlibtable(L, l) \
|
||||||
(lua_createtable(L, 0, sizeof(l)/sizeof(*(l))-1))
|
(lua_createtable(L, 0, sizeof(l)/sizeof(*(l))-1))
|
||||||
#define luaL_newlib(L, l) \
|
#define luaL_newlib(L, l) \
|
||||||
|
@ -13,5 +15,6 @@ extern void luaL_requiref (lua_State *L, const char *modname, lua_CFunction open
|
||||||
extern void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
|
extern void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
|
||||||
extern void luaL_setmetatable (lua_State *L, const char *tname);
|
extern void luaL_setmetatable (lua_State *L, const char *tname);
|
||||||
extern int luaL_getsubtable (lua_State *L, int i, const char *name);
|
extern int luaL_getsubtable (lua_State *L, int i, const char *name);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue