| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2007-2011 OpenWrt.org |
| 3 | # |
| 4 | # This is free software, licensed under the GNU General Public License v2. |
| 5 | # See /LICENSE for more information. |
| 6 | # |
| 7 | |
| 8 | include $(TOPDIR)/rules.mk |
| 9 | |
| 10 | PKG_NAME:=apr |
| 11 | PKG_VERSION:=1.7.5 |
| 12 | PKG_RELEASE:=1 |
| 13 | |
| 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 15 | PKG_SOURCE_URL:=@APACHE/apr/ |
| 16 | PKG_HASH:=cd0f5d52b9ab1704c72160c5ee3ed5d3d4ca2df4a7f8ab564e3cb352b67232f2 |
| 17 | |
| 18 | PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de> |
| 19 | |
| 20 | PKG_LICENSE:=Apache-2.0 |
| 21 | PKG_LICENSE_FILES:=LICENSE |
| 22 | |
| 23 | PKG_CPE_ID:=cpe:/a:apache:portable_runtime |
| 24 | |
| 25 | PKG_BUILD_PARALLEL:=1 |
| 26 | |
| 27 | PKG_FIXUP:=autoreconf |
| 28 | |
| 29 | PKG_INSTALL:=1 |
| 30 | |
| 31 | include $(INCLUDE_DIR)/package.mk |
| 32 | |
| 33 | define Package/libapr |
| 34 | SECTION:=libs |
| 35 | CATEGORY:=Libraries |
| 36 | DEPENDS:=+libpthread +librt +libuuid |
| 37 | TITLE:=Apache Portable Runtime Library |
| 38 | URL:=https://apr.apache.org/ |
| 39 | endef |
| 40 | |
| 41 | CONFIGURE_ARGS += \ |
| 42 | --with-devrandom=/dev/urandom \ |
| 43 | $(call autoconf_bool,CONFIG_IPV6,ipv6) |
| 44 | |
| 45 | # XXX: ac_cv_sizeof_struct_iovec=1 is just to trick configure |
| 46 | # XXX: don't set apr_cv_use_lfs64=yes, see |
| 47 | # https://www.openwall.com/lists/musl/2020/02/03/18 |
| 48 | # XXX: the atomic builtins used require 8-byte intrinsics, which are available |
| 49 | # on all 64-bit architectures and some arm as well as x86 32-bit platforms |
| 50 | CONFIGURE_VARS += \ |
| 51 | ap_cv_atomic_builtins=$(if $(CONFIG_ARCH_64BIT),yes,no) \ |
| 52 | ac_cv_file__dev_zero=yes \ |
| 53 | ac_cv_func_pthread_mutexattr_setpshared=yes \ |
| 54 | ac_cv_func_sem_open=yes \ |
| 55 | ac_cv_func_setpgrp_void=yes \ |
| 56 | ac_cv_mmap__dev_zero=yes \ |
| 57 | ac_cv_negative_eai=yes \ |
| 58 | ac_cv_o_nonblock_inherited=no \ |
| 59 | ac_cv_sizeof_struct_iovec=1 \ |
| 60 | ac_cv_struct_rlimit=yes \ |
| 61 | apr_cv_accept4=yes \ |
| 62 | apr_cv_dup3=yes \ |
| 63 | apr_cv_epoll=yes \ |
| 64 | apr_cv_epoll_create1=yes \ |
| 65 | apr_cv_gai_addrconfig=yes \ |
| 66 | apr_cv_mutex_recursive=yes \ |
| 67 | apr_cv_mutex_robust_shared=yes \ |
| 68 | apr_cv_process_shared_works=yes \ |
| 69 | apr_cv_pthreads_lib=-lpthread \ |
| 70 | apr_cv_sock_cloexec=yes \ |
| 71 | apr_cv_tcp_nodelay_with_cork=yes |
| 72 | |
| 73 | ifeq ($(call qstrip,$(CONFIG_LIBC)),musl) |
| 74 | CONFIGURE_VARS += \ |
| 75 | ac_cv_strerror_r_rc_int=yes |
| 76 | endif |
| 77 | |
| 78 | define Build/InstallDev |
| 79 | $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/include/apr-1 \ |
| 80 | $(1)/usr/lib/pkgconfig $(1)/usr/share/build-1 |
| 81 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/apr-1-config \ |
| 82 | $(1)/usr/bin |
| 83 | $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/apr-1/* \ |
| 84 | $(1)/usr/include/apr-1 |
| 85 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libapr-1.{a,so*} $(1)/usr/lib |
| 86 | $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/apr-1.pc \ |
| 87 | $(1)/usr/lib/pkgconfig |
| 88 | $(CP) $(PKG_INSTALL_DIR)/usr/share/build-1/* $(1)/usr/share/build-1 |
| 89 | $(SED) '/^prefix=\|^exec_prefix=/s|/usr|$(STAGING_DIR)/usr|' \ |
| 90 | $(1)/usr/bin/apr-1-config |
| 91 | $(SED) '/^bindir=/s|/usr|$$$${prefix}|' $(1)/usr/bin/apr-1-config |
| 92 | $(SED) '/^datadir=/s|/usr|$$$${prefix}|' $(1)/usr/bin/apr-1-config |
| 93 | $(SED) '/^datarootdir=/s|/usr|$$$${prefix}|' $(1)/usr/bin/apr-1-config |
| 94 | $(SED) 's,/usr/share/build-1,$(STAGING_DIR)/usr/share/build-1,g' \ |
| 95 | $(1)/usr/share/build-1/apr_rules.mk |
| 96 | $(INSTALL_DIR) $(2)/bin |
| 97 | $(LN) ../../usr/bin/apr-1-config $(2)/bin/apr-1-config |
| 98 | endef |
| 99 | |
| 100 | define Package/libapr/install |
| 101 | $(INSTALL_DIR) $(1)/usr/lib |
| 102 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libapr-1.so.* $(1)/usr/lib |
| 103 | endef |
| 104 | |
| 105 | $(eval $(call BuildPackage,libapr)) |