summarylogtreecommitdiffstats
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)
downloadaur-ddd332e6920faa66166cb0ab0e222481452e01bc.tar.gz
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 a92e5889acdc..d33f894ca744 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,17 @@
-# Generated by mksrcinfo v8
-# Thu Mar 5 01:45:39 UTC 2020
pkgbase = xq
- pkgdesc = xml to json convert parser
- pkgver = 0.3.4
+ pkgdesc = Command-line XML and HTML beautifier and content extractor
+ pkgver = 1.0.0
pkgrel = 1
- url = https://github.com/syui/xq
+ url = https://github.com/sibprogrammer/xq
arch = x86_64
- arch = i686
license = MIT
- makedepends = go-pie
- source = xq-0.3.4::https://github.com/syui/xq/archive/0.3.4.tar.gz
- sha256sums = 6dc017cf06a598f8bc781a508ff0e63bbc5d7828026b8e7733dc387aec280ceb
+ makedepends = git
+ makedepends = go
+ depends = glibc
+ options = !lto
+ source = xq::git+https://github.com/sibprogrammer/xq#commit=21fca280a144fbf34ab1a58efa39acb495a46764
+ source = manpage-template.patch
+ b2sums = SKIP
+ b2sums = 4673d2c90996be27f5889f97541f1c4bd0c89c48d5b0573846d7e7a791bba3eaa66ca9774a054911d0014ee33e48bb19084fa3340a12756b2369928c4b951eb3
pkgname = xq
-
diff --git a/PKGBUILD b/PKGBUILD
index ba0cf85b133b..d7114b4e0cf4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,24 +1,91 @@
-# Maintainer: syui <syui@users.noreply.github.com>
+# Maintainer: George Rawlinson <grawlinson@archlinux.org>
+
pkgname=xq
-pkgver=0.3.4
+pkgver=1.0.0
pkgrel=1
-pkgdesc="xml to json convert parser"
-arch=('x86_64' 'i686')
-url="https://github.com/syui/xq"
-makedepends=('go-pie')
+pkgdesc='Command-line XML and HTML beautifier and content extractor'
+arch=('x86_64')
+url='https://github.com/sibprogrammer/xq'
license=('MIT')
-source=("${pkgname}-${pkgver}::${url}/archive/$pkgver.tar.gz")
-sha256sums=('6dc017cf06a598f8bc781a508ff0e63bbc5d7828026b8e7733dc387aec280ceb')
-build(){
- cd "${pkgname}-${pkgver}"
- go build \
+depends=('glibc')
+makedepends=('git' 'go')
+options=('!lto')
+_commit='21fca280a144fbf34ab1a58efa39acb495a46764'
+source=(
+ "$pkgname::git+$url#commit=$_commit"
+ 'manpage-template.patch'
+)
+b2sums=('SKIP'
+ '4673d2c90996be27f5889f97541f1c4bd0c89c48d5b0573846d7e7a791bba3eaa66ca9774a054911d0014ee33e48bb19084fa3340a12756b2369928c4b951eb3')
+
+pkgver() {
+ cd "$pkgname"
+
+ git describe --tags | sed 's/^v//'
+}
+
+prepare() {
+ cd "$pkgname"
+
+ # create directory for build output
+ mkdir build
+
+ # download dependencies
+ go mod download
+
+ # turn man page into a template
+ patch -p1 -i "$srcdir/manpage-template.patch"
+}
+
+build() {
+ cd "$pkgname"
+
+ # set Go flags
+ export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CFLAGS="${CFLAGS}"
+ export CGO_CXXFLAGS="${CXXFLAGS}"
+
+ # commit date for binary & man page
+ local _commit_date=$(git show --no-patch --format=%cd --date=format:%Y-%m-%d)
+
+ go build -v \
-trimpath \
- -ldflags "-extldflags ${LDFLAGS}" \
- -o $pkgname .
+ -buildmode=pie \
+ -mod=readonly \
+ -modcacherw \
+ -ldflags "-linkmode external -extldflags ${LDFLAGS} \
+ -X main.commit=$_commit \
+ -X main.date=$_commit_date \
+ -X main.version=$pkgver" \
+ -o build \
+ .
+
+ # template-ify man page
+ sed \
+ -e "s/@DATE@/$_commit_date/" \
+ -e "s/@VERSION@/$pkgver/" \
+ -i docs/xq.man
}
-package() {
- cd "${pkgname}-${pkgver}"
- install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
+
+check() {
+ cd "$pkgname"
+
+ go test -v ./...
}
-# vim:set ts=2 sw=2 et:
+package() {
+ cd "$pkgname"
+
+ # binary
+ install -vDm755 -t "$pkgdir/usr/bin" build/xq
+
+ # documentation
+ install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
+ cp -vr assets "$pkgdir/usr/share/doc/$pkgname"
+
+ # man
+ install -vDm644 docs/xq.man "$pkgdir/usr/share/man/man1/$pkgname.1"
+
+ # license
+ install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
+}
diff --git a/manpage-template.patch b/manpage-template.patch
new file mode 100644
index 000000000000..6dba9af786cb
--- /dev/null
+++ b/manpage-template.patch
@@ -0,0 +1,9 @@
+--- a/docs/xq.man
++++ b/docs/xq.man
+@@ -1,5 +1,5 @@
+ .\" Manpage for xq utility
+-.TH XQ 1 "06 Nov 2022" "0.0.8" "xq man page"
++.TH XQ 1 "@DATE@" "@VERSION@" "xq man page"
+ .SH NAME
+ xq - command-line XML and HTML beautifier and content extractor
+ .SH SYNOPSIS