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.
9 include $(TOPDIR)/rules.mk
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
17 http://ftp.gwdg.de/pub/languages/lua/ \
18 http://mirrors.dotsrc.org/lua/ \
19 http://www.tecgraf.puc-rio.br/lua/ftp/
20 PKG_MD5SUM:=d0870f2de55d59c1c8419f36e8fac150
22 HOST_PATCH_DIR=./patches-host
23 PKG_BUILD_DEPENDS:=lua/host
25 include $(INCLUDE_DIR)/host-build.mk
26 include $(INCLUDE_DIR)/package.mk
28 define Package/lua/Default
32 TITLE:=LUA programming language
33 URL:=http://www.lua.org/
36 define Package/lua/Default/description
37 Lua is a powerful light-weight programming language designed for extending
38 applications. Lua is also frequently used as a general-purpose, stand-alone
39 language. Lua is free software.
43 $(call Package/lua/Default)
50 define Package/liblua/description
51 $(call Package/lua/Default/description)
52 This package contains the LUA shared libraries, needed by other programs.
56 $(call Package/lua/Default)
61 define Package/lua/description
62 $(call Package/lua/Default/description)
63 This package contains the LUA language interpreter.
67 $(call Package/lua/Default)
72 define Package/luac/description
73 $(call Package/lua/Default/description)
74 This package contains the LUA language compiler.
77 define Package/lua-examples
78 $(call Package/lua/Default)
83 define Package/lua-examples/description
84 $(call Package/lua/Default/description)
85 This package contains LUA language examples.
94 $(MAKE) -C $(HOST_BUILD_DIR)/src luac-host
98 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/luac-host $(STAGING_DIR_HOST)/bin/luac
103 TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC)
105 ifneq ($(CONFIG_USE_EGLIBC),)
106 ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
107 TARGET_CFLAGS += -DNO_GETLOGIN
111 Build/Configure=$(Host/Configure)
114 $(MAKE) -C $(PKG_BUILD_DIR) \
115 CC="$(TARGET_CROSS)gcc" \
116 AR="$(TARGET_CROSS)ar rcu" \
117 RANLIB="$(TARGET_CROSS)ranlib" \
119 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
120 MYLDFLAGS="$(TARGET_LDFLAGS)" \
121 PKG_VERSION=$(PKG_VERSION) \
123 rm -rf $(PKG_INSTALL_DIR)
124 mkdir -p $(PKG_INSTALL_DIR)
125 $(MAKE) -C $(PKG_BUILD_DIR) \
126 INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
130 define Build/InstallDev
131 mkdir -p $(1)/usr/include
132 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
133 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
134 $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
135 mkdir -p $(1)/usr/lib
136 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
137 ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
140 define Package/liblua/install
141 $(INSTALL_DIR) $(1)/usr/lib
142 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
145 define Package/lua/install
146 $(INSTALL_DIR) $(1)/usr/bin
147 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
150 define Package/luac/install
151 $(INSTALL_DIR) $(1)/usr/bin
152 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
155 define Package/lua-examples/install
156 $(INSTALL_DIR) $(1)/usr/share/lua/examples
157 $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
158 $(1)/usr/share/lua/examples/
161 $(eval $(call HostBuild))
162 $(eval $(call BuildPackage,liblua))
163 $(eval $(call BuildPackage,lua))
164 $(eval $(call BuildPackage,luac))
165 $(eval $(call BuildPackage,lua-examples))