node: fix build on x86 & x86.64 targets
[feed/packages.git] / lang / node / Makefile
1 #
2 # Copyright (C) 2006-2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=node
11 PKG_VERSION:=v0.12.7
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=node-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
16
17 HOST_BUILD_DEPENDS:=python/host
18 PKG_BUILD_DEPENDS:=python/host
19 PKG_INSTALL:=1
20 PKG_USE_MIPS16:=0
21
22 PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
23 PKG_LICENSE:=
24
25 include $(INCLUDE_DIR)/host-build.mk
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/node
29 SECTION:=lang
30 CATEGORY:=Languages
31 SUBMENU:=Node.js
32 TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
33 URL:=http://nodejs.org/
34 DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +libuv
35 endef
36
37 define Package/node/description
38 Node.jsĀ® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
39 an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js'
40 package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
41 endef
42
43 CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))
44
45 MAKE_VARS += \
46 DESTCPU=$(CPU)
47
48 CONFIGURE_ARGS= \
49 --dest-cpu=$(CPU) \
50 --dest-os=linux \
51 --without-snapshot \
52 --shared-zlib \
53 --shared-openssl \
54 --prefix=/usr
55
56 HOST_CONFIGURE_VARS:=
57 HOST_CONFIGURE_ARGS:= \
58 --dest-os=linux \
59 --without-snapshot \
60 --prefix=$(STAGING_DIR_HOST)/
61
62 HOST_CONFIGURE_CMD:=python ./configure
63
64 define Build/InstallDev
65 $(INSTALL_DIR) $(1)/usr/include
66 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
67 endef
68
69 define Package/node/install
70 mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
71 $(CP) $(PKG_INSTALL_DIR)/usr/bin/{node,npm} $(1)/usr/bin/
72 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm
73 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
74 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
75 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
76 endef
77
78 $(eval $(call HostBuild))
79 $(eval $(call BuildPackage,node))