fix lua compile with eglibc selected and utmp support disabled
authorFelix Fietkau <nbd@openwrt.org>
Sat, 31 Jan 2009 07:18:13 +0000 (07:18 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 31 Jan 2009 07:18:13 +0000 (07:18 +0000)
SVN-Revision: 14298

package/lua/Makefile
package/lua/patches/500-eglibc_config.patch [new file with mode: 0644]

index aff52c3..eff3139 100644 (file)
@@ -86,6 +86,12 @@ endef
 
 TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC)
 
+ifneq ($(CONFIG_USE_EGLIBC),)
+  ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
+    TARGET_CFLAGS += -DNO_GETLOGIN
+  endif
+endif
+
 define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR) \
                CC="$(TARGET_CROSS)gcc" \
diff --git a/package/lua/patches/500-eglibc_config.patch b/package/lua/patches/500-eglibc_config.patch
new file mode 100644 (file)
index 0000000..61d2b1d
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/src/lposix.c
++++ b/src/lposix.c
+@@ -727,11 +727,13 @@ static int Pctermid(lua_State *L)                /** c
+ }
++#ifndef NO_GETLOGIN
+ static int Pgetlogin(lua_State *L)            /** getlogin() */
+ {
+       lua_pushstring(L, getlogin());
+       return 1;
+ }
++#endif
+ static void Fgetpasswd(lua_State *L, int i, const void *data)
+@@ -1052,7 +1054,9 @@ static const luaL_reg R[] =
+       {"getcwd",              Pgetcwd},
+       {"getenv",              Pgetenv},
+       {"getgroup",            Pgetgroup},
++#ifndef NO_GETLOGIN
+       {"getlogin",            Pgetlogin},
++#endif
+       {"getpasswd",           Pgetpasswd},
+       {"getpid",              Pgetpid},
+       {"glob",                Pglob},