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.

136 lines
3.6 KiB

  1. #
  2. # Copyright (C) 2017-2020 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.4
  15. PKG_RELEASE:=4
  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:=fce47a956fad0c30def9c71821bcec450a40d3f881548e31e66cedf262b89eb1
  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/conffiles
  36. /etc/config/shadowsocks-libev
  37. endef
  38. define Package/shadowsocks-libev-config/install
  39. $(INSTALL_DIR) $(1)/etc/config
  40. $(INSTALL_DATA) ./files/shadowsocks-libev.config $(1)/etc/config/shadowsocks-libev
  41. $(INSTALL_DIR) $(1)/etc/init.d
  42. $(INSTALL_BIN) ./files/shadowsocks-libev.init $(1)/etc/init.d/shadowsocks-libev
  43. endef
  44. define Package/shadowsocks-libev/Default
  45. define Package/shadowsocks-libev-$(1)
  46. SECTION:=net
  47. CATEGORY:=Network
  48. SUBMENU:=Web Servers/Proxies
  49. TITLE:=shadowsocks-libev $(1)
  50. URL:=https://github.com/shadowsocks/shadowsocks-libev
  51. DEPENDS:=+libev +libmbedtls +libpthread +libsodium +shadowsocks-libev-config $(DEPENDS_$(1))
  52. endef
  53. define Package/shadowsocks-libev-$(1)/install
  54. $$(INSTALL_DIR) $$(1)/usr/bin
  55. $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin
  56. endef
  57. endef
  58. DEPENDS_ss-local = +libpcre
  59. DEPENDS_ss-server = +libcares +libpcre
  60. SHADOWSOCKS_COMPONENTS:=ss-local ss-redir ss-tunnel ss-server
  61. define shadowsocks-libev/templates
  62. $(foreach component,$(SHADOWSOCKS_COMPONENTS),
  63. $(call Package/shadowsocks-libev/Default,$(component))
  64. )
  65. endef
  66. $(eval $(call shadowsocks-libev/templates))
  67. define Package/shadowsocks-libev-ss-rules
  68. SECTION:=net
  69. CATEGORY:=Network
  70. SUBMENU:=Web Servers/Proxies
  71. TITLE:=shadowsocks-libev ss-rules
  72. URL:=https://github.com/shadowsocks/shadowsocks-libev
  73. DEPENDS:=+ip +ipset +iptables-mod-tproxy +resolveip +shadowsocks-libev-ss-redir +shadowsocks-libev-config
  74. endef
  75. define Package/shadowsocks-libev-ss-rules/install
  76. $(INSTALL_DIR) $(1)/usr/bin
  77. $(INSTALL_BIN) ./files/ss-rules $(1)/usr/bin
  78. $(INSTALL_DIR) $(1)/etc/uci-defaults
  79. $(INSTALL_DATA) ./files/firewall.ss-rules $(1)/etc
  80. $(INSTALL_BIN) ./files/ss-rules.defaults $(1)/etc/uci-defaults
  81. endef
  82. define Package/shadowsocks-libev-ss-rules/prerm
  83. #!/bin/sh
  84. s=firewall.ss_rules
  85. uci get "$$s" >/dev/null || exit 0
  86. uci batch <<-EOF
  87. delete $$s
  88. commit firewall
  89. EOF
  90. endef
  91. define Build/Prepare
  92. $(call Build/Prepare/Default)
  93. $(FIND) $(PKG_BUILD_DIR) \
  94. -name '*.o' \
  95. -o -name '*.lo' \
  96. -o -name '.deps' \
  97. -o -name '.libs' \
  98. | $(XARGS) rm -rvf
  99. endef
  100. CONFIGURE_ARGS += \
  101. --disable-documentation \
  102. --disable-silent-rules \
  103. --disable-assert \
  104. --disable-ssp \
  105. TARGET_CFLAGS += -flto
  106. TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
  107. $(eval $(call BuildPackage,shadowsocks-libev-config))
  108. $(eval $(call BuildPackage,shadowsocks-libev-ss-rules))
  109. $(foreach component,$(SHADOWSOCKS_COMPONENTS), \
  110. $(eval $(call BuildPackage,shadowsocks-libev-$(component))) \
  111. )