f5fca7b8f8a62e75ce0ba9951c116d721db17d92
[openwrt/svn-archive/archive.git] / package / lua / Makefile
1 #
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=lua
11 PKG_VERSION:=5.1.4
12 PKG_RELEASE:=4
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
16 http://ftp.gwdg.de/pub/languages/lua/ \
17 http://mirrors.dotsrc.org/lua/ \
18 http://www.tecgraf.puc-rio.br/lua/ftp/
19 PKG_MD5SUM:=d0870f2de55d59c1c8419f36e8fac150
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/lua/Default
24 SUBMENU:=Lua
25 SECTION:=lang
26 CATEGORY:=Languages
27 TITLE:=Lua programming language
28 URL:=http://www.lua.org/
29 endef
30
31 define Package/lua/Default/description
32 Lua is a powerful light-weight programming language designed for extending
33 applications. Lua is also frequently used as a general-purpose, stand-alone
34 language. Lua is free software.
35 endef
36
37 define Package/liblua
38 $(call Package/lua/Default)
39 SUBMENU:=
40 SECTION:=libs
41 CATEGORY:=Libraries
42 TITLE+= (libraries)
43 endef
44
45 define Package/liblua/description
46 $(call Package/lua/Default/description)
47 This package contains the Lua shared libraries, needed by other programs.
48 endef
49
50 define Package/lua
51 $(call Package/lua/Default)
52 DEPENDS:=+liblua
53 TITLE+= (interpreter)
54 endef
55
56 define Package/lua/description
57 $(call Package/lua/Default/description)
58 This package contains the Lua language interpreter.
59 endef
60
61 define Package/luac
62 $(call Package/lua/Default)
63 DEPENDS:=+liblua
64 TITLE+= (compiler)
65 endef
66
67 define Package/luac/description
68 $(call Package/lua/Default/description)
69 This package contains the Lua language compiler.
70 endef
71
72 define Package/lua-examples
73 $(call Package/lua/Default)
74 DEPENDS:=lua
75 TITLE+= (examples)
76 endef
77
78 define Package/lua-examples/description
79 $(call Package/lua/Default/description)
80 This package contains Lua language examples.
81 endef
82
83 define Build/Configure
84 endef
85
86 TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC)
87
88 ifneq ($(CONFIG_USE_EGLIBC),)
89 ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
90 TARGET_CFLAGS += -DNO_GETLOGIN
91 endif
92 endif
93
94 define Build/Compile
95 $(MAKE) -C $(PKG_BUILD_DIR) \
96 CC="$(TARGET_CROSS)gcc" \
97 AR="$(TARGET_CROSS)ar rcu" \
98 RANLIB="$(TARGET_CROSS)ranlib" \
99 INSTALL_ROOT=/usr \
100 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
101 MYLDFLAGS="$(TARGET_LDFLAGS)" \
102 PKG_VERSION=$(PKG_VERSION) \
103 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 endef
110
111 define Build/InstallDev
112 $(INSTALL_DIR) $(1)/usr/include
113 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
114 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
115 $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
116 $(INSTALL_DIR) $(1)/usr/lib
117 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
118 ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
119 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
120 $(CP) $(PKG_BUILD_DIR)/etc/lua.pc $(1)/usr/lib/pkgconfig/
121 endef
122
123 define Package/liblua/install
124 $(INSTALL_DIR) $(1)/usr/lib
125 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
126 endef
127
128 define Package/lua/install
129 $(INSTALL_DIR) $(1)/usr/bin
130 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
131 endef
132
133 define Package/luac/install
134 $(INSTALL_DIR) $(1)/usr/bin
135 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
136 endef
137
138 define Package/lua-examples/install
139 $(INSTALL_DIR) $(1)/usr/share/lua/examples
140 $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
141 $(1)/usr/share/lua/examples/
142 endef
143
144 $(eval $(call BuildPackage,liblua))
145 $(eval $(call BuildPackage,lua))
146 $(eval $(call BuildPackage,luac))
147 $(eval $(call BuildPackage,lua-examples))