fix more packages (#847)
[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_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
18 http://ftp.gwdg.de/pub/languages/lua/ \
19 http://mirrors.dotsrc.org/lua/ \
20 http://www.tecgraf.puc-rio.br/lua/ftp/
21 PKG_MD5SUM:= dea74646b7e5c621fef7174df83c34b1
22 PKG_CAT:=zcat
23
24 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/liblua
29 SECTION:=libs
30 CATEGORY:=Libraries
31 TITLE:=LUA programming language (libraries)
32 DESCRIPTION:=LUA programming language (libraries).\\\
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 \\\
37 This package contains the LUA shared libraries, needed by other programs.
38 URL:=http://www.lua.org/
39 endef
40
41 define Package/lua
42 SECTION:=utils
43 CATEGORY:=Utilities
44 DEPENDS:=+liblua
45 TITLE:=LUA programming language (interpreter)
46 DESCRIPTION:=LUA programming language (interpreter).\\\
47 Lua is a powerful light-weight programming language designed for extending \\\
48 applications. Lua is also frequently used as a general-purpose, stand-alone \\\
49 language. Lua is free software.\\\
50 \\\
51 This package contains the LUA language interpreter.
52 URL:=http://www.lua.org/
53 endef
54
55 define Package/lua-examples
56 SECTION:=utils
57 CATEGORY:=Utilities
58 DEPENDS:=lua
59 TITLE:=LUA programming language (examples)
60 DESCRIPTION:=LUA programming language (examples).\\\
61 Lua is a powerful light-weight programming language designed for extending \\\
62 applications. Lua is also frequently used as a general-purpose, stand-alone \\\
63 language. Lua is free software.\\\
64 \\\
65 This package contains LUA language examples.
66 URL:=http://www.lua.org/
67 endef
68
69 define Package/luac
70 SECTION:=utils
71 CATEGORY:=Utilities
72 DEPENDS:=+liblua
73 TITLE:=LUA programming language (compiler)
74 DESCRIPTION:=LUA programming language (compiler).\\\
75 Lua is a powerful light-weight programming language designed for extending \\\
76 applications. Lua is also frequently used as a general-purpose, stand-alone \\\
77 language. Lua is free software.\\\
78 \\\
79 This package contains the LUA language compiler.
80 URL:=http://www.lua.org/
81 endef
82
83 define Build/Configure
84 endef
85
86 define Build/Compile
87 $(MAKE) -C $(PKG_BUILD_DIR) \
88 CC="$(TARGET_CROSS)gcc" \
89 LD="$(TARGET_CROSS)ld" \
90 AR="$(TARGET_CROSS)ar rcu" \
91 RANLIB="$(TARGET_CROSS)ranlib" \
92 INSTALL_ROOT=/usr \
93 MYCFLAGS="-I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \
94 MYLDFLAGS="-L$(STAGING_DIR)/usr/lib" \
95 all so
96 # remove statically linked binaries, so that they will get linked against shlib this time
97 rm -f $(PKG_BUILD_DIR)/bin/lua{,c}
98 $(MAKE) -C $(PKG_BUILD_DIR) \
99 CC="$(TARGET_CROSS)gcc" \
100 LD="$(TARGET_CROSS)ld" \
101 AR="$(TARGET_CROSS)ar rcu" \
102 RANLIB="$(TARGET_CROSS)ranlib" \
103 INSTALL_ROOT=/usr \
104 MYCFLAGS="-I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \
105 MYLDFLAGS="-L$(STAGING_DIR)/usr/lib" \
106 all
107 rm -rf $(PKG_INSTALL_DIR)
108 mkdir -p $(PKG_INSTALL_DIR)
109 $(MAKE) -C $(PKG_BUILD_DIR) \
110 INSTALL_ROOT="$(PKG_INSTALL_DIR)/usr" \
111 install soinstall
112 endef
113
114 define Package/liblua/install
115 install -d -m0755 $(1)/usr/lib
116 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua{,lib}.so.* $(1)/usr/lib/
117 endef
118
119 define Package/lua/install
120 install -d -m0755 $(1)/usr/bin
121 $(CP) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
122 endef
123
124 define Package/luac/install
125 install -d -m0755 $(1)/usr/bin
126 $(CP) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
127 endef
128
129 define Package/lua-examples/install
130 install -d -m0755 $(1)/usr/share/lua/examples
131 install -m0644 $(PKG_BUILD_DIR)/test/*.lua \
132 $(1)/usr/share/lua/examples/
133 endef
134
135 define Build/InstallDev
136 mkdir -p $(STAGING_DIR)/usr/include
137 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib}.h $(STAGING_DIR)/usr/include/
138 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(STAGING_DIR)/usr/include/
139 mkdir -p $(STAGING_DIR)/usr/lib
140 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua{,lib}.{a,so*} $(STAGING_DIR)/usr/lib/
141 endef
142
143 define Build/UninstallDev
144 rm -rf \
145 $(STAGING_DIR)/usr/include/lua{,lib}.h \
146 $(STAGING_DIR)/usr/include/lauxlib.h \
147 $(STAGING_DIR)/usr/lib/liblua{,lib}.{a,so*}
148 endef
149
150 $(eval $(call BuildPackage,liblua))
151 $(eval $(call BuildPackage,lua))
152 $(eval $(call BuildPackage,lua-examples))
153 $(eval $(call BuildPackage,luac))