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.

104 lines
3.5 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:=javascript-obfuscator
  6. PKG_NAME:=node-$(PKG_NPM_NAME)
  7. PKG_VERSION:=1.2.2
  8. PKG_RELEASE:=1
  9. PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
  10. PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/
  11. PKG_HASH:=adac10d3afe244833b74e6c965b7631a2a4417879e022fc4b7beea8be60ca86b
  12. PKG_BUILD_DEPENDS:=node/host
  13. HOST_BUILD_PARALLEL:=1
  14. HOST_BUILD_DEPENDS:=node/host
  15. PKG_BUILD_PARALLEL:=1
  16. PKG_USE_MIPS16:=0
  17. PKG_MAINTAINER:=Zbynek Kocur <zbynek.kocur@fel.cvut.cz>
  18. PKG_LICENSE:=BSD-2-Clause
  19. PKG_LICENSE_FILES:=LICENSE.BSD
  20. include $(INCLUDE_DIR)/host-build.mk
  21. include $(INCLUDE_DIR)/package.mk
  22. define Package/node-javascript-obfuscator
  23. SUBMENU:=Node.js
  24. SECTION:=lang
  25. CATEGORY:=Languages
  26. TITLE:=JavaScript obfuscator
  27. URL:=https://www.npmjs.org/package/javascript-obfuscator
  28. DEPENDS:=+node
  29. endef
  30. define Package/node-javascript-obfuscator/description
  31. JavaScript obfuscator is a powerful free obfuscator for JavaScript with a wide number of features which provides protection for your source code.
  32. endef
  33. TAR_OPTIONS+= --strip-components 1
  34. TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
  35. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  36. TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
  37. HOSTTMPNPM:=$(shell mktemp -u XXXXXXXXXX)
  38. TARGET_CFLAGS+=$(FPIC)
  39. TARGET_CPPFLAGS+=$(FPIC)
  40. define Build/Compile
  41. $(MAKE_VARS) \
  42. $(MAKE_FLAGS) \
  43. npm_config_arch=$(NODEJS_CPU) \
  44. npm_config_target_arch=$(NODEJS_CPU) \
  45. npm_config_build_from_source=true \
  46. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  47. npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
  48. npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \
  49. npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \
  50. npm install -g $(PKG_BUILD_DIR)
  51. rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
  52. rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
  53. endef
  54. define Package/node-javascript-obfuscator/install
  55. $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME)
  56. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE.BSD} \
  57. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  58. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/README.md \
  59. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  60. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,bin,dist} \
  61. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  62. $(INSTALL_DIR) $(1)/usr/bin
  63. $(LN) ../lib/node/javascript-obfuscator/bin/javascript-obfuscator $(1)/usr/bin/javascript-obfuscator
  64. endef
  65. define Host/Compile
  66. $(HOST_MAKE_VARS) \
  67. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  68. npm_config_prefix=$(HOST_INSTALL_DIR)/usr/ \
  69. npm_config_cache=$(TMP_DIR)/npm-cache-$(HOSTTMPNPM) \
  70. npm_config_tmp=$(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) \
  71. npm install -g --no-optional $(HOST_BUILD_DIR)
  72. rm -rf $(TMP_DIR)/npm-tmp-$(HOSTTMPNPM)
  73. rm -rf $(TMP_DIR)/npm-cache-$(HOSTTMPNPM)
  74. endef
  75. define Host/Install
  76. $(INSTALL_DIR) $(1)/lib/node_modules/$(PKG_NPM_NAME)
  77. $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE.BSD} \
  78. $(1)/lib/node_modules/$(PKG_NPM_NAME)/
  79. $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/README.md \
  80. $(1)/lib/node_modules/$(PKG_NPM_NAME)/
  81. $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,bin,dist} \
  82. $(1)/lib/node_modules/$(PKG_NPM_NAME)/
  83. $(INSTALL_DIR) $(1)/bin
  84. $(LN) ../lib/node_modules/javascript-obfuscator/bin/javascript-obfuscator $(1)/bin/javascript-obfuscator
  85. endef
  86. $(eval $(call HostBuild))
  87. $(eval $(call BuildPackage,node-javascript-obfuscator))