summaryrefslogtreecommitdiffstats
path: root/xq/PKGBUILD
diff options
context:
space:
mode:
authorYigit Sever2024-10-23 09:23:10 +0200
committerYigit Sever2024-10-23 09:23:10 +0200
commit9dc6e236688ed7f12ba8e5244034e54270126979 (patch)
tree386e6478cb73c083d198f6cdad244fedaba82683 /xq/PKGBUILD
parentc3cbc42ee9b8b83d776381df92db75e1e812c3cb (diff)
downloadpackages-9dc6e236688ed7f12ba8e5244034e54270126979.tar.gz
packages-9dc6e236688ed7f12ba8e5244034e54270126979.tar.bz2
packages-9dc6e236688ed7f12ba8e5244034e54270126979.zip
upgpkg: xq 1.2.5-1
upstream release
Diffstat (limited to 'xq/PKGBUILD')
-rw-r--r--xq/PKGBUILD85
1 files changed, 18 insertions, 67 deletions
diff --git a/xq/PKGBUILD b/xq/PKGBUILD
index 3d7c110..ed49aeb 100644
--- a/xq/PKGBUILD
+++ b/xq/PKGBUILD
@@ -1,86 +1,37 @@
1# Maintainer: George Rawlinson <grawlinson@archlinux.org> 1# Maintainer: Yigit Sever <yigit at yigitsever dot com>
2# Contributor: George Rawlinson <grawlinson@archlinux.org>
2 3
3pkgname=xq 4pkgname=xq
4pkgver=1.2.3 5pkgver=1.2.5
5pkgrel=1 6pkgrel=1
6pkgdesc='Command-line XML and HTML beautifier and content extractor' 7pkgdesc='Command-line XML and HTML beautifier and content extractor'
7arch=('x86_64') 8arch=('x86_64')
8url='https://github.com/sibprogrammer/xq' 9url='https://github.com/sibprogrammer/xq'
9license=('MIT') 10license=('MIT')
10depends=('glibc') 11makedepends=('go')
11makedepends=('git' 'go') 12source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
12conflicts=('yq') 13sha256sums=('9432a992d2f0ab82a7350da6317e27f835713c340177518dd08581bd0e918365')
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 14
28prepare() { 15prepare() {
29 cd "$pkgname" 16 cd "${pkgname}-${pkgver}"
30 17 mkdir -p build/
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} 18}
40 19
41build() { 20build() {
42 cd "$pkgname" 21 cd "${pkgname}-${pkgver}"
43 22 export CGO_CPPFLAGS="${CPPFLAGS}"
44 # set Go flags 23 export CGO_CFLAGS="${CFLAGS}"
45 export CGO_CPPFLAGS="${CPPFLAGS}" 24 export CGO_CXXFLAGS="${CXXFLAGS}"
46 export CGO_CFLAGS="${CFLAGS}" 25 export CGO_LDFLAGS="${LDFLAGS}"
47 export CGO_CXXFLAGS="${CXXFLAGS}" 26 export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
48 export GOPATH="${srcdir}" 27 go build -o build .
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} 28}
78 29
79package() { 30package() {
80 cd "$pkgname" 31 cd "${pkgname}-${pkgver}"
81 32
82 # binary 33 #binary
83 install -vDm755 -t "$pkgdir/usr/bin" build/xq 34 install -Dm755 build/$pkgname "$pkgdir/usr/bin/$pkgname"
84 35
85 # documentation 36 # documentation
86 install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md 37 install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md