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.

129 lines
3.8 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.12.0
  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:=5a9dff58016c18fb4bf902d963b124ff058a550ebcd9840c677757387bce419a
  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 +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. --with-intl=$(if $(CONFIG_NODEJS_ICU),system-icu,none) \
  72. $(if $(findstring mips,$(NODEJS_CPU)), \
  73. $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \
  74. $(if $(findstring +neon,$(CONFIG_CPU_TYPE)),--with-arm-fpu=neon) \
  75. $(if $(findstring +vfp",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfp) \
  76. $(if $(findstring +vfpv3",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3-d16) \
  77. $(if $(findstring +vfpv4",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3) \
  78. --prefix=/usr
  79. HOST_CONFIGURE_VARS:=
  80. HOST_CONFIGURE_ARGS:= \
  81. --dest-os=linux \
  82. --without-snapshot \
  83. --prefix=$(STAGING_DIR_HOSTPKG)
  84. HOST_CONFIGURE_CMD:=python ./configure
  85. define Build/InstallDev
  86. $(INSTALL_DIR) $(1)/usr/include
  87. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  88. endef
  89. define Package/node/install
  90. mkdir -p $(1)/usr/bin
  91. $(CP) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/
  92. endef
  93. define Package/node-npm/install
  94. mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
  95. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{npm,npx} $(1)/usr/bin/
  96. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE} $(1)/usr/lib/node_modules/npm
  97. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
  98. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npx-cli.js $(1)/usr/lib/node_modules/npm/bin
  99. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
  100. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
  101. endef
  102. $(eval $(call HostBuild))
  103. $(eval $(call BuildPackage,node))
  104. $(eval $(call BuildPackage,node-npm))