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.

77 lines
2.4 KiB

  1. # This is free software, licensed under the GNU General Public License v2.
  2. # See /LICENSE for more information.
  3. #
  4. include $(TOPDIR)/rules.mk
  5. PKG_NPM_NAME:=yarn
  6. PKG_NAME:=node-$(PKG_NPM_NAME)
  7. PKG_VERSION:=1.22.10
  8. PKG_RELEASE:=2
  9. PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
  10. PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/
  11. PKG_HASH:=05a22fff30d7d8e8005bed277bf20d55111ba2bed65a6b91a0fcd1307b71fd8d
  12. PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>, Patrik Laszlo <alabard@gmail.com>, Dobroslaw Kijowski <dobo90@gmail.com>
  13. PKG_LICENSE:=BSD-2-Clause
  14. PKG_LICENSE_FILES:=LICENSE
  15. PKG_HOST_ONLY:=1
  16. HOST_BUILD_DEPENDS:=node/host
  17. HOST_BUILD_PARALLEL:=1
  18. include $(INCLUDE_DIR)/host-build.mk
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/node-yarn
  21. SUBMENU:=Node.js
  22. SECTION:=lang
  23. CATEGORY:=Languages
  24. TITLE:=Fast, reliable, and secure dependency management
  25. URL:=https://yarnpkg.com/
  26. DEPENDS:=+node
  27. BUILDONLY:=1
  28. endef
  29. define Package/node-yarn/description
  30. Fast, reliable, and secure dependency management
  31. endef
  32. TAR_OPTIONS+= --strip-components 1
  33. TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
  34. HOSTTMPNPM:=$(shell mktemp -u XXXXXXXXXX)
  35. HOST_NPM_FLAGS=$(HOST_MAKE_VARS) \
  36. $(HOST_MAKE_FLAGS) \
  37. npm_config_arch=$(NODEJS_CPU) \
  38. npm_config_target_arch=$(NODEJS_CPU) \
  39. npm_config_build_from_source=true \
  40. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  41. npm_config_prefix=$(HOST_INSTALL_DIR)/usr/ \
  42. npm_config_cache=$(TMP_DIR)/npm-cache-$(HOSTTMPNPM) \
  43. npm_config_tmp=$(TMP_DIR)/npm-tmp-$(HOSTTMPNPM)
  44. define Host/Compile
  45. $(HOST_NPM_FLAGS) npm i -g --production $(HOST_BUILD_DIR)
  46. $(HOST_NPM_FLAGS) npm i --production --prefix=$(HOST_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe
  47. rm -rf $(TMP_DIR)/npm-tmp-$(HOSTTMPNPM)
  48. rm -rf $(TMP_DIR)/npm-cache-$(HOSTTMPNPM)
  49. endef
  50. define Host/Install
  51. $(INSTALL_DIR) $(1)/lib/node_modules/$(PKG_NPM_NAME)
  52. $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE} \
  53. $(1)/lib/node_modules/$(PKG_NPM_NAME)/
  54. $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/README.md \
  55. $(1)/lib/node_modules/$(PKG_NPM_NAME)/
  56. $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{bin,lib} \
  57. $(1)/lib/node_modules/$(PKG_NPM_NAME)/
  58. $(INSTALL_DIR) $(1)/bin
  59. $(LN) ../lib/node_modules/$(PKG_NPM_NAME)/bin/yarn.js $(1)/bin/yarn
  60. $(LN) ../lib/node_modules/$(PKG_NPM_NAME)/bin/yarn.js $(1)/bin/yarnpkg
  61. endef
  62. $(eval $(call HostBuild))
  63. $(eval $(call BuildPackage,node-yarn))