Commit based upon d6442850bde61f0c3e7e2ae3247b4a856073c5e0
[librecmc/package-feed.git] / lang / node / Makefile
1 #
2 # Copyright (C) 2006-2016 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:=v4.4.5
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
16 PKG_MD5SUM:=376140907bbe362f36065a30af04f020
17
18 HOST_BUILD_DEPENDS:=python/host
19 PKG_BUILD_DEPENDS:=python/host
20 PKG_INSTALL:=1
21 PKG_USE_MIPS16:=0
22
23 HOST_BUILD_PARALLEL:=1
24 PKG_BUILD_PARALLEL:=1
25
26 PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
27 PKG_LICENSE:=
28
29 include $(INCLUDE_DIR)/host-build.mk
30 include $(INCLUDE_DIR)/package.mk
31
32 define Package/node
33   SECTION:=lang
34   CATEGORY:=Languages
35   SUBMENU:=Node.js
36   TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
37   URL:=http://nodejs.org/
38   DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +zlib
39 endef
40
41 define Package/node/description
42   Node.jsĀ® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
43   an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js'
44    package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
45 endef
46
47 CPU:=$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))
48
49 MAKE_VARS += \
50         DESTCPU=$(CPU)
51
52 CONFIGURE_ARGS= \
53         --dest-cpu=$(CPU) \
54         --dest-os=linux \
55         --without-snapshot \
56         --shared-zlib \
57         --shared-openssl \
58         --prefix=/usr
59
60 ifneq ($(findstring arm,$(ARCH)),)
61 CONFIGURE_ARGS+= \
62         $(if $(CONFIG_SOFT_FLOAT),--with-arm-float-abi=soft,--with-arm-float-abi=hard)
63 endif
64
65 ifneq ($(findstring mips,$(ARCH)),)
66 CONFIGURE_ARGS+= \
67         $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft,--with-mips-float-abi=hard)
68 endif
69
70 HOST_CONFIGURE_VARS:=
71
72 HOST_CONFIGURE_ARGS:= \
73         --dest-os=linux \
74         --without-snapshot \
75         --prefix=$(STAGING_DIR_HOSTPKG)
76
77 HOST_CONFIGURE_CMD:=python ./configure
78
79 define Build/InstallDev
80         $(INSTALL_DIR) $(1)/usr/include
81         $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
82 endef
83
84 define Package/node/install
85         mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
86         $(CP) $(PKG_INSTALL_DIR)/usr/bin/{node,npm} $(1)/usr/bin/
87         $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm
88         $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
89         $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
90         $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
91 endef
92
93 $(eval $(call HostBuild))
94 $(eval $(call BuildPackage,node))