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.

132 lines
3.5 KiB

  1. #
  2. # Copyright (C) 2017-2019 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.3.1
  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:=afd25ae5e737be385fa53364c66095c354277e98cf141b54beb2be93d9228f4f
  19. PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
  20. PKG_LICENSE:=GPL-3.0-or-later
  21. PKG_LICENSE_FILES:=LICENSE
  22. PKG_FIXUP:=autoreconf
  23. PKG_INSTALL:=1
  24. PKG_USE_MIPS16:=0
  25. PKG_BUILD_PARALLEL:=1
  26. PKG_BUILD_DEPENDS:=c-ares pcre
  27. include $(INCLUDE_DIR)/package.mk
  28. define Package/shadowsocks-libev-config
  29. SECTION:=net
  30. CATEGORY:=Network
  31. SUBMENU:=Web Servers/Proxies
  32. TITLE:=shadowsocks-libev config scripts
  33. URL:=https://github.com/shadowsocks/shadowsocks-libev
  34. endef
  35. define Package/shadowsocks-libev-config/install
  36. $(INSTALL_DIR) $(1)/etc/config
  37. $(INSTALL_DATA) ./files/shadowsocks-libev.config $(1)/etc/config/shadowsocks-libev
  38. $(INSTALL_DIR) $(1)/etc/init.d
  39. $(INSTALL_BIN) ./files/shadowsocks-libev.init $(1)/etc/init.d/shadowsocks-libev
  40. endef
  41. define Package/shadowsocks-libev/Default
  42. define Package/shadowsocks-libev-$(1)
  43. SECTION:=net
  44. CATEGORY:=Network
  45. SUBMENU:=Web Servers/Proxies
  46. TITLE:=shadowsocks-libev $(1)
  47. URL:=https://github.com/shadowsocks/shadowsocks-libev
  48. DEPENDS:=+libev +libmbedtls +libpthread +libsodium +shadowsocks-libev-config $(DEPENDS_$(1))
  49. endef
  50. define Package/shadowsocks-libev-$(1)/install
  51. $$(INSTALL_DIR) $$(1)/usr/bin
  52. $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin
  53. endef
  54. endef
  55. DEPENDS_ss-local = +libpcre
  56. DEPENDS_ss-server = +libcares +libpcre
  57. SHADOWSOCKS_COMPONENTS:=ss-local ss-redir ss-tunnel ss-server
  58. define shadowsocks-libev/templates
  59. $(foreach component,$(SHADOWSOCKS_COMPONENTS),
  60. $(call Package/shadowsocks-libev/Default,$(component))
  61. )
  62. endef
  63. $(eval $(call shadowsocks-libev/templates))
  64. define Package/shadowsocks-libev-ss-rules
  65. SECTION:=net
  66. CATEGORY:=Network
  67. SUBMENU:=Web Servers/Proxies
  68. TITLE:=shadowsocks-libev ss-rules
  69. URL:=https://github.com/shadowsocks/shadowsocks-libev
  70. DEPENDS:=+ip +ipset +iptables-mod-tproxy +resolveip +shadowsocks-libev-ss-redir +shadowsocks-libev-config
  71. endef
  72. define Package/shadowsocks-libev-ss-rules/install
  73. $(INSTALL_DIR) $(1)/usr/bin
  74. $(INSTALL_BIN) ./files/ss-rules $(1)/usr/bin
  75. $(INSTALL_DIR) $(1)/etc/uci-defaults
  76. $(INSTALL_DATA) ./files/firewall.ss-rules $(1)/etc
  77. $(INSTALL_BIN) ./files/ss-rules.defaults $(1)/etc/uci-defaults
  78. endef
  79. define Package/shadowsocks-libev-ss-rules/prerm
  80. #!/bin/sh
  81. s=firewall.ss_rules
  82. uci get "$$s" >/dev/null || exit 0
  83. uci batch <<-EOF
  84. delete $$s
  85. commit firewall
  86. EOF
  87. endef
  88. define Build/Prepare
  89. $(call Build/Prepare/Default)
  90. $(FIND) $(PKG_BUILD_DIR) \
  91. -name '*.o' \
  92. -o -name '*.lo' \
  93. -o -name '.deps' \
  94. -o -name '.libs' \
  95. | $(XARGS) rm -rvf
  96. endef
  97. CONFIGURE_ARGS += \
  98. --disable-documentation \
  99. --disable-silent-rules \
  100. --disable-assert \
  101. --disable-ssp \
  102. TARGET_CFLAGS += -flto
  103. TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
  104. $(eval $(call BuildPackage,shadowsocks-libev-config))
  105. $(eval $(call BuildPackage,shadowsocks-libev-ss-rules))
  106. $(foreach component,$(SHADOWSOCKS_COMPONENTS), \
  107. $(eval $(call BuildPackage,shadowsocks-libev-$(component))) \
  108. )