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.

120 lines
3.2 KiB

  1. #
  2. # Copyright (C) 2017 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 TCP_ONLY
  12. # - check if ss-rules has been upstreamed
  13. #
  14. # TODO
  15. #
  16. # - add validate type: user
  17. #
  18. PKG_NAME:=shadowsocks-libev
  19. PKG_VERSION:=3.0.7
  20. PKG_RELEASE:=2
  21. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  22. PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-libev/releases/download/v$(PKG_VERSION)
  23. PKG_HASH:=024f2ff501e15ad0cd03dcbac5ca1842aad13dbd51788e522818ff4c129dee18
  24. PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
  25. PKG_LICENSE:=GPL-3.0+
  26. PKG_LICENSE_FILES:=LICENSE
  27. PKG_FIXUP:=autoreconf
  28. PKG_INSTALL:=1
  29. PKG_USE_MIPS16:=0
  30. PKG_BUILD_PARALLEL:=1
  31. include $(INCLUDE_DIR)/package.mk
  32. define Package/shadowsocks-libev-config
  33. SECTION:=net
  34. CATEGORY:=Network
  35. SUBMENU:=Web Servers/Proxies
  36. TITLE:=shadowsocks-libev config scripts
  37. URL:=https://github.com/shadowsocks/shadowsocks-libev
  38. endef
  39. define Package/shadowsocks-libev-config/install
  40. $(INSTALL_DIR) $(1)/etc/config
  41. $(INSTALL_DATA) ./files/shadowsocks-libev.config $(1)/etc/config/shadowsocks-libev
  42. $(INSTALL_DIR) $(1)/etc/init.d
  43. $(INSTALL_BIN) ./files/shadowsocks-libev.init $(1)/etc/init.d/shadowsocks-libev
  44. endef
  45. define Package/shadowsocks-libev/Default
  46. define Package/shadowsocks-libev-$(1)
  47. SECTION:=net
  48. CATEGORY:=Network
  49. SUBMENU:=Web Servers/Proxies
  50. TITLE:=shadowsocks-libev $(1)
  51. URL:=https://github.com/shadowsocks/shadowsocks-libev
  52. DEPENDS:=+libev +libmbedtls +libpcre +libpthread +libsodium +libudns +shadowsocks-libev-config +zlib
  53. endef
  54. define Package/shadowsocks-libev-$(1)/install
  55. $$(INSTALL_DIR) $$(1)/usr/bin
  56. $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin
  57. endef
  58. endef
  59. SHADOWSOCKS_COMPONENTS:=ss-local ss-redir ss-tunnel ss-server
  60. define shadowsocks-libev/templates
  61. $(foreach component,$(SHADOWSOCKS_COMPONENTS),
  62. $(call Package/shadowsocks-libev/Default,$(component))
  63. )
  64. endef
  65. $(eval $(call shadowsocks-libev/templates))
  66. define Package/shadowsocks-libev-ss-rules
  67. SECTION:=net
  68. CATEGORY:=Network
  69. SUBMENU:=Web Servers/Proxies
  70. TITLE:=shadowsocks-libev ss-rules
  71. URL:=https://github.com/shadowsocks/shadowsocks-libev
  72. DEPENDS:=+ip +ipset +iptables-mod-tproxy +shadowsocks-libev-ss-redir +shadowsocks-libev-config
  73. endef
  74. define Package/shadowsocks-libev-ss-rules/install
  75. $(INSTALL_DIR) $(1)/usr/bin
  76. $(INSTALL_BIN) ./files/ss-rules $(1)/usr/bin
  77. $(INSTALL_DIR) $(1)/etc/uci-defaults
  78. $(INSTALL_DATA) ./files/firewall.ss-rules $(1)/etc
  79. $(INSTALL_BIN) ./files/ss-rules.defaults $(1)/etc/uci-defaults
  80. endef
  81. define Package/shadowsocks-libev-ss-rules/prerm
  82. #!/bin/sh
  83. s=firewall.ss_rules
  84. uci get "$$s" >/dev/null || exit 0
  85. uci batch <<-EOF
  86. delete $$s
  87. commit firewall
  88. EOF
  89. endef
  90. CONFIGURE_ARGS += \
  91. --disable-documentation \
  92. --disable-silent-rules \
  93. --disable-assert \
  94. --disable-ssp \
  95. $(eval $(call BuildPackage,shadowsocks-libev-config))
  96. $(eval $(call BuildPackage,shadowsocks-libev-ss-rules))
  97. $(foreach component,$(SHADOWSOCKS_COMPONENTS), \
  98. $(eval $(call BuildPackage,shadowsocks-libev-$(component))) \
  99. )