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