xref: /OK3568_Linux_fs/buildroot/package/apr/apr.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# apr
4#
5################################################################################
6
7APR_VERSION = 1.7.0
8APR_SOURCE = apr-$(APR_VERSION).tar.bz2
9APR_SITE = http://archive.apache.org/dist/apr
10APR_LICENSE = Apache-2.0
11APR_LICENSE_FILES = LICENSE
12APR_CPE_ID_VENDOR = apache
13APR_CPE_ID_PRODUCT = portable_runtime
14APR_INSTALL_STAGING = YES
15# We have a patch touching configure.in and Makefile.in,
16# so we need to autoreconf:
17APR_AUTORECONF = YES
18
19# avoid apr_hints.m4 by setting apr_preload_done=yes and set
20# the needed CFLAGS on our own (avoids '-D_REENTRANT' in case
21# not supported by toolchain and subsequent configure failure)
22APR_CFLAGS = $(TARGET_CFLAGS) -DLINUX -D_GNU_SOURCE
23ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
24APR_CFLAGS += -D_REENTRANT
25endif
26
27APR_CONF_ENV = \
28	CC_FOR_BUILD="$(HOSTCC)" \
29	CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
30	CFLAGS="$(APR_CFLAGS)" \
31	ac_cv_file__dev_zero=yes \
32	ac_cv_func_setpgrp_void=yes \
33	apr_cv_process_shared_works=yes \
34	apr_cv_mutex_robust_shared=no \
35	apr_cv_tcp_nodelay_with_cork=yes \
36	ac_cv_sizeof_struct_iovec=8 \
37	ac_cv_sizeof_pid_t=4 \
38	ac_cv_struct_rlimit=yes \
39	ac_cv_o_nonblock_inherited=no \
40	apr_cv_mutex_recursive=yes \
41	apr_cv_epoll=yes \
42	apr_cv_epoll_create1=yes \
43	apr_cv_dup3=yes \
44	apr_cv_sock_cloexec=yes \
45	apr_cv_accept4=yes \
46	apr_preload_done=yes
47APR_CONFIG_SCRIPTS = apr-1-config
48
49# Doesn't even try to guess when cross compiling
50ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
51APR_CONF_ENV += apr_cv_pthreads_lib="-lpthread"
52endif
53
54# Fix lfs detection when cross compiling
55APR_CONF_ENV += apr_cv_use_lfs64=yes
56
57# Use non-portable atomics when available. We have to override
58# ap_cv_atomic_builtins because the test used to  check for atomic
59# builtins uses AC_TRY_RUN, which doesn't work when cross-compiling.
60ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_8),y)
61APR_CONF_OPTS += --enable-nonportable-atomics
62APR_CONF_ENV += ap_cv_atomic_builtins=yes
63else
64APR_CONF_OPTS += --disable-nonportable-atomics
65endif
66
67ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBUUID),y)
68APR_DEPENDENCIES += util-linux
69endif
70
71define APR_CLEANUP_UNNEEDED_FILES
72	$(RM) -rf $(TARGET_DIR)/usr/build-1/
73endef
74
75APR_POST_INSTALL_TARGET_HOOKS += APR_CLEANUP_UNNEEDED_FILES
76
77define APR_FIXUP_RULES_MK
78	$(SED) 's%apr_builddir=%apr_builddir=$(STAGING_DIR)%' \
79		$(STAGING_DIR)/usr/build-1/apr_rules.mk
80	$(SED) 's%apr_builders=%apr_builders=$(STAGING_DIR)%' \
81		$(STAGING_DIR)/usr/build-1/apr_rules.mk
82	$(SED) 's%top_builddir=%top_builddir=$(STAGING_DIR)%' \
83		$(STAGING_DIR)/usr/build-1/apr_rules.mk
84endef
85
86APR_POST_INSTALL_STAGING_HOOKS += APR_FIXUP_RULES_MK
87
88$(eval $(autotools-package))
89