Add lua package
[openwrt.git] / package / lua / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=lua
6 PKG_VERSION:=5.0.2
7 PKG_RELEASE:=1
8 PKG_MD5SUM:= dea74646b7e5c621fef7174df83c34b1
9
10 PKG_SOURCE_URL:=http://www.lua.org/ftp/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_CAT:=zcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
16
17 include $(TOPDIR)/package/rules.mk
18
19 $(eval $(call PKG_template,LIBLUA,liblua,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
20 $(eval $(call PKG_template,LUA_INTERPRETER,lua,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
21 $(eval $(call PKG_template,LUA_COMPILER,luac,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
22 $(eval $(call PKG_template,LUA_EXAMPLES,lua-examples,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
23
24 $(PKG_BUILD_DIR)/.configured:
25 touch $@
26
27 $(PKG_BUILD_DIR)/.built:
28 $(MAKE) -C $(PKG_BUILD_DIR) \
29 CC="$(TARGET_CROSS)gcc" \
30 LD="$(TARGET_CROSS)ld" \
31 AR="$(TARGET_CROSS)ar rcu" \
32 RANLIB="$(TARGET_CROSS)ranlib" \
33 INSTALL_ROOT=/usr \
34 MYCFLAGS="-I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \
35 MYLDFLAGS="-L$(STAGING_DIR)/usr/lib" \
36 all so
37 # remove statically linked binaries, so that they will get linked against shlib this time
38 rm -f $(PKG_BUILD_DIR)/bin/lua{,c}
39 $(MAKE) -C $(PKG_BUILD_DIR) \
40 CC="$(TARGET_CROSS)gcc" \
41 LD="$(TARGET_CROSS)ld" \
42 AR="$(TARGET_CROSS)ar rcu" \
43 RANLIB="$(TARGET_CROSS)ranlib" \
44 INSTALL_ROOT=/usr \
45 MYCFLAGS="-I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \
46 MYLDFLAGS="-L$(STAGING_DIR)/usr/lib" \
47 all
48 rm -rf $(PKG_INSTALL_DIR)
49 mkdir -p $(PKG_INSTALL_DIR)
50 $(MAKE) -C $(PKG_BUILD_DIR) \
51 INSTALL_ROOT="$(PKG_INSTALL_DIR)/usr" \
52 install soinstall
53 touch $@
54
55 $(IPKG_LIBLUA):
56 install -d -m0755 $(IDIR_LIBLUA)/usr/lib
57 cp -fp $(PKG_INSTALL_DIR)/usr/lib/liblua{,lib}.so.* $(IDIR_LIBLUA)/usr/lib/
58 $(RSTRIP) $(IDIR_LIBLUA)
59 $(IPKG_BUILD) $(IDIR_LIBLUA) $(PACKAGE_DIR)
60
61 $(IPKG_LUA_INTERPRETER):
62 install -d -m0755 $(IDIR_LUA_INTERPRETER)/usr/bin
63 cp -fp $(PKG_INSTALL_DIR)/usr/bin/lua $(IDIR_LUA_INTERPRETER)/usr/bin/
64 $(RSTRIP) $(IDIR_LUA_INTERPRETER)
65 $(IPKG_BUILD) $(IDIR_LUA_INTERPRETER) $(PACKAGE_DIR)
66
67 $(IPKG_LUA_COMPILER):
68 install -d -m0755 $(IDIR_LUA_COMPILER)/usr/bin
69 cp -fp $(PKG_INSTALL_DIR)/usr/bin/luac $(IDIR_LUA_COMPILER)/usr/bin/
70 $(RSTRIP) $(IDIR_LUA_COMPILER)
71 $(IPKG_BUILD) $(IDIR_LUA_COMPILER) $(PACKAGE_DIR)
72
73 $(IPKG_LUA_EXAMPLES):
74 install -d -m0755 $(IDIR_LUA_EXAMPLES)/usr/share/lua/examples
75 install -m0644 $(PKG_BUILD_DIR)/test/*.lua \
76 $(IDIR_LUA_EXAMPLES)/usr/share/lua/examples/
77 $(RSTRIP) $(IDIR_LUA_EXAMPLES)
78 $(IPKG_BUILD) $(IDIR_LUA_EXAMPLES) $(PACKAGE_DIR)
79
80 $(STAGING_DIR)/usr/lib/liblua.so: $(PKG_BUILD_DIR)/.built
81 mkdir -p $(STAGING_DIR)/usr/include
82 cp -fp $(PKG_INSTALL_DIR)/usr/include/lua{,lib}.h $(STAGING_DIR)/usr/include/
83 cp -fp $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(STAGING_DIR)/usr/include/
84 mkdir -p $(STAGING_DIR)/usr/lib
85 cp -fp $(PKG_INSTALL_DIR)/usr/lib/liblua{,lib}.{a,so*} $(STAGING_DIR)/usr/lib/
86 touch $@
87
88 install-dev: $(STAGING_DIR)/usr/lib/liblua.so
89
90 uninstall-dev:
91 rm -rf \
92 $(STAGING_DIR)/usr/include/lua{,lib}.h \
93 $(STAGING_DIR)/usr/include/lauxlib.h \
94 $(STAGING_DIR)/usr/lib/liblua{,lib}.{a,so*} \
95
96 compile: install-dev
97 clean: uninstall-dev
This page took 0.042573 seconds and 5 git commands to generate.