diff --git a/nawk/PKGBUILD b/nawk/PKGBUILD new file mode 100644 index 00000000..91ee4bb0 --- /dev/null +++ b/nawk/PKGBUILD @@ -0,0 +1,38 @@ +# Maintainer: Andrew Sun + +pkgname=nawk +pkgver=20121220 +pkgrel=1 +pkgdesc="The one, true implementation of AWK" +url="https://www.cs.princeton.edu/~bwk/btl.mirror/" +license=('MIT') +arch=('i686' 'x86_64') +options=('!makeflags') +depends=('msys2-runtime') +source=("${pkgname}-${pkgver}.tar.gz::https://www.cs.princeton.edu/~bwk/btl.mirror/awk.tar.gz" + 'manpage-naming.patch') +md5sums=('b74ca7f8f4284fc82ccee6b4e34531d8' + '8486d387a51fe3b3c9875c4151ad92b4') + +prepare() { + # awk -> nawk + patch -Np1 <"${srcdir}"/manpage-naming.patch + + # create license + sed -n '/Copyright/,/THIS SOFTWARE\./p' README > LICENSE + + # fix build + sed -i '/YACC = yacc -d -S/ s|^|#|' makefile +} + +build() { + make "CPPFLAGS=-DHAS_ISBLANK ${CPPFLAGS}" \ + "LDFLAGS=${LDFLAGS}" \ + "CFLAGS=${CFLAGS}" +} + +package() { + install -Dm755 a.exe "${pkgdir}/usr/bin/nawk.exe" + install -Dm644 awk.1 "${pkgdir}/usr/share/man/man1/nawk.1" + install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/nawk/LICENSE" +} \ No newline at end of file diff --git a/nawk/manpage-naming.patch b/nawk/manpage-naming.patch new file mode 100644 index 00000000..782f5e42 --- /dev/null +++ b/nawk/manpage-naming.patch @@ -0,0 +1,46 @@ +diff -uNr ./nawk-20100523.orig/awk.1 nawk-20100523/awk.1 +--- ./nawk-20100523.orig/awk.1 2007-03-31 16:56:19.000000000 -0400 ++++ nawk-20100523/awk.1 2010-09-20 21:49:16.840069318 -0400 +@@ -7,13 +7,11 @@ + .fi + .ft 1 + .. +-awk +-.TH AWK 1 +-.CT 1 files prog_other ++.TH NAWK 1 + .SH NAME +-awk \- pattern-directed scanning and processing language ++nawk \- pattern-directed scanning and processing language + .SH SYNOPSIS +-.B awk ++.B nawk + [ + .BI \-F + .I fs +@@ -32,7 +30,7 @@ + .I file ... + ] + .SH DESCRIPTION +-.I Awk ++.I Nawk + scans each input + .I file + for lines that match any of a set of patterns specified literally in +@@ -198,7 +196,6 @@ + .BR atan2 + are built in. + Other built-in functions: +-.TF length + .TP + .B length + the length of its argument +@@ -407,7 +404,6 @@ + do not combine with other patterns. + .PP + Variable names with special meanings: +-.TF FILENAME + .TP + .B CONVFMT + conversion format used when converting numbers +