dev-libs/fribidi: remove old
[gentoo.git] / dev-libs / apr / apr-1.6.3-r3.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit autotools libtool multilib toolchain-funcs
7
8 DESCRIPTION="Apache Portable Runtime Library"
9 HOMEPAGE="https://apr.apache.org/"
10 SRC_URI="mirror://apache/apr/${P}.tar.bz2"
11
12 LICENSE="Apache-2.0"
13 SLOT="1/${PV%.*}"
14 KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~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"
16
17 CDEPEND="elibc_glibc? ( >=sys-apps/util-linux-2.16 )
18         elibc_mintlib? ( >=sys-apps/util-linux-2.18 )"
19 RDEPEND="${CDEPEND}
20         selinux? ( sec-policy/selinux-apache )"
21 DEPEND="${CDEPEND}
22         >=sys-devel/libtool-2.4.2
23         doc? ( app-doc/doxygen )"
24
25 DOCS=( CHANGES NOTICE README )
26
27 PATCHES=(
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-fix-overflow-check-in-overflow_strfsize.patch
33         "${FILESDIR}"/${PN}-1.6.3-skip-known-failing-tests.patch
34 )
35
36 src_prepare() {
37         default
38
39         mv configure.in configure.ac || die
40         AT_M4DIR="build" eautoreconf
41         elibtoolize
42
43         eapply "${FILESDIR}/config.layout.patch"
44 }
45
46 src_configure() {
47         local myconf=(
48                 --enable-layout=gentoo
49                 --enable-nonportable-atomics
50                 --enable-posix-shm
51                 --enable-threads
52                 $(use_enable static-libs static)
53                 --with-installbuilddir=/usr/share/${PN}/build
54         )
55
56         [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
57
58         if use older-kernels-compatibility; then
59                 local apr_cv_accept4 apr_cv_dup3 apr_cv_epoll_create1 apr_cv_sock_cloexec
60                 export apr_cv_accept4="no"
61                 export apr_cv_dup3="no"
62                 export apr_cv_epoll_create1="no"
63                 export apr_cv_sock_cloexec="no"
64         fi
65         if tc-is-cross-compiler; then
66                 # The apache project relies heavily on AC_TRY_RUN and doesn't
67                 # have any sane cross-compiling fallback logic.
68                 export \
69                         ac_cv_file__dev_zero="yes" \
70                         ac_cv_func_sem_open="yes" \
71                         ac_cv_negative_eai="yes" \
72                         ac_cv_o_nonblock_inherited="no" \
73                         ac_cv_struct_rlimit="yes" \
74                         ap_cv_atomic_builtins="yes" \
75                         apr_cv_accept4="yes" \
76                         apr_cv_dup3="yes" \
77                         apr_cv_epoll="yes" \
78                         apr_cv_epoll_create1="yes" \
79                         apr_cv_gai_addrconfig="yes" \
80                         apr_cv_mutex_recursive="yes" \
81                         apr_cv_mutex_robust_shared="yes" \
82                         apr_cv_process_shared_works="yes" \
83                         apr_cv_pthreads_lib="-pthread" \
84                         apr_cv_sock_cloexec="yes" \
85                         apr_cv_tcp_nodelay_with_cork="yes"
86         fi
87
88         if use urandom; then
89                 myconf+=( --with-devrandom=/dev/urandom )
90         elif (( ${CHOST#*-hpux11.} <= 11 )); then
91                 : # no /dev/*random on hpux11.11 and before, $PN detects this.
92         else
93                 myconf+=( --with-devrandom=/dev/random )
94         fi
95
96         tc-is-static-only && myconf+=( --disable-dso )
97
98         # shl_load does not search runpath, but hpux11 supports dlopen
99         [[ ${CHOST} == *-hpux11* ]] && myconf+=( --enable-dso=dlfcn )
100
101         if [[ ${CHOST} == *-solaris2.10 ]]; then
102                 case $(<$([[ ${CHOST} != ${CBUILD} ]] && echo "${EPREFIX}/usr/${CHOST}")/usr/include/atomic.h) in
103                 *atomic_cas_ptr*) ;;
104                 *)
105                         elog "You do not have Solaris Patch ID "$(
106                                 [[ ${CHOST} == sparc* ]] && echo 118884 || echo 118885
107                         )" (Problem 4954703) installed on your host ($(hostname)),"
108                         elog "using generic atomic operations instead."
109                         myconf+=( --disable-nonportable-atomics )
110                         ;;
111                 esac
112         fi
113
114         econf "${myconf[@]}"
115 }
116
117 src_compile() {
118         if tc-is-cross-compiler; then
119                 # This header is the same across targets, so use the build compiler.
120                 emake tools/gen_test_char
121                 tc-export_build_env BUILD_CC
122                 ${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} \
123                         tools/gen_test_char.c -o tools/gen_test_char || die
124         fi
125
126         emake
127
128         if use doc; then
129                 emake dox
130         fi
131 }
132
133 src_test() {
134         # Building tests in parallel is broken
135         emake -j1 check
136 }
137
138 src_install() {
139         default
140
141         # Prallel install breaks since apr-1.5.1
142         #make -j1 DESTDIR="${D}" install || die
143
144         if ! use static-libs; then
145                 find "${ED%/}" -name '*.la' -delete || die
146         fi
147
148         if use doc; then
149                 docinto html
150                 dodoc -r docs/dox/html/*
151         fi
152
153         # This file is only used on AIX systems, which Gentoo is not,
154         # and causes collisions between the SLOTs, so remove it.
155         # Even in Prefix, we don't need this on AIX.
156         rm -f "${ED%/}/usr/$(get_libdir)/apr.exp"
157 }