1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools libtool multilib toolchain-funcs
8 DESCRIPTION="Apache Portable Runtime Library"
9 HOMEPAGE="https://apr.apache.org/"
10 SRC_URI="mirror://apache/apr/${P}.tar.bz2"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~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"
15 IUSE="doc elibc_FreeBSD older-kernels-compatibility selinux static-libs +urandom"
17 CDEPEND="elibc_glibc? ( >=sys-apps/util-linux-2.16 )
18 elibc_mintlib? ( >=sys-apps/util-linux-2.18 )"
20 selinux? ( sec-policy/selinux-base-policy )"
22 >=sys-devel/libtool-2.4.2
23 doc? ( app-doc/doxygen )"
25 DOCS=( CHANGES NOTICE README )
28 "${FILESDIR}"/${PN}-1.5.0-mint.patch
29 "${FILESDIR}"/${PN}-1.5.0-libtool.patch
30 "${FILESDIR}"/${PN}-1.5.0-cross-types.patch
31 "${FILESDIR}"/${PN}-1.5.0-sysroot.patch #385775
32 "${FILESDIR}"/${PN}-1.6.3-skip-known-failing-tests.patch
38 mv configure.in configure.ac || die
39 AT_M4DIR="build" eautoreconf
42 eapply "${FILESDIR}/config.layout.patch"
47 --enable-layout=gentoo
48 --enable-nonportable-atomics
51 $(use_enable static-libs static)
52 --with-installbuilddir="${EPREFIX}"/usr/share/${PN}/build
55 [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
57 if use older-kernels-compatibility; then
58 local apr_cv_accept4 apr_cv_dup3 apr_cv_epoll_create1 apr_cv_sock_cloexec
59 export apr_cv_accept4="no"
60 export apr_cv_dup3="no"
61 export apr_cv_epoll_create1="no"
62 export apr_cv_sock_cloexec="no"
64 if tc-is-cross-compiler; then
65 # The apache project relies heavily on AC_TRY_RUN and doesn't
66 # have any sane cross-compiling fallback logic.
68 ac_cv_file__dev_zero="yes" \
69 ac_cv_func_sem_open="yes" \
70 ac_cv_negative_eai="yes" \
71 ac_cv_o_nonblock_inherited="no" \
72 ac_cv_struct_rlimit="yes" \
73 ap_cv_atomic_builtins="yes" \
74 apr_cv_accept4="yes" \
77 apr_cv_epoll_create1="yes" \
78 apr_cv_gai_addrconfig="yes" \
79 apr_cv_mutex_recursive="yes" \
80 apr_cv_mutex_robust_shared="yes" \
81 apr_cv_process_shared_works="yes" \
82 apr_cv_pthreads_lib="-pthread" \
83 apr_cv_sock_cloexec="yes" \
84 apr_cv_tcp_nodelay_with_cork="yes"
88 myconf+=( --with-devrandom=/dev/urandom )
89 elif (( ${CHOST#*-hpux11.} <= 11 )); then
90 : # no /dev/*random on hpux11.11 and before, $PN detects this.
92 myconf+=( --with-devrandom=/dev/random )
95 tc-is-static-only && myconf+=( --disable-dso )
97 # shl_load does not search runpath, but hpux11 supports dlopen
98 [[ ${CHOST} == *-hpux11* ]] && myconf+=( --enable-dso=dlfcn )
100 if [[ ${CHOST} == *-solaris2.10 ]]; then
101 case $(<$([[ ${CHOST} != ${CBUILD} ]] && echo "${EPREFIX}/usr/${CHOST}")/usr/include/atomic.h) in
104 elog "You do not have Solaris Patch ID "$(
105 [[ ${CHOST} == sparc* ]] && echo 118884 || echo 118885
106 )" (Problem 4954703) installed on your host ($(hostname)),"
107 elog "using generic atomic operations instead."
108 myconf+=( --disable-nonportable-atomics )
117 if tc-is-cross-compiler; then
118 # This header is the same across targets, so use the build compiler.
119 emake tools/gen_test_char
120 tc-export_build_env BUILD_CC
121 ${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} \
122 tools/gen_test_char.c -o tools/gen_test_char || die
133 # Building tests in parallel is broken
140 if ! use static-libs; then
141 find "${ED}" -name '*.la' -delete || die
146 dodoc -r docs/dox/html/*
149 # This file is only used on AIX systems, which Gentoo is not,
150 # and causes collisions between the SLOTs, so remove it.
151 # Even in Prefix, we don't need this on AIX.
152 rm "${ED}/usr/$(get_libdir)/apr.exp" || die