Skip to content

Commit

Permalink
lua-lsqlite3: add build VARIANT for Lua5.3
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 authored and 1715173329 committed Aug 25, 2023
1 parent c2d7f6a commit 9b38508
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions lang/lua-lsqlite3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,46 @@ PKG_HASH:=d38402aa7640055d260c1246c36e6d6d31b425a25a805431f13695694466b722
PKG_LICENSE:=MIT
PKG_MAINTAINER:=Oskari Rauta <[email protected]>

PKG_BUILD_DIR:=$(BUILD_DIR)/$(basename $(PKG_SOURCE))
PKG_BUILD_DIR:=$(BUILD_DIR)/lsqlite3-$(BUILD_VARIANT)/$(basename $(PKG_SOURCE))

include $(INCLUDE_DIR)/package.mk

define Package/lsqlite3
define Package/lsqlite3/default
SUBMENU:=Lua
SECTION:=lang
CATEGORY:=Languages
TITLE:=Lua wrapper for the SQLite3 library
URL:=http://lua.sqlite.org
DEPENDS:= +lua +libsqlite3
DEPENDS:=+libsqlite3
endef

define Package/lsqlite3
$(Package/lsqlite3/default)
DEPENDS+=+liblua
VARIANT:=lua-51
endef

define Package/lsqlite3-lua5.3
$(Package/lsqlite3/default)
DEPENDS+=+liblua5.3
VARIANT:=lua-53
endef

define Package/lsqlite3/description
define Package/lsqlite3/default/description
LuaSQLite3 is a thin wrapper around the public domain SQLite3 database engine.
endef

Package/lsqlite3/description = $(Package/lsqlite3/default/description)
Package/lsqlite3-lua5.3/description = $(Package/lsqlite3/default/description)

TARGET_CFLAGS += $(FPIC) -std=gnu99
TARGET_CPPFLAGS += -DLUA_USE_LINUX
TARGET_LDFLAGS += -lsqlite3 -lpthread

ifeq ($(BUILD_VARIANT),lua-53)
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/lua5.3
endif

define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) \
-c $(PKG_BUILD_DIR)/lsqlite3.c \
Expand All @@ -54,4 +73,10 @@ define Package/lsqlite3/install
$(CP) $(PKG_BUILD_DIR)/*.so $(1)/usr/lib/lua/
endef

define Package/lsqlite3-lua5.3/install
$(INSTALL_DIR) $(1)/usr/local/lib/lua/5.3
$(CP) $(PKG_BUILD_DIR)/*.so $(1)/usr/local/lib/lua/5.3
endef

$(eval $(call BuildPackage,lsqlite3))
$(eval $(call BuildPackage,lsqlite3-lua5.3))

0 comments on commit 9b38508

Please sign in to comment.