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.

135 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:=1
  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. +USE_UCLIBC:libpthread +USE_UCLIBC:librt \
  35. +NODEJS_ICU:icu
  36. endef
  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. define Package/node-npm
  43. SECTION:=lang
  44. CATEGORY:=Languages
  45. SUBMENU:=Node.js
  46. TITLE:=NPM stands for Node Package Manager
  47. URL:=https://npmjs.com/
  48. DEPENDS:=+node
  49. endef
  50. define Package/node-npm/description
  51. NPM is the package manager for NodeJS
  52. endef
  53. define Package/node/config
  54. if PACKAGE_node
  55. config NODEJS_ICU
  56. bool "enable i18n features"
  57. default n
  58. endif
  59. endef
  60. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  61. MAKE_VARS+= \
  62. DESTCPU=$(NODEJS_CPU)
  63. CONFIGURE_VARS:= \
  64. CC="$(TARGET_CC) $(TARGET_OPTIMIZATION)" \
  65. CXX="$(TARGET_CXX) $(TARGET_OPTIMIZATION)" \
  66. CC_host="$(HOSTCC)" \
  67. CXX_host="$(HOSTCXX)"
  68. CONFIGURE_ARGS:= \
  69. --dest-cpu=$(NODEJS_CPU) \
  70. --dest-os=linux \
  71. --without-snapshot \
  72. --shared-zlib \
  73. --shared-openssl \
  74. --shared-nghttp2 \
  75. --shared-libuv \
  76. --shared-http-parser \
  77. --with-intl=$(if $(CONFIG_NODEJS_ICU),system-icu,none) \
  78. $(if $(findstring mips,$(NODEJS_CPU)), \
  79. $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \
  80. $(if $(findstring +neon,$(CONFIG_CPU_TYPE)),--with-arm-fpu=neon) \
  81. $(if $(findstring +vfp",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfp) \
  82. $(if $(findstring +vfpv3",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3-d16) \
  83. $(if $(findstring +vfpv4",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3) \
  84. --prefix=/usr
  85. HOST_CONFIGURE_VARS:=
  86. HOST_CONFIGURE_ARGS:= \
  87. --dest-os=linux \
  88. --without-snapshot \
  89. --prefix=$(STAGING_DIR_HOSTPKG)
  90. HOST_CONFIGURE_CMD:=python ./configure
  91. define Build/InstallDev
  92. $(INSTALL_DIR) $(1)/usr/include
  93. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  94. endef
  95. define Package/node/install
  96. mkdir -p $(1)/usr/bin
  97. $(CP) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/
  98. endef
  99. define Package/node-npm/install
  100. mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
  101. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{npm,npx} $(1)/usr/bin/
  102. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE} $(1)/usr/lib/node_modules/npm
  103. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
  104. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npx-cli.js $(1)/usr/lib/node_modules/npm/bin
  105. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
  106. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
  107. endef
  108. $(eval $(call HostBuild))
  109. $(eval $(call BuildPackage,node))
  110. $(eval $(call BuildPackage,node-npm))