summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: effb597159d538c6e882d7ef6e2b7b34bcc05e63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Maintainer: aksr <aksr at t-com dot me>
pkgname=nawk-git
pkgver=20231001.r288.d8e4368
pkgrel=1
pkgdesc='The version of awk described in "The AWK Programming Language".'
arch=('i686' 'x86_64')
url='https://github.com/onetrueawk/awk'
license=('MIT')
depends=(glibc)
makedepends=(git)
provides=("${pkgname%-*}")
conflicts=("${pkgname%-*}")
options=('!makeflags')
source=("$pkgname::git+$url"
        "${pkgname}-bsd::git+$url#branch=bsd-features")
md5sums=('SKIP' 'SKIP')

pkgver() {
	cd "$srcdir/$pkgname"
	printf "%s.r%s.%s" "$(grep '*version' main.c | sed 's/.*version //;s/";//')" \
		"$(git rev-list --count HEAD)" \
		"$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$srcdir/$pkgname"
	sed -i 's/^\.TH AWK/.TH NAWK/;s/awk/nawk/g;s/Awk/Nawk/' awk.1
	sed -i '/^\.CT .*/d;/^\.TF .*/d' awk.1
	cd "$srcdir/$pkgname-bsd"
	sed -i 's/^\.TH AWK/.TH NAWK-BSD/;s/awk/nawk-bsd/g;s/Awk/Nawk-BSD/' awk.1
	sed -i '/^\.CT .*/d;/^\.TF .*/d' awk.1
}

build() {
	cd "$srcdir/$pkgname"
	make "CPPFLAGS=-DHAS_ISBLANK $CPPFLAGS" "LDFLAGS=$LDFLAGS" "CFLAGS=$CFLAGS"
	cd "$srcdir/$pkgname-bsd"
	make "CPPFLAGS=-DHAS_ISBLANK $CPPFLAGS" "LDFLAGS=$LDFLAGS" "CFLAGS=$CFLAGS"
}

check() {
	cd "$srcdir/$pkgname"
	./REGRESS
	cd "$srcdir/$pkgname-bsd"
	./REGRESS
}

package() {
	cd "$srcdir/$pkgname"
	install -Dm755 a.out "$pkgdir/usr/bin/nawk"
	install -Dm644 awk.1 "$pkgdir/usr/share/man/man1/nawk.1"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/nawk/LICENSE"
	cd "$srcdir/$pkgname-bsd"
	install -Dm755 a.out "$pkgdir/usr/bin/nawk-bsd"
	install -Dm644 awk.1 "$pkgdir/usr/share/man/man1/nawk-bsd.1"
}