Root/package/lua/Makefile

1#
2# Copyright (C) 2006-2011 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=lua
11PKG_VERSION:=5.1.4
12PKG_RELEASE:=8
13
14PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15PKG_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/
19PKG_MD5SUM:=d0870f2de55d59c1c8419f36e8fac150
20
21HOST_PATCH_DIR := ./patches-host
22
23include $(INCLUDE_DIR)/package.mk
24include $(INCLUDE_DIR)/host-build.mk
25
26define Package/lua/Default
27  SUBMENU:=Lua
28  SECTION:=lang
29  CATEGORY:=Languages
30  TITLE:=Lua programming language
31  URL:=http://www.lua.org/
32endef
33
34define Package/lua/Default/description
35 Lua is a powerful light-weight programming language designed for extending
36 applications. Lua is also frequently used as a general-purpose, stand-alone
37 language. Lua is free software.
38endef
39
40define Package/liblua
41$(call Package/lua/Default)
42  SUBMENU:=
43  SECTION:=libs
44  CATEGORY:=Libraries
45  TITLE+= (libraries)
46endef
47
48define Package/liblua/description
49$(call Package/lua/Default/description)
50 This package contains the Lua shared libraries, needed by other programs.
51endef
52
53define Package/lua
54$(call Package/lua/Default)
55  DEPENDS:=+liblua
56  TITLE+= (interpreter)
57endef
58
59define Package/lua/description
60$(call Package/lua/Default/description)
61 This package contains the Lua language interpreter.
62endef
63
64define Package/luac
65$(call Package/lua/Default)
66  DEPENDS:=+liblua
67  TITLE+= (compiler)
68endef
69
70define Package/luac/description
71$(call Package/lua/Default/description)
72 This package contains the Lua language compiler.
73endef
74
75define Package/lua-examples
76$(call Package/lua/Default)
77  DEPENDS:=lua
78  TITLE+= (examples)
79endef
80
81define Package/lua-examples/description
82$(call Package/lua/Default/description)
83 This package contains Lua language examples.
84endef
85
86define Build/Configure
87endef
88
89TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
90
91ifneq ($(CONFIG_USE_EGLIBC),)
92  ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
93    TARGET_CFLAGS += -DNO_GETLOGIN
94  endif
95endif
96
97define Build/Compile
98    $(MAKE) -C $(PKG_BUILD_DIR) \
99        CC="$(TARGET_CROSS)gcc" \
100        AR="$(TARGET_CROSS)ar rcu" \
101        RANLIB="$(TARGET_CROSS)ranlib" \
102        INSTALL_ROOT=/usr \
103        CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
104        MYLDFLAGS="$(TARGET_LDFLAGS)" \
105        PKG_VERSION=$(PKG_VERSION) \
106        linux
107    rm -rf $(PKG_INSTALL_DIR)
108    mkdir -p $(PKG_INSTALL_DIR)
109    $(MAKE) -C $(PKG_BUILD_DIR) \
110        INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
111        install
112endef
113
114define Host/Configure
115    $(SED) 's,"/usr/local/","$(STAGING_DIR_HOST)/",' $(HOST_BUILD_DIR)/src/luaconf.h
116endef
117
118ifeq ($(HOST_OS),Darwin)
119    LUA_OS:=macosx
120else
121    ifeq ($(HOST_OS),FreeBSD)
122        LUA_OS:=freebsd
123    else
124        LUA_OS:=linux
125    endif
126endif
127
128define Host/Compile
129    $(MAKE) -C $(HOST_BUILD_DIR) \
130        CC="$(HOSTCC) -std=gnu99" \
131        $(LUA_OS)
132endef
133
134define Host/Install
135    $(MAKE) -C $(HOST_BUILD_DIR) \
136        INSTALL_TOP="$(STAGING_DIR_HOST)" \
137        install
138endef
139
140define Build/InstallDev
141    $(INSTALL_DIR) $(1)/usr/include
142    $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
143    $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
144    $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
145    $(INSTALL_DIR) $(1)/usr/lib
146    $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
147    ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
148    $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
149    $(CP) $(PKG_BUILD_DIR)/etc/lua.pc $(1)/usr/lib/pkgconfig/
150endef
151
152define Package/liblua/install
153    $(INSTALL_DIR) $(1)/usr/lib
154    $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
155endef
156
157define Package/lua/install
158    $(INSTALL_DIR) $(1)/usr/bin
159    $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
160endef
161
162define Package/luac/install
163    $(INSTALL_DIR) $(1)/usr/bin
164    $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
165endef
166
167define Package/lua-examples/install
168    $(INSTALL_DIR) $(1)/usr/share/lua/examples
169    $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
170        $(1)/usr/share/lua/examples/
171endef
172
173$(eval $(call BuildPackage,liblua))
174$(eval $(call BuildPackage,lua))
175$(eval $(call BuildPackage,luac))
176$(eval $(call BuildPackage,lua-examples))
177$(eval $(call HostBuild))
178
179

Archive Download this file



interactive