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