From 17b62f86468e3df9c0169583a10a1fd91368a84d Mon Sep 17 00:00:00 2001 From: kuoruan Date: Thu, 14 Feb 2019 16:22:41 +0800 Subject: [PATCH] v2ray-core: Split packages Signed-off-by: kuoruan --- Makefile | 84 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 72 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 476dccc..5d33273 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,8 @@ include $(INCLUDE_DIR)/package.mk include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk define Package/v2ray-core/Default - TITLE:=A platform for building proxies to bypass network restrictions - URL:=https://www.v2ray.com/ + TITLE:=A platform for building proxies + URL:=https://www.v2ray.com endef define Package/v2ray-core/Default/description @@ -41,19 +41,27 @@ Project V is a set of network tools that help you to build your own computer net It secures your network connections and thus protects your privacy. endef +define project-v/SubMenu + SECTION:=net + CATEGORY:=Network + SUBMENU:=Project V +endef + +define v2ray-core/GoBinDefault + $(call Package/v2ray-core/Default) + $(call project-v/SubMenu) + USERID:=v2ray=10800:v2ray=10800 + DEPENDS:=$(GO_ARCH_DEPENDS) +endef + define v2ray-core/templates define Package/$(1) - $$(call Package/v2ray-core/Default) + $$(call v2ray-core/GoBinDefault) TITLE+= ($(1)) - USERID:=v2ray=10800:v2ray=10800 - SECTION:=net - CATEGORY:=Network - SUBMENU:=Web Servers/Proxies - DEPENDS:=$$(GO_ARCH_DEPENDS) endef define Package/$(1)/description - $(call Package/v2ray-core/Default/description) + $$(call Package/v2ray-core/Default/description) This package contains the $(1). endef @@ -64,6 +72,53 @@ define v2ray-core/templates endef endef +V2RAY_COMPONENTS:=v2ray v2ctl + +$(foreach component,$(V2RAY_COMPONENTS), \ + $(eval $(call v2ray-core/templates,$(component))) \ +) + +define Package/v2ray-assets + $(call Package/v2ray-core/Default) + $(call project-v/SubMenu) + TITLE+= (geoip & geosite) +endef + +define Package/v2ray-assets/description +$(call Package/v2ray-core/Default/description) + + This package contains geoip.dat & geosite.dat. +endef + +define Package/v2ray-assets/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/release/config/{geoip,geosite}.dat \ + $(1)/usr/bin +endef + +define Package/v2ray-core +$(call v2ray-core/GoBinDefault) + TITLE+= (full) + PROVIDES:=$(V2RAY_COMPONENTS) v2ray-assets +endef + +define Package/v2ray-core/description +$(call Package/v2ray-core/Default/description) + + This package contains v2ray, v2ctl and v2ray-assets. +endef + +define Package/v2ray-core/install +$(call Package/v2ray-assets/install,$(1)) + $(INSTALL_DIR) $(1)/usr/bin + ( \ + for component in $(V2RAY_COMPONENTS); do \ + $(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/$$$$component $(1)/usr/bin ; \ + done ; \ + ) +endef + define Package/golang-v2ray-core-dev $(call Package/v2ray-core/Default) $(call GoPackage/GoSubMenu) @@ -74,7 +129,11 @@ endef define Package/golang-v2ray-core-dev/description $(call Package/v2ray-core/Default/description) -This package provides the source files for v2ray. +This package provides the source files for v2ray-core. +endef + +define Build/Prepare + $(Build/Prepare/Default) endef define Build/Compile @@ -87,13 +146,14 @@ define Build/Compile mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ctl endef -V2RAY_COMPONENTS:=v2ray v2ctl $(foreach component,$(V2RAY_COMPONENTS), \ - $(eval $(call v2ray-core/templates,$(component))) \ $(eval $(call GoBinPackage,$(component))) \ $(eval $(call BuildPackage,$(component))) \ ) +$(eval $(call BuildPackage,v2ray-assets)) +$(eval $(call GoBinPackage,v2ray-core)) +$(eval $(call BuildPackage,v2ray-core)) $(eval $(call GoSrcPackage,golang-v2ray-core-dev)) $(eval $(call BuildPackage,golang-v2ray-core-dev))