apr: fix cross

This commit is contained in:
Jürgen Buchmüller 2020-01-30 15:49:52 +01:00
parent cd2e132ea1
commit 82c90f2f6b

View file

@ -11,15 +11,17 @@ license="Apache-2.0"
homepage="http://apr.apache.org/"
distfiles="http://www.apache.org/dist/apr/apr-${version}.tar.bz2"
checksum=e2e148f0b2e99b8e5c6caa09f6d4fb4dd3e83f744aa72a952f94f5a14436f7ea
nocross="mutex_proc_pthread_methods undeclared, configure args need to be fixed"
# Do not redefine struct iovec in include/apr_want.h
CFLAGS="-DAPR_IOVEC_DEFINED=1"
# Can't run test programs when cross compiling
if [ "$CROSS_BUILD" ]; then
configure_args+=" apr_cv_pthreads_cflags=-pthread"
configure_args+=" apr_cv_process_shared_works=yes"
configure_args+=" apr_cv_mutex_robust_shared=yes"
configure_args+=" apr_cv_tcp_nodelay_with_cork=yes"
configure_args+=" ac_cv_func_sem_open=sem_open"
fi
case "$XBPS_TARGET_MACHINE" in
@ -32,7 +34,13 @@ esac
pre_build() {
if [ "$CROSS_BUILD" ]; then
sed -i "/LINK_PROG.*OBJECTS_gen_test_char/s|.*|\t${BUILD_CC} ${BUILD_CFLAGS} tools/gen_test_char.c -o tools/gen_test_char|" Makefile
vsed -i Makefile \
-e "/LINK_PROG.*OBJECTS_gen_test_char/s|.*|\t${BUILD_CC} ${BUILD_CFLAGS} tools/gen_test_char.c -o tools/gen_test_char|"
# Fixup some not detected configure results to match native builds
vsed -i include/apr.h \
-e "/#define APR_HAVE_SHMEM_MMAP_ZERO/s;0;1;" \
-e "/#define APR_HAS_POSIXSEM_SERIALIZE/s;0;1;" \
-e "/#define APR_HAS_PROC_PTHREAD_SERIALIZE/s;0;1;"
fi
}