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