* Added own custom version of Lua
[project/luci.git] / contrib / package / lua-luci / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id: Makefile 10499 2008-02-19 23:40:28Z nico $
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=lua
12 PKG_VERSION:=5.1.3
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
17         http://ftp.gwdg.de/pub/languages/lua/ \
18         http://mirrors.dotsrc.org/lua/ \
19         http://www.tecgraf.puc-rio.br/lua/ftp/
20 PKG_MD5SUM:=a70a8dfaa150e047866dc01a46272599
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 X_HOST_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-luci
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/lua-luci/Default
30   SUBMENU:=LUA
31   SECTION:=lang
32   CATEGORY:=Languages
33   TITLE:=LUA programming language
34   URL:=http://www.lua.org/
35 endef
36
37 define Package/lua-luci/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-luci
44 $(call Package/lua-luci/Default)
45   SUBMENU:=
46   SECTION:=libs
47   CATEGORY:=Libraries
48   TITLE+= (libraries)
49 endef
50
51 define Package/liblua-luci/description
52 $(call Package/lua-luci/Default/description)
53  This package contains the LUA shared libraries, needed by other programs.
54 endef
55
56 define Package/lua-luci
57 $(call Package/lua-luci/Default)
58   DEPENDS:=+liblua-luci +libreadline +libncurses
59   TITLE+= (interpreter)
60 endef
61
62 define Package/lua-luci/description
63 $(call Package/lua-luci/Default/description)
64  This package contains the LUA language interpreter.
65 endef
66
67 define Package/luac-luci
68 $(call Package/lua-luci/Default)
69   DEPENDS:=+liblua-luci
70   TITLE+= (compiler)
71 endef
72
73 define Package/luac/description
74 $(call Package/lua-luci/Default/description)
75  This package contains the LUA language compiler.
76 endef
77
78 define Package/lua-luci-examples
79 $(call Package/lua-luci/Default)
80   DEPENDS:=lua-luci
81   TITLE+= (examples)
82 endef
83
84 define Package/lua-luci-examples/description
85 $(call Package/lua-luci/Default/description)
86  This package contains LUA language examples.
87 endef
88
89 define Build/Configure
90 endef
91
92 define Build/Compile
93         cp $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/src-host -R
94         $(MAKE) -C $(PKG_BUILD_DIR) \
95                 CC="$(TARGET_CROSS)gcc" \
96                 LD="$(TARGET_CROSS)ld" \
97                 AR="$(TARGET_CROSS)ar rcu" \
98                 RANLIB="$(TARGET_CROSS)ranlib" \
99                 INSTALL_ROOT=/usr \
100                 MYCFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
101                 MYLDFLAGS="$(TARGET_LDFLAGS)" \
102                 PKG_VERSION=$(PKG_VERSION) \
103                 all 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         $(MAKE) -C $(PKG_BUILD_DIR)/src-host luac-host
110         mkdir -p $(X_HOST_DIR)
111         cp $(PKG_BUILD_DIR)/src-host/luac-host $(X_HOST_DIR)/luac
112 endef
113
114 define Build/InstallDev
115         mkdir -p $(1)/usr/include
116         $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
117         $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
118         $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
119         mkdir -p $(1)/usr/lib
120         $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so.*} $(1)/usr/lib/
121         ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblua.so
122         ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
123 endef
124
125 define Package/liblua-luci/install
126         $(INSTALL_DIR) $(1)/usr/lib
127         $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
128 endef
129
130 define Package/lua-luci/install
131         $(INSTALL_DIR) $(1)/usr/bin
132         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
133 endef
134
135 define Package/luac-luci/install
136         $(INSTALL_DIR) $(1)/usr/bin
137         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
138 endef
139
140 define Package/lua-luci-examples/install
141         $(INSTALL_DIR) $(1)/usr/share/lua/examples
142         $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
143                 $(1)/usr/share/lua/examples/
144 endef
145
146 $(eval $(call BuildPackage,liblua-luci))
147 $(eval $(call BuildPackage,lua-luci))
148 $(eval $(call BuildPackage,luac-luci))
149 $(eval $(call BuildPackage,lua-luci-examples))