diff options
Diffstat (limited to 'xq')
-rw-r--r-- | xq/.SRCINFO | 12 | ||||
-rw-r--r-- | xq/PKGBUILD | 85 |
2 files changed, 21 insertions, 76 deletions
diff --git a/xq/.SRCINFO b/xq/.SRCINFO index c759b26..3a307a5 100644 --- a/xq/.SRCINFO +++ b/xq/.SRCINFO | |||
@@ -1,18 +1,12 @@ | |||
1 | pkgbase = xq | 1 | pkgbase = xq |
2 | pkgdesc = Command-line XML and HTML beautifier and content extractor | 2 | pkgdesc = Command-line XML and HTML beautifier and content extractor |
3 | pkgver = 1.2.3 | 3 | pkgver = 1.2.5 |
4 | pkgrel = 1 | 4 | pkgrel = 1 |
5 | url = https://github.com/sibprogrammer/xq | 5 | url = https://github.com/sibprogrammer/xq |
6 | arch = x86_64 | 6 | arch = x86_64 |
7 | license = MIT | 7 | license = MIT |
8 | makedepends = git | ||
9 | makedepends = go | 8 | makedepends = go |
10 | depends = glibc | 9 | source = xq-1.2.5.tar.gz::https://github.com/sibprogrammer/xq/archive/refs/tags/v1.2.5.tar.gz |
11 | conflicts = yq | 10 | sha256sums = 9432a992d2f0ab82a7350da6317e27f835713c340177518dd08581bd0e918365 |
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 | 11 | ||
18 | pkgname = xq | 12 | pkgname = xq |
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 | ||
3 | pkgname=xq | 4 | pkgname=xq |
4 | pkgver=1.2.3 | 5 | pkgver=1.2.5 |
5 | pkgrel=1 | 6 | pkgrel=1 |
6 | pkgdesc='Command-line XML and HTML beautifier and content extractor' | 7 | pkgdesc='Command-line XML and HTML beautifier and content extractor' |
7 | arch=('x86_64') | 8 | arch=('x86_64') |
8 | url='https://github.com/sibprogrammer/xq' | 9 | url='https://github.com/sibprogrammer/xq' |
9 | license=('MIT') | 10 | license=('MIT') |
10 | depends=('glibc') | 11 | makedepends=('go') |
11 | makedepends=('git' 'go') | 12 | source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz") |
12 | conflicts=('yq') | 13 | sha256sums=('9432a992d2f0ab82a7350da6317e27f835713c340177518dd08581bd0e918365') |
13 | options=('!lto') | ||
14 | _commit='2842ec90a2d8143dd90211b083ace7325e6a3a8f' | ||
15 | source=( | ||
16 | "$pkgname::git+$url#commit=$_commit" | ||
17 | 'manpage-template.patch' | ||
18 | ) | ||
19 | b2sums=('SKIP' | ||
20 | 'f2448e22798e018d6962016dc800ff96ae9c23b776742348a7036d613efa8c37e5c8c7a539804f2daebc4c152495cc1cbbcb2635fcf223e958596333cab1b843') | ||
21 | |||
22 | pkgver() { | ||
23 | cd "$pkgname" | ||
24 | |||
25 | git describe --tags | sed 's/^v//' | ||
26 | } | ||
27 | 14 | ||
28 | prepare() { | 15 | prepare() { |
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 | ||
41 | build() { | 20 | build() { |
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 | |||
73 | check() { | ||
74 | cd "$pkgname" | ||
75 | |||
76 | go test -v ./... | ||
77 | } | 28 | } |
78 | 29 | ||
79 | package() { | 30 | package() { |
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 |