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.

151 lines
4.1 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:=v12.15.0
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=https://nodejs.org/dist/$(PKG_VERSION)
  13. PKG_HASH:=d2fb4fa80ccf321570552b0a6e6b5f2aedeb281a8450207b057cf54c54d5a81b
  14. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>, Adrian Panella <ianchi74@outlook.com>
  15. PKG_LICENSE:=MIT
  16. PKG_LICENSE_FILES:=LICENSE
  17. PKG_CPE_ID:=cpe:/a:nodejs:node.js
  18. HOST_BUILD_DEPENDS:=python3/host
  19. HOST_BUILD_PARALLEL:=1
  20. PKG_BUILD_DEPENDS:=python3/host
  21. PKG_BUILD_PARALLEL:=1
  22. PKG_INSTALL:=1
  23. PKG_USE_MIPS16:=0
  24. PKG_ASLR_PIE:=0
  25. include $(INCLUDE_DIR)/host-build.mk
  26. include $(INCLUDE_DIR)/package.mk
  27. define Package/node
  28. SECTION:=lang
  29. CATEGORY:=Languages
  30. SUBMENU:=Node.js
  31. TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
  32. URL:=https://nodejs.org/
  33. DEPENDS:=@(HAS_FPU||KERNEL_MIPS_FPU_EMULATOR) @!arc @!armeb @!powerpc \
  34. +libstdcpp +libopenssl +zlib +libnghttp2 +libuv +libhttp-parser \
  35. +libcares +libatomic +NODEJS_ICU_SYSTEM:icu +NODEJS_ICU_SYSTEM:icu-full-data
  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. *** Requires GCC/G++ Multilib on host system to build 32-bit target ***
  42. endef
  43. define Package/node-npm
  44. SECTION:=lang
  45. CATEGORY:=Languages
  46. SUBMENU:=Node.js
  47. TITLE:=NPM stands for Node Package Manager
  48. URL:=https://www.npmjs.com/
  49. DEPENDS:=+node
  50. endef
  51. define Package/node-npm/description
  52. NPM is the package manager for NodeJS
  53. endef
  54. define Package/node/config
  55. if PACKAGE_node
  56. choice
  57. prompt "i18n features"
  58. default NODEJS_ICU_NONE
  59. help
  60. Select i18n features
  61. config NODEJS_ICU_NONE
  62. bool "Disable"
  63. config NODEJS_ICU_SMALL
  64. depends on !BIG_ENDIAN
  65. bool "small-icu"
  66. config NODEJS_ICU_SYSTEM
  67. depends on ARCH_64BIT&&!BIG_ENDIAN
  68. bool "system-icu"
  69. endchoice
  70. endif
  71. endef
  72. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  73. ifneq ($(CONFIG_ARCH_64BIT),y)
  74. FORCE_32BIT:=-m32
  75. endif
  76. MAKE_VARS+= \
  77. DESTCPU=$(NODEJS_CPU) \
  78. LD_LIBRARY_PATH=$(STAGING_DIR_HOSTPKG)/share/icu/65.1/lib
  79. CONFIGURE_VARS:= \
  80. CC="$(TARGET_CC) $(TARGET_OPTIMIZATION)" \
  81. CXX="$(TARGET_CXX) $(TARGET_OPTIMIZATION)" \
  82. CC_host="$(HOSTCC) $(FORCE_32BIT)" \
  83. CXX_host="$(HOSTCXX) $(FORCE_32BIT)"
  84. CONFIGURE_ARGS:= \
  85. --dest-cpu=$(NODEJS_CPU) \
  86. --dest-os=linux \
  87. --cross-compiling \
  88. --shared-zlib \
  89. --shared-openssl \
  90. --shared-nghttp2 \
  91. --shared-libuv \
  92. --shared-http-parser \
  93. --shared-cares \
  94. $(if $(CONFIG_NODEJS_ICU_SMALL),, \
  95. --with-intl=$(if $(CONFIG_NODEJS_ICU_SYSTEM),system-icu,none)) \
  96. $(if $(findstring mips,$(NODEJS_CPU)), \
  97. $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \
  98. $(if $(findstring +neon,$(CONFIG_CPU_TYPE)),--with-arm-fpu=neon) \
  99. $(if $(findstring +vfp",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfp) \
  100. $(if $(findstring +vfpv3",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3-d16) \
  101. $(if $(findstring +vfpv4",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3) \
  102. --prefix=/usr
  103. HOST_CONFIGURE_VARS:=
  104. HOST_CONFIGURE_ARGS:= \
  105. --dest-os=$(if $(findstring Darwin,$(HOST_OS)),mac,linux) \
  106. --with-intl=none \
  107. --prefix=$(STAGING_DIR_HOSTPKG)
  108. define Build/InstallDev
  109. $(INSTALL_DIR) $(1)/usr/include
  110. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  111. endef
  112. define Package/node/install
  113. $(INSTALL_DIR) $(1)/usr/bin
  114. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/
  115. endef
  116. define Package/node-npm/install
  117. $(INSTALL_DIR) $(1)/usr/lib/node_modules
  118. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node_modules/
  119. $(INSTALL_DIR) $(1)/usr/bin
  120. $(LN) ../lib/node_modules/npm/bin/npm-cli.js $(1)/usr/bin/npm
  121. $(LN) ../lib/node_modules/npm/bin/npx-cli.js $(1)/usr/bin/npx
  122. endef
  123. $(eval $(call HostBuild))
  124. $(eval $(call BuildPackage,node))
  125. $(eval $(call BuildPackage,node-npm))