5dc625424a06eb4745d11ce35c13bafba1be7a13
[gentoo.git] / dev-libs / libpcre2 / libpcre2-10.33-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit flag-o-matic libtool multilib-minimal toolchain-funcs usr-ldscript
7
8 PATCH_SET="${P}-patchset-1.0.tar.xz"
9
10 DESCRIPTION="Perl-compatible regular expression library"
11 HOMEPAGE="http://www.pcre.org/"
12 MY_P="pcre2-${PV/_rc/-RC}"
13 if [[ ${PV} != *_rc* ]] ; then
14         # Only the final releases are available here.
15         SRC_URI="mirror://sourceforge/pcre/${MY_P}.tar.bz2
16                 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${MY_P}.tar.bz2
17                 https://dev.gentoo.org/~whissi/dist/${PN}/${PATCH_SET}"
18 else
19         SRC_URI="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Testing/${MY_P}.tar.bz2"
20 fi
21
22 LICENSE="BSD"
23 SLOT="0"
24 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
25 IUSE="bzip2 +jit libedit pcre16 pcre32 +readline +recursion-limit static-libs unicode zlib"
26 REQUIRED_USE="?? ( libedit readline )"
27
28 BDEPEND="virtual/pkgconfig
29         userland_GNU? ( >=sys-apps/findutils-4.4.0 )"
30 RDEPEND="bzip2? ( app-arch/bzip2 )
31         zlib? ( sys-libs/zlib )
32         libedit? ( dev-libs/libedit )
33         readline? ( sys-libs/readline:0= )"
34 DEPEND="${RDEPEND}"
35
36 S="${WORKDIR}/${MY_P}"
37
38 MULTILIB_CHOST_TOOLS=(
39         /usr/bin/pcre2-config
40 )
41
42 src_prepare() {
43         [[ -d ${WORKDIR}/patches ]] && eapply "${WORKDIR}"/patches
44
45         default
46
47         elibtoolize
48 }
49
50 multilib_src_configure() {
51         local myeconfargs=(
52                 --enable-pcre2-8
53                 --enable-shared
54                 --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
55                 --with-match-limit-depth=$(usex recursion-limit 8192 MATCH_LIMIT)
56                 $(multilib_native_use_enable bzip2 pcre2grep-libbz2)
57                 $(multilib_native_use_enable libedit pcre2test-libedit)
58                 $(multilib_native_use_enable readline pcre2test-libreadline)
59                 $(multilib_native_use_enable zlib pcre2grep-libz)
60                 $(use_enable jit)
61                 $(use_enable jit pcre2grep-jit)
62                 $(use_enable pcre16 pcre2-16)
63                 $(use_enable pcre32 pcre2-32)
64                 $(use_enable static-libs static)
65                 $(use_enable unicode)
66         )
67         ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
68 }
69
70 multilib_src_compile() {
71         emake V=1 $(multilib_is_native_abi || echo "bin_PROGRAMS=")
72 }
73
74 multilib_src_install() {
75         emake \
76                 DESTDIR="${D}" \
77                 $(multilib_is_native_abi || echo "bin_PROGRAMS= dist_html_DATA=") \
78                 install
79         multilib_is_native_abi && gen_usr_ldscript -a pcre2-posix
80 }
81
82 multilib_src_install_all() {
83         find "${ED}" -name "*.la" -delete || die
84 }