ath79: mikrotik: use vmlinuz (zBoot ELF)
[openwrt/staging/wigyori.git] / package / utils / lua / Makefile
1 #
2 # Copyright (C) 2006-2014 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:=7
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
16 http://www.tecgraf.puc-rio.br/lua/ftp/
17 PKG_HASH:=2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
18 PKG_BUILD_PARALLEL:=1
19
20 PKG_LICENSE:=MIT
21 PKG_LICENSE_FILES:=COPYRIGHT
22
23 HOST_PATCH_DIR := ./patches-host
24
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/host-build.mk
27
28 define Package/lua/Default
29 SUBMENU:=Lua
30 SECTION:=lang
31 CATEGORY:=Languages
32 TITLE:=Lua programming language
33 URL:=http://www.lua.org/
34 MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
35 endef
36
37 define Package/lua/Default/description
38 Lua is a powerful light-weight programming language designed for extending
39 applications. Lua is also frequently used as a general-purpose, stand-alone
40 language. Lua is free software.
41 endef
42
43 define Package/liblua
44 $(call Package/lua/Default)
45 SUBMENU:=
46 SECTION:=libs
47 CATEGORY:=Libraries
48 TITLE+= (libraries)
49 ABI_VERSION:=5.1.5
50 endef
51
52 define Package/liblua/description
53 $(call Package/lua/Default/description)
54 This package contains the Lua shared libraries, needed by other programs.
55 endef
56
57 define Package/lua
58 $(call Package/lua/Default)
59 DEPENDS:=+liblua
60 TITLE+= (interpreter)
61 endef
62
63 define Package/lua/description
64 $(call Package/lua/Default/description)
65 This package contains the Lua language interpreter.
66 endef
67
68 define Package/luac
69 $(call Package/lua/Default)
70 DEPENDS:=+liblua
71 TITLE+= (compiler)
72 endef
73
74 define Package/luac/description
75 $(call Package/lua/Default/description)
76 This package contains the Lua language compiler.
77 endef
78
79 define Package/lua-examples
80 $(call Package/lua/Default)
81 DEPENDS:=lua
82 TITLE+= (examples)
83 endef
84
85 define Package/lua-examples/description
86 $(call Package/lua/Default/description)
87 This package contains Lua language examples.
88 endef
89
90 define Build/Configure
91 endef
92
93 TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
94
95 define Build/Compile
96 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
97 CC="$(TARGET_CROSS)gcc" \
98 AR="$(TARGET_CROSS)ar rcu" \
99 RANLIB="$(TARGET_CROSS)ranlib" \
100 INSTALL_ROOT=/usr \
101 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
102 MYLDFLAGS="$(TARGET_LDFLAGS) $(if $(CONFIG_USE_GLIBC),-lm)" \
103 PKG_VERSION=$(PKG_VERSION) \
104 linux
105 rm -rf $(PKG_INSTALL_DIR)
106 mkdir -p $(PKG_INSTALL_DIR)
107 $(MAKE) -C $(PKG_BUILD_DIR) \
108 INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
109 install
110 endef
111
112 define Host/Configure
113 $(SED) 's,"/usr/local/","$(STAGING_DIR_HOSTPKG)/",' $(HOST_BUILD_DIR)/src/luaconf.h
114 endef
115
116 ifeq ($(HOST_OS),Darwin)
117 LUA_OS:=macosx
118 else
119 ifeq ($(HOST_OS),FreeBSD)
120 LUA_OS:=freebsd
121 else
122 LUA_OS:=linux
123 endif
124 endif
125
126 define Host/Compile
127 $(MAKE) -C $(HOST_BUILD_DIR) \
128 CC="$(HOSTCC) -std=gnu99" \
129 $(LUA_OS)
130 endef
131
132 define Host/Install
133 $(MAKE) -C $(HOST_BUILD_DIR) \
134 INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \
135 install
136
137 $(LN) $(STAGING_DIR_HOSTPKG)/bin/lua5.1 $(STAGING_DIR_HOSTPKG)/bin/lua
138 $(LN) $(STAGING_DIR_HOSTPKG)/bin/luac5.1 $(STAGING_DIR_HOSTPKG)/bin/luac
139 endef
140
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/lua.hpp $(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) 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/lua5.1 $(1)/usr/bin/
162 $(LN) lua5.1 $(1)/usr/bin/lua
163 endef
164
165 define Package/luac/install
166 $(INSTALL_DIR) $(1)/usr/bin
167 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac5.1 $(1)/usr/bin/
168 $(LN) luac5.1 $(1)/usr/bin/luac
169 endef
170
171 define Package/lua-examples/install
172 $(INSTALL_DIR) $(1)/usr/share/lua/examples
173 $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
174 $(1)/usr/share/lua/examples/
175 endef
176
177 $(eval $(call BuildPackage,liblua))
178 $(eval $(call BuildPackage,lua))
179 $(eval $(call BuildPackage,luac))
180 $(eval $(call BuildPackage,lua-examples))
181 $(eval $(call HostBuild))
182