| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2006-2015 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:=openldap |
| 11 | PKG_VERSION:=2.6.8 |
| 12 | PKG_RELEASE:=2 |
| 13 | |
| 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz |
| 15 | PKG_SOURCE_URL:=https://mirror.eu.oneandone.net/software/openldap/openldap-release/ \ |
| 16 | https://www.openldap.org/software/download/OpenLDAP/openldap-release/ |
| 17 | PKG_HASH:=48969323e94e3be3b03c6a132942dcba7ef8d545f2ad35401709019f696c3c4e |
| 18 | PKG_LICENSE:=OLDAP-2.8 |
| 19 | PKG_LICENSE_FILES:=LICENSE |
| 20 | PKG_CPE_ID:=cpe:/a:openldap:openldap |
| 21 | |
| 22 | PKG_FIXUP:=autoreconf |
| 23 | |
| 24 | # Fixes the following: |
| 25 | # libtool: Version mismatch error. This is libtool 2.4.2, but the |
| 26 | # libtool: definition of this LT_INIT comes from libtool 2.4.6. |
| 27 | # libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2 |
| 28 | # libtool: and run autoconf again. |
| 29 | PKG_REMOVE_FILES:=build/ltversion.m4 |
| 30 | |
| 31 | PKG_CONFIG_DEPENDS := \ |
| 32 | CONFIG_OPENLDAP_DEBUG \ |
| 33 | CONFIG_OPENLDAP_CRYPT \ |
| 34 | CONFIG_OPENLDAP_MONITOR \ |
| 35 | CONFIG_OPENLDAP_DB47 \ |
| 36 | CONFIG_OPENLDAP_ICU |
| 37 | |
| 38 | include $(INCLUDE_DIR)/package.mk |
| 39 | |
| 40 | define Package/libopenldap/Default |
| 41 | SECTION:=net |
| 42 | CATEGORY:=Network |
| 43 | SUBMENU:=OpenLDAP |
| 44 | TITLE:=LDAP directory suite |
| 45 | URL:=https://www.openldap.org/ |
| 46 | MAINTAINER:=W. Michael Petullo <mike@flyn.org> |
| 47 | endef |
| 48 | |
| 49 | define Package/libopenldap |
| 50 | $(call Package/libopenldap/Default) |
| 51 | MENU:=1 |
| 52 | DEPENDS:=+libopenssl +libsasl2 +libpthread +libuuid +OPENLDAP_DB47:libdb47 +OPENLDAP_ICU:icu |
| 53 | TITLE+= (libraries) |
| 54 | endef |
| 55 | |
| 56 | define Package/openldap/config |
| 57 | source "$(SOURCE)/Config.in" |
| 58 | endef |
| 59 | |
| 60 | define Package/libopenldap/description |
| 61 | OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol (LDAP). This package contains the shared LDAP client libraries, needed by other programs. |
| 62 | endef |
| 63 | |
| 64 | define Package/libopenldap/conffiles |
| 65 | /etc/openldap/ldap.conf |
| 66 | endef |
| 67 | |
| 68 | define Package/openldap-utils |
| 69 | $(call Package/libopenldap/Default) |
| 70 | DEPENDS:=+libopenldap |
| 71 | TITLE+= (utilities) |
| 72 | endef |
| 73 | |
| 74 | define Package/openldap-utils/description |
| 75 | This package contains client programs required to access LDAP servers. |
| 76 | endef |
| 77 | |
| 78 | define Package/openldap-server |
| 79 | $(call Package/libopenldap/Default) |
| 80 | DEPENDS:=+libopenldap +libuuid |
| 81 | TITLE+= (server) |
| 82 | endef |
| 83 | |
| 84 | define Package/openldap-server/description |
| 85 | This package contains server programs required to provide LDAP services. |
| 86 | endef |
| 87 | |
| 88 | define Package/openldap-server/conffiles |
| 89 | /etc/openldap/slapd.conf |
| 90 | /etc/init.d/ldap |
| 91 | endef |
| 92 | |
| 93 | TARGET_CFLAGS += $(FPIC) -lpthread \ |
| 94 | -DURANDOM_DEVICE=\\\"/dev/urandom\\\" |
| 95 | |
| 96 | CONFIGURE_ARGS += \ |
| 97 | --enable-dynamic \ |
| 98 | --enable-syslog \ |
| 99 | --with-cyrus-sasl \ |
| 100 | --with-threads \ |
| 101 | --with-tls \ |
| 102 | --with-yielding-select="yes" \ |
| 103 | --enable-null \ |
| 104 | --disable-relay |
| 105 | |
| 106 | |
| 107 | ifdef CONFIG_OPENLDAP_CRYPT |
| 108 | CONFIGURE_ARGS+= --enable-crypt |
| 109 | else |
| 110 | CONFIGURE_ARGS+= --disable-crypt |
| 111 | endif |
| 112 | |
| 113 | ifdef CONFIG_OPENLDAP_MONITOR |
| 114 | CONFIGURE_ARGS+= --enable-monitor |
| 115 | else |
| 116 | CONFIGURE_ARGS+= --disable-monitor |
| 117 | endif |
| 118 | |
| 119 | ifdef CONFIG_OPENLDAP_DEBUG |
| 120 | CONFIGURE_ARGS+= --enable-debug |
| 121 | else |
| 122 | CONFIGURE_ARGS+= --disable-debug |
| 123 | endif |
| 124 | |
| 125 | ifdef CONFIG_OPENLDAP_DB47 |
| 126 | CONFIGURE_ARGS+= \ |
| 127 | --enable-bdb \ |
| 128 | --enable-hdb |
| 129 | else |
| 130 | CONFIGURE_ARGS+= \ |
| 131 | --disable-bdb \ |
| 132 | --disable-hdb |
| 133 | endif |
| 134 | |
| 135 | ifndef CONFIG_OPENLDAP_ICU |
| 136 | CONFIGURE_VARS += \ |
| 137 | ol_cv_lib_icu="no" |
| 138 | endif |
| 139 | |
| 140 | define Build/Compile |
| 141 | $(MAKE) -C $(PKG_BUILD_DIR) \ |
| 142 | DESTDIR="$(PKG_INSTALL_DIR)" \ |
| 143 | HOSTCC="$(HOSTCC)" \ |
| 144 | depend all install |
| 145 | cd $(PKG_BUILD_DIR)/libraries/liblmdb && $(MAKE) $(CONFIGURE_VARS) |
| 146 | endef |
| 147 | |
| 148 | define Build/InstallDev |
| 149 | $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib |
| 150 | $(CP) $(PKG_INSTALL_DIR)/usr/include/{lber,ldap}*.h $(1)/usr/include/ |
| 151 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{lber,ldap}*.{a,so*} $(1)/usr/lib/ |
| 152 | endef |
| 153 | |
| 154 | define Package/libopenldap/install |
| 155 | $(INSTALL_DIR) $(1)/etc/openldap $(1)/usr/lib |
| 156 | $(CP) $(PKG_INSTALL_DIR)/etc/openldap/ldap.conf $(1)/etc/openldap/ |
| 157 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{lber,ldap}*.so.* $(1)/usr/lib/ |
| 158 | endef |
| 159 | |
| 160 | define Package/openldap-utils/install |
| 161 | $(INSTALL_DIR) $(1)/usr/bin |
| 162 | $(CP) $(PKG_INSTALL_DIR)/usr/bin/ldap* $(1)/usr/bin/ |
| 163 | endef |
| 164 | |
| 165 | define Package/openldap-server/install |
| 166 | $(INSTALL_DIR) $(1)/etc/init.d |
| 167 | $(INSTALL_BIN) ./files/ldap.init $(1)/etc/init.d/ldap |
| 168 | $(INSTALL_DIR) $(1)/etc/openldap/schema |
| 169 | $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/openldap/schema/* $(1)/etc/openldap/schema/ |
| 170 | $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/openldap/slapd.conf $(1)/etc/openldap/ |
| 171 | $(INSTALL_DIR) $(1)/usr/sbin |
| 172 | # NB: OpenLDAP installs slapd into libexecdir, not sbindir |
| 173 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/slapd $(1)/usr/sbin/ |
| 174 | $(eval SLAPTOOLS := slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl slapschema) |
| 175 | for i in $(SLAPTOOLS); do \ |
| 176 | $(LN) ./slapd $(1)/usr/sbin/$$$$i; \ |
| 177 | done |
| 178 | endef |
| 179 | |
| 180 | $(eval $(call BuildPackage,libopenldap)) |
| 181 | $(eval $(call BuildPackage,openldap-utils)) |
| 182 | $(eval $(call BuildPackage,openldap-server)) |