Compile library for Lua 5.3

I asked this question a couple of years ago already but did not get an answer.

OpenWrt comes with luv compiled against Lua 5.1. However my program does not run with that version throwing good old friend "yield across C-call boundary". So my next plan is to compile luv for Lua 5.3. I do not need to install it system wide, putting the luv.so next to my program is all I need.

I got an environment setup and compilation of luv works. But whatever I do, it always compiles against Lua 5.1. This is my current Makefile version. I replaced lua by lua5.3 which causes make menuconfig to automatically toggle Lua5.3 when setting luv to {M}.

Any help would be very much appreciated!

include $(TOPDIR)/rules.mk

PKG_NAME:=luv
PKG_VERSION:=1.40.0-0
PKG_RELEASE:=$(AUTORELEASE)

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/luvit/luv/releases/download/$(PKG_VERSION)
PKG_HASH:=24473a081c3928eec2a352369cbafda97059574f4a4276861274473e7c7d17a0

PKG_MAINTAINER:=Morteza Milani <milani@pichak.co>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/luv
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=Luv
  URL:=https://github.com/luvit/luv
  DEPENDS:=+libuv +lua5.3
endef

define Package/luv/description
  Bare libuv bindings for lua
endef

define Package/luv/config
	source "$(SOURCE)/Config.in"
endef

CMAKE_OPTIONS += \
	-DLUA_BUILD_TYPE=System \
	-DWITH_SHARED_LIBUV=ON \
	-DBUILD_MODULE=OFF \
	-DBUILD_SHARED_LIBS=ON \
	-DWITH_LUA_ENGINE=Lua

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include/luv
	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/luv/*.h $(1)/usr/include/luv
	$(INSTALL_DIR) $(1)/usr/lib/lua
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libluv.so* $(1)/usr/lib
	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libluv.pc $(1)/usr/lib/pkgconfig
	$(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libluv.pc
	$(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libluv.pc
endef

define Package/luv/install
	$(INSTALL_DIR) $(1)/usr/lib/lua
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libluv.so.1.40.0 $(1)/usr/lib/lua/luv.so
endef


$(eval $(call BuildPackage,luv))

The (more optional-) parts of luci (packages) that haven't been ported to client-side javascript and ucode yet and still depend on lua, still depend on lua 5.1 specifically. This makes upgrading the default lua or multiple concurrent lua versions a bit difficult.

Yes, I am waiting for the day 5.3 libraries (or 5.4 by now) become available via opkg.

The troubles with concurrent versions is why I wrote that I only need the luv.so file (manually extracted from the .ipk) so I can put it alongside my program. It is a standalone system and only has that one dependency.

After I opened the other topic two years ago I somehow figured out a way by sheer luck that yielded the .so file I needed. However by now I got another router and the old file is not compatible with its architecture. Hence why I ask again for help since I can not reproduce my past success.