commit:     4498d9ccdca1604605e207b8baad6c98842d430b
Author:     Yuhang Zeng <unlsycn <AT> unlsycn <DOT> com>
AuthorDate: Thu Feb 22 03:08:47 2024 +0000
Commit:     Yuhang Zeng <unlsycn <AT> unlsycn <DOT> com>
CommitDate: Thu Feb 22 03:08:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4498d9cc

net-misc/graftcp: new package, add 0.7.1

Signed-off-by: Yuhang Zeng <unlsycn <AT> unlsycn.com>

 net-misc/graftcp/Manifest                          |  2 +
 ...d-not-enabling-service-in-install_systemd.patch | 76 ++++++++++++++++++++++
 .../files/0002-build-no-longer-strip-symbols.patch | 30 +++++++++
 net-misc/graftcp/files/0003-version-v0.7.patch     | 37 +++++++++++
 net-misc/graftcp/graftcp-0.7.1.ebuild              | 47 +++++++++++++
 net-misc/graftcp/metadata.xml                      | 15 +++++
 6 files changed, 207 insertions(+)

diff --git a/net-misc/graftcp/Manifest b/net-misc/graftcp/Manifest
new file mode 100644
index 0000000000..b93ab4fb17
--- /dev/null
+++ b/net-misc/graftcp/Manifest
@@ -0,0 +1,2 @@
+DIST graftcp-0.7.1.tar.gz 1631745 BLAKE2B 
5658ba3d0a7ace0ffce55c0139025b5adda6d52473bfe4681fa3bc067382794934b9c8b577e0252534df4d8800a683ac997ae2be413d2b9c599d9814a48417c5
 SHA512 
56cd5d293290e6498fb4da75cfb39561092aff15a7a9391b8caf3c6d0a45869263a445900a47fc2a224765a7f3dc8e3db849bbdce2f674750c89de7a74ec8fcc
+DIST vendor.tar.xz 219676 BLAKE2B 
d7f230486f2ef2e9366a98823bf18d7f2e2aef80d2307f7cdcd870327f727919be362632670717d1f1eb53b793d61ce52c90ed98f7c58ab7ddc70c19fcab1bce
 SHA512 
81ce9625b4dc0ad294ebe121c56720617975145592c6927aa6a1fae3834724280f16f25e9ac470b438b09ce6343b632849373cbd235d0c546da60dfc8ad5687d

diff --git 
a/net-misc/graftcp/files/0001-build-not-enabling-service-in-install_systemd.patch
 
b/net-misc/graftcp/files/0001-build-not-enabling-service-in-install_systemd.patch
new file mode 100644
index 0000000000..eed3c96f12
--- /dev/null
+++ 
b/net-misc/graftcp/files/0001-build-not-enabling-service-in-install_systemd.patch
@@ -0,0 +1,76 @@
+From 9f1773d02630b5390e5dc1dc213b374a17518fb1 Mon Sep 17 00:00:00 2001
+From: unlsycn <[email protected]>
+Date: Tue, 20 Feb 2024 21:55:17 +0800
+Subject: [PATCH] build: not enabling service in install_systemd
+
+Enabling service should be a post-installation behavior and is best
+performed manually by user. Invoke systemctl at installation will break
+the flow of package manager on environments without systemd as the
+service file is usually installed in such systems as well.
+
+Signed-off-by: unlsycn <[email protected]>
+---
+ README.md       | 4 +++-
+ README.zh-CN.md | 4 +++-
+ local/Makefile  | 8 ++++++--
+ 3 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/README.md b/README.md
+index d367aaf..ac27104 100644
+--- a/README.md
++++ b/README.md
+@@ -31,8 +31,10 @@ Optionally, you can also install them to system:
+ 
+ ```sh
+ sudo make install
+-# Enable and activate systemed unit 
++# Install systemed unit
+ sudo make install_systemd
++# Activate systemd service
++sudo make enable_systemd
+ ```
+ 
+ ### Install from binary package
+diff --git a/README.zh-CN.md b/README.zh-CN.md
+index 4759992..8fd5f61 100644
+--- a/README.zh-CN.md
++++ b/README.zh-CN.md
+@@ -25,8 +25,10 @@ make 执行完后,即可运行 `graftcp-local/graftcp-local` 和 `./graftcp`
+ 
+ ```sh
+ sudo make install
+-# Enable and activate systemed unit 
++# Install systemed unit
+ sudo make install_systemd
++# Activate systemd service
++sudo make enable_systemd
+ ```
+ 
+ ### 二进制包安装
+diff --git a/local/Makefile b/local/Makefile
+index a6a8793..39836ce 100644
+--- a/local/Makefile
++++ b/local/Makefile
+@@ -46,13 +46,17 @@ install_systemd:: install
+ ifneq ($(PREFIX),/usr/)
+       sed -i -re 's#/usr/bin/graftcp-local#$(subst 
#,\#,${PREFIX})/bin/graftcp-local#g' 
${DESTDIR}/${SYSTEMD_UNIT_DIR}/graftcp-local.service
+ endif
++
++enable_systemd::
+       @echo "Enable and start the graftcp-local systemd unit"
+       systemctl daemon-reload && systemctl --now enable graftcp-local.service
+ 
+-uninstall_systemd::
+-      $(if $(SYSTEMD_UNIT_DIR),,$(error SYSTEMD_UNIT_DIR is not defined))
++disable_systemd::
+       @echo "Disable and stop the graftcp-local systemd unit"
+       systemctl disable --now graftcp-local.service
++
++uninstall_systemd:: disable_systemd
++      $(if $(SYSTEMD_UNIT_DIR),,$(error SYSTEMD_UNIT_DIR is not defined))
+       rm -f ${DESTDIR}/${SYSTEMD_UNIT_DIR}/graftcp-local.service
+ 
+ uninstall::
+-- 
+2.43.0
+

diff --git a/net-misc/graftcp/files/0002-build-no-longer-strip-symbols.patch 
b/net-misc/graftcp/files/0002-build-no-longer-strip-symbols.patch
new file mode 100644
index 0000000000..421e96b7df
--- /dev/null
+++ b/net-misc/graftcp/files/0002-build-no-longer-strip-symbols.patch
@@ -0,0 +1,30 @@
+From 22399e4ba6c1e47a42fd99776d2d7ab651ced34a Mon Sep 17 00:00:00 2001
+From: unlsycn <[email protected]>
+Date: Wed, 21 Feb 2024 10:17:51 +0800
+Subject: [PATCH] build: no longer strip symbols
+
+Signed-off-by: unlsycn <[email protected]>
+---
+ local/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/local/Makefile b/local/Makefile
+index 39836ce..7076dd2 100644
+--- a/local/Makefile
++++ b/local/Makefile
+@@ -25,10 +25,10 @@ TARGET = graftcp-local mgraftcp
+ all:: $(TARGET)
+ 
+ graftcp-local: $(wildcard *.go cmd/graftcp-local/*.go)
+-      ${GO_BUILD_PREFIX_FLAGS} go build -ldflags "-s -w -X 
main.version=${VERSION}" ./cmd/graftcp-local
++      ${GO_BUILD_PREFIX_FLAGS} go build -ldflags "-w -X 
main.version=${VERSION}" ./cmd/graftcp-local
+ 
+ mgraftcp: $(wildcard *.go cmd/mgraftcp/*.go) ../libgraftcp.a
+-      ${GO_BUILD_PREFIX_FLAGS} ${CGO_FLAGS} go build -ldflags "-s -w -X 
main.version=${VERSION}" ./cmd/mgraftcp
++      ${GO_BUILD_PREFIX_FLAGS} ${CGO_FLAGS} go build -ldflags "-w -X 
main.version=${VERSION}" ./cmd/mgraftcp
+ 
+ ../libgraftcp.a::
+       $(MAKE) -C .. libgraftcp.a
+-- 
+2.43.0
+

diff --git a/net-misc/graftcp/files/0003-version-v0.7.patch 
b/net-misc/graftcp/files/0003-version-v0.7.patch
new file mode 100644
index 0000000000..87766d068c
--- /dev/null
+++ b/net-misc/graftcp/files/0003-version-v0.7.patch
@@ -0,0 +1,37 @@
+From eb0e60dc47d08fbb8e11eadc9676b4569de4b59b Mon Sep 17 00:00:00 2001
+From: "mingang.he" <[email protected]>
+Date: Sun, 17 Dec 2023 03:44:24 +0000
+Subject: [PATCH] VERSION v0.6 => v0.7
+
+---
+ Makefile       | 2 +-
+ local/Makefile | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1344536..64d088a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -46,7 +46,7 @@ else
+ endif
+ 
+ ifneq ($(shell echo $(VERSION) | head -c 1), v)
+-      VERSION=v0.6
++      VERSION=v0.7
+ endif
+ CFLAGS += -DVERSION=\"$(VERSION)\"
+ 
+diff --git a/local/Makefile b/local/Makefile
+index a6a8793..2426ebf 100644
+--- a/local/Makefile
++++ b/local/Makefile
+@@ -1,5 +1,5 @@
+ ifneq ($(shell echo $(VERSION) | head -c 1), v)
+-      VERSION=v0.6
++      VERSION=v0.7
+ endif
+ 
+ GO_BUILD_PREFIX_FLAGS :=
+-- 
+2.43.0
+

diff --git a/net-misc/graftcp/graftcp-0.7.1.ebuild 
b/net-misc/graftcp/graftcp-0.7.1.ebuild
new file mode 100644
index 0000000000..875749fa01
--- /dev/null
+++ b/net-misc/graftcp/graftcp-0.7.1.ebuild
@@ -0,0 +1,47 @@
+#Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="A tool for redirecting a given program's TCP traffic to SOCKS5 or 
HTTP proxy"
+HOMEPAGE="https://github.com/hmgle/graftcp";
+
+GO_OPTIONAL=1
+
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/hmgle/graftcp.git";
+else
+       SRC_URI="
+       https://github.com/hmgle/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
+       
https://github.com/unlsycn/${PN}/releases/download/vendor-${PV}/${PN}-local-vendor-${PV}.tar.xz
 -> vendor.tar.xz
+       "
+       KEYWORDS="~amd64"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+
+RDEPEND="${DEPEND}"
+BDEPEND="
+       dev-lang/go
+       dev-util/pkgconf
+"
+
+PATCHES="
+       ${FILESDIR}/0001-build-not-enabling-service-in-install_systemd.patch
+       ${FILESDIR}/0002-build-no-longer-strip-symbols.patch
+       ${FILESDIR}/0003-version-v0.7.patch
+"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+src_prepare() {
+       default
+       mv "${WORKDIR}/vendor" "${WORKDIR}/${P}/local" || die
+}
+
+src_install() {
+       emake DESTDIR="${D}" PREFIX="/usr" install
+       emake DESTDIR="${D}" PREFIX="/usr" install_systemd
+}

diff --git a/net-misc/graftcp/metadata.xml b/net-misc/graftcp/metadata.xml
new file mode 100644
index 0000000000..24536c6aaf
--- /dev/null
+++ b/net-misc/graftcp/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>unlsycn</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">hmgle/graftcp</remote-id>
+       </upstream>
+       <longdescription lang="en"> 
+               graftcp can redirect the TCP connection made by the given 
program
+               [application, script, shell, etc.] to SOCKS5 or HTTP proxy.
+       </longdescription>
+</pkgmetadata>

Reply via email to