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.

132 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.14.1
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=https://nodejs.org/dist/${PKG_VERSION}
  13. PKG_HASH:=b1df87803ddffb76fc6739f025f69f6b8288514fcd2f278f0d675ac3d52a6b9b
  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) +libstdcpp +libopenssl +zlib +libnghttp2 +libuv +libhttp-parser +USE_UCLIBC:libpthread +USE_UCLIBC:librt +NODEJS_ICU:icu
  33. endef
  34. define Package/node/description
  35. Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
  36. an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js'
  37. package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
  38. endef
  39. define Package/node-npm
  40. SECTION:=lang
  41. CATEGORY:=Languages
  42. SUBMENU:=Node.js
  43. TITLE:=NPM stands for Node Package Manager
  44. URL:=https://npmjs.com/
  45. DEPENDS:=+node
  46. endef
  47. define Package/node-npm/description
  48. NPM is the package manager for NodeJS
  49. endef
  50. define Package/node/config
  51. menu "Module Selection"
  52. config NODEJS_ICU
  53. bool "enable i18n features"
  54. default n
  55. endmenu
  56. endef
  57. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  58. MAKE_VARS+= \
  59. DESTCPU=$(NODEJS_CPU)
  60. CONFIGURE_VARS:= \
  61. CC="$(TARGET_CC) $(TARGET_OPTIMIZATION)" \
  62. CXX="$(TARGET_CXX) $(TARGET_OPTIMIZATION)" \
  63. CC_host="$(HOSTCC)" \
  64. CXX_host="$(HOSTCXX)"
  65. CONFIGURE_ARGS:= \
  66. --dest-cpu=$(NODEJS_CPU) \
  67. --dest-os=linux \
  68. --without-snapshot \
  69. --shared-zlib \
  70. --shared-openssl \
  71. --shared-nghttp2 \
  72. --shared-libuv \
  73. --shared-http-parser \
  74. --with-intl=$(if $(CONFIG_NODEJS_ICU),system-icu,none) \
  75. $(if $(findstring mips,$(NODEJS_CPU)), \
  76. $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \
  77. $(if $(findstring +neon,$(CONFIG_CPU_TYPE)),--with-arm-fpu=neon) \
  78. $(if $(findstring +vfp",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfp) \
  79. $(if $(findstring +vfpv3",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3-d16) \
  80. $(if $(findstring +vfpv4",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3) \
  81. --prefix=/usr
  82. HOST_CONFIGURE_VARS:=
  83. HOST_CONFIGURE_ARGS:= \
  84. --dest-os=linux \
  85. --without-snapshot \
  86. --prefix=$(STAGING_DIR_HOSTPKG)
  87. HOST_CONFIGURE_CMD:=python ./configure
  88. define Build/InstallDev
  89. $(INSTALL_DIR) $(1)/usr/include
  90. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  91. endef
  92. define Package/node/install
  93. mkdir -p $(1)/usr/bin
  94. $(CP) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/
  95. endef
  96. define Package/node-npm/install
  97. mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
  98. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{npm,npx} $(1)/usr/bin/
  99. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE} $(1)/usr/lib/node_modules/npm
  100. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
  101. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npx-cli.js $(1)/usr/lib/node_modules/npm/bin
  102. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
  103. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
  104. endef
  105. $(eval $(call HostBuild))
  106. $(eval $(call BuildPackage,node))
  107. $(eval $(call BuildPackage,node-npm))