ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/package/utils/lua5.3/patches/001-include-version-number.patch b/package/utils/lua5.3/patches/001-include-version-number.patch
new file mode 100644
index 0000000..1c9fdb2
--- /dev/null
+++ b/package/utils/lua5.3/patches/001-include-version-number.patch
@@ -0,0 +1,75 @@
+From 96576b44a1b368bd6590eb0778ae45cc9ccede3f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Fri, 21 Jun 2019 14:08:38 +0200
+Subject: [PATCH] include version number
+
+Including it allows multiple lua versions to coexist.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+
+--- a/Makefile
++++ b/Makefile
+@@ -12,7 +12,7 @@ PLAT= none
+ # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
+ INSTALL_TOP= /usr/local
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+-INSTALL_INC= $(INSTALL_TOP)/include
++INSTALL_INC= $(INSTALL_TOP)/include/lua$V
+ INSTALL_LIB= $(INSTALL_TOP)/lib
+ INSTALL_MAN= $(INSTALL_TOP)/man/man1
+ INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
+@@ -39,10 +39,10 @@ RM= rm -f
+ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+
+ # What to install.
+-TO_BIN= lua luac
++TO_BIN= lua$V luac$V
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua.a
+-TO_MAN= lua.1 luac.1
++TO_LIB= liblua$V.a
++TO_MAN= lua$V.1 luac$V.1
+
+ # Lua version and release.
+ V= 5.3
+@@ -52,7 +52,7 @@ R= $V.4
+ all: $(PLAT)
+
+ $(PLATS) clean:
+- cd src && $(MAKE) $@
++ cd src && $(MAKE) $@ V=$V
+
+ test: dummy
+ src/lua -v
+diff --git a/doc/lua.1 b/doc/lua5.3.1
+rename from doc/lua.1
+rename to doc/lua5.3.1
+diff --git a/doc/luac.1 b/doc/luac5.3.1
+rename from doc/luac.1
+rename to doc/luac5.3.1
+diff --git a/src/Makefile b/src/Makefile
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -28,7 +28,7 @@ MYOBJS=
+
+ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+
+-LUA_A= liblua.a
++LUA_A= liblua$V.a
+ CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
+ lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
+ ltm.o lundump.o lvm.o lzio.o
+@@ -36,10 +36,10 @@ LIB_O= lauxlib.o lbaselib.o lbitlib.o lc
+ lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
+ BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
+
+-LUA_T= lua
++LUA_T= lua$V
+ LUA_O= lua.o
+
+-LUAC_T= luac
++LUAC_T= luac$V
+ LUAC_O= luac.o
+
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
diff --git a/package/utils/lua5.3/patches/020-shared_liblua.patch b/package/utils/lua5.3/patches/020-shared_liblua.patch
new file mode 100644
index 0000000..a462fa4
--- /dev/null
+++ b/package/utils/lua5.3/patches/020-shared_liblua.patch
@@ -0,0 +1,322 @@
+--- a/Makefile
++++ b/Makefile
+@@ -41,7 +41,7 @@ PLATS= aix bsd c89 freebsd generic linux
+ # What to install.
+ TO_BIN= lua$V luac$V
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua$V.a
++TO_LIB= liblua$V.a liblua$V.so.0.0.0
+ TO_MAN= lua$V.1 luac$V.1
+
+ # Lua version and release.
+@@ -62,6 +62,9 @@ install: dummy
+ cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
+ cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
++ ln -s liblua$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so.0.0
++ ln -s liblua$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so.0
++ ln -s liblua$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so
+ cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+
+ uninstall:
+--- a/src/ldo.h
++++ b/src/ldo.h
+@@ -47,8 +47,8 @@ LUAI_FUNC int luaD_pcall (lua_State *L,
+ LUAI_FUNC int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult,
+ int nres);
+ LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
+-LUAI_FUNC void luaD_growstack (lua_State *L, int n);
+-LUAI_FUNC void luaD_shrinkstack (lua_State *L);
++LUA_API void luaD_growstack (lua_State *L, int n);
++LUA_API void luaD_shrinkstack (lua_State *L);
+ LUAI_FUNC void luaD_inctop (lua_State *L);
+
+ LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode);
+--- a/src/lfunc.h
++++ b/src/lfunc.h
+@@ -47,14 +47,14 @@ struct UpVal {
+ #define upisopen(up) ((up)->v != &(up)->u.value)
+
+
+-LUAI_FUNC Proto *luaF_newproto (lua_State *L);
++LUA_API Proto *luaF_newproto (lua_State *L);
+ LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems);
+-LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems);
+-LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
+-LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
+-LUAI_FUNC void luaF_close (lua_State *L, StkId level);
++LUA_API LClosure *luaF_newLclosure (lua_State *L, int nelems);
++LUA_API void luaF_initupvals (lua_State *L, LClosure *cl);
++LUA_API UpVal *luaF_findupval (lua_State *L, StkId level);
++LUA_API void luaF_close (lua_State *L, StkId level);
+ LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
+-LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
++LUA_API const char *luaF_getlocalname (const Proto *func, int local_number,
+ int pc);
+
+
+--- a/src/lgc.h
++++ b/src/lgc.h
+@@ -133,11 +133,11 @@
+
+ LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o);
+ LUAI_FUNC void luaC_freeallobjects (lua_State *L);
+-LUAI_FUNC void luaC_step (lua_State *L);
++LUA_API void luaC_step (lua_State *L);
+ LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask);
+ LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency);
+ LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz);
+-LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v);
++LUA_API void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v);
+ LUAI_FUNC void luaC_barrierback_ (lua_State *L, Table *o);
+ LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv);
+ LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt);
+--- a/src/llex.h
++++ b/src/llex.h
+@@ -73,13 +73,13 @@ typedef struct LexState {
+
+
+ LUAI_FUNC void luaX_init (lua_State *L);
+-LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
++LUA_API void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
+ TString *source, int firstchar);
+ LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
+-LUAI_FUNC void luaX_next (LexState *ls);
+-LUAI_FUNC int luaX_lookahead (LexState *ls);
+-LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s);
+-LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
++LUA_API void luaX_next (LexState *ls);
++LUA_API int luaX_lookahead (LexState *ls);
++LUA_API l_noret luaX_syntaxerror (LexState *ls, const char *s);
++LUA_API const char *luaX_token2str (LexState *ls, int token);
+
+
+ #endif
+--- a/src/lmem.h
++++ b/src/lmem.h
+@@ -56,12 +56,12 @@
+ #define luaM_reallocvector(L, v,oldn,n,t) \
+ ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
+
+-LUAI_FUNC l_noret luaM_toobig (lua_State *L);
++LUA_API l_noret luaM_toobig (lua_State *L);
+
+ /* not to be called directly */
+-LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
++LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
+ size_t size);
+-LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
++LUA_API void *luaM_growaux_ (lua_State *L, void *block, int *size,
+ size_t size_elem, int limit,
+ const char *what);
+
+--- a/src/lobject.h
++++ b/src/lobject.h
+@@ -525,7 +525,7 @@ typedef struct Table {
+ #define luaO_nilobject (&luaO_nilobject_)
+
+
+-LUAI_DDEC const TValue luaO_nilobject_;
++LUA_API const TValue luaO_nilobject_;
+
+ /* size of buffer for 'luaO_utf8esc' function */
+ #define UTF8BUFFSZ 8
+@@ -534,15 +534,15 @@ LUAI_FUNC int luaO_int2fb (unsigned int
+ LUAI_FUNC int luaO_fb2int (int x);
+ LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x);
+ LUAI_FUNC int luaO_ceillog2 (unsigned int x);
+-LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1,
++LUA_API void luaO_arith (lua_State *L, int op, const TValue *p1,
+ const TValue *p2, TValue *res);
+ LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o);
+ LUAI_FUNC int luaO_hexavalue (int c);
+ LUAI_FUNC void luaO_tostring (lua_State *L, StkId obj);
+-LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
++LUA_API const char *luaO_pushvfstring (lua_State *L, const char *fmt,
+ va_list argp);
+-LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
+-LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);
++LUA_API const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
++LUA_API void luaO_chunkid (char *out, const char *source, size_t len);
+
+
+ #endif
+--- a/src/lopcodes.h
++++ b/src/lopcodes.h
+@@ -278,7 +278,7 @@ enum OpArgMask {
+ OpArgK /* argument is a constant or register/constant */
+ };
+
+-LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
++LUA_API const lu_byte luaP_opmodes[NUM_OPCODES];
+
+ #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
+ #define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
+@@ -287,7 +287,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM
+ #define testTMode(m) (luaP_opmodes[m] & (1 << 7))
+
+
+-LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
++LUA_API const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
+
+
+ /* number of list items to accumulate before a SETLIST instruction */
+--- a/src/lstate.h
++++ b/src/lstate.h
+@@ -244,9 +244,9 @@ union GCUnion {
+
+ LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt);
+ LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
+-LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);
+-LUAI_FUNC void luaE_freeCI (lua_State *L);
+-LUAI_FUNC void luaE_shrinkCI (lua_State *L);
++LUA_API CallInfo *luaE_extendCI (lua_State *L);
++LUA_API void luaE_freeCI (lua_State *L);
++LUA_API void luaE_shrinkCI (lua_State *L);
+
+
+ #endif
+--- a/src/lstring.h
++++ b/src/lstring.h
+@@ -35,15 +35,15 @@
+
+ LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
+ LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts);
+-LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
++LUA_API int luaS_eqlngstr (TString *a, TString *b);
+ LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
+ LUAI_FUNC void luaS_clearcache (global_State *g);
+ LUAI_FUNC void luaS_init (lua_State *L);
+ LUAI_FUNC void luaS_remove (lua_State *L, TString *ts);
+ LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s);
+-LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
+-LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
+-LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l);
++LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
++LUA_API TString *luaS_new (lua_State *L, const char *str);
++LUA_API TString *luaS_createlngstrobj (lua_State *L, size_t l);
+
+
+ #endif
+--- a/src/ltable.h
++++ b/src/ltable.h
+@@ -41,14 +41,14 @@
+
+
+ LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key);
+-LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key,
++LUA_API void luaH_setint (lua_State *L, Table *t, lua_Integer key,
+ TValue *value);
+ LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key);
+ LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
+ LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
+ LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key);
+-LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
+-LUAI_FUNC Table *luaH_new (lua_State *L);
++LUA_API TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
++LUA_API Table *luaH_new (lua_State *L);
+ LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
+ unsigned int nhsize);
+ LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize);
+--- a/src/ltm.h
++++ b/src/ltm.h
+@@ -55,10 +55,10 @@ typedef enum {
+ LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS];
+
+
+-LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o);
++LUA_API const char *luaT_objtypename (lua_State *L, const TValue *o);
+
+ LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
+-LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
++LUA_API const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
+ TMS event);
+ LUAI_FUNC void luaT_init (lua_State *L);
+
+@@ -66,9 +66,9 @@ LUAI_FUNC void luaT_callTM (lua_State *L
+ const TValue *p2, TValue *p3, int hasres);
+ LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
+ StkId res, TMS event);
+-LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
++LUA_API void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
+ StkId res, TMS event);
+-LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1,
++LUA_API int luaT_callorderTM (lua_State *L, const TValue *p1,
+ const TValue *p2, TMS event);
+
+
+--- a/src/lundump.h
++++ b/src/lundump.h
+@@ -23,10 +23,10 @@
+ #define LUAC_FORMAT 0 /* this is the official format */
+
+ /* load one chunk; from lundump.c */
+-LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
++LUA_API LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
+
+ /* dump one chunk; from ldump.c */
+-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
++LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
+ void* data, int strip);
+
+ #endif
+--- a/src/lzio.h
++++ b/src/lzio.h
+@@ -61,6 +61,6 @@ struct Zio {
+ };
+
+
+-LUAI_FUNC int luaZ_fill (ZIO *z);
++LUA_API int luaZ_fill (ZIO *z);
+
+ #endif
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -29,6 +29,7 @@ MYOBJS=
+ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+
+ LUA_A= liblua$V.a
++LUA_SO= liblua$V.so.0.0.0
+ CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
+ lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
+ ltm.o lundump.o lvm.o lzio.o
+@@ -43,8 +44,9 @@ LUAC_T= luac$V
+ LUAC_O= luac.o
+
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
++ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
+ ALL_A= $(LUA_A)
++ALL_SO= $(LUA_SO)
+
+ # Targets start here.
+ default: $(PLAT)
+@@ -55,14 +57,25 @@ o: $(ALL_O)
+
+ a: $(ALL_A)
+
++so: $(ALL_SO)
++
+ $(LUA_A): $(BASE_O)
+ $(AR) $@ $(BASE_O)
+ $(RANLIB) $@
+
+-$(LUA_T): $(LUA_O) $(LUA_A)
+- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
++$(LUA_SO): $(CORE_O) $(LIB_O)
++ $(CC) -o $@ -Wl,-Bsymbolic-functions -shared -Wl,-soname="$@" $?
++ ln -fs $@ liblua$V.so.0.0
++ ln -fs $@ liblua$V.so.0
++ ln -fs $@ liblua$V.so
++
++$(LUA_T): $(LUA_O) $(LUA_SO)
++ $(CC) -o $@ -L. -llua$V $(MYLDFLAGS) $(LUA_O) $(LIBS)
++
++$(LUAC_T): $(LUAC_O) $(LUA_SO)
++ $(CC) -o $@ -L. -llua$V $(MYLDFLAGS) $(LUAC_O) $(LIBS)
+
+-$(LUAC_T): $(LUAC_O) $(LUA_A)
++$(LUAC_T)-host: $(LUAC_O) $(LUA_A)
+ $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+
+ clean:
diff --git a/package/utils/lua5.3/patches/100-no_readline.patch b/package/utils/lua5.3/patches/100-no_readline.patch
new file mode 100644
index 0000000..363b900
--- /dev/null
+++ b/package/utils/lua5.3/patches/100-no_readline.patch
@@ -0,0 +1,54 @@
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -61,14 +61,12 @@
+ #if defined(LUA_USE_LINUX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
+-#define LUA_USE_READLINE /* needs some extra libraries */
+ #endif
+
+
+ #if defined(LUA_USE_MACOSX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* MacOS does not need -ldl */
+-#define LUA_USE_READLINE /* needs an extra library: -lreadline */
+ #endif
+
+
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -23,6 +23,7 @@ MYCFLAGS=
+ MYLDFLAGS=
+ MYLIBS=
+ MYOBJS=
++# USE_READLINE=1
+
+ # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
+
+@@ -96,6 +97,7 @@ echo:
+
+ # Convenience targets for popular platforms
+ ALL= all
++RFLAG=$(if $(USE_READLINE),-DLUA_USE_READLINE)
+
+ none:
+ @echo "Please do 'make PLATFORM' where PLATFORM is one of these:"
+@@ -115,15 +117,15 @@ c89:
+
+
+ freebsd:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX $(RFLAG) -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
+
+ generic: $(ALL)
+
+ linux:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" $(RFLAG) SYSLIBS="-Wl,-E -ldl $(if $(USE_READLINE), -lreadline)"
+
+ macosx:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" $(RFLAG) SYSLIBS="$(if $(USE_READLINE), -lreadline)"
+
+ mingw:
+ $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \
diff --git a/package/utils/lua5.3/patches/200-CVE-2019-6706.patch b/package/utils/lua5.3/patches/200-CVE-2019-6706.patch
new file mode 100644
index 0000000..8024d41
--- /dev/null
+++ b/package/utils/lua5.3/patches/200-CVE-2019-6706.patch
@@ -0,0 +1,51 @@
+From 89aee84cbc9224f638f3b7951b306d2ee8ecb71e Mon Sep 17 00:00:00 2001
+From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
+Date: Wed, 27 Mar 2019 14:30:12 -0300
+Subject: [PATCH] Fixed bug in 'lua_upvaluejoin'
+
+Bug-fix: joining an upvalue with itself could cause a use-after-free
+crash.
+---
+ src/lapi.c | 12 +++++------
+ 1 file changed, 41 insertions(+), 39 deletions(-)
+
+--- a/src/lapi.c
++++ b/src/lapi.c
+@@ -1254,13 +1254,12 @@ LUA_API const char *lua_setupvalue (lua_
+ }
+
+
+-static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
++static UpVal **getupvalref (lua_State *L, int fidx, int n) {
+ LClosure *f;
+ StkId fi = index2addr(L, fidx);
+ api_check(L, ttisLclosure(fi), "Lua function expected");
+ f = clLvalue(fi);
+ api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index");
+- if (pf) *pf = f;
+ return &f->upvals[n - 1]; /* get its upvalue pointer */
+ }
+
+@@ -1269,7 +1268,7 @@ LUA_API void *lua_upvalueid (lua_State *
+ StkId fi = index2addr(L, fidx);
+ switch (ttype(fi)) {
+ case LUA_TLCL: { /* lua closure */
+- return *getupvalref(L, fidx, n, NULL);
++ return *getupvalref(L, fidx, n);
+ }
+ case LUA_TCCL: { /* C closure */
+ CClosure *f = clCvalue(fi);
+@@ -1286,9 +1285,10 @@ LUA_API void *lua_upvalueid (lua_State *
+
+ LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,
+ int fidx2, int n2) {
+- LClosure *f1;
+- UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
+- UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
++ UpVal **up1 = getupvalref(L, fidx1, n1);
++ UpVal **up2 = getupvalref(L, fidx2, n2);
++ if (*up1 == *up2)
++ return;
+ luaC_upvdeccount(L, *up1);
+ *up1 = *up2;
+ (*up1)->refcount++;