| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2007-2016 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-util |
| 11 | PKG_VERSION:=1.6.3 |
| 12 | PKG_RELEASE:=1 |
| 13 | |
| 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 15 | PKG_SOURCE_URL:=@APACHE/apr/ |
| 16 | PKG_HASH:=a41076e3710746326c3945042994ad9a4fcac0ce0277dd8fea076fec3c9772b5 |
| 17 | PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de> |
| 18 | |
| 19 | PKG_LICENSE:=Apache-2.0 |
| 20 | PKG_LICENSE_FILES:=LICENSE |
| 21 | |
| 22 | PKG_CPE_ID:=cpe:/a:apache:apr-util |
| 23 | |
| 24 | PKG_CONFIG_DEPENDS := \ |
| 25 | CONFIG_PACKAGE_libaprutil-crypto-openssl \ |
| 26 | CONFIG_PACKAGE_libaprutil-dbd-mysql \ |
| 27 | CONFIG_PACKAGE_libaprutil-dbd-odbc \ |
| 28 | CONFIG_PACKAGE_libaprutil-dbd-pgsql \ |
| 29 | CONFIG_PACKAGE_libaprutil-dbd-sqlite3 \ |
| 30 | CONFIG_PACKAGE_libaprutil-dbm-gdbm \ |
| 31 | CONFIG_PACKAGE_libaprutil-ldap |
| 32 | |
| 33 | PKG_FIXUP:=autoreconf |
| 34 | |
| 35 | PKG_INSTALL:=1 |
| 36 | |
| 37 | include $(INCLUDE_DIR)/package.mk |
| 38 | include $(INCLUDE_DIR)/nls.mk |
| 39 | |
| 40 | define Package/libaprutil/Default |
| 41 | SECTION:=libs |
| 42 | CATEGORY:=Libraries |
| 43 | URL:=http://apr.apache.org/ |
| 44 | endef |
| 45 | |
| 46 | define Package/libaprutil |
| 47 | $(call Package/libaprutil/Default) |
| 48 | DEPENDS:=+libapr +libexpat +libuuid $(ICONV_DEPENDS) |
| 49 | TITLE:=Apache Portable Runtime Utility Library |
| 50 | endef |
| 51 | |
| 52 | ## Prevent apu-iconv.m4 to append "/lib" to LDFLAGS if ICONV_PREFIX is empty |
| 53 | ifeq ($(ICONV_PREFIX),) |
| 54 | ICONV_PREFIX=no |
| 55 | endif |
| 56 | |
| 57 | CONFIGURE_ARGS += \ |
| 58 | --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \ |
| 59 | --with-expat="$(STAGING_DIR)/usr" \ |
| 60 | --with-iconv="$(ICONV_PREFIX)" \ |
| 61 | --without-sqlite2 |
| 62 | |
| 63 | ifneq ($(CONFIG_PACKAGE_libaprutil-crypto-openssl),) |
| 64 | CONFIGURE_ARGS += --with-crypto --with-openssl="$(STAGING_DIR)/usr" |
| 65 | else |
| 66 | CONFIGURE_ARGS += --without-crypto |
| 67 | endif |
| 68 | |
| 69 | ifneq ($(CONFIG_PACKAGE_libaprutil-dbd-mysql),) |
| 70 | CONFIGURE_ARGS += --with-mysql="$(STAGING_DIR)/usr" |
| 71 | else |
| 72 | CONFIGURE_ARGS += --without-mysql |
| 73 | endif |
| 74 | |
| 75 | ifneq ($(CONFIG_PACKAGE_libaprutil-dbd-odbc),) |
| 76 | CONFIGURE_ARGS += --with-odbc="$(STAGING_DIR)/usr" |
| 77 | else |
| 78 | CONFIGURE_ARGS += --without-odbc |
| 79 | endif |
| 80 | |
| 81 | ifneq ($(CONFIG_PACKAGE_libaprutil-dbd-pgsql),) |
| 82 | CONFIGURE_ARGS += --with-pgsql="$(STAGING_DIR)/usr" |
| 83 | else |
| 84 | CONFIGURE_ARGS += --without-pgsql |
| 85 | endif |
| 86 | |
| 87 | ifneq ($(CONFIG_PACKAGE_libaprutil-dbd-sqlite3),) |
| 88 | CONFIGURE_ARGS += --with-sqlite3="$(STAGING_DIR)/usr" |
| 89 | else |
| 90 | CONFIGURE_ARGS += --without-sqlite3 |
| 91 | endif |
| 92 | |
| 93 | ifneq ($(CONFIG_PACKAGE_libaprutil-dbm-gdbm),) |
| 94 | CONFIGURE_ARGS += --with-gdbm="$(STAGING_DIR)/usr" |
| 95 | else |
| 96 | CONFIGURE_ARGS += --without-gdbm |
| 97 | endif |
| 98 | |
| 99 | ifneq ($(CONFIG_PACKAGE_libaprutil-ldap),) |
| 100 | CONFIGURE_ARGS += \ |
| 101 | --with-ldap \ |
| 102 | --with-ldap-include="$(STAGING_DIR)/usr/include" \ |
| 103 | --with-ldap-lib="$(STAGING_DIR)/usr/lib" |
| 104 | else |
| 105 | CONFIGURE_ARGS += \ |
| 106 | --without-ldap |
| 107 | endif |
| 108 | |
| 109 | CONFIGURE_VARS += \ |
| 110 | ac_cv_path_ODBC_CONFIG= \ |
| 111 | apu_cv_weak_symbols=yes \ |
| 112 | APR_BUILD_DIR="$(STAGING_DIR)/usr/share/build-1" |
| 113 | |
| 114 | ifeq ($(CONFIG_USE_GLIBC)$(CONFIG_USE_MUSL),y) |
| 115 | CONFIGURE_VARS += \ |
| 116 | apu_cv_explicit_bzero=yes |
| 117 | endif |
| 118 | |
| 119 | define Package/libaprutil/install/driver |
| 120 | $(INSTALL_DIR) $(1)/usr/lib/apr-util-1 |
| 121 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/apr-util-1/apr_$(2)*.so \ |
| 122 | $(1)/usr/lib/apr-util-1 |
| 123 | endef |
| 124 | |
| 125 | define Package/libaprutil/Driver |
| 126 | define Package/libaprutil-$(subst _,-,$(1)) |
| 127 | $(call Package/libaprutil/Default) |
| 128 | TITLE:=libaprutil - $(2) driver |
| 129 | DEPENDS:=libaprutil $(patsubst +%,+PACKAGE_libaprutil-$(subst _,-,$(1)):%,$(3)) |
| 130 | endef |
| 131 | define Package/libaprutil-$(subst _,-,$(1))/install |
| 132 | $(foreach d,$(1),$(call Package/libaprutil/install/driver,$$(1),$(d));) |
| 133 | endef |
| 134 | $$(eval $$(call BuildPackage,libaprutil-$(subst _,-,$(1)))) |
| 135 | endef |
| 136 | |
| 137 | # PKG_CONFIG_DEPENDS trigger configure, but the compile afterward may be |
| 138 | # incomplete if the build directory is not cleaned before. This is not a |
| 139 | # general observation, yet it is valid for apr-util :/ |
| 140 | define Build/Compile |
| 141 | $(call Build/Compile/Default,clean all) |
| 142 | endef |
| 143 | |
| 144 | define Build/InstallDev |
| 145 | $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/include/apr-1 \ |
| 146 | $(1)/usr/lib/apr-util-1 $(1)/usr/lib/pkgconfig |
| 147 | $(CP) $(PKG_INSTALL_DIR)/usr/bin/apu-1-config $(1)/usr/bin |
| 148 | $(SED) '/^prefix=\|^exec_prefix=/s|/usr|$(STAGING_DIR)/usr|' $(1)/usr/bin/apu-1-config |
| 149 | $(SED) '/^bindir=/s|/usr|$$$${prefix}|' $(1)/usr/bin/apu-1-config |
| 150 | $(CP) $(PKG_INSTALL_DIR)/usr/include/apr-1/* $(1)/usr/include/apr-1 |
| 151 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/apr-util-1/apr_*.{a,so} \ |
| 152 | $(1)/usr/lib/apr-util-1 2>/dev/null || : |
| 153 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libaprutil-1.{a,so*} \ |
| 154 | $(1)/usr/lib |
| 155 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/apr-util-1.pc \ |
| 156 | $(1)/usr/lib/pkgconfig |
| 157 | $(INSTALL_DIR) $(2)/bin |
| 158 | $(LN) ../../usr/bin/apu-1-config $(2)/bin/apu-1-config |
| 159 | endef |
| 160 | |
| 161 | define Package/libaprutil/install |
| 162 | $(INSTALL_DIR) $(1)/usr/lib |
| 163 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libaprutil-1.so.* $(1)/usr/lib |
| 164 | endef |
| 165 | |
| 166 | $(eval $(call BuildPackage,libaprutil)) |
| 167 | $(eval $(call Package/libaprutil/Driver,crypto_openssl,OpenSSL,+libopenssl)) |
| 168 | $(eval $(call Package/libaprutil/Driver,dbd_mysql,MySQL,+libmariadb)) |
| 169 | $(eval $(call Package/libaprutil/Driver,dbd_odbc,ODBC,+unixodbc)) |
| 170 | $(eval $(call Package/libaprutil/Driver,dbd_pgsql,PostgreSQL,+libpq)) |
| 171 | $(eval $(call Package/libaprutil/Driver,dbd_sqlite3,SQLite3,+libsqlite3)) |
| 172 | $(eval $(call Package/libaprutil/Driver,dbm_gdbm,GDBM dbm,+libgdbm)) |
| 173 | $(eval $(call Package/libaprutil/Driver,ldap,LDAP,+libopenldap)) |