2 # Copyright (C) 2006-2011 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
23 include $(INCLUDE_DIR)/package.mk
24 include $(INCLUDE_DIR)/host-build.mk
26 define Package/lua/Default
30 TITLE:=Lua programming language
31 URL:=http://www.lua.org/
32 MAINTAINER:=Jo-Philipp Wich <jow@openwrt.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.
87 define Build/Configure
90 TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
92 ifneq ($(CONFIG_USE_EGLIBC),)
93 ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
94 TARGET_CFLAGS += -DNO_GETLOGIN
99 $(MAKE) -C $(PKG_BUILD_DIR) \
100 CC="$(TARGET_CROSS)gcc" \
101 AR="$(TARGET_CROSS)ar rcu" \
102 RANLIB="$(TARGET_CROSS)ranlib" \
104 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
105 MYLDFLAGS="$(TARGET_LDFLAGS)" \
106 PKG_VERSION=$(PKG_VERSION) \
108 rm -rf $(PKG_INSTALL_DIR)
109 mkdir -p $(PKG_INSTALL_DIR)
110 $(MAKE) -C $(PKG_BUILD_DIR) \
111 INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
115 define Host/Configure
116 $(SED) 's,"/usr/local/","$(STAGING_DIR_HOST)/",' $(HOST_BUILD_DIR)/src/luaconf.h
119 ifeq ($(HOST_OS),Darwin)
122 ifeq ($(HOST_OS),FreeBSD)
130 $(MAKE) -C $(HOST_BUILD_DIR) \
131 CC="$(HOSTCC) -std=gnu99" \
136 $(MAKE) -C $(HOST_BUILD_DIR) \
137 INSTALL_TOP="$(STAGING_DIR_HOST)" \
141 define Build/InstallDev
142 $(INSTALL_DIR) $(1)/usr/include
143 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
144 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
145 $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
146 $(INSTALL_DIR) $(1)/usr/lib
147 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
148 ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
149 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
150 $(CP) $(PKG_BUILD_DIR)/etc/lua.pc $(1)/usr/lib/pkgconfig/
153 define Package/liblua/install
154 $(INSTALL_DIR) $(1)/usr/lib
155 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
158 define Package/lua/install
159 $(INSTALL_DIR) $(1)/usr/bin
160 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
163 define Package/luac/install
164 $(INSTALL_DIR) $(1)/usr/bin
165 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
168 define Package/lua-examples/install
169 $(INSTALL_DIR) $(1)/usr/share/lua/examples
170 $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
171 $(1)/usr/share/lua/examples/
174 $(eval $(call BuildPackage,liblua))
175 $(eval $(call BuildPackage,lua))
176 $(eval $(call BuildPackage,luac))
177 $(eval $(call BuildPackage,lua-examples))
178 $(eval $(call HostBuild))