# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=grep
pkgver=3.12
pkgrel=0
pkgdesc="Searches input files for lines containing a match to a specified pattern"
url="https://www.gnu.org/software/grep/grep.html"
arch="all"
license="GPL-3.0-or-later"
makedepends="pcre2-dev autoconf automake"
checkdepends="coreutils bash diffutils"
subpackages="$pkgname-doc"
source="https://mirrors.kernel.org/gnu/grep/grep-$pkgver.tar.xz"

build() {
	CFLAGS="$CFLAGS -flto=auto"\
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--bindir=/bin \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-nls
	make
}

check() {
	make check || {
		cat tests/test-suite.log
	}
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
c54b4db5a8b9afe098c088decd94977746305284d716666a60bac82b4edc0fae4acf828970b5b6fc7d58ecd549f638e17e6958f33a71fedcc7d7415b9228b161  grep-3.12.tar.xz
"
