summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Rawlinson2022-11-13 21:06:25 +1300
committerGeorge Rawlinson2022-11-13 21:06:25 +1300
commitddd332e6920faa66166cb0ab0e222481452e01bc (patch)
tree3b0f8a78c5ccd685a02b73f4d91421f84428ba44
parent807d7c80d6c090a588f4506c86a47f7f64ccee3f (diff)
downloadpackages-ddd332e6920faa66166cb0ab0e222481452e01bc.tar.gz
packages-ddd332e6920faa66166cb0ab0e222481452e01bc.tar.bz2
packages-ddd332e6920faa66166cb0ab0e222481452e01bc.zip
addpkg: xq 1.0.0-1
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD101
-rw-r--r--manpage-template.patch9
3 files changed, 104 insertions, 27 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a92e588..d33f894 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,17 @@
1# Generated by mksrcinfo v8
2# Thu Mar 5 01:45:39 UTC 2020
3pkgbase = xq 1pkgbase = xq
4 pkgdesc = xml to json convert parser 2 pkgdesc = Command-line XML and HTML beautifier and content extractor
5 pkgver = 0.3.4 3 pkgver = 1.0.0
6 pkgrel = 1 4 pkgrel = 1
7 url = https://github.com/syui/xq 5 url = https://github.com/sibprogrammer/xq
8 arch = x86_64 6 arch = x86_64
9 arch = i686
10 license = MIT 7 license = MIT
11 makedepends = go-pie 8 makedepends = git
12 source = xq-0.3.4::https://github.com/syui/xq/archive/0.3.4.tar.gz 9 makedepends = go
13 sha256sums = 6dc017cf06a598f8bc781a508ff0e63bbc5d7828026b8e7733dc387aec280ceb 10 depends = glibc
11 options = !lto
12 source = xq::git+https://github.com/sibprogrammer/xq#commit=21fca280a144fbf34ab1a58efa39acb495a46764
13 source = manpage-template.patch
14 b2sums = SKIP
15 b2sums = 4673d2c90996be27f5889f97541f1c4bd0c89c48d5b0573846d7e7a791bba3eaa66ca9774a054911d0014ee33e48bb19084fa3340a12756b2369928c4b951eb3
14 16
15pkgname = xq 17pkgname = xq
16
diff --git a/PKGBUILD b/PKGBUILD
index ba0cf85..d7114b4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,24 +1,91 @@
1# Maintainer: syui <syui@users.noreply.github.com> 1# Maintainer: George Rawlinson <grawlinson@archlinux.org>
2
2pkgname=xq 3pkgname=xq
3pkgver=0.3.4 4pkgver=1.0.0
4pkgrel=1 5pkgrel=1
5pkgdesc="xml to json convert parser" 6pkgdesc='Command-line XML and HTML beautifier and content extractor'
6arch=('x86_64' 'i686') 7arch=('x86_64')
7url="https://github.com/syui/xq" 8url='https://github.com/sibprogrammer/xq'
8makedepends=('go-pie')
9license=('MIT') 9license=('MIT')
10source=("${pkgname}-${pkgver}::${url}/archive/$pkgver.tar.gz") 10depends=('glibc')
11sha256sums=('6dc017cf06a598f8bc781a508ff0e63bbc5d7828026b8e7733dc387aec280ceb') 11makedepends=('git' 'go')
12build(){ 12options=('!lto')
13 cd "${pkgname}-${pkgver}" 13_commit='21fca280a144fbf34ab1a58efa39acb495a46764'
14 go build \ 14source=(
15 "$pkgname::git+$url#commit=$_commit"
16 'manpage-template.patch'
17)
18b2sums=('SKIP'
19 '4673d2c90996be27f5889f97541f1c4bd0c89c48d5b0573846d7e7a791bba3eaa66ca9774a054911d0014ee33e48bb19084fa3340a12756b2369928c4b951eb3')
20
21pkgver() {
22 cd "$pkgname"
23
24 git describe --tags | sed 's/^v//'
25}
26
27prepare() {
28 cd "$pkgname"
29
30 # create directory for build output
31 mkdir build
32
33 # download dependencies
34 go mod download
35
36 # turn man page into a template
37 patch -p1 -i "$srcdir/manpage-template.patch"
38}
39
40build() {
41 cd "$pkgname"
42
43 # set Go flags
44 export CGO_CPPFLAGS="${CPPFLAGS}"
45 export CGO_CFLAGS="${CFLAGS}"
46 export CGO_CXXFLAGS="${CXXFLAGS}"
47
48 # commit date for binary & man page
49 local _commit_date=$(git show --no-patch --format=%cd --date=format:%Y-%m-%d)
50
51 go build -v \
15 -trimpath \ 52 -trimpath \
16 -ldflags "-extldflags ${LDFLAGS}" \ 53 -buildmode=pie \
17 -o $pkgname . 54 -mod=readonly \
55 -modcacherw \
56 -ldflags "-linkmode external -extldflags ${LDFLAGS} \
57 -X main.commit=$_commit \
58 -X main.date=$_commit_date \
59 -X main.version=$pkgver" \
60 -o build \
61 .
62
63 # template-ify man page
64 sed \
65 -e "s/@DATE@/$_commit_date/" \
66 -e "s/@VERSION@/$pkgver/" \
67 -i docs/xq.man
18} 68}
19package() { 69
20 cd "${pkgname}-${pkgver}" 70check() {
21 install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname" 71 cd "$pkgname"
72
73 go test -v ./...
22} 74}
23 75
24# vim:set ts=2 sw=2 et: 76package() {
77 cd "$pkgname"
78
79 # binary
80 install -vDm755 -t "$pkgdir/usr/bin" build/xq
81
82 # documentation
83 install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
84 cp -vr assets "$pkgdir/usr/share/doc/$pkgname"
85
86 # man
87 install -vDm644 docs/xq.man "$pkgdir/usr/share/man/man1/$pkgname.1"
88
89 # license
90 install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
91}
diff --git a/manpage-template.patch b/manpage-template.patch
new file mode 100644
index 0000000..6dba9af
--- /dev/null
+++ b/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" "0.0.8" "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