Skip to content

Commit

Permalink
community/termshark: backport patch to support loongarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangxuhui authored and ptrcnull committed Jun 4, 2024
1 parent a603a4b commit 76788a2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
4 changes: 3 additions & 1 deletion community/termshark/APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ arch="all !armhf" # no tshark on armhf
depends="tshark"
makedepends="go"
options="net"
source="$pkgname-$pkgver.tar.gz::https://github.com/gcla/termshark/archive/v$pkgver.tar.gz"
source="$pkgname-$pkgver.tar.gz::https://github.com/gcla/termshark/archive/v$pkgver.tar.gz
loongarch64-support.patch"

export GOFLAGS="$GOFLAGS -trimpath -mod=readonly -modcacherw"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
Expand All @@ -33,4 +34,5 @@ package() {

sha512sums="
378bb67ff50a8dfa80f614540371f326627e73bdf63bceb183ed73afbbf9dead4e0597fb969ba49c4ee3d3de00ac7bb91166421c19c788df47ff8d9fcbc5b9fc termshark-2.4.0.tar.gz
21080967cf59878cb2c86e815faaec481bbe48bcbf1bc9de2ef9755d2e12e76c481493835697a720af7e43ad9417b7da63d92ae62a2aad2e9c5f9222994f65f6 loongarch64-support.patch
"
54 changes: 54 additions & 0 deletions community/termshark/loongarch64-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/go.mod b/go.mod
index 176b1d0..64ae1b6 100644
--- a/go.mod
+++ b/go.mod
@@ -7,6 +7,7 @@ require (
github.com/antchfx/xmlquery v1.3.3
github.com/antchfx/xpath v1.1.11 // indirect
github.com/blang/semver v3.5.1+incompatible
+ github.com/creack/pty v1.1.21 // indirect
github.com/flytam/filenamify v1.1.0
github.com/gcla/deep v1.0.2
github.com/gcla/gowid v1.4.0
diff --git a/go.sum b/go.sum
index 928c074..41936b4 100644
--- a/go.sum
+++ b/go.sum
@@ -116,6 +116,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.15 h1:cKRCLMj3Ddm54bKSpemfQ8AtYFBhAI2MPmdys22fBdc=
github.com/creack/pty v1.1.15/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
+github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
+github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
diff --git a/pkg/system/dup.go b/pkg/system/dup.go
index 4fee401..8270f05 100644
--- a/pkg/system/dup.go
+++ b/pkg/system/dup.go
@@ -5,6 +5,7 @@
// +build !windows
// +build !linux !arm64
// +build !linux !riscv64
+// +build !linux !loong64

package system

diff --git a/pkg/system/dup_linux_loong64.go b/pkg/system/dup_linux_loong64.go
new file mode 100644
index 0000000..74d633e
--- /dev/null
+++ b/pkg/system/dup_linux_loong64.go
@@ -0,0 +1,11 @@
+// Copyright 2019-2022 Graham Clark. All rights reserved. Use of this source
+// code is governed by the MIT license that can be found in the LICENSE
+// file.
+
+package system
+
+import "syscall"
+
+func Dup2(fd int, fd2 int) error {
+ return syscall.Dup3(fd, fd2, 0)
+}

0 comments on commit 76788a2

Please sign in to comment.