lua-rs232: don't rely on detected luadir 16327/head
authorEneas U de Queiroz <cotequeiroz@gmail.com>
Wed, 11 Aug 2021 14:17:30 +0000 (11:17 -0300)
committerEneas U de Queiroz <cotequeiroz@gmail.com>
Wed, 11 Aug 2021 20:47:30 +0000 (17:47 -0300)
If TOPDIR starts with /usr, then the configure script will use the
staging tree hierarchy instead of using plain /usr/lib.  For example, if
TOPDIR=/usr/src/openwrt, then the files will not be available under
$(PKG_INSTALL_DIR)/usr/lib/lua/5.1/, as expected, but under
$(PKG_INSTALL_DIR)/usr/src/openwrt/staging_dir/hostpkg/lib/lua/5.1/.

Set the correct path when calling 'make'.  As a bonus, the hardcoded
version number in the Makefile can be dropped.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
lang/lua-rs232/Makefile

index d5fb95331947c1b44a7290470f6026cb3e05ac32..a7b2d9505709f19d1b0ecd9e25f55fe8955d84df 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=lua-rs232
 PKG_SOURCE_DATE:=2019-11-20
 PKG_SOURCE_VERSION:=c106c94d1a5a84e8582c936528303528608776c2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/srdgame/librs232
@@ -42,6 +42,7 @@ endef
 
 TARGET_CFLAGS += -ffunction-sections -fdata-sections
 TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
+MAKE_FLAGS += luadir='$$$${prefix}/lib/lua' luaexecdir='$$$${exec_prefix}/lib/lua'
 
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include/librs232
@@ -49,7 +50,7 @@ define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/librs232* $(1)/usr/lib/
        $(INSTALL_DIR) $(1)/usr/lib/lua
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/luars232* $(1)/usr/lib/lua
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/luars232* $(1)/usr/lib/lua
        $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/librs232.pc $(1)/usr/lib/pkgconfig
 endef
@@ -58,7 +59,7 @@ define Package/lua-rs232/install
        $(INSTALL_DIR) $(1)/usr/lib/
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/librs232.so* $(1)/usr/lib/
        $(INSTALL_DIR) $(1)/usr/lib/lua
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/luars232* $(1)/usr/lib/lua
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/luars232* $(1)/usr/lib/lua
 endef
 
 $(eval $(call BuildPackage,lua-rs232))