lua: fix linking under glibc
authorRosen Penev <rosenp@gmail.com>
Tue, 15 Oct 2019 05:59:42 +0000 (22:59 -0700)
committerDavid Bauer <mail@david-bauer.net>
Tue, 15 Oct 2019 16:13:54 +0000 (18:13 +0200)
Compilation of liblua itself works, but when other packages link against
it, the linker starts throwing undefined references to a bunch of math
functions in libm.

First discovered in a failed attempt to transition a package to uClibc++.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[fix commit title capitalization]
Signed-off-by: David Bauer <mail@david-bauer.net>
package/utils/lua/Makefile

index e376e8c..0421abc 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lua
 PKG_VERSION:=5.1.5
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
@@ -99,7 +99,7 @@ define Build/Compile
                RANLIB="$(TARGET_CROSS)ranlib" \
                INSTALL_ROOT=/usr \
                CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
-               MYLDFLAGS="$(TARGET_LDFLAGS)" \
+               MYLDFLAGS="$(TARGET_LDFLAGS) $(if $(CONFIG_USE_GLIBC),-lm)" \
                PKG_VERSION=$(PKG_VERSION) \
                linux
        rm -rf $(PKG_INSTALL_DIR)