summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2024-10-23 09:08:35 +0200
committerYigit Sever2024-10-23 09:08:35 +0200
commitc3cbc42ee9b8b83d776381df92db75e1e812c3cb (patch)
tree4fb3397a14e0a2b33e530e1b899c87f4e6b118b6
parent1b0d59d2597881e1532b413f4cf82e49aefd1c42 (diff)
parent9e445a2a89089f7ad9705241a5158a1320173869 (diff)
downloadpackages-c3cbc42ee9b8b83d776381df92db75e1e812c3cb.tar.gz
packages-c3cbc42ee9b8b83d776381df92db75e1e812c3cb.tar.bz2
packages-c3cbc42ee9b8b83d776381df92db75e1e812c3cb.zip
Add 'xq/' from commit '9e445a2a89089f7ad9705241a5158a1320173869'
git-subtree-dir: xq git-subtree-mainline: 1b0d59d2597881e1532b413f4cf82e49aefd1c42 git-subtree-split: 9e445a2a89089f7ad9705241a5158a1320173869
-rw-r--r--xq/.SRCINFO18
-rw-r--r--xq/.gitignore3
-rw-r--r--xq/PKGBUILD94
-rw-r--r--xq/manpage-template.patch9
4 files changed, 124 insertions, 0 deletions
diff --git a/xq/.SRCINFO b/xq/.SRCINFO
new file mode 100644
index 0000000..c759b26
--- /dev/null
+++ b/xq/.SRCINFO
@@ -0,0 +1,18 @@
1pkgbase = xq
2 pkgdesc = Command-line XML and HTML beautifier and content extractor
3 pkgver = 1.2.3
4 pkgrel = 1
5 url = https://github.com/sibprogrammer/xq
6 arch = x86_64
7 license = MIT
8 makedepends = git
9 makedepends = go
10 depends = glibc
11 conflicts = yq
12 options = !lto
13 source = xq::git+https://github.com/sibprogrammer/xq#commit=2842ec90a2d8143dd90211b083ace7325e6a3a8f
14 source = manpage-template.patch
15 b2sums = SKIP
16 b2sums = f2448e22798e018d6962016dc800ff96ae9c23b776742348a7036d613efa8c37e5c8c7a539804f2daebc4c152495cc1cbbcb2635fcf223e958596333cab1b843
17
18pkgname = xq
diff --git a/xq/.gitignore b/xq/.gitignore
new file mode 100644
index 0000000..c0d838f
--- /dev/null
+++ b/xq/.gitignore
@@ -0,0 +1,3 @@
1linux_amd64_xq
2linux_386_xq
3xq
diff --git a/xq/PKGBUILD b/xq/PKGBUILD
new file mode 100644
index 0000000..3d7c110
--- /dev/null
+++ b/xq/PKGBUILD
@@ -0,0 +1,94 @@
1# Maintainer: George Rawlinson <grawlinson@archlinux.org>
2
3pkgname=xq
4pkgver=1.2.3
5pkgrel=1
6pkgdesc='Command-line XML and HTML beautifier and content extractor'
7arch=('x86_64')
8url='https://github.com/sibprogrammer/xq'
9license=('MIT')
10depends=('glibc')
11makedepends=('git' 'go')
12conflicts=('yq')
13options=('!lto')
14_commit='2842ec90a2d8143dd90211b083ace7325e6a3a8f'
15source=(
16 "$pkgname::git+$url#commit=$_commit"
17 'manpage-template.patch'
18)
19b2sums=('SKIP'
20 'f2448e22798e018d6962016dc800ff96ae9c23b776742348a7036d613efa8c37e5c8c7a539804f2daebc4c152495cc1cbbcb2635fcf223e958596333cab1b843')
21
22pkgver() {
23 cd "$pkgname"
24
25 git describe --tags | sed 's/^v//'
26}
27
28prepare() {
29 cd "$pkgname"
30
31 # create directory for build output
32 mkdir build
33
34 # download dependencies
35 go mod download
36
37 # turn man page into a template
38 patch -p1 -i "$srcdir/manpage-template.patch"
39}
40
41build() {
42 cd "$pkgname"
43
44 # set Go flags
45 export CGO_CPPFLAGS="${CPPFLAGS}"
46 export CGO_CFLAGS="${CFLAGS}"
47 export CGO_CXXFLAGS="${CXXFLAGS}"
48 export GOPATH="${srcdir}"
49
50 # commit date for binary & man page
51 local _commit_date=$(git show --no-patch --format=%cd --date=format:%Y-%m-%d)
52
53 go build -v \
54 -buildmode=pie \
55 -mod=readonly \
56 -modcacherw \
57 -ldflags "-compressdwarf=false \
58 -linkmode external \
59 -extldflags ${LDFLAGS} \
60 -X main.commit=$_commit \
61 -X main.date=$_commit_date \
62 -X main.version=$pkgver" \
63 -o build \
64 .
65
66 # template-ify man page
67 sed \
68 -e "s/@DATE@/$_commit_date/" \
69 -e "s/@VERSION@/$pkgver/" \
70 -i docs/xq.man
71}
72
73check() {
74 cd "$pkgname"
75
76 go test -v ./...
77}
78
79package() {
80 cd "$pkgname"
81
82 # binary
83 install -vDm755 -t "$pkgdir/usr/bin" build/xq
84
85 # documentation
86 install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
87 cp -vr assets "$pkgdir/usr/share/doc/$pkgname"
88
89 # man
90 install -vDm644 docs/xq.man "$pkgdir/usr/share/man/man1/$pkgname.1"
91
92 # license
93 install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
94}
diff --git a/xq/manpage-template.patch b/xq/manpage-template.patch
new file mode 100644
index 0000000..32b64cf
--- /dev/null
+++ b/xq/manpage-template.patch
@@ -0,0 +1,9 @@
1--- a/docs/xq.man
2+++ b/docs/xq.man
3@@ -1,5 +1,5 @@
4 .\" Manpage for xq utility
5-.TH XQ 1 "06 Nov 2022" "" "xq man page"
6+.TH XQ 1 "@DATE@" "@VERSION@" "xq man page"
7 .SH NAME
8 xq - command-line XML and HTML beautifier and content extractor
9 .SH SYNOPSIS