*/*: Discontinue Gentoo SuperH port
[gentoo.git] / dev-libs / apr / apr-1.7.0-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 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 ~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"
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-base-policy )"
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-skip-known-failing-tests.patch
33 )
34
35 src_prepare() {
36         default
37
38         mv configure.in configure.ac || die
39         AT_M4DIR="build" eautoreconf
40         elibtoolize
41
42         eapply "${FILESDIR}/config.layout.patch"
43 }
44
45 src_configure() {
46         local myconf=(
47                 --enable-layout=gentoo
48                 --enable-nonportable-atomics
49                 --enable-posix-shm
50                 --enable-threads
51                 $(use_enable static-libs static)
52                 --with-installbuilddir="${EPREFIX}"/usr/share/${PN}/build
53         )
54
55         [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
56
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"
63         fi
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.
67                 export \
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" \
75                         apr_cv_dup3="yes" \
76                         apr_cv_epoll="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"
85         fi
86
87         if use urandom; then
88                 myconf+=( --with-devrandom=/dev/urandom )
89         elif (( ${CHOST#*-hpux11.} <= 11 )); then
90                 : # no /dev/*random on hpux11.11 and before, $PN detects this.
91         else
92                 myconf+=( --with-devrandom=/dev/random )
93         fi
94
95         tc-is-static-only && myconf+=( --disable-dso )
96
97         # shl_load does not search runpath, but hpux11 supports dlopen
98         [[ ${CHOST} == *-hpux11* ]] && myconf+=( --enable-dso=dlfcn )
99
100         if [[ ${CHOST} == *-solaris2.10 ]]; then
101                 case $(<$([[ ${CHOST} != ${CBUILD} ]] && echo "${EPREFIX}/usr/${CHOST}")/usr/include/atomic.h) in
102                 *atomic_cas_ptr*) ;;
103                 *)
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 )
109                         ;;
110                 esac
111         fi
112
113         econf "${myconf[@]}"
114 }
115
116 src_compile() {
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
123         fi
124
125         emake
126
127         if use doc; then
128                 emake dox
129         fi
130 }
131
132 src_test() {
133         # Building tests in parallel is broken
134         emake -j1 check
135 }
136
137 src_install() {
138         default
139
140         if ! use static-libs; then
141                 find "${ED}" -name '*.la' -delete || die
142         fi
143
144         if use doc; then
145                 docinto html
146                 dodoc -r docs/dox/html/*
147         fi
148
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
153 }