summaryrefslogtreecommitdiffstats
path: root/grep-compat/PKGBUILD
blob: 38bf6b5c3087415beeb8bba23f367643188591d0 (plain) (blame)
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
58
59
60
61
# Maintainer: kj_sh604 <406hs_jk@proton.me>

pkgname=grep-compat
_pkgname=grep
pkgver=3.12
pkgrel=2
pkgdesc='A string search utility (without egrep and fgrep warnings when used in scripts)'
arch=('x86_64')
license=('GPL3')
url='https://www.gnu.org/software/grep/'
depends=('glibc' 'pcre2')
makedepends=('gperf' 'git' 'python' 'texinfo' 'wget')
provides=('grep')
conflicts=('grep')
source=("git+https://git.savannah.gnu.org/git/grep.git#tag=v${pkgver}"
        "git+https://git.savannah.gnu.org/git/gnulib.git")
sha256sums=('9543190d9ca2201ea46fddaeb39031a0acde1f6aa4351a72f33ef3455e6dd41e'
            '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'

  sh bootstrap
}

build() {
  cd $_pkgname
  ./configure --prefix=/usr
  make
}

check() {
  cd $_pkgname
  make check
}

package() {
  cd $_pkgname
  make DESTDIR="$pkgdir" install

  # add egrep wrapper script with no warnings
  install -Dm755 /dev/stdin "$pkgdir/usr/bin/egrep" <<END
#!/bin/sh
cmd=\${0##*/}
exec grep -E "\$@"
END

  # add fgrep wrapper script with no warnings
  install -Dm755 /dev/stdin "$pkgdir/usr/bin/fgrep" <<END
#!/bin/sh
cmd=\${0##*/}
exec grep -F "\$@"
END
}