From 9f455a1d9d6e8154341e0c650acf5c049aacc81a Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 4 May 2011 14:49:58 +0000 Subject: [PATCH] [packages] package luaposix, the general Lua POSIX library git-svn-id: svn://svn.openwrt.org/openwrt/packages@26821 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- lang/luaposix/Makefile | 52 +++++++++++++++++++++++++++ lang/luaposix/patches/100-eglibc-compat.patch | 26 ++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 lang/luaposix/Makefile create mode 100644 lang/luaposix/patches/100-eglibc-compat.patch diff --git a/lang/luaposix/Makefile b/lang/luaposix/Makefile new file mode 100644 index 000000000..7252b91e8 --- /dev/null +++ b/lang/luaposix/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luaposix +PKG_VERSION:=5.1.11 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/4813 +PKG_MD5SUM:=edb76911dbdabe98dec49e3d8a126227 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/luaposix + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=luaposix + URL:=http://luaposix.luaforge.net/ + DEPENDS:=+lua +endef + +define Package/luaposix/description + luaposix is a general POSIX library for Lua providing access + to various low level libc functions. +endef + +define Build/Configure +endef + +TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99 + +ifneq ($(CONFIG_USE_EGLIBC),) + ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),) + TARGET_CFLAGS += -DNO_GETLOGIN + endif +endif + + +define Package/luaposix/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/posix.so $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,luaposix)) diff --git a/lang/luaposix/patches/100-eglibc-compat.patch b/lang/luaposix/patches/100-eglibc-compat.patch new file mode 100644 index 000000000..96a6fce64 --- /dev/null +++ b/lang/luaposix/patches/100-eglibc-compat.patch @@ -0,0 +1,26 @@ +--- a/lposix.c ++++ b/lposix.c +@@ -960,11 +960,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) +@@ -1778,7 +1780,9 @@ static const luaL_reg R[] = + #if _POSIX_VERSION >= 200112L + {"getgroups", Pgetgroups}, + #endif ++#ifndef NO_GETLOGIN + {"getlogin", Pgetlogin}, ++#endif + {"getopt_long", Pgetopt_long}, + {"getpasswd", Pgetpasswd}, + {"getpid", Pgetpid}, -- 2.11.0