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.

157 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:=v6.11.2
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
  13. PKG_HASH:=04af4992238b19124ea56f1bcfda36827613a24eb3b00fc3b50f261a415a26e4
  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:=+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_ARGS:= \
  60. --dest-cpu=$(NODEJS_CPU) \
  61. --dest-os=linux \
  62. --without-snapshot \
  63. --shared-zlib \
  64. --shared-openssl \
  65. --prefix=/usr
  66. ifneq ($(findstring arm,$(NODEJS_CPU)),)
  67. ifeq ($(CONFIG_SOFT_FLOAT),y)
  68. CONFIGURE_ARGS+= with-arm-float-abi=softfp
  69. else
  70. CONFIGURE_ARGS+= --with-arm-float-abi=hard
  71. ifneq ($(findstring vfp,$(CONFIG_CPU_TYPE)),)
  72. ARM_FPU=vfp
  73. endif
  74. ifneq ($(findstring vfpv3,$(CONFIG_CPU_TYPE)),)
  75. ARM_FPU=vfpv3
  76. endif
  77. ifneq ($(findstring vfpv3-d16,$(CONFIG_CPU_TYPE)),)
  78. ARM_FPU=vfpv3-d16
  79. endif
  80. ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),)
  81. ARM_FPU=neon
  82. endif
  83. CONFIGURE_ARGS+= --with-arm-fpu=$(ARM_FPU)
  84. endif
  85. endif
  86. ifneq ($(findstring mips,$(NODEJS_CPU)),)
  87. ifeq ($(CONFIG_SOFT_FLOAT),y)
  88. CONFIGURE_ARGS+= \
  89. --with-mips-float-abi=soft
  90. endif
  91. endif
  92. ifeq ($(CONFIG_NODEJS_ICU),y)
  93. CONFIGURE_ARGS+= \
  94. --with-intl=system-icu
  95. else
  96. CONFIGURE_ARGS+= \
  97. --with-intl=none
  98. endif
  99. HOST_CONFIGURE_VARS:=
  100. HOST_CONFIGURE_ARGS:= \
  101. --dest-os=linux \
  102. --without-snapshot \
  103. --shared-zlib \
  104. --prefix=$(STAGING_DIR_HOSTPKG)
  105. HOST_CONFIGURE_CMD:=python ./configure
  106. define Build/InstallDev
  107. $(INSTALL_DIR) $(1)/usr/include
  108. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  109. endef
  110. define Package/node/install
  111. mkdir -p $(1)/usr/bin
  112. $(CP) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/
  113. endef
  114. define Package/node-npm/install
  115. mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
  116. $(CP) $(PKG_INSTALL_DIR)/usr/bin/npm $(1)/usr/bin/
  117. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm
  118. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
  119. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
  120. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
  121. endef
  122. $(eval $(call HostBuild))
  123. $(eval $(call BuildPackage,node))
  124. $(eval $(call BuildPackage,node-npm))