move lua from packages/ to trunk in anticipation of upcoming stuff ;)
[openwrt/openwrt.git] / package / lua / 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$
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 include $(INCLUDE_DIR)/package.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 endef
34
35 define Package/lua/Default/description
36 Lua is a powerful light-weight programming language designed for extending
37 applications. Lua is also frequently used as a general-purpose, stand-alone
38 language. Lua is free software.
39 endef
40
41 define Package/liblua
42 $(call Package/lua/Default)
43 SUBMENU:=
44 SECTION:=libs
45 CATEGORY:=Libraries
46 TITLE+= (libraries)
47 endef
48
49 define Package/liblua/description
50 $(call Package/lua/Default/description)
51 This package contains the LUA shared libraries, needed by other programs.
52 endef
53
54 define Package/lua
55 $(call Package/lua/Default)
56 DEPENDS:=+liblua +libreadline +libncurses
57 TITLE+= (interpreter)
58 endef
59
60 define Package/lua/description
61 $(call Package/lua/Default/description)
62 This package contains the LUA language interpreter.
63 endef
64
65 define Package/luac
66 $(call Package/lua/Default)
67 DEPENDS:=+liblua
68 TITLE+= (compiler)
69 endef
70
71 define Package/luac/description
72 $(call Package/lua/Default/description)
73 This package contains the LUA language compiler.
74 endef
75
76 define Package/lua-examples
77 $(call Package/lua/Default)
78 DEPENDS:=lua
79 TITLE+= (examples)
80 endef
81
82 define Package/lua-examples/description
83 $(call Package/lua/Default/description)
84 This package contains LUA language examples.
85 endef
86
87 define Build/Configure
88 endef
89
90 define Build/Compile
91 $(MAKE) -C $(PKG_BUILD_DIR) \
92 CC="$(TARGET_CROSS)gcc" \
93 LD="$(TARGET_CROSS)ld" \
94 AR="$(TARGET_CROSS)ar rcu" \
95 RANLIB="$(TARGET_CROSS)ranlib" \
96 INSTALL_ROOT=/usr \
97 MYCFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
98 MYLDFLAGS="$(TARGET_LDFLAGS)" \
99 PKG_VERSION=$(PKG_VERSION) \
100 all linux
101 rm -rf $(PKG_INSTALL_DIR)
102 mkdir -p $(PKG_INSTALL_DIR)
103 $(MAKE) -C $(PKG_BUILD_DIR) \
104 INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
105 install
106 endef
107
108 define Build/InstallDev
109 mkdir -p $(1)/usr/include
110 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
111 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
112 mkdir -p $(1)/usr/lib
113 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so.*} $(1)/usr/lib/
114 ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblua.so
115 ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
116 endef
117
118 define Package/liblua/install
119 $(INSTALL_DIR) $(1)/usr/lib
120 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
121 endef
122
123 define Package/lua/install
124 $(INSTALL_DIR) $(1)/usr/bin
125 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
126 endef
127
128 define Package/luac/install
129 $(INSTALL_DIR) $(1)/usr/bin
130 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
131 endef
132
133 define Package/lua-examples/install
134 $(INSTALL_DIR) $(1)/usr/share/lua/examples
135 $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
136 $(1)/usr/share/lua/examples/
137 endef
138
139 $(eval $(call BuildPackage,liblua))
140 $(eval $(call BuildPackage,lua))
141 $(eval $(call BuildPackage,luac))
142 $(eval $(call BuildPackage,lua-examples))