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.

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