2 # Copyright (C) 2006-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
16 http://ftp.gwdg.de/pub/languages/lua/ \
17 http://mirrors.dotsrc.org/lua/ \
18 http://www.tecgraf.puc-rio.br/lua/ftp/
19 PKG_MD5SUM:=d0870f2de55d59c1c8419f36e8fac150
21 HOST_PATCH_DIR=./patches-host
22 PKG_BUILD_DEPENDS:=lua/host zlib
24 include $(INCLUDE_DIR)/host-build.mk
25 include $(INCLUDE_DIR)/package.mk
27 define Package/lua/Default
31 TITLE:=LUA programming language
32 URL:=http://www.lua.org/
35 define Package/lua/Default/description
36 Lua is a powerful light-weight programming language designed for extending
37 applications. Lua is also frequently used as a general-purpose, stand-alone
38 language. Lua is free software.
42 $(call Package/lua/Default)
49 define Package/liblua/description
50 $(call Package/lua/Default/description)
51 This package contains the LUA shared libraries, needed by other programs.
55 $(call Package/lua/Default)
60 define Package/lua/description
61 $(call Package/lua/Default/description)
62 This package contains the LUA language interpreter.
66 $(call Package/lua/Default)
71 define Package/luac/description
72 $(call Package/lua/Default/description)
73 This package contains the LUA language compiler.
76 define Package/lua-examples
77 $(call Package/lua/Default)
82 define Package/lua-examples/description
83 $(call Package/lua/Default/description)
84 This package contains LUA language examples.
93 $(MAKE) -C $(HOST_BUILD_DIR)/src luac-host
97 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/luac-host $(STAGING_DIR_HOST)/bin/luac
102 TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC)
104 ifneq ($(CONFIG_USE_EGLIBC),)
105 ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
106 TARGET_CFLAGS += -DNO_GETLOGIN
110 Build/Configure=$(Host/Configure)
113 $(MAKE) -C $(PKG_BUILD_DIR) \
114 CC="$(TARGET_CROSS)gcc" \
115 AR="$(TARGET_CROSS)ar rcu" \
116 RANLIB="$(TARGET_CROSS)ranlib" \
118 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
119 MYLDFLAGS="$(TARGET_LDFLAGS)" \
120 PKG_VERSION=$(PKG_VERSION) \
122 rm -rf $(PKG_INSTALL_DIR)
123 mkdir -p $(PKG_INSTALL_DIR)
124 $(MAKE) -C $(PKG_BUILD_DIR) \
125 INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
129 define Build/InstallDev
130 mkdir -p $(1)/usr/include
131 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
132 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
133 $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
134 mkdir -p $(1)/usr/lib
135 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
136 ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
139 define Package/liblua/install
140 $(INSTALL_DIR) $(1)/usr/lib
141 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
144 define Package/lua/install
145 $(INSTALL_DIR) $(1)/usr/bin
146 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
149 define Package/luac/install
150 $(INSTALL_DIR) $(1)/usr/bin
151 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
154 define Package/lua-examples/install
155 $(INSTALL_DIR) $(1)/usr/share/lua/examples
156 $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
157 $(1)/usr/share/lua/examples/
160 $(eval $(call HostBuild))
161 $(eval $(call BuildPackage,liblua))
162 $(eval $(call BuildPackage,lua))
163 $(eval $(call BuildPackage,luac))
164 $(eval $(call BuildPackage,lua-examples))