kmod-sched-cake: bump to latest 20180706
[oweals/openwrt.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:=1
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 endef
50
51 define Package/liblua/description
52 $(call Package/lua/Default/description)
53  This package contains the Lua shared libraries, needed by other programs.
54 endef
55
56 define Package/lua
57 $(call Package/lua/Default)
58   DEPENDS:=+liblua
59   TITLE+= (interpreter)
60 endef
61
62 define Package/lua/description
63 $(call Package/lua/Default/description)
64  This package contains the Lua language interpreter.
65 endef
66
67 define Package/luac
68 $(call Package/lua/Default)
69   DEPENDS:=+liblua
70   TITLE+= (compiler)
71 endef
72
73 define Package/luac/description
74 $(call Package/lua/Default/description)
75  This package contains the Lua language compiler.
76 endef
77
78 define Package/lua-examples
79 $(call Package/lua/Default)
80   DEPENDS:=lua
81   TITLE+= (examples)
82 endef
83
84 define Package/lua-examples/description
85 $(call Package/lua/Default/description)
86  This package contains Lua language examples.
87 endef
88
89 define Build/Configure
90 endef
91
92 TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
93
94 define Build/Compile
95         $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
96                 CC="$(TARGET_CROSS)gcc" \
97                 AR="$(TARGET_CROSS)ar rcu" \
98                 RANLIB="$(TARGET_CROSS)ranlib" \
99                 INSTALL_ROOT=/usr \
100                 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
101                 MYLDFLAGS="$(TARGET_LDFLAGS)" \
102                 PKG_VERSION=$(PKG_VERSION) \
103                 linux
104         rm -rf $(PKG_INSTALL_DIR)
105         mkdir -p $(PKG_INSTALL_DIR)
106         $(MAKE) -C $(PKG_BUILD_DIR) \
107                 INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
108                 install
109 endef
110
111 define Host/Configure
112         $(SED) 's,"/usr/local/","$(STAGING_DIR_HOSTPKG)/",' $(HOST_BUILD_DIR)/src/luaconf.h
113 endef
114
115 ifeq ($(HOST_OS),Darwin)
116         LUA_OS:=macosx
117 else
118         ifeq ($(HOST_OS),FreeBSD)
119                 LUA_OS:=freebsd
120         else
121                 LUA_OS:=linux
122         endif
123 endif
124
125 define Host/Compile
126         $(MAKE) -C $(HOST_BUILD_DIR) \
127                 CC="$(HOSTCC) -std=gnu99" \
128                 $(LUA_OS)
129 endef
130
131 define Host/Install
132         $(MAKE) -C $(HOST_BUILD_DIR) \
133                 INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \
134                 install
135 endef
136
137 define Build/InstallDev
138         $(INSTALL_DIR) $(1)/usr/include
139         $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
140         $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
141         $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
142         $(INSTALL_DIR) $(1)/usr/lib
143         $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
144         $(LN) liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
145         $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
146         $(CP) $(PKG_BUILD_DIR)/etc/lua.pc $(1)/usr/lib/pkgconfig/
147 endef
148
149 define Package/liblua/install
150         $(INSTALL_DIR) $(1)/usr/lib
151         $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
152 endef
153
154 define Package/lua/install
155         $(INSTALL_DIR) $(1)/usr/bin
156         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
157 endef
158
159 define Package/luac/install
160         $(INSTALL_DIR) $(1)/usr/bin
161         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
162 endef
163
164 define Package/lua-examples/install
165         $(INSTALL_DIR) $(1)/usr/share/lua/examples
166         $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
167                 $(1)/usr/share/lua/examples/
168 endef
169
170 $(eval $(call BuildPackage,liblua))
171 $(eval $(call BuildPackage,lua))
172 $(eval $(call BuildPackage,luac))
173 $(eval $(call BuildPackage,lua-examples))
174 $(eval $(call HostBuild))
175