x86_64 also needs -fPIC to create lua shared libraries
[openwrt/svn-archive/archive.git] / package / 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.3
13 PKG_RELEASE:=2
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:=a70a8dfaa150e047866dc01a46272599
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 include $(INCLUDE_DIR)/package.mk
26
27 ifeq ($(ARCH),powerpc)
28 FPIC:=-fPIC
29 endif
30 ifeq ($(ARCH),x86_64)
31 FPIC:=-fPIC
32 endif
33
34
35 define Package/lua/Default
36 SUBMENU:=LUA
37 SECTION:=lang
38 CATEGORY:=Languages
39 TITLE:=LUA programming language
40 URL:=http://www.lua.org/
41 endef
42
43 define Package/lua/Default/description
44 Lua is a powerful light-weight programming language designed for extending
45 applications. Lua is also frequently used as a general-purpose, stand-alone
46 language. Lua is free software.
47 endef
48
49 define Package/liblua
50 $(call Package/lua/Default)
51 SUBMENU:=
52 SECTION:=libs
53 CATEGORY:=Libraries
54 TITLE+= (libraries)
55 endef
56
57 define Package/liblua/description
58 $(call Package/lua/Default/description)
59 This package contains the LUA shared libraries, needed by other programs.
60 endef
61
62 define Package/lua
63 $(call Package/lua/Default)
64 DEPENDS:=+liblua
65 TITLE+= (interpreter)
66 endef
67
68 define Package/lua/description
69 $(call Package/lua/Default/description)
70 This package contains the LUA language interpreter.
71 endef
72
73 define Package/luac
74 $(call Package/lua/Default)
75 DEPENDS:=+liblua
76 TITLE+= (compiler)
77 endef
78
79 define Package/luac/description
80 $(call Package/lua/Default/description)
81 This package contains the LUA language compiler.
82 endef
83
84 define Package/lua-examples
85 $(call Package/lua/Default)
86 DEPENDS:=lua
87 TITLE+= (examples)
88 endef
89
90 define Package/lua-examples/description
91 $(call Package/lua/Default/description)
92 This package contains LUA language examples.
93 endef
94
95 define Build/Configure
96 endef
97
98 TARGET_CFLAGS += -DLUA_USE_LINUX
99
100 define Build/Compile
101 $(MAKE) -C $(PKG_BUILD_DIR) \
102 CC="$(TARGET_CROSS)gcc" \
103 LD="$(TARGET_CROSS)ld" \
104 AR="$(TARGET_CROSS)ar rcu" \
105 RANLIB="$(TARGET_CROSS)ranlib" \
106 INSTALL_ROOT=/usr \
107 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(FPIC)" \
108 MYLDFLAGS="$(TARGET_LDFLAGS)" \
109 PKG_VERSION=$(PKG_VERSION) \
110 all linux
111 rm -rf $(PKG_INSTALL_DIR)
112 mkdir -p $(PKG_INSTALL_DIR)
113 $(MAKE) -C $(PKG_BUILD_DIR) \
114 INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
115 install
116 endef
117
118 define Build/InstallDev
119 mkdir -p $(1)/usr/include
120 $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
121 $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
122 $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
123 mkdir -p $(1)/usr/lib
124 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.* $(1)/usr/lib/
125 ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
126 endef
127
128 define Package/liblua/install
129 $(INSTALL_DIR) $(1)/usr/lib
130 $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so* $(1)/usr/lib/
131 endef
132
133 define Package/lua/install
134 $(INSTALL_DIR) $(1)/usr/bin
135 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
136 endef
137
138 define Package/luac/install
139 $(INSTALL_DIR) $(1)/usr/bin
140 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
141 endef
142
143 define Package/lua-examples/install
144 $(INSTALL_DIR) $(1)/usr/share/lua/examples
145 $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
146 $(1)/usr/share/lua/examples/
147 endef
148
149 $(eval $(call BuildPackage,liblua))
150 $(eval $(call BuildPackage,lua))
151 $(eval $(call BuildPackage,luac))
152 $(eval $(call BuildPackage,lua-examples))