dev-libs/libpcre: Bump to version 8.42
[gentoo.git] / dev-libs / libpcre / libpcre-8.41.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit eutils multilib libtool flag-o-matic toolchain-funcs multilib-minimal
7
8 DESCRIPTION="Perl-compatible regular expression library"
9 HOMEPAGE="http://www.pcre.org/"
10 MY_P="pcre-${PV/_rc/-RC}"
11 if [[ ${PV} != *_rc* ]] ; then
12         # Only the final releases are available here.
13         SRC_URI="mirror://sourceforge/pcre/${MY_P}.tar.bz2
14                 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${MY_P}.tar.bz2"
15 else
16         SRC_URI="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Testing/${MY_P}.tar.bz2"
17 fi
18
19 LICENSE="BSD"
20 SLOT="3"
21 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
22 IUSE="bzip2 +cxx +jit libedit pcre16 pcre32 +readline +recursion-limit static-libs unicode zlib"
23 REQUIRED_USE="readline? ( !libedit )
24         libedit? ( !readline )"
25
26 RDEPEND="
27         bzip2? ( app-arch/bzip2 )
28         zlib? ( sys-libs/zlib )
29         libedit? ( dev-libs/libedit )
30         readline? ( sys-libs/readline:0= )
31 "
32 DEPEND="
33         ${RDEPEND}
34         virtual/pkgconfig
35 "
36 RDEPEND="
37         ${RDEPEND}
38         abi_x86_32? (
39                 !<=app-emulation/emul-linux-x86-baselibs-20131008-r2
40                 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
41         )
42 "
43
44 S="${WORKDIR}/${MY_P}"
45
46 MULTILIB_CHOST_TOOLS=(
47         /usr/bin/pcre-config
48 )
49
50 PATCHES=(
51         "${FILESDIR}"/${PN}-8.41-sljit_mips-label-statement-fix.patch
52 )
53
54 src_prepare() {
55         epatch "${PATCHES[@]}"
56         sed -i -e "s:-lpcre ::" libpcrecpp.pc.in || die
57         elibtoolize
58 }
59
60 multilib_src_configure() {
61         local myeconfargs=(
62                 --with-match-limit-recursion=$(usex recursion-limit 8192 MATCH_LIMIT)
63                 $(multilib_native_use_enable bzip2 pcregrep-libbz2)
64                 $(use_enable cxx cpp)
65                 $(use_enable jit) $(use_enable jit pcregrep-jit)
66                 $(use_enable pcre16)
67                 $(use_enable pcre32)
68                 $(multilib_native_use_enable libedit pcretest-libedit)
69                 $(multilib_native_use_enable readline pcretest-libreadline)
70                 $(use_enable static-libs static)
71                 $(use_enable unicode utf) $(use_enable unicode unicode-properties)
72                 $(multilib_native_use_enable zlib pcregrep-libz)
73                 --enable-pcre8
74                 --enable-shared
75                 --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
76                 --docdir="${EPREFIX}"/usr/share/doc/${PF}
77         )
78         ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
79 }
80
81 multilib_src_compile() {
82         emake V=1 $(multilib_is_native_abi || echo "bin_PROGRAMS=")
83 }
84
85 multilib_src_install() {
86         emake \
87                 DESTDIR="${D}" \
88                 $(multilib_is_native_abi || echo "bin_PROGRAMS= dist_html_DATA=") \
89                 install
90         gen_usr_ldscript -a pcre
91 }
92
93 multilib_src_install_all() {
94         prune_libtool_files
95 }
96
97 pkg_preinst() {
98         preserve_old_lib /$(get_libdir)/libpcre.so.0
99 }
100
101 pkg_postinst() {
102         preserve_old_lib_notify /$(get_libdir)/libpcre.so.0
103 }