Name grep
Description A string search utility
Version 3.12-2
Package Base grep
Homepage https://www.gnu.org/software/grep/
Maintainers ['Christian Hesse <eworm@archlinux.org>', 'Sébastien Luttringer <seblu@archlinux.org>']
Contributors ['Allan McRae <allan@archlinux.org>', 'judd <jvinet@zeroflux.org>']
Distro-repo https://gitlab.archlinux.org/archlinux/packaging/packages/grep
Sources ['git+https://git.savannah.gnu.org/git/gnulib.git', 'git+https://git.savannah.gnu.org/git/grep.git#tag=v3.12?signed', 'https://ftp.gnu.org/gnu/grep/grep-3.12.tar.gz', 'https://ftp.gnu.org/gnu/grep/grep-3.12.tar.gz.sig']
Dependencies ['glibc', 'pcre2']
Optional-Dependencies []
Build-Dependencies ['gperf', 'git', 'python', 'texinfo', 'wget']
Provides []
Builddate 23-04-2025 10:22:35
Architecture x86_64
Distro-Version
Licenses ['GPL3']
Hash 9dd8a5dad99e8d388b1fb1406919de218d30c7e49924f615a12d3f2deaaecfe2
# Maintainer: Sébastien Luttringer <seblu@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

pkgname=grep
pkgver=3.12
pkgrel=2
pkgdesc='A string search utility'
arch=('x86_64')
license=('GPL-3.0-or-later')
url='https://www.gnu.org/software/grep/'
depends=('glibc' 'pcre2' 'sh')
makedepends=('gperf' 'git' 'python' 'texinfo' 'wget')
checkdepends=('glibc-locales')
validpgpkeys=('155D3FC500C834486D1EEA677FD9FCCB000BEEEE') # Jim Meyering <meyering@meta.com>
source=("git+https://git.savannah.gnu.org/git/grep.git#tag=v${pkgver}?signed"
        "git+https://git.savannah.gnu.org/git/gnulib.git"
        "https://ftp.gnu.org/gnu/grep/grep-${pkgver}.tar.gz"{,.sig})
sha256sums=('9543190d9ca2201ea46fddaeb39031a0acde1f6aa4351a72f33ef3455e6dd41e'
            'SKIP'
            'badda546dfc4b9d97e992e2c35f3b5c7f20522ffcbe2f01ba1e9cdcbe7644cdc'
            'SKIP')

prepare() {
  cd "${pkgname}"

  git submodule init
  git config submodule.gnulib.url "${srcdir}/gnulib"
  git -c protocol.file.allow=always submodule update

  git cherry-pick -n \
    '2e19d07ef1c08c3ce4771bb1bfee1ae6541f1c0d'

  ./bootstrap \
    --skip-po
}

build() {
  cd "${pkgname}"

  ./configure \
    --prefix=/usr \
    --disable-gcc-warnings
  make

  # Generate grep mo files from dist tarball
  cd "${srcdir}/${pkgname}-${pkgver}/po"
  for po in *.po; do
    msgfmt "${po}" -o "${po%.po}.mo"
  done
}

check() {
  cd "${pkgname}"

  make check
}

package() {
  cd "${pkgname}"

  make DESTDIR="$pkgdir" install

  # Install grep mo files from dist tarball
  cd "${srcdir}/${pkgname}-${pkgver}/po"
  for mo in *.mo; do
    install -Dm 644 "${mo}" "${pkgdir}/usr/share/locale/${mo%.mo}/LC_MESSAGES/${pkgname}.mo"
  done
}