blob: f23d1222c0629d00d54e51b20f1ba7695291a10b [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#
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
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=openldap
11PKG_VERSION:=2.6.8
12PKG_RELEASE:=2
13
14PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
15PKG_SOURCE_URL:=https://mirror.eu.oneandone.net/software/openldap/openldap-release/ \
16 https://www.openldap.org/software/download/OpenLDAP/openldap-release/
17PKG_HASH:=48969323e94e3be3b03c6a132942dcba7ef8d545f2ad35401709019f696c3c4e
18PKG_LICENSE:=OLDAP-2.8
19PKG_LICENSE_FILES:=LICENSE
20PKG_CPE_ID:=cpe:/a:openldap:openldap
21
22PKG_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.
29PKG_REMOVE_FILES:=build/ltversion.m4
30
31PKG_CONFIG_DEPENDS := \
32 CONFIG_OPENLDAP_DEBUG \
33 CONFIG_OPENLDAP_CRYPT \
34 CONFIG_OPENLDAP_MONITOR \
35 CONFIG_OPENLDAP_DB47 \
36 CONFIG_OPENLDAP_ICU
37
38include $(INCLUDE_DIR)/package.mk
39
40define 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>
47endef
48
49define 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)
54endef
55
56define Package/openldap/config
57 source "$(SOURCE)/Config.in"
58endef
59
60define Package/libopenldap/description
61OpenLDAP 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.
62endef
63
64define Package/libopenldap/conffiles
65/etc/openldap/ldap.conf
66endef
67
68define Package/openldap-utils
69 $(call Package/libopenldap/Default)
70 DEPENDS:=+libopenldap
71 TITLE+= (utilities)
72endef
73
74define Package/openldap-utils/description
75This package contains client programs required to access LDAP servers.
76endef
77
78define Package/openldap-server
79 $(call Package/libopenldap/Default)
80 DEPENDS:=+libopenldap +libuuid
81 TITLE+= (server)
82endef
83
84define Package/openldap-server/description
85This package contains server programs required to provide LDAP services.
86endef
87
88define Package/openldap-server/conffiles
89/etc/openldap/slapd.conf
90/etc/init.d/ldap
91endef
92
93TARGET_CFLAGS += $(FPIC) -lpthread \
94 -DURANDOM_DEVICE=\\\"/dev/urandom\\\"
95
96CONFIGURE_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
107ifdef CONFIG_OPENLDAP_CRYPT
108 CONFIGURE_ARGS+= --enable-crypt
109else
110 CONFIGURE_ARGS+= --disable-crypt
111endif
112
113ifdef CONFIG_OPENLDAP_MONITOR
114 CONFIGURE_ARGS+= --enable-monitor
115else
116 CONFIGURE_ARGS+= --disable-monitor
117endif
118
119ifdef CONFIG_OPENLDAP_DEBUG
120 CONFIGURE_ARGS+= --enable-debug
121else
122 CONFIGURE_ARGS+= --disable-debug
123endif
124
125ifdef CONFIG_OPENLDAP_DB47
126 CONFIGURE_ARGS+= \
127 --enable-bdb \
128 --enable-hdb
129else
130 CONFIGURE_ARGS+= \
131 --disable-bdb \
132 --disable-hdb
133endif
134
135ifndef CONFIG_OPENLDAP_ICU
136 CONFIGURE_VARS += \
137 ol_cv_lib_icu="no"
138endif
139
140define 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)
146endef
147
148define 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/
152endef
153
154define 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/
158endef
159
160define Package/openldap-utils/install
161 $(INSTALL_DIR) $(1)/usr/bin
162 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ldap* $(1)/usr/bin/
163endef
164
165define 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
178endef
179
180$(eval $(call BuildPackage,libopenldap))
181$(eval $(call BuildPackage,openldap-utils))
182$(eval $(call BuildPackage,openldap-server))