1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/grep.asc
|
7 |
|
inherit flag-o-matic toolchain-funcs verify-sig
|
|
7 |
inherit flag-o-matic verify-sig
|
8 |
8 |
|
9 |
9 |
DESCRIPTION="GNU regular expression matcher"
|
10 |
10 |
HOMEPAGE="https://www.gnu.org/software/grep/"
|
11 |
|
SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
|
12 |
|
SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )"
|
|
11 |
|
|
12 |
if [[ ${PV} == *_p* ]] ; then
|
|
13 |
# Subscribe to the 'platform-testers' ML to find these.
|
|
14 |
# Useful to test on our especially more niche arches and report issues upstream.
|
|
15 |
MY_COMMIT="98-c9ac"
|
|
16 |
MY_P=${PN}-$(ver_cut 1-2).${MY_COMMIT}
|
|
17 |
SRC_URI="https://meyering.net/${PN}/${MY_P}.tar.xz"
|
|
18 |
SRC_URI+=" verify-sig? ( https://meyering.net/${PN}/${MY_P}.tar.xz.sig )"
|
|
19 |
S="${WORKDIR}"/${MY_P}
|
|
20 |
else
|
|
21 |
SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
|
|
22 |
SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )"
|
|
23 |
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
|
24 |
fi
|
13 |
25 |
|
14 |
26 |
LICENSE="GPL-3+"
|
15 |
27 |
SLOT="0"
|
16 |
|
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
17 |
|
IUSE="nls pcre static"
|
|
28 |
IUSE="+egrep-fgrep nls pcre static"
|
18 |
29 |
|
19 |
30 |
# We lack dev-libs/libsigsegv[static-libs] for now
|
20 |
31 |
REQUIRED_USE="static? ( !sparc )"
|
21 |
32 |
|
22 |
|
LIB_DEPEND="pcre? ( >=dev-libs/libpcre-7.8-r1[static-libs(+)] )
|
|
33 |
LIB_DEPEND="pcre? ( >=dev-libs/libpcre2-7.8-r1[static-libs(+)] )
|
23 |
34 |
sparc? ( dev-libs/libsigsegv )"
|
24 |
35 |
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
|
25 |
36 |
nls? ( virtual/libintl )
|
26 |
37 |
virtual/libiconv"
|
27 |
38 |
DEPEND="${RDEPEND}
|
28 |
39 |
static? ( ${LIB_DEPEND} )"
|
29 |
|
BDEPEND="
|
30 |
|
virtual/pkgconfig
|
|
40 |
BDEPEND="virtual/pkgconfig
|
31 |
41 |
nls? ( sys-devel/gettext )
|
32 |
42 |
verify-sig? ( sec-keys/openpgp-keys-grep )"
|
33 |
43 |
|
34 |
|
PATCHES=(
|
35 |
|
"${FILESDIR}/ppc-musl.patch"
|
36 |
|
"${FILESDIR}/loong-fix-build.patch"
|
37 |
|
)
|
38 |
|
|
39 |
44 |
DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
|
40 |
45 |
|
41 |
46 |
src_prepare() {
|
|
47 |
default
|
|
48 |
|
|
49 |
# bug #523898
|
42 |
50 |
sed -i \
|
43 |
51 |
-e "s:@SHELL@:${EPREFIX}/bin/sh:g" \
|
44 |
52 |
-e "s:@grep@:${EPREFIX}/bin/grep:" \
|
45 |
|
src/egrep.sh || die #523898
|
46 |
|
|
47 |
|
default
|
48 |
|
|
49 |
|
# touch generated files after patching m4, to avoid activating maintainer
|
50 |
|
# mode
|
51 |
|
# remove when loong-fix-build.patch is no longer necessary
|
52 |
|
touch ./aclocal.m4 ./config.hin ./configure || die
|
53 |
|
find . -name Makefile.in -exec touch {} + || die
|
|
53 |
src/egrep.sh || die
|
54 |
54 |
}
|
55 |
55 |
|
56 |
56 |
src_configure() {
|
... | ... | |
62 |
62 |
# In particular, it's necessary for sparc: bug #768135
|
63 |
63 |
export ac_cv_libsigsegv=$(usex sparc)
|
64 |
64 |
|
65 |
|
# Always use pkg-config to get lib info for pcre.
|
66 |
|
export ac_cv_search_pcre_compile=$(
|
67 |
|
usex pcre "$($(tc-getPKG_CONFIG) --libs $(usex static --static '') libpcre)" ''
|
68 |
|
)
|
69 |
65 |
local myeconfargs=(
|
70 |
66 |
--bindir="${EPREFIX}"/bin
|
71 |
67 |
$(use_enable nls)
|
72 |
68 |
$(use_enable pcre perl-regexp)
|
73 |
69 |
)
|
|
70 |
|
74 |
71 |
econf "${myeconfargs[@]}"
|
75 |
72 |
}
|
|
73 |
|
|
74 |
src_install() {
|
|
75 |
default
|
|
76 |
|
|
77 |
if use egrep-fgrep ; then
|
|
78 |
# Delete the upstream wrapper variants which warn on egrep+fgrep use
|
|
79 |
rm "${ED}"/bin/{egrep,fgrep} || die
|
|
80 |
|
|
81 |
into /
|
|
82 |
# Install egrep, fgrep which don't warn.
|
|
83 |
#
|
|
84 |
# We do this by default to avoid breakage in old scripts
|
|
85 |
# and such which don't expect unexpected output on stderr,
|
|
86 |
# we've had examples of builds failing because foo-config
|
|
87 |
# starts returning a warning.
|
|
88 |
#
|
|
89 |
# https://lists.gnu.org/archive/html/bug-grep/2022-10/msg00000.html
|
|
90 |
newbin - egrep <<-EOF
|
|
91 |
#!/usr/bin/env sh
|
|
92 |
exec "${EPREFIX}/bin/grep" -E "\$@"
|
|
93 |
EOF
|
|
94 |
|
|
95 |
newbin - fgrep <<-EOF
|
|
96 |
#!/usr/bin/env sh
|
|
97 |
exec "${EPREFIX}/bin/grep" -F "\$@"
|
|
98 |
EOF
|
|
99 |
fi
|
|
100 |
}
|