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