From 1563615bed4a160cfe937ae834dd333ce7070ace Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 13 Apr 2008 01:06:12 +0000 Subject: [PATCH] move lua from packages/ to trunk in anticipation of upcoming stuff ;) SVN-Revision: 10806 --- package/lua/Makefile | 142 +++++++++++++++++++ package/lua/patches/010-shared_liblua.patch | 147 ++++++++++++++++++++ 2 files changed, 289 insertions(+) create mode 100644 package/lua/Makefile create mode 100644 package/lua/patches/010-shared_liblua.patch diff --git a/package/lua/Makefile b/package/lua/Makefile new file mode 100644 index 0000000000..ae6206d3b6 --- /dev/null +++ b/package/lua/Makefile @@ -0,0 +1,142 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua +PKG_VERSION:=5.1.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.lua.org/ftp/ \ + http://ftp.gwdg.de/pub/languages/lua/ \ + http://mirrors.dotsrc.org/lua/ \ + http://www.tecgraf.puc-rio.br/lua/ftp/ +PKG_MD5SUM:=a70a8dfaa150e047866dc01a46272599 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/lua/Default + SUBMENU:=LUA + SECTION:=lang + CATEGORY:=Languages + TITLE:=LUA programming language + URL:=http://www.lua.org/ +endef + +define Package/lua/Default/description + Lua is a powerful light-weight programming language designed for extending + applications. Lua is also frequently used as a general-purpose, stand-alone + language. Lua is free software. +endef + +define Package/liblua +$(call Package/lua/Default) + SUBMENU:= + SECTION:=libs + CATEGORY:=Libraries + TITLE+= (libraries) +endef + +define Package/liblua/description +$(call Package/lua/Default/description) + This package contains the LUA shared libraries, needed by other programs. +endef + +define Package/lua +$(call Package/lua/Default) + DEPENDS:=+liblua +libreadline +libncurses + TITLE+= (interpreter) +endef + +define Package/lua/description +$(call Package/lua/Default/description) + This package contains the LUA language interpreter. +endef + +define Package/luac +$(call Package/lua/Default) + DEPENDS:=+liblua + TITLE+= (compiler) +endef + +define Package/luac/description +$(call Package/lua/Default/description) + This package contains the LUA language compiler. +endef + +define Package/lua-examples +$(call Package/lua/Default) + DEPENDS:=lua + TITLE+= (examples) +endef + +define Package/lua-examples/description +$(call Package/lua/Default/description) + This package contains LUA language examples. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CROSS)gcc" \ + LD="$(TARGET_CROSS)ld" \ + AR="$(TARGET_CROSS)ar rcu" \ + RANLIB="$(TARGET_CROSS)ranlib" \ + INSTALL_ROOT=/usr \ + MYCFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ + MYLDFLAGS="$(TARGET_LDFLAGS)" \ + PKG_VERSION=$(PKG_VERSION) \ + all linux + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \ + install +endef + +define Build/InstallDev + mkdir -p $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/ + mkdir -p $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so.*} $(1)/usr/lib/ + ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblua.so + ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so +endef + +define Package/liblua/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/ +endef + +define Package/lua/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/ +endef + +define Package/luac/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/ +endef + +define Package/lua-examples/install + $(INSTALL_DIR) $(1)/usr/share/lua/examples + $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \ + $(1)/usr/share/lua/examples/ +endef + +$(eval $(call BuildPackage,liblua)) +$(eval $(call BuildPackage,lua)) +$(eval $(call BuildPackage,luac)) +$(eval $(call BuildPackage,lua-examples)) diff --git a/package/lua/patches/010-shared_liblua.patch b/package/lua/patches/010-shared_liblua.patch new file mode 100644 index 0000000000..47b37d235e --- /dev/null +++ b/package/lua/patches/010-shared_liblua.patch @@ -0,0 +1,147 @@ +# +# Copyright (C) 2006 OpenWrt.org +# + +Index: lua-5.1.3/Makefile +=================================================================== +--- lua-5.1.3.orig/Makefile 2008-02-20 00:06:06.000000000 +0100 ++++ lua-5.1.3/Makefile 2008-02-20 00:06:07.000000000 +0100 +@@ -38,7 +38,7 @@ + # What to install. + TO_BIN= lua luac + TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp +-TO_LIB= liblua.a ++TO_LIB= liblua.a liblua.so liblua.so.$R + TO_MAN= lua.1 luac.1 + + # Lua version and release. +Index: lua-5.1.3/src/Makefile +=================================================================== +--- lua-5.1.3.orig/src/Makefile 2008-02-20 00:06:06.000000000 +0100 ++++ lua-5.1.3/src/Makefile 2008-02-20 00:06:07.000000000 +0100 +@@ -23,6 +23,7 @@ + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + + LUA_A= liblua.a ++LUA_SO= liblua.so + CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ + lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ + lundump.o lvm.o lzio.o +@@ -33,11 +34,12 @@ + LUA_O= lua.o + + LUAC_T= luac +-LUAC_O= luac.o print.o ++LUAC_O= luac.o print.o lopcodes.o + + ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) +-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) ++ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T) + ALL_A= $(LUA_A) ++ALL_SO= $(LUA_SO) + + default: $(PLAT) + +@@ -47,15 +49,21 @@ + + a: $(ALL_A) + ++so: $(ALL_SO) ++ + $(LUA_A): $(CORE_O) $(LIB_O) + $(AR) $@ $? + $(RANLIB) $@ + +-$(LUA_T): $(LUA_O) $(LUA_A) +- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) ++$(LUA_SO): $(CORE_O) $(LIB_O) ++ $(LD) -o $@.$(PKG_VERSION) -shared -soname="$@.$(PKG_VERSION)" $? ++ ln -fs $@.$(PKG_VERSION) $@ ++ ++$(LUA_T): $(LUA_O) $(LUA_SO) ++ $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUA_O) $(LIBS) + +-$(LUAC_T): $(LUAC_O) $(LUA_A) +- $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) ++$(LUAC_T): $(LUAC_O) $(LUA_SO) ++ $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUAC_O) $(LIBS) + + clean: + $(RM) $(ALL_T) $(ALL_O) +@@ -96,7 +104,7 @@ + $(MAKE) all MYCFLAGS= + + linux: +- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" ++ $(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" + + macosx: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" +Index: lua-5.1.3/src/ldo.h +=================================================================== +--- lua-5.1.3.orig/src/ldo.h 2008-02-20 00:06:06.000000000 +0100 ++++ lua-5.1.3/src/ldo.h 2008-02-20 00:06:07.000000000 +0100 +@@ -46,7 +46,7 @@ + LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); + LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); + LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +-LUAI_FUNC void luaD_growstack (lua_State *L, int n); ++LUA_API void luaD_growstack (lua_State *L, int n); + + LUAI_FUNC void luaD_throw (lua_State *L, int errcode); + LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); +Index: lua-5.1.3/src/lfunc.h +=================================================================== +--- lua-5.1.3.orig/src/lfunc.h 2008-02-20 00:06:06.000000000 +0100 ++++ lua-5.1.3/src/lfunc.h 2008-02-20 00:06:07.000000000 +0100 +@@ -18,7 +18,7 @@ + cast(int, sizeof(TValue *)*((n)-1))) + + +-LUAI_FUNC Proto *luaF_newproto (lua_State *L); ++LUA_API Proto *luaF_newproto (lua_State *L); + LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); + LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); + LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +Index: lua-5.1.3/src/lmem.h +=================================================================== +--- lua-5.1.3.orig/src/lmem.h 2008-02-20 00:06:06.000000000 +0100 ++++ lua-5.1.3/src/lmem.h 2008-02-20 00:06:07.000000000 +0100 +@@ -38,9 +38,9 @@ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + + +-LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, ++LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +-LUAI_FUNC void *luaM_toobig (lua_State *L); ++LUA_API void *luaM_toobig (lua_State *L); + LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *errormsg); +Index: lua-5.1.3/src/lstring.h +=================================================================== +--- lua-5.1.3.orig/src/lstring.h 2008-02-20 00:06:06.000000000 +0100 ++++ lua-5.1.3/src/lstring.h 2008-02-20 00:06:07.000000000 +0100 +@@ -25,7 +25,7 @@ + + LUAI_FUNC void luaS_resize (lua_State *L, int newsize); + LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); +-LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); ++LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l); + + + #endif +Index: lua-5.1.3/src/lundump.h +=================================================================== +--- lua-5.1.3.orig/src/lundump.h 2008-02-20 00:06:06.000000000 +0100 ++++ lua-5.1.3/src/lundump.h 2008-02-20 00:06:07.000000000 +0100 +@@ -17,7 +17,7 @@ + LUAI_FUNC void luaU_header (char* h); + + /* dump one chunk; from ldump.c */ +-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); ++LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); + + #ifdef luac_c + /* print one chunk; from print.c */ -- 2.25.1