You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.9 KiB

  1. #
  2. # Copyright (C) 2006-2017 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=node
  9. PKG_VERSION:=v8.16.0
  10. PKG_RELEASE:=3
  11. PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=https://nodejs.org/dist/${PKG_VERSION}
  13. PKG_HASH:=3515e8e01568a5dc4dff3d91a76ebc6724f5fa2fbb58b4b0c5da7b178a2f7340
  14. HOST_BUILD_DEPENDS:=python/host
  15. PKG_BUILD_DEPENDS:=python/host
  16. PKG_INSTALL:=1
  17. PKG_USE_MIPS16:=0
  18. HOST_BUILD_PARALLEL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>, Adrian Panella <ianchi74@outlook.com>
  21. PKG_LICENSE:=MIT
  22. PKG_LICENSE_FILES:=LICENSE
  23. PKG_CPE_ID:=cpe:/a:nodejs:node.js
  24. include $(INCLUDE_DIR)/host-build.mk
  25. include $(INCLUDE_DIR)/package.mk
  26. define Package/node
  27. SECTION:=lang
  28. CATEGORY:=Languages
  29. SUBMENU:=Node.js
  30. TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
  31. URL:=https://nodejs.org/
  32. DEPENDS:=@(HAS_FPU||KERNEL_MIPS_FPU_EMULATOR) @!arc @!armeb \
  33. +libstdcpp +libopenssl +zlib +libnghttp2 +libuv +libhttp-parser \
  34. +NODEJS_ICU:icu
  35. endef
  36. define Package/node/description
  37. Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
  38. an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js'
  39. package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
  40. endef
  41. define Package/node-npm
  42. SECTION:=lang
  43. CATEGORY:=Languages
  44. SUBMENU:=Node.js
  45. TITLE:=NPM stands for Node Package Manager
  46. URL:=https://npmjs.com/
  47. DEPENDS:=+node
  48. endef
  49. define Package/node-npm/description
  50. NPM is the package manager for NodeJS
  51. endef
  52. define Package/node/config
  53. if PACKAGE_node
  54. config NODEJS_ICU
  55. bool "enable i18n features"
  56. default n
  57. endif
  58. endef
  59. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  60. MAKE_VARS+= \
  61. DESTCPU=$(NODEJS_CPU)
  62. CONFIGURE_VARS:= \
  63. CC="$(TARGET_CC) $(TARGET_OPTIMIZATION)" \
  64. CXX="$(TARGET_CXX) $(TARGET_OPTIMIZATION)" \
  65. CC_host="$(HOSTCC)" \
  66. CXX_host="$(HOSTCXX)"
  67. CONFIGURE_ARGS:= \
  68. --dest-cpu=$(NODEJS_CPU) \
  69. --dest-os=linux \
  70. --without-snapshot \
  71. --shared-zlib \
  72. --shared-openssl \
  73. --shared-nghttp2 \
  74. --shared-libuv \
  75. --shared-http-parser \
  76. --with-intl=$(if $(CONFIG_NODEJS_ICU),system-icu,none) \
  77. $(if $(findstring mips,$(NODEJS_CPU)), \
  78. $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \
  79. $(if $(findstring +neon,$(CONFIG_CPU_TYPE)),--with-arm-fpu=neon) \
  80. $(if $(findstring +vfp",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfp) \
  81. $(if $(findstring +vfpv3",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3-d16) \
  82. $(if $(findstring +vfpv4",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3) \
  83. --prefix=/usr
  84. HOST_CONFIGURE_VARS:=
  85. HOST_CONFIGURE_ARGS:= \
  86. --dest-os=$(if $(findstring Darwin,$(HOST_OS)),mac,linux) \
  87. --without-snapshot \
  88. --prefix=$(STAGING_DIR_HOSTPKG)
  89. HOST_CONFIGURE_CMD:=python ./configure
  90. define Build/InstallDev
  91. $(INSTALL_DIR) $(1)/usr/include
  92. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  93. endef
  94. define Package/node/install
  95. mkdir -p $(1)/usr/bin
  96. $(CP) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/
  97. endef
  98. define Package/node-npm/install
  99. mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
  100. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{npm,npx} $(1)/usr/bin/
  101. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE} $(1)/usr/lib/node_modules/npm
  102. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
  103. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npx-cli.js $(1)/usr/lib/node_modules/npm/bin
  104. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
  105. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
  106. endef
  107. $(eval $(call HostBuild))
  108. $(eval $(call BuildPackage,node))
  109. $(eval $(call BuildPackage,node-npm))