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.

125 lines
3.4 KiB

  1. #
  2. # Copyright (C) 2017-2018 Yousong Zhou <yszhou4tech@gmail.com>
  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. # Checklist when bumping versions
  9. #
  10. # - update cipher list by checking src/crypto.c:crypto_init()
  11. # - check if default mode has changed from being tcp_only
  12. #
  13. PKG_NAME:=shadowsocks-libev
  14. PKG_VERSION:=3.1.3
  15. PKG_RELEASE:=2
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  17. PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-libev/releases/download/v$(PKG_VERSION)
  18. PKG_HASH:=58fb438d2cfe33cfa6ac8c50e587e2138c50e59a4b943f88d22883bf2e192a96
  19. PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
  20. PKG_LICENSE:=GPL-3.0+
  21. PKG_LICENSE_FILES:=LICENSE
  22. PKG_FIXUP:=autoreconf
  23. PKG_INSTALL:=1
  24. PKG_USE_MIPS16:=0
  25. PKG_BUILD_PARALLEL:=1
  26. include $(INCLUDE_DIR)/package.mk
  27. define Package/shadowsocks-libev-config
  28. SECTION:=net
  29. CATEGORY:=Network
  30. SUBMENU:=Web Servers/Proxies
  31. TITLE:=shadowsocks-libev config scripts
  32. URL:=https://github.com/shadowsocks/shadowsocks-libev
  33. endef
  34. define Package/shadowsocks-libev-config/install
  35. $(INSTALL_DIR) $(1)/etc/config
  36. $(INSTALL_DATA) ./files/shadowsocks-libev.config $(1)/etc/config/shadowsocks-libev
  37. $(INSTALL_DIR) $(1)/etc/init.d
  38. $(INSTALL_BIN) ./files/shadowsocks-libev.init $(1)/etc/init.d/shadowsocks-libev
  39. endef
  40. define Package/shadowsocks-libev/Default
  41. define Package/shadowsocks-libev-$(1)
  42. SECTION:=net
  43. CATEGORY:=Network
  44. SUBMENU:=Web Servers/Proxies
  45. TITLE:=shadowsocks-libev $(1)
  46. URL:=https://github.com/shadowsocks/shadowsocks-libev
  47. DEPENDS:=+libcares +libev +libmbedtls +libpcre +libpthread +libsodium +shadowsocks-libev-config +zlib
  48. endef
  49. define Package/shadowsocks-libev-$(1)/install
  50. $$(INSTALL_DIR) $$(1)/usr/bin
  51. $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin
  52. endef
  53. endef
  54. SHADOWSOCKS_COMPONENTS:=ss-local ss-redir ss-tunnel ss-server
  55. define shadowsocks-libev/templates
  56. $(foreach component,$(SHADOWSOCKS_COMPONENTS),
  57. $(call Package/shadowsocks-libev/Default,$(component))
  58. )
  59. endef
  60. $(eval $(call shadowsocks-libev/templates))
  61. define Package/shadowsocks-libev-ss-rules
  62. SECTION:=net
  63. CATEGORY:=Network
  64. SUBMENU:=Web Servers/Proxies
  65. TITLE:=shadowsocks-libev ss-rules
  66. URL:=https://github.com/shadowsocks/shadowsocks-libev
  67. DEPENDS:=+ip +ipset +iptables-mod-tproxy +resolveip +shadowsocks-libev-ss-redir +shadowsocks-libev-config
  68. endef
  69. define Package/shadowsocks-libev-ss-rules/install
  70. $(INSTALL_DIR) $(1)/usr/bin
  71. $(INSTALL_BIN) ./files/ss-rules $(1)/usr/bin
  72. $(INSTALL_DIR) $(1)/etc/uci-defaults
  73. $(INSTALL_DATA) ./files/firewall.ss-rules $(1)/etc
  74. $(INSTALL_BIN) ./files/ss-rules.defaults $(1)/etc/uci-defaults
  75. endef
  76. define Package/shadowsocks-libev-ss-rules/prerm
  77. #!/bin/sh
  78. s=firewall.ss_rules
  79. uci get "$$s" >/dev/null || exit 0
  80. uci batch <<-EOF
  81. delete $$s
  82. commit firewall
  83. EOF
  84. endef
  85. define Build/Prepare
  86. $(call Build/Prepare/Default)
  87. $(FIND) $(PKG_BUILD_DIR) \
  88. -name '*.o' \
  89. -o -name '*.lo' \
  90. -o -name '.deps' \
  91. -o -name '.libs' \
  92. | $(XARGS) rm -rvf
  93. endef
  94. CONFIGURE_ARGS += \
  95. --disable-documentation \
  96. --disable-silent-rules \
  97. --disable-assert \
  98. --disable-ssp \
  99. $(eval $(call BuildPackage,shadowsocks-libev-config))
  100. $(eval $(call BuildPackage,shadowsocks-libev-ss-rules))
  101. $(foreach component,$(SHADOWSOCKS_COMPONENTS), \
  102. $(eval $(call BuildPackage,shadowsocks-libev-$(component))) \
  103. )