151c1f0e46f47979c2bcba8ea9376f806cd790c2
[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.0.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:= dea74646b7e5c621fef7174df83c34b1
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 SECTION:=lang
30 CATEGORY:=Languages
31 TITLE:=LUA programming language
32 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 URL:=http://www.lua.org/
37 endef
38
39 define Package/liblua
40 $(call Package/lua/Default)
41 SECTION:=libs
42 CATEGORY:=Libraries
43 TITLE+= (libraries)
44 DESCRIPTION+=\\\
45 \\\
46 This package contains the LUA shared libraries, needed by other programs.
47 endef
48
49 define Package/lua
50 $(call Package/lua/Default)
51 DEPENDS:=+liblua
52 TITLE+= (interpreter)
53 DESCRIPTION+=\\\
54 \\\
55 This package contains the LUA language interpreter.
56 endef
57
58 define Package/luac
59 $(call Package/lua/Default)
60 DEPENDS:=+liblua
61 TITLE+= (compiler)
62 DESCRIPTION+=\\\
63 \\\
64 This package contains the LUA language compiler.
65 endef
66
67 define Package/lua-examples
68 $(call Package/lua/Default)
69 DEPENDS:=lua
70 TITLE+= (examples)
71 DESCRIPTION+=\\\
72 \\\
73 This package contains LUA language examples.
74 endef
75
76 define Build/Configure
77 endef
78
79 define Build/Compile
80 $(MAKE) -C $(PKG_BUILD_DIR) \
81 CC="$(TARGET_CROSS)gcc" \
82 LD="$(TARGET_CROSS)ld" \
83 AR="$(TARGET_CROSS)ar rcu" \
84 RANLIB="$(TARGET_CROSS)ranlib" \
85 INSTALL_ROOT=/usr \
86 MYCFLAGS="-I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \
87 MYLDFLAGS="-L$(STAGING_DIR)/usr/lib" \
88 all so
89 # remove statically linked binaries, so that they will get linked against shlib this time
90 rm -f $(PKG_BUILD_DIR)/bin/lua{,c}
91 $(MAKE) -C $(PKG_BUILD_DIR) \
92 CC="$(TARGET_CROSS)gcc" \
93 LD="$(TARGET_CROSS)ld" \
94 AR="$(TARGET_CROSS)ar rcu" \
95 RANLIB="$(TARGET_CROSS)ranlib" \
96 INSTALL_ROOT=/usr \
97 MYCFLAGS="-I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \
98 MYLDFLAGS="-L$(STAGING_DIR)/usr/lib" \
99 all
100 rm -rf $(PKG_INSTALL_DIR)
101 mkdir -p $(PKG_INSTALL_DIR)
102 $(MAKE) -C $(PKG_BUILD_DIR) \
103 INSTALL_ROOT="$(PKG_INSTALL_DIR)/usr" \
104 install soinstall
105 endef
106
107 define Build/InstallDev
108 mkdir -p $(STAGING_DIR)/usr/include
109 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib}.h $(STAGING_DIR)/usr/include/
110 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(STAGING_DIR)/usr/include/
111 mkdir -p $(STAGING_DIR)/usr/lib
112 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua{,lib}.{a,so*} $(STAGING_DIR)/usr/lib/
113 endef
114
115 define Build/UninstallDev
116 rm -rf \
117 $(STAGING_DIR)/usr/include/lua{,lib}.h \
118 $(STAGING_DIR)/usr/include/lauxlib.h \
119 $(STAGING_DIR)/usr/lib/liblua{,lib}.{a,so*}
120 endef
121
122 define Package/liblua/install
123 $(INSTALL_DIR) $(1)/usr/lib
124 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua{,lib}.so.* $(1)/usr/lib/
125 endef
126
127 define Package/lua/install
128 $(INSTALL_DIR) $(1)/usr/bin
129 $(CP) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
130 endef
131
132 define Package/luac/install
133 $(INSTALL_DIR) $(1)/usr/bin
134 $(CP) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
135 endef
136
137 define Package/lua-examples/install
138 $(INSTALL_DIR) $(1)/usr/share/lua/examples
139 $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
140 $(1)/usr/share/lua/examples/
141 endef
142
143 $(eval $(call BuildPackage,liblua))
144 $(eval $(call BuildPackage,lua))
145 $(eval $(call BuildPackage,luac))
146 $(eval $(call BuildPackage,lua-examples))