move lua packages (except liblua) in a 'LUA' submenu
[openwrt/svn-archive/archive.git] / lang / 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.2
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:=687ce4c2a1ddff18f1008490fdc4e5e0
21 PKG_CAT:=zcat
22
23 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
24 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/lua/Default
29 SUBMENU:=LUA
30 SECTION:=lang
31 CATEGORY:=Languages
32 TITLE:=LUA programming language
33 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 URL:=http://www.lua.org/
38 endef
39
40 define Package/liblua
41 $(call Package/lua/Default)
42 SUBMENU:=
43 SECTION:=libs
44 CATEGORY:=Libraries
45 TITLE+= (libraries)
46 DESCRIPTION+=\\\
47 \\\
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 +libreadline +libncurses
54 TITLE+= (interpreter)
55 DESCRIPTION+=\\\
56 \\\
57 This package contains the LUA language interpreter.
58 endef
59
60 define Package/luac
61 $(call Package/lua/Default)
62 DEPENDS:=+liblua
63 TITLE+= (compiler)
64 DESCRIPTION+=\\\
65 \\\
66 This package contains the LUA language compiler.
67 endef
68
69 define Package/lua-examples
70 $(call Package/lua/Default)
71 DEPENDS:=lua
72 TITLE+= (examples)
73 DESCRIPTION+=\\\
74 \\\
75 This package contains LUA language examples.
76 endef
77
78 define Build/Configure
79 endef
80
81 define Build/Compile
82 $(MAKE) -C $(PKG_BUILD_DIR) \
83 CC="$(TARGET_CROSS)gcc" \
84 LD="$(TARGET_CROSS)ld" \
85 AR="$(TARGET_CROSS)ar rcu" \
86 RANLIB="$(TARGET_CROSS)ranlib" \
87 INSTALL_ROOT=/usr \
88 MYCFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
89 MYLDFLAGS="$(TARGET_LDFLAGS)" \
90 PKG_VERSION=$(PKG_VERSION) \
91 all linux
92 rm -rf $(PKG_INSTALL_DIR)
93 mkdir -p $(PKG_INSTALL_DIR)
94 $(MAKE) -C $(PKG_BUILD_DIR) \
95 INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
96 install
97 endef
98
99 define Build/InstallDev
100 mkdir -p $(STAGING_DIR)/usr/include
101 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(STAGING_DIR)/usr/include/
102 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(STAGING_DIR)/usr/include/
103 mkdir -p $(STAGING_DIR)/usr/lib
104 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so.*} $(STAGING_DIR)/usr/lib/
105 ln -sf liblua.so.$(PKG_VERSION) $(STAGING_DIR)/usr/lib/liblua.so
106 ln -sf liblua.so.$(PKG_VERSION) $(STAGING_DIR)/usr/lib/liblualib.so
107 endef
108
109 define Build/UninstallDev
110 rm -rf \
111 $(STAGING_DIR)/usr/include/lua{,lib,conf}.h \
112 $(STAGING_DIR)/usr/include/lauxlib.h \
113 $(STAGING_DIR)/usr/lib/liblua.{a,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 $(CP) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
124 endef
125
126 define Package/luac/install
127 $(INSTALL_DIR) $(1)/usr/bin
128 $(CP) $(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))