diff -Naur -u lua-5.4.6.orig/src/ldo.c lua-5.4.6/src/ldo.c
--- lua-5.4.6.orig/src/ldo.c	2023-05-02 23:02:29.000000000 +0300
+++ lua-5.4.6/src/ldo.c	2024-04-24 18:45:03.009789283 +0300
@@ -60,7 +60,7 @@
 	try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }
 #define luai_jmpbuf		int  /* dummy variable */
 
-#elif defined(LUA_USE_POSIX)				/* }{ */
+#elif 0 /*defined(LUA_USE_POSIX)*/				/* }{ */
 
 /* in POSIX, try _longjmp/_setjmp (more efficient) */
 #define LUAI_THROW(L,c)		_longjmp((c)->b, 1)
--- lua-5.4.6.orig/src/linit.c	2024-04-24 19:56:28.596313022 +0300
+++ lua-5.4.6/src/linit.c	2024-04-24 20:06:39.529105277 +0300
@@ -35,6 +35,9 @@
 #include "lauxlib.h"
 
 
+extern int luaopen_socket_core(lua_State *L);
+extern int luaopen_mime_core(lua_State *L);
+
 /*
 ** these libs are loaded by lua.c and are readily available to any Lua
 ** program
@@ -50,6 +53,10 @@
   {LUA_MATHLIBNAME, luaopen_math},
   {LUA_UTF8LIBNAME, luaopen_utf8},
   {LUA_DBLIBNAME, luaopen_debug},
+#ifdef LUASOCKET_SUPPORT
+  {"socket.core", luaopen_socket_core},
+  {"mime.core", luaopen_mime_core},
+#endif
   {NULL, NULL}
 };
 
diff -Naur -u lua-5.4.6.orig/src/liolib.c lua-5.4.6/src/liolib.c
--- lua-5.4.6.orig/src/liolib.c	2023-05-02 23:02:29.000000000 +0300
+++ lua-5.4.6/src/liolib.c	2024-04-24 19:49:12.371459505 +0300
@@ -54,7 +54,7 @@
 
 #if !defined(l_popen)		/* { */
 
-#if defined(LUA_USE_POSIX)	/* { */
+#if 0 /*defined(LUA_USE_POSIX)*/	/* { */
 
 #define l_popen(L,c,m)		(fflush(NULL), popen(c,m))
 #define l_pclose(L,file)	(pclose(file))
@@ -94,7 +94,7 @@
 
 #if !defined(l_getc)		/* { */
 
-#if defined(LUA_USE_POSIX)
+#if 0 /*defined(LUA_USE_POSIX)*/
 #define l_getc(f)		getc_unlocked(f)
 #define l_lockfile(f)		flockfile(f)
 #define l_unlockfile(f)		funlockfile(f)
diff -Naur -u lua-5.4.6.orig/src/Makefile lua-5.4.6/src/Makefile
--- lua-5.4.6.orig/src/Makefile	2023-02-03 13:43:14.000000000 +0300
+++ lua-5.4.6/src/Makefile	2024-04-24 19:51:49.316274576 +0300
@@ -6,7 +6,7 @@
 # Your platform. See PLATS for possible values.
 PLAT= guess
 
-CC= gcc -std=gnu99
+#CC= gcc -std=gnu99
 CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
 LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
 LIBS= -lm $(SYSLIBS) $(MYLIBS)
@@ -50,7 +50,7 @@
 # Targets start here.
 default: $(PLAT)
 
-all:	$(ALL_T)
+all:	$(LUA_T)
 
 o:	$(ALL_O)
 
@@ -60,8 +60,8 @@
 	$(AR) $@ $(BASE_O)
 	$(RANLIB) $@
 
-$(LUA_T): $(LUA_O) $(LUA_A)
-	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+$(LUA_T): $(LUA_O) $(BASE_O)
+	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(BASE_O)
 
 $(LUAC_T): $(LUAC_O) $(LUA_A)
 	$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
