aboutsummaryrefslogtreecommitdiff
path: root/package/lua/lua.mk
diff options
context:
space:
mode:
Diffstat (limited to 'package/lua/lua.mk')
-rw-r--r--package/lua/lua.mk19
1 files changed, 13 insertions, 6 deletions
diff --git a/package/lua/lua.mk b/package/lua/lua.mk
index c016d7e0e7..bf68e654f2 100644
--- a/package/lua/lua.mk
+++ b/package/lua/lua.mk
@@ -14,8 +14,7 @@ LUA_INSTALL_STAGING = YES
LUA_LICENSE = MIT
LUA_LICENSE_FILES = COPYRIGHT
-LUA_CFLAGS = -Wall -fPIC
-LUA_MYLIBS += -ldl
+LUA_CFLAGS = -Wall -fPIC -DLUA_USE_POSIX
ifeq ($(BR2_PACKAGE_LUA_5_2),y)
LUA_CFLAGS += -DLUA_COMPAT_ALL
@@ -24,17 +23,23 @@ LUA_CFLAGS += -D_FILE_OFFSET_BITS=32
endif
endif
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+ LUA_BUILDMODE = static
+else
+ LUA_BUILDMODE = dynamic
+ LUA_CFLAGS += -DLUA_USE_DLOPEN
+ LUA_MYLIBS += -ldl
+endif
+
ifeq ($(BR2_PACKAGE_LUA_INTERPRETER_READLINE),y)
LUA_DEPENDENCIES = readline ncurses
LUA_MYLIBS += -lreadline -lhistory -lncurses
- LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_READLINE
+ LUA_CFLAGS += -DLUA_USE_READLINE
else
ifeq ($(BR2_PACKAGE_LUA_INTERPRETER_LINENOISE),y)
LUA_DEPENDENCIES = linenoise
LUA_MYLIBS += -llinenoise
- LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_LINENOISE
-else
- LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN
+ LUA_CFLAGS += -DLUA_USE_LINENOISE
endif
endif
@@ -53,6 +58,7 @@ define LUA_BUILD_CMDS
CC="$(TARGET_CC)" RANLIB="$(TARGET_RANLIB)" \
CFLAGS="$(TARGET_CFLAGS) $(LUA_CFLAGS)" \
MYLIBS="$(LUA_MYLIBS)" AR="$(TARGET_CROSS)ar rcu" \
+ BUILDMODE=$(LUA_BUILDMODE) \
PKG_VERSION=$(LUA_VERSION) -C $(@D)/src all
endef
@@ -61,6 +67,7 @@ define HOST_LUA_BUILD_CMDS
CFLAGS="$(HOST_LUA_CFLAGS)" \
MYLDFLAGS="$(HOST_LDFLAGS)" \
MYLIBS="$(HOST_LUA_MYLIBS)" \
+ BUILDMODE=static \
PKG_VERSION=$(LUA_VERSION) -C $(@D)/src all
endef