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