git: 6e1233be2292 - main - Mk/**ldap.mk: Convert USE_LDAP to USES=ldap

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Wed, 08 Feb 2023 10:54:31 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6e1233be229212a0496f42d611bd40f3e3a628da

commit 6e1233be229212a0496f42d611bd40f3e3a628da
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-02-08 10:50:40 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-02-08 10:53:56 +0000

    Mk/**ldap.mk: Convert USE_LDAP to USES=ldap
    
    Convert the USE_LDAP=yes to USES=ldap and adds the following features:
    
    - Adds the argument USES=ldap:server to add openldap2{4|5|6}-server as
      RUN_DEPENDS
    - Adds the argument USES=ldap<version> and replaces WANT_OPENLDAP_VER
    - Adds OPENLDAP versions in bsd.default-versions.mk
    - Adds USE_OPENLDAP/WANT_OPENLDAP_VER in Mk/bsd.sanity.mk
    - Changes consumers to use the features
    
    Reviewed by:    delphij
    Approved by:    portmgr
    Differential Revision: https://reviews.freebsd.org/D38233
---
 Mk/Uses/ldap.mk                            | 109 +++++++++++++++++++++++++++++
 Mk/bsd.default-versions.mk                 |   4 +-
 Mk/bsd.ldap.mk                             |  87 -----------------------
 Mk/bsd.port.mk                             |   4 --
 Mk/bsd.sanity.mk                           |   5 +-
 databases/ateam_mysql57_ldap_auth/Makefile |   3 +-
 databases/ateam_mysql_ldap_auth/Makefile   |   3 +-
 databases/evolution-data-server/Makefile   |   2 +-
 databases/ldb15/Makefile                   |   3 +-
 databases/ldb20/Makefile                   |   3 +-
 databases/ldb21/Makefile                   |   3 +-
 databases/ldb22/Makefile                   |   3 +-
 databases/libgda5/Makefile                 |   2 +-
 databases/mysql57-client/Makefile          |   2 +-
 databases/mysql80-client/Makefile          |   2 +-
 databases/percona57-client/Makefile        |   2 +-
 databases/postgresql15-server/Makefile     |   2 +-
 databases/virtuoso/Makefile                |   2 +-
 devel/apr1/Makefile                        |   2 +-
 devel/p5-Test-OpenLDAP/Makefile            |   6 +-
 devel/ptlib/Makefile                       |   2 +-
 devel/sope/Makefile                        |   2 +-
 devel/sope2/Makefile                       |   3 +-
 dns/bind916/Makefile                       |   2 +-
 dns/ldapdns/Makefile                       |   3 +-
 dns/powerdns/Makefile                      |   2 +-
 editors/libreoffice/Makefile               |   3 +-
 emulators/wine/Makefile                    |   2 +-
 finance/odoo/Makefile                      |   3 +-
 finance/odoo14/Makefile                    |   3 +-
 finance/odoo15/Makefile                    |   3 +-
 ftp/curl/Makefile                          |   2 +-
 ftp/pure-ftpd/Makefile                     |   2 +-
 irc/anope/Makefile                         |   2 +-
 irc/atheme-services/Makefile               |   2 +-
 irc/bitlbee/Makefile                       |   2 +-
 irc/inspircd/Makefile                      |   2 +-
 irc/quassel/Makefile                       |   3 +-
 lang/php80/Makefile.ext                    |   5 +-
 lang/php81/Makefile                        |   3 +-
 lang/php82/Makefile                        |   3 +-
 mail/alpine/Makefile                       |   2 +-
 mail/balsa/Makefile                        |   2 +-
 mail/claws-mail/Makefile                   |   2 +-
 mail/cone/Makefile                         |   5 +-
 mail/courier/Makefile                      |   2 +-
 mail/cyrus-imapd23/Makefile                |   2 +-
 mail/cyrus-imapd24/Makefile                |   2 +-
 mail/cyrus-imapd25/Makefile                |   2 +-
 mail/cyrus-imapd30/Makefile                |   2 +-
 mail/cyrus-imapd32/Makefile                |   2 +-
 mail/cyrus-imapd34/Makefile                |   2 +-
 mail/cyrus-imapd36/Makefile                |   2 +-
 mail/dbmail/Makefile                       |   3 +-
 mail/dovecot-pigeonhole/Makefile           |   2 +-
 mail/dovecot/Makefile                      |   2 +-
 mail/dspam/Makefile                        |   2 +-
 mail/evolution/Makefile                    |   2 +-
 mail/exim/Makefile                         |   6 +-
 mail/gnarwl/Makefile                       |   3 +-
 mail/mailutils/Makefile                    |   2 +-
 mail/milter-greylist/Makefile              |   2 +-
 mail/opendkim/Makefile                     |   2 +-
 mail/opensmtpd-extras-table-ldap/Makefile  |   2 +-
 mail/perdition/Makefile                    |   2 +-
 mail/postfix-current/Makefile              |   5 +-
 mail/postfix/Makefile                      |   7 +-
 mail/qmail-activedir/Makefile              |   7 +-
 mail/sendmail-devel/Makefile               |   2 +-
 mail/sendmail/Makefile                     |   2 +-
 mail/spamass-milter/Makefile               |   2 +-
 mail/spmfilter/Makefile                    |   5 +-
 mail/sylpheed/Makefile                     |   2 +-
 mail/tpop3d/Makefile                       |   2 +-
 mail/vpopmail/Makefile                     |   2 +-
 net-im/jabberd/Makefile                    |   2 +-
 net-mgmt/adcli/Makefile                    |   3 +-
 net-mgmt/collectd5/Makefile                |   2 +-
 net-mgmt/monitoring-plugins/Makefile       |   2 +-
 net-mgmt/nagios-plugins/Makefile           |   2 +-
 net-mgmt/seafile-server/Makefile           |   2 +-
 net-mgmt/xymon-server/Makefile             |   2 +-
 net-mgmt/zabbix4-server/Makefile           |   2 +-
 net-mgmt/zabbix5-server/Makefile           |   2 +-
 net-mgmt/zabbix6-server/Makefile           |   2 +-
 net-mgmt/zabbix62-server/Makefile          |   2 +-
 net/asterisk16/Makefile                    |   2 +-
 net/asterisk18/Makefile                    |   2 +-
 net/ceph14/Makefile                        |   3 +-
 net/echoping/Makefile                      |   2 +-
 net/fpc-ldap/Makefile                      |   2 +-
 net/freeradius3/Makefile                   |   2 +-
 net/gnu-dico/Makefile                      |   2 +-
 net/gq/Makefile                            |   3 +-
 net/isc-dhcp44-server/Makefile             |   3 +-
 net/kldap/Makefile                         |   3 +-
 net/ldapdiff/Makefile                      |   3 +-
 net/ldapscripts/Makefile                   |  10 +--
 net/liblinphone/Makefile                   |   2 +-
 net/lualdap/Makefile                       |   3 +-
 net/netatalk3/Makefile                     |   2 +-
 net/nss-pam-ldapd/Makefile                 |   3 +-
 net/nss_ldap/Makefile                      |   3 +-
 net/ntopng/Makefile                        |   3 +-
 net/openldap24-server/Makefile             |  11 +--
 net/openradius/Makefile                    |   2 +-
 net/opensips31/Makefile                    |   2 +-
 net/proftpd-mod_ldap/Makefile              |   3 +-
 net/proxy-suite/Makefile                   |   2 +-
 net/py-ldap/Makefile                       |   3 +-
 net/py-ldap0/Makefile                      |   5 +-
 net/samba413/Makefile                      |   2 +-
 net/samba416/Makefile                      |   2 +-
 net/ss5/Makefile                           |   3 +-
 net/x2goclient/Makefile                    |   2 +-
 net/yptransitd/Makefile                    |   3 +-
 news/nntpcache/Makefile                    |   2 +-
 print/cups-filters/Makefile                |   2 +-
 security/clamav-lts/Makefile               |   2 +-
 security/courier-authlib/Makefile          |   2 +-
 security/cyrus-sasl2-ldapdb/Makefile       |   2 +-
 security/cyrus-sasl2-saslauthd/Makefile    |   2 +-
 security/dirmngr/Makefile                  |   3 +-
 security/gnupg/Makefile                    |   2 +-
 security/gnupg1/Makefile                   |   2 +-
 security/gvm-libs/Makefile                 |   2 +-
 security/heimdal-devel/Makefile            |   2 +-
 security/heimdal/Makefile                  |   2 +-
 security/ipsec-tools/Makefile              |   2 +-
 security/krb5-118/Makefile                 |   2 +-
 security/krb5-119/Makefile                 |   2 +-
 security/krb5-120/Makefile                 |   2 +-
 security/krb5-devel/Makefile               |   2 +-
 security/libpki/Makefile                   |   2 +-
 security/opencryptoki/Makefile             |   3 +-
 security/openscep/Makefile                 |   3 +-
 security/openvpn-auth-ldap/Makefile        |   3 +-
 security/pam_ldap/Makefile                 |   3 +-
 security/pam_pkcs11/Makefile               |   2 +-
 security/pam_yubico/Makefile               |   2 +-
 security/seahorse/Makefile                 |   2 +-
 security/sssd/Makefile                     |   3 +-
 security/strongswan/Makefile               |   2 +-
 security/sudo/Makefile                     |   2 +-
 sysutils/adtool/Makefile                   |   3 +-
 sysutils/am-utils/Makefile                 |   3 +-
 sysutils/eclat/Makefile                    |   2 +-
 sysutils/ldapvi/Makefile                   |   3 +-
 sysutils/msktutil/Makefile                 |   3 +-
 sysutils/omnibackup/Makefile               |   2 +-
 www/c-icap/Makefile                        |   2 +-
 www/glewlwyd/Makefile                      |   3 +-
 www/lighttpd/Makefile                      |   2 +-
 www/mod_cfg_ldap/Makefile                  |   3 +-
 www/mod_webauth/Makefile                   |   3 +-
 www/sarg/Makefile                          |   2 +-
 www/squid-devel/Makefile                   |   2 +-
 www/squid/Makefile                         |   2 +-
 www/squidguard/Makefile                    |   2 +-
 159 files changed, 275 insertions(+), 336 deletions(-)

diff --git a/Mk/Uses/ldap.mk b/Mk/Uses/ldap.mk
new file mode 100644
index 000000000000..e2cbc1e407cc
--- /dev/null
+++ b/Mk/Uses/ldap.mk
@@ -0,0 +1,109 @@
+# Provide support for OpenLDAP
+# Feature:	ldap
+# Usage:	USES=ldap or USES=ldap:args
+# Valid ARGS:	<version>, client, server, (none)
+#
+# version	If no version is given (by the maintainer via the port), try to
+#		find the currently installed version.  Fall back to default if
+#		necessary (OpenLDAP-2.6 = 26, look at bsd.default-versions.mk for
+#		possible values).
+# client	Depends on the libldap library (default)
+# server
+#		Depend on the server at runtime. If none of these is
+#		set, depends on the client.
+#
+# IGNORE_WITH_OPENLDAP
+#		This variable can be defined if the ports does not support one
+#		or more version of OpenLDAP.
+# WITH_OPENLDAP_VER
+#		User defined variable to set OpenLDAP version.
+# OPENLDAP_VER
+#		Detected OpenLDAP version.
+#
+# MAINTAINER:	ports@FreeBSD.org
+
+.if !defined(_INCLUDE_USES_LDAP_MK)
+_INCLUDE_USES_LDAP_MK=    yes
+
+.  if !empty(ldap_ARGS)
+.undef _WANT_OPENLDAP_VER
+.undef _WANT_OPENLDAP_SERVER
+_OPENLDAP_ARGS=		${ldap_ARGS:S/,/ /g}
+.    if ${_OPENLDAP_ARGS:Mserver}
+_WANT_OPENLDAP_SERVER=	yes
+_OPENLDAP_ARGS:=	${_OPENLDAP_ARGS:Nserver}
+.    endif
+.    if ${_OPENLDAP_ARGS:Mclient}
+_WANT_OPENLDAP_CLIENT=	yes
+_OPENLDAP_ARGS:=	${_OPENLDAP_ARGS:Nclient}
+.    endif
+
+# Port requested a version
+.    if !empty(_OPENLDAP_ARGS)
+_WANT_OPENLDAP_VER=	${_OPENLDAP_ARGS}
+.    endif
+.  endif # !empty(ldap_ARGS)
+
+.  if defined(DEFAULT_OPENLDAP_VER)
+WARNING+=	"DEFAULT_OPENLDAP_VER is defined, consider using DEFAULT_VERSIONS=openldap=${DEFAULT_OPENLDAP_VER} instead"
+.  endif
+
+DEFAULT_OPENLDAP_VER?=	${OPENLDAP_DEFAULT:S/.//}
+# OpenLDAP client version currently supported.
+# When adding a version, please keep the comment in
+# Mk/bsd.default-versions.mk in sync.
+# OpenLDAP client versions currently supported
+OPENLDAP24_LIB=		libldap-2.4.so.2
+OPENLDAP25_LIB=		libldap-2.5.so.0
+OPENLDAP26_LIB=		libldap.so.2
+
+.  if exists(${LOCALBASE}/bin/ldapwhoami)
+_OPENLDAP_VER!=	${LOCALBASE}/bin/ldapwhoami -VV 2>&1 | ${GREP} ldapwhoami | ${SED} -E 's/.*OpenLDAP: ldapwhoami (2)\.([0-9]).*/\1\2/'
+.  endif
+
+.  if defined(WANT_OPENLDAP_VER)
+.    if defined(WITH_OPENLDAP_VER) && ${WITH_OPENLDAP_VER} != ${WANT_OPENLDAP_VER}
+IGNORE=		cannot install: the port wants openldap${WANT_OPENLDAP_VER}-client and you try to install openldap${WITH_OPENLDAP_VER}-client
+.    endif
+OPENLDAP_VER=	${WANT_OPENLDAP_VER}
+.  elif defined(WITH_OPENLDAP_VER)
+OPENLDAP_VER=	${WITH_OPENLDAP_VER}
+.  else
+.    if defined(_OPENLDAP_VER)
+OPENLDAP_VER=	${_OPENLDAP_VER}
+.    else
+OPENLDAP_VER=	${DEFAULT_OPENLDAP_VER}
+.    endif
+.  endif # WANT_OPENLDAP_VER
+
+.  if defined(_OPENLDAP_VER)
+.    if ${_OPENLDAP_VER} != ${OPENLDAP_VER}
+IGNORE=	cannot install: OpenLDAP versions mismatch: openldap${_OPENLDAP_VER}-client is installed and wanted version is openldap${OPENLDAP_VER}-client
+.    endif
+.  endif
+
+CFLAGS+=	-DLDAP_DEPRECATED
+
+_OPENLDAP_CLIENT=	net/openldap${OPENLDAP_VER}-client
+_OPENLDAP_SERVER=	net/openldap${OPENLDAP_VER}-server
+
+# And now we are checking if we can use it
+.  if defined(OPENLDAP${OPENLDAP_VER}_LIB)
+.    if defined(IGNORE_WITH_OPENLDAP)
+.      for VER in ${IGNORE_WITH_OPENLDAP}
+.        if (${OPENLDAP_VER} == "${VER}")
+IGNORE=		cannot install: doesn't work with OpenLDAP version: ${OPENLDAP_VER} (Doesn't support OpenLDAP ${IGNORE_WITH_OPENLDAP})
+.        endif
+.      endfor
+.    endif # IGNORE_WITH_OPENLDAP
+.    if defined(_WANT_OPENLDAP_SERVER)
+RUN_DEPENDS+=	${LOCALBASE}/libexec/slapd:${_OPENLDAP_SERVER}
+.    endif
+.    if defined(_WANT_OPENLDAP_CLIENT) || !defined(_WANT_OPENLDAP_SERVER)
+LIB_DEPENDS+=	${OPENLDAP${OPENLDAP_VER}_LIB}:${_OPENLDAP_CLIENT}
+.    endif
+.  else
+IGNORE=		cannot install: unknown OpenLDAP version: ${OPENLDAP_VER}
+.  endif # Check for correct libs
+
+.endif # !defined(_INCLUDE_USES_LDAP_MK)
diff --git a/Mk/bsd.default-versions.mk b/Mk/bsd.default-versions.mk
index b6a0cbeb1f4d..14d27d2e1daa 100644
--- a/Mk/bsd.default-versions.mk
+++ b/Mk/bsd.default-versions.mk
@@ -19,7 +19,7 @@ LOCALBASE?=	/usr/local
 
 .  for lang in APACHE BDB COROSYNC EMACS FIREBIRD FORTRAN FPC GCC \
 	GHOSTSCRIPT GL GO IMAGEMAGICK JAVA LAZARUS LIBRSVG2 LINUX LLVM \
-	LUA LUAJIT MONO MYSQL NINJA NODEJS PERL5 PGSQL PHP PYTHON \
+	LUA LUAJIT MONO MYSQL NINJA NODEJS OPENLDAP PERL5 PGSQL PHP PYTHON \
 	PYTHON2 PYTHON3 RUBY RUST SAMBA SSL TCLTK VARNISH
 .    if defined(${lang}_DEFAULT)
 ERROR+=	"The variable ${lang}_DEFAULT is set and it should only be defined through DEFAULT_VERSIONS+=${lang:tl}=${${lang}_DEFAULT} in /etc/make.conf"
@@ -95,6 +95,8 @@ MYSQL_DEFAULT?=		5.7
 NINJA_DEFAULT?=		ninja
 # Possible value: 14, 16, 18, 19, current, lts (Note: current = 19 and lts = 18)
 NODEJS_DEFAULT?=    lts
+# Possible value: 24, 25, 26
+OPENLDAP_DEFAULT?=    26
 # Possible values: 5.32, 5.34, 5.36, devel
 .  if !exists(${LOCALBASE}/bin/perl) || (!defined(_PORTS_ENV_CHECK) && \
     defined(PACKAGE_BUILDING))
diff --git a/Mk/bsd.ldap.mk b/Mk/bsd.ldap.mk
deleted file mode 100644
index 7e6ec2ffa9f4..000000000000
--- a/Mk/bsd.ldap.mk
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- tab-width: 4; -*-
-# ex: ts=4
-
-.if defined(_POSTMKINCLUDED) && !defined(Ldap_Post_Include)
-
-Ldap_Post_Include=			bsd.ldap.mk
-Database_Include_MAINTAINER=		ports@FreeBSD.org
-
-# For including this file define macro USE_OPENLDAP. Defining macro like
-# USE_OPENLDAP_VER or WANT_OPENLDAP_VER will include this file too.
-#
-##
-# USE_OPENLDAP			- Add OpenLDAP client dependency.
-#				  If no version is given (by the maintainer via the port or
-#				  by the user via defined variable), try to find the
-#				  currently installed version.  Fall back to default if
-#				  necessary (OpenLDAP 2.4 = 24).
-# DEFAULT_OPENLDAP_VER
-#				- OpenLDAP default version. Can be overriden within a port.
-#				  Default: 24.
-# WANT_OPENLDAP_VER
-#				- Maintainer can set an arbitrary version of OpenLDAP by using it.
-# IGNORE_OPENLDAP_OPENLDAP
-#				- This variable can be defined if the ports doesn't support
-#				  one or more version of OpenLDAP.
-# WITH_OPENLDAP_VER
-#				- User defined variable to set OpenLDAP version.
-# OPENLDAP_VER
-#				- Detected OpenLDAP version.
-
-.  if defined(USE_OPENLDAP)
-DEFAULT_OPENLDAP_VER?=	26
-# OpenLDAP client versions currently supported
-OPENLDAP24_LIB=		libldap-2.4.so.2
-OPENLDAP25_LIB=		libldap-2.5.so.0
-OPENLDAP26_LIB=		libldap.so.2
-
-.    if exists(${LOCALBASE}/bin/ldapwhoami)
-_OPENLDAP_VER!=	${LOCALBASE}/bin/ldapwhoami -VV 2>&1 | ${GREP} ldapwhoami | ${SED} -E 's/.*OpenLDAP: ldapwhoami (2)\.([0-9]).*/\1\2/'
-.    endif
-
-.    if defined(WANT_OPENLDAP_VER)
-.      if defined(WITH_OPENLDAP_VER) && ${WITH_OPENLDAP_VER} != ${WANT_OPENLDAP_VER}
-IGNORE=		cannot install: the port wants openldap${WANT_OPENLDAP_VER}-client and you try to install openldap${WITH_OPENLDAP_VER}-client
-.      endif
-OPENLDAP_VER=	${WANT_OPENLDAP_VER}
-.    elif defined(WITH_OPENLDAP_VER)
-OPENLDAP_VER=	${WITH_OPENLDAP_VER}
-.    else
-.      if defined(_OPENLDAP_VER)
-OPENLDAP_VER=	${_OPENLDAP_VER}
-.      else
-OPENLDAP_VER=	${DEFAULT_OPENLDAP_VER}
-.      endif
-.    endif # WANT_OPENLDAP_VER
-
-.    if defined(_OPENLDAP_VER)
-.      if ${_OPENLDAP_VER} != ${OPENLDAP_VER}
-IGNORE=	cannot install: OpenLDAP versions mismatch: openldap${_OPENLDAP_VER}-client is installed and wanted version is openldap${OPENLDAP_VER}-client
-.      endif
-.    endif
-
-CFLAGS+=	-DLDAP_DEPRECATED
-
-_OPENLDAP_CLIENT_PKG!=	${PKG_INFO} -Ex openldap.\*-client 2>/dev/null; ${ECHO_CMD}
-
-# And now we are checking if we can use it
-.    if defined(OPENLDAP${OPENLDAP_VER}_LIB)
-# compatability shim
-.      if defined(BROKEN_WITH_OPENLDAP)
-IGNORE_WITH_OPENLDAP=${BROKEN_WITH_OPENLDAP}
-.      endif
-.      if defined(IGNORE_WITH_OPENLDAP)
-.        for VER in ${IGNORE_WITH_OPENLDAP}
-.          if (${OPENLDAP_VER} == "${VER}")
-IGNORE=		cannot install: doesn't work with OpenLDAP version: ${OPENLDAP_VER} (Doesn't support OpenLDAP ${IGNORE_WITH_OPENLDAP})
-.          endif
-.        endfor
-.      endif # IGNORE_WITH_OPENLDAP
-LIB_DEPENDS+=	${OPENLDAP${OPENLDAP_VER}_LIB}:net/openldap${OPENLDAP_VER}-client
-.    else
-IGNORE=		cannot install: unknown OpenLDAP version: ${OPENLDAP_VER}
-.    endif # Check for correct libs
-
-.  endif # defined(USE_OPENLDAP)
-
-.endif # defined(_POSTMKINCLUDED) && !defined(Ldap_Post_Include)
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index b20876eff9f0..184fbbfe3db3 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1863,10 +1863,6 @@ MAKE_ENV+=	${b}="${${b}}"
 .      endfor
 .    endif
 
-.    if defined(USE_OPENLDAP) || defined(WANT_OPENLDAP_VER)
-.include "${PORTSDIR}/Mk/bsd.ldap.mk"
-.    endif
-
 .    if defined(USE_RC_SUBR)
 SUB_FILES+=	${USE_RC_SUBR}
 .    endif
diff --git a/Mk/bsd.sanity.mk b/Mk/bsd.sanity.mk
index 516b33e0a518..557b72a30509 100644
--- a/Mk/bsd.sanity.mk
+++ b/Mk/bsd.sanity.mk
@@ -209,7 +209,8 @@ SANITY_UNSUPPORTED=	USE_OPENAL USE_FAM USE_MAKESELF USE_ZIP USE_LHA USE_CMAKE \
 		USE_FPC_RUN WANT_FPC_BASE WANT_FPC_ALL USE_QT4 USE_QT5 QT_NONSTANDARD \
 		XORG_CAT CARGO_USE_GITHUB CARGO_USE_GITLAB CARGO_GIT_SUBDIR \
 		USE_RUBY USE_RUBY_EXTCONF USE_RUBY_SETUP RUBY_NO_BUILD_DEPENDS \
-		RUBY_NO_RUN_DEPENDS USE_APACHE USE_APACHE_BUILD USE_APACHE_RUN
+		RUBY_NO_RUN_DEPENDS USE_APACHE USE_APACHE_BUILD USE_APACHE_RUN \
+		USE_OPENLDAP WANT_OPENLDAP_VER
 SANITY_DEPRECATED=	MLINKS \
 			USE_MYSQL WANT_MYSQL_VER \
 			PYDISTUTILS_INSTALLNOSINGLE
@@ -244,6 +245,7 @@ USE_SCONS_ALT=		USES=scons
 USE_DRUPAL_ALT=		USES=drupal
 USE_PYDISTUTILS_ALT=		USE_PYTHON=distutils
 USE_PGSQL_ALT=		USES=pgsql
+USE_OPENLDAP_ALT=	USES=ldap
 INSTALLS_SHLIB_ALT=	USE_LDCONFIG
 NEED_ROOT_ALT=		USES=fakeroot or USES=uidfix
 PYTHON_CONCURRENT_INSTALL_ALT=	USE_PYTHON=concurrent
@@ -262,6 +264,7 @@ USE_FIREBIRD_ALT=	USES=firebird
 USE_BDB_ALT=		USES=bdb:${USE_BDB}
 USE_MYSQL_ALT=		USES=mysql:${USE_MYSQL}
 WANT_MYSQL_VER_ALT=	USES=mysql:${WANT_MYSQL_VER}
+WANT_OPENLDAP_VER_ALT=	USES=ldap:${WANT_OPENLDAP_VER}
 USE_OPENSSL_ALT=	USES=ssl
 USE_PHPIZE_ALT=		USES=php:phpize
 USE_PHPEXT_ALT=		USES=php:ext
diff --git a/databases/ateam_mysql57_ldap_auth/Makefile b/databases/ateam_mysql57_ldap_auth/Makefile
index 1b7ba9a0ed40..62b9ecfe9967 100644
--- a/databases/ateam_mysql57_ldap_auth/Makefile
+++ b/databases/ateam_mysql57_ldap_auth/Makefile
@@ -14,8 +14,7 @@ IGNORE_WITH_MYSQL=	56 80 101m 102m 103m
 
 LIB_DEPENDS=	libconfig.so:devel/libconfig
 
-USES=		compiler:c++11-lang gmake mysql:57,client,server
-USE_OPENLDAP=	yes
+USES=		compiler:c++11-lang gmake ldap mysql:57,client,server
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	ateamsystems
diff --git a/databases/ateam_mysql_ldap_auth/Makefile b/databases/ateam_mysql_ldap_auth/Makefile
index 720c36967c99..4396a514ac58 100644
--- a/databases/ateam_mysql_ldap_auth/Makefile
+++ b/databases/ateam_mysql_ldap_auth/Makefile
@@ -15,8 +15,7 @@ EXPIRATION_DATE=	2023-06-30
 
 LIB_DEPENDS=	libconfig.so:devel/libconfig
 
-USE_OPENLDAP=	yes
-USES=		gmake mysql:client,server
+USES=		gmake ldap mysql:client,server
 
 IGNORE_WITH_MYSQL=	57 80 101m 102m 103m 57p 57w
 
diff --git a/databases/evolution-data-server/Makefile b/databases/evolution-data-server/Makefile
index f5e3dae8733c..16f6607fecb2 100644
--- a/databases/evolution-data-server/Makefile
+++ b/databases/evolution-data-server/Makefile
@@ -65,7 +65,7 @@ KERBEROS_USES=		ssl
 
 LDAP_CMAKE_ON=		-DWITH_OPENLDAP=${LOCALBASE}
 LDAP_CMAKE_OFF=		-DWITH_OPENLDAP=OFF
-LDAP_USE=		openldap=yes
+LDAP_USES=		ldap
 
 VAPI_USES=		vala:build
 VAPI_CMAKE_BOOL=	ENABLE_VALA_BINDINGS
diff --git a/databases/ldb15/Makefile b/databases/ldb15/Makefile
index 5a3b08a91a33..5cecb3d54d79 100644
--- a/databases/ldb15/Makefile
+++ b/databases/ldb15/Makefile
@@ -31,12 +31,11 @@ CONFLICTS_INSTALL=	ldb[0-9][0-9] samba4[0-9][0-9] # include/ldb.h lib/python3.8/
 #nopython_CONFLICTS=	ldb
 #default_CONFLICTS=	ldb-nopython
 
-USES=			compiler gettext-runtime pkgconfig waf
+USES=			compiler gettext-runtime ldap pkgconfig waf
 USE_LDCONFIG=		yes
 WAF_CMD=		${BUILD_WRKSRC}/buildtools/bin/waf
 CONFIGURE_LOG=		${BUILD_WRKSRC}/bin/config.log
 
-USE_OPENLDAP=		yes
 PKGCONFIGDIR?=		${PREFIX}/libdata/pkgconfig
 PLIST_SUB+=		PKGCONFIGDIR=${PKGCONFIGDIR:S;${PREFIX}/;;}
 
diff --git a/databases/ldb20/Makefile b/databases/ldb20/Makefile
index 41199ae8c945..4c4895d01c8d 100644
--- a/databases/ldb20/Makefile
+++ b/databases/ldb20/Makefile
@@ -26,12 +26,11 @@ LDB_DEPENDS=		talloc>=2.2.0:devel/talloc \
 
 CONFLICTS_INSTALL=	ldb[0-9][0-9] # include/ldb.h
 
-USES=			compiler pkgconfig waf
+USES=			compiler ldap pkgconfig waf
 USE_LDCONFIG=		yes
 WAF_CMD=		${BUILD_WRKSRC}/buildtools/bin/waf
 CONFIGURE_LOG=		${BUILD_WRKSRC}/bin/config.log
 
-USE_OPENLDAP=		yes
 PKGCONFIGDIR?=		${PREFIX}/libdata/pkgconfig
 PLIST_SUB+=		PKGCONFIGDIR=${PKGCONFIGDIR:S;${PREFIX}/;;}
 
diff --git a/databases/ldb21/Makefile b/databases/ldb21/Makefile
index f874bb3c6ab3..5a82ea00d743 100644
--- a/databases/ldb21/Makefile
+++ b/databases/ldb21/Makefile
@@ -23,7 +23,7 @@ LDB_DEPENDS=		talloc>=2.2.0:devel/talloc \
 			cmocka>=1.1.3:sysutils/cmocka \
 			popt>=0:devel/popt
 
-USES=			compiler pkgconfig waf
+USES=			compiler ldap pkgconfig waf
 
 CONFLICTS_INSTALL=	ldb[0-9][0-9] # include/ldb.h
 
@@ -31,7 +31,6 @@ USE_LDCONFIG=		yes
 WAF_CMD=		${BUILD_WRKSRC}/buildtools/bin/waf
 CONFIGURE_LOG=		${BUILD_WRKSRC}/bin/config.log
 
-USE_OPENLDAP=		yes
 PKGCONFIGDIR?=		${PREFIX}/libdata/pkgconfig
 PLIST_SUB+=		PKGCONFIGDIR=${PKGCONFIGDIR:S;${PREFIX}/;;}
 
diff --git a/databases/ldb22/Makefile b/databases/ldb22/Makefile
index a2a82f83b01e..3081d2478c0c 100644
--- a/databases/ldb22/Makefile
+++ b/databases/ldb22/Makefile
@@ -24,7 +24,7 @@ TEST_DEPENDS=		${LDB_DEPENDS} \
 			cmocka>=1.1.3:sysutils/cmocka
 RUN_DEPENDS=		${LDB_DEPENDS}
 
-USES=			compiler pkgconfig waf
+USES=			compiler ldap pkgconfig waf
 
 CONFLICTS_INSTALL=	ldb[0-9][0-9] # include/ldb.h
 
@@ -32,7 +32,6 @@ USE_LDCONFIG=		yes
 WAF_CMD=		${BUILD_WRKSRC}/buildtools/bin/waf
 CONFIGURE_LOG=		${BUILD_WRKSRC}/bin/config.log
 
-USE_OPENLDAP=		yes
 PKGCONFIGDIR?=		${PREFIX}/libdata/pkgconfig
 PLIST_SUB+=		PKGCONFIGDIR=${PKGCONFIGDIR:S;${PREFIX}/;;}
 
diff --git a/databases/libgda5/Makefile b/databases/libgda5/Makefile
index 2f26c34db2f4..3f09ecff651a 100644
--- a/databases/libgda5/Makefile
+++ b/databases/libgda5/Makefile
@@ -61,7 +61,7 @@ CONFIGURE_ARGS+=	--without-bdb
 .endif
 
 .if ${LIBGDA5_SLAVE}==ldap
-USE_OPENLDAP=	yes
+USES=	ldap
 CONFIGURE_ARGS+=	--with-ldap=${LOCALBASE}
 .else
 CONFIGURE_ARGS+=	--without-ldap
diff --git a/databases/mysql57-client/Makefile b/databases/mysql57-client/Makefile
index c1a312aafec8..ec2127d9803f 100644
--- a/databases/mysql57-client/Makefile
+++ b/databases/mysql57-client/Makefile
@@ -34,7 +34,7 @@ OPTIONS_GROUP_PLUGINS=	SASLCLIENT
 SASLCLIENT_DESC=	SASL client plugin module
 SASLCLIENT_CMAKE_BOOL=	WITH_AUTHENTICATION_LDAP
 SASLCLIENT_LIB_DEPENDS=		libsasl2.so:security/cyrus-sasl2
-SASLCLIENT_USE=		OPENLDAP=yes
+SASLCLIENT_USES=		ldap
 OPTIONS_DEFAULT+=	SASLCLIENT
 
 # issue 166367: adding symlinks for back-compatibility with ${lib}_r
diff --git a/databases/mysql80-client/Makefile b/databases/mysql80-client/Makefile
index 6ee35754d862..d5f01f4b1f67 100644
--- a/databases/mysql80-client/Makefile
+++ b/databases/mysql80-client/Makefile
@@ -33,7 +33,7 @@ OPTIONS_GROUP_PLUGINS=	SASLCLIENT
 SASLCLIENT_DESC=	SASL client plugin module
 SASLCLIENT_CMAKE_BOOL=	WITH_AUTHENTICATION_LDAP
 SASLCLIENT_LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2
-SASLCLIENT_USE=		OPENLDAP=yes
+SASLCLIENT_USES=		ldap
 
 OPTIONS_DEFAULT+=	SASLCLIENT
 OPTIONS_SUB=	yes
diff --git a/databases/percona57-client/Makefile b/databases/percona57-client/Makefile
index 62cedd6416aa..c7491369167f 100644
--- a/databases/percona57-client/Makefile
+++ b/databases/percona57-client/Makefile
@@ -34,7 +34,7 @@ OPTIONS_GROUP_PLUGINS=	SASLCLIENT
 SASLCLIENT_DESC=	SASL client plugin module
 SASLCLIENT_CMAKE_BOOL=	WITH_AUTHENTICATION_LDAP
 SASLCLIENT_LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2
-SASLCLIENT_USE=		OPENLDAP=yes
+SASLCLIENT_USES=		ldap
 OPTIONS_DEFAULT+=	SASLCLIENT
 OPTIONS_SUB=	yes
 
diff --git a/databases/postgresql15-server/Makefile b/databases/postgresql15-server/Makefile
index 16d458ab0f3c..6639a6500fe0 100644
--- a/databases/postgresql15-server/Makefile
+++ b/databases/postgresql15-server/Makefile
@@ -164,7 +164,7 @@ NLS_CONFIGURE_ENABLE=	nls
 NLS_USES=		gettext
 
 LDAP_CONFIGURE_WITH=	ldap
-LDAP_USE=		OPENLDAP=yes
+LDAP_USES=		ldap
 
 OPTIMIZED_CFLAGS_CFLAGS=-O3 -funroll-loops
 
diff --git a/databases/virtuoso/Makefile b/databases/virtuoso/Makefile
index e7859889eb20..043e321b348f 100644
--- a/databases/virtuoso/Makefile
+++ b/databases/virtuoso/Makefile
@@ -99,7 +99,7 @@ CONFIGURE_ARGS+=--disable-krb
 
 .if ${PORT_OPTIONS:MLDAP}
 CONFIGURE_ARGS+=--enable-openldap=${LOCALBASE}
-USE_OPENLDAP=	yes
+USES=	ldap
 .else
 CONFIGURE_ARGS+=--disable-openldap
 .endif
diff --git a/devel/apr1/Makefile b/devel/apr1/Makefile
index 644cd93f517c..d3ba4db4a51e 100644
--- a/devel/apr1/Makefile
+++ b/devel/apr1/Makefile
@@ -43,7 +43,7 @@ SSL_DESC=		OpenSSL crypto driver
 # APR-Util Options
 BDB_USES=		bdb:5+
 GDBM_LIB_DEPENDS=	libgdbm.so:databases/gdbm
-LDAP_USE=		OPENLDAP=yes
+LDAP_USES=		ldap
 MYSQL_USES=		mysql
 NSS_LIB_DEPENDS=	libnss3.so:security/nss
 ODBC_LIB_DEPENDS=	libodbc.so:databases/unixODBC
diff --git a/devel/p5-Test-OpenLDAP/Makefile b/devel/p5-Test-OpenLDAP/Makefile
index f0e7b42f0567..9df623458b27 100644
--- a/devel/p5-Test-OpenLDAP/Makefile
+++ b/devel/p5-Test-OpenLDAP/Makefile
@@ -14,14 +14,12 @@ LICENSE_COMB=	dual
 
 RUN_DEPENDS=	\
 	p5-Data-UUID>0:devel/p5-Data-UUID \
-	p5-perl-ldap>0:net/p5-perl-ldap \
-	${LOCALBASE}/libexec/slapd:net/openldap${OPENLDAP_VER}-server
+	p5-perl-ldap>0:net/p5-perl-ldap
 BUILD_DEPENDS=	${RUN_DEPENDS}
 
 NO_ARCH=	yes
-USES=		perl5
+USES=		ldap:server perl5
 USE_PERL5=	configure
-USE_OPENLDAP=	yes
 
 CONFIGURE_ENV=	PATH=${PATH}:${PREFIX}/libexec
 
diff --git a/devel/ptlib/Makefile b/devel/ptlib/Makefile
index 885adb42edba..63d38fb9a98c 100644
--- a/devel/ptlib/Makefile
+++ b/devel/ptlib/Makefile
@@ -135,7 +135,7 @@ CONFIGURE_ARGS+=--disable-sdl
 .endif
 
 .if ${PORT_OPTIONS:MLDAP}
-USE_OPENLDAP=	yes
+USES+=	ldap
 CONFIGURE_ARGS+=--enable-openldap
 .else
 CONFIGURE_ARGS+=--disable-openldap
diff --git a/devel/sope/Makefile b/devel/sope/Makefile
index 78ee0b05b7ee..e9f971cddc36 100644
--- a/devel/sope/Makefile
+++ b/devel/sope/Makefile
@@ -38,7 +38,7 @@ MEMCACHED_DESC=		Install memcached
 MYSQL_DESC=		Build with MySQL support
 PGSQL_DESC=		Build with PostgreSQL support
 
-LDAP_USE=		OPENLDAP=client
+LDAP_USES=		ldap
 MEMCACHED_RUN_DEPENDS=	${LOCALBASE}/bin/memcached:databases/memcached
 MYSQL_USES=		mysql
 PGSQL_USES=		pgsql
diff --git a/devel/sope2/Makefile b/devel/sope2/Makefile
index 43c25ce4efa9..f46e17294f43 100644
--- a/devel/sope2/Makefile
+++ b/devel/sope2/Makefile
@@ -22,7 +22,6 @@ OPTIONS_DEFINE=		LDAP MYSQL PGSQL MEMCACHED
 OPTIONS_DEFAULT=	LDAP PGSQL MEMCACHED
 OPTIONS_SUB=		yes
 
-LDAP_DESC=		Build with LDAP support
 MYSQL_DESC=		Build with MySQL support
 PGSQL_DESC=		Build with PostgreSQL support
 MEMCACHED_DESC=		Install memcached
@@ -37,7 +36,7 @@ SUB_LIST+=		GNUSTEP_LOCAL_TOOLS=${GNUSTEP_LOCAL_TOOLS} \
 
 CONFIGURE_ARGS=		--with-gnustep --disable-debug --enable-strip
 
-LDAP_USE=		OPENLDAP=client
+LDAP_USES=		ldap
 PGSQL_USES=		pgsql
 MYSQL_USES=		mysql
 MEMCACHED_RUN_DEPENDS=	${LOCALBASE}/bin/memcached:databases/memcached
diff --git a/dns/bind916/Makefile b/dns/bind916/Makefile
index ff27843fc5be..38053bf5d72c 100644
--- a/dns/bind916/Makefile
+++ b/dns/bind916/Makefile
@@ -100,7 +100,7 @@ DLZ_BDB_USES=		bdb
 DLZ_FILESYSTEM_CONFIGURE_ON=	--with-dlz-filesystem=yes
 
 DLZ_LDAP_CONFIGURE_ON=	--with-dlz-ldap=yes
-DLZ_LDAP_USE=		OPENLDAP=yes
+DLZ_LDAP_USES=		ldap
 
 DLZ_MYSQL_CONFIGURE_ON=	--with-dlz-mysql=yes
 DLZ_MYSQL_USES=		mysql
diff --git a/dns/ldapdns/Makefile b/dns/ldapdns/Makefile
index ede96663468c..a23274d9eac3 100644
--- a/dns/ldapdns/Makefile
+++ b/dns/ldapdns/Makefile
@@ -14,8 +14,7 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 RUN_DEPENDS=	setuidgid:sysutils/daemontools \
 		tcpserver:sysutils/ucspi-tcp
 
-USES=		localbase:ldflags shebangfix tar:xz
-USE_OPENLDAP=	yes
+USES=		ldap localbase:ldflags shebangfix tar:xz
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS=	--prefix=${PREFIX}
 USE_CSTD=	gnu89
diff --git a/dns/powerdns/Makefile b/dns/powerdns/Makefile
index 2babc53071c8..194334f50d7a 100644
--- a/dns/powerdns/Makefile
+++ b/dns/powerdns/Makefile
@@ -96,7 +96,7 @@ MYSQL_CONFIGURE_ON=	--with-mysql=${LOCALBASE}
 MYSQL_CONFIGURE_OFF=	--without-mysql
 MYSQL_VARS=		MODULES+=gmysql
 
-OPENLDAP_USE=		OPENLDAP=YES
+OPENLDAP_USES=		ldap
 OPENLDAP_CXXFLAGS=	-DLDAP_DEPRECATED=1
 OPENLDAP_VARS=		MODULES+=ldap
 
diff --git a/editors/libreoffice/Makefile b/editors/libreoffice/Makefile
index 014e36456e62..1e0e7135bebf 100644
--- a/editors/libreoffice/Makefile
+++ b/editors/libreoffice/Makefile
@@ -118,11 +118,10 @@ SHEBANG_GLOB=	*.py
 
 GNU_CONFIGURE=	yes
 USES=		autoreconf:build bison compiler:c++17-lang cpe desktop-file-utils \
-		gettext gl gmake gnome jpeg localbase:ldflags perl5 pkgconfig \
+		gettext gl gmake gnome jpeg ldap localbase:ldflags perl5 pkgconfig \
 		python:3.8+ shebangfix shared-mime-info ssl tar:xz xorg
 USE_GL=		gl glew glu
 USE_GNOME=	cairo glib20 libxml2 libxslt
-USE_OPENLDAP=	yes
 USE_PERL5=	build
 USE_XORG=	ice sm x11 xaw xcb xext xinerama xrandr xrender
 
diff --git a/emulators/wine/Makefile b/emulators/wine/Makefile
index a45d1a3c8170..1b1967127d67 100644
--- a/emulators/wine/Makefile
+++ b/emulators/wine/Makefile
@@ -89,7 +89,7 @@ GNUTLS_CONFIGURE_WITH=	gnutls
 GNUTLS_LIB_DEPENDS=	libgnutls.so:security/gnutls
 
 LDAP_CONFIGURE_WITH=	ldap
-LDAP_USE=		OPENLDAP=yes
+LDAP_USES=		ldap
 
 MONO_RUN_DEPENDS=	wine-mono>0:emulators/wine-mono
 
diff --git a/finance/odoo/Makefile b/finance/odoo/Makefile
index 16b40d144fb2..48502ba13a4e 100644
--- a/finance/odoo/Makefile
+++ b/finance/odoo/Makefile
@@ -64,9 +64,8 @@ RUN_DEPENDS=	wkhtmltopdf>0:converters/wkhtmltopdf \
 		${PYTHON_PKGNAMEPREFIX}idna>0:dns/py-idna@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}stdnum>0:devel/py-stdnum@${PY_FLAVOR}
 
-USES=		cpe python:3.7+ pgsql shebangfix
+USES=		cpe ldap python:3.7+ pgsql shebangfix
 USE_PYTHON=	distutils
-USE_OPENLDAP=	yes
 
 SHEBANG_LANG=	python
 SHEBANG_FILES=	${WRKSRC}/${PORTNAME}-bin
diff --git a/finance/odoo14/Makefile b/finance/odoo14/Makefile
index 2f5194f2a7f5..74495a69575b 100644
--- a/finance/odoo14/Makefile
+++ b/finance/odoo14/Makefile
@@ -66,9 +66,8 @@ RUN_DEPENDS=	wkhtmltopdf>0:converters/wkhtmltopdf \
 		${PYTHON_PKGNAMEPREFIX}idna>0:dns/py-idna@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}stdnum>0:devel/py-stdnum@${PY_FLAVOR}
 
-USES=		cpe python:3.7+ pgsql shebangfix
+USES=		cpe ldap python:3.7+ pgsql shebangfix
 USE_PYTHON=	distutils
-USE_OPENLDAP=	yes
 
 SHEBANG_LANG=	python
 SHEBANG_FILES=	${WRKSRC}/${PORTNAME}-bin
diff --git a/finance/odoo15/Makefile b/finance/odoo15/Makefile
index 1a9478c05c77..6b53f1b6b2bf 100644
--- a/finance/odoo15/Makefile
+++ b/finance/odoo15/Makefile
@@ -66,9 +66,8 @@ RUN_DEPENDS=	wkhtmltopdf>0:converters/wkhtmltopdf \
 		${PYTHON_PKGNAMEPREFIX}idna>0:dns/py-idna@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}stdnum>0:devel/py-stdnum@${PY_FLAVOR}
 
-USES=		cpe python:3.7+ pgsql shebangfix
+USES=		cpe ldap python:3.7+ pgsql shebangfix
 USE_PYTHON=	distutils
-USE_OPENLDAP=	yes
 
 SHEBANG_LANG=	python
 SHEBANG_FILES=	${WRKSRC}/${PORTNAME}-bin
diff --git a/ftp/curl/Makefile b/ftp/curl/Makefile
index 040359c87a65..818a353e6736 100644
--- a/ftp/curl/Makefile
+++ b/ftp/curl/Makefile
@@ -105,7 +105,7 @@ IDN_LIB_DEPENDS=	libidn2.so:dns/libidn2
 IMAP_CONFIGURE_ENABLE=	imap
 IPV6_CONFIGURE_ENABLE=	ipv6
 LDAP_CONFIGURE_ENABLE=	ldap
-LDAP_USE=		OPENLDAP=yes
+LDAP_USES=		ldap
 LDAPS_CONFIGURE_ENABLE=	ldaps
 LIBSSH2_CONFIGURE_WITH=	libssh2
 LIBSSH2_LIB_DEPENDS=	libssh2.so:security/libssh2
diff --git a/ftp/pure-ftpd/Makefile b/ftp/pure-ftpd/Makefile
index 624118c04454..880a2ef04f78 100644
--- a/ftp/pure-ftpd/Makefile
+++ b/ftp/pure-ftpd/Makefile
@@ -51,7 +51,7 @@ ANONRENAME_CPPFLAGS=	-DANON_CAN_RENAME
 ANONRESUME_CPPFLAGS=	-DANON_CAN_RESUME
 LARGEFILE_CONFIGURE_ENABLE=	largefile
 LDAP_CONFIGURE_WITH=	ldap
-LDAP_USE=		OPENLDAP=yes
+LDAP_USES=		ldap
 MYSQL_CONFIGURE_WITH=	mysql
 MYSQL_USES=		mysql
 PAM_CONFIGURE_WITH=	pam
diff --git a/irc/anope/Makefile b/irc/anope/Makefile
index 19c62f36f4cb..57be759c9f4e 100644
--- a/irc/anope/Makefile
+++ b/irc/anope/Makefile
@@ -27,7 +27,7 @@ TRE_DESC=	Tre Regex Module
 
 GNUTLS_LIB_DEPENDS=	libgnutls.so:security/gnutls
 
-LDAP_USE=	OPENLDAP=yes
+LDAP_USES=	ldap
 
 MYSQL_USES=	mysql
 
diff --git a/irc/atheme-services/Makefile b/irc/atheme-services/Makefile
index 548737cc380e..db61c8ba45dc 100644
--- a/irc/atheme-services/Makefile
+++ b/irc/atheme-services/Makefile
@@ -43,7 +43,7 @@ OPTIONS_SUB=	yes
 CONTRIB_CONFIGURE_ENABLE=	contrib
 CRACKLIB_LIB_DEPENDS=	libcrack.so:security/cracklib
 CRACKLIB_CONFIGURE_WITH=	cracklib
-LDAP_USE=	openldap=yes
+LDAP_USES=	ldap
 LDAP_CONFIGURE_WITH=	ldap
 NLS_USES=	gettext
 NLS_CONFIGURE_ENABLE=	nls
diff --git a/irc/bitlbee/Makefile b/irc/bitlbee/Makefile
index 5319ab4a9758..8bc53ac840a2 100644
--- a/irc/bitlbee/Makefile
+++ b/irc/bitlbee/Makefile
@@ -66,7 +66,7 @@ GNUTLS_LIB_DEPENDS=	libgnutls.so:security/gnutls \
 			libgpg-error.so:security/libgpg-error
 JABBER_CONFIGURE_OFF=	--jabber=0
 LDAP_CONFIGURE_ON=	--ldap=1
-LDAP_USE=		OPENLDAP=yes
+LDAP_USES=		ldap
 LIBEVENT_CONFIGURE_ON=	--events=libevent --libevent=${LOCALBASE}
 LIBEVENT_LIB_DEPENDS=	libevent.so:devel/libevent
 LIBPURPLE_CONFIGURE_ON=	--purple=1
diff --git a/irc/inspircd/Makefile b/irc/inspircd/Makefile
index 84c2d36ea182..8530ea784526 100644
--- a/irc/inspircd/Makefile
+++ b/irc/inspircd/Makefile
@@ -68,7 +68,7 @@ GNUTLS_LIB_DEPENDS=	libgnutls.so:security/gnutls
 GNUTLS_USES=		pkgconfig
 GNUTLS_VARS=		EXTRAS+=m_ssl_gnutls.cpp
 
-LDAP_USE=		OPENLDAP=yes
+LDAP_USES=		ldap
 LDAP_VARS=		EXTRAS+=m_ldap.cpp
 MBEDTLS_LIB_DEPENDS=	libmbedtls.so:security/mbedtls
 MBEDTLS_VARS=		EXTRAS+=m_ssl_mbedtls.cpp
diff --git a/irc/quassel/Makefile b/irc/quassel/Makefile
index 2956b79bf7c6..f09b80d39653 100644
--- a/irc/quassel/Makefile
+++ b/irc/quassel/Makefile
@@ -13,11 +13,10 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 
 BUILD_DEPENDS=	${LOCALBASE}/include/boost/optional.hpp:devel/boost-libs
 
-USES=		cmake compiler:c++11-lib cpe pkgconfig qca qt:5 tar:xz
+USES=		cmake compiler:c++11-lib cpe ldap pkgconfig qca qt:5 tar:xz
 USE_GITHUB=	nodefault
 #GH_ACCOUNT=	${PORTNAME}
 #GH_PROJECT=	${PORTNAME}
-USE_OPENLDAP=	yes
 USE_QT=		buildtools:build core network qmake:build
 
 CPE_VENDOR=	quassel-irc
diff --git a/lang/php80/Makefile.ext b/lang/php80/Makefile.ext
index 8f47bdbfa6a0..8621f7c23145 100644
--- a/lang/php80/Makefile.ext
+++ b/lang/php80/Makefile.ext
@@ -179,7 +179,7 @@ CONFIGURE_ARGS+=--with-imap=${LOCALBASE} \
 CONFIGURE_ENV+=	OPENSSL_CFLAGS="-I${OPENSSLINC}" \
 		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
 		PHP_OPENSSL=yes
-  
+
 LDFLAGS+=	-L${OPENSSLLIB} -lcrypto -lssl
 USES+=		ssl
 .endif
@@ -197,8 +197,7 @@ BUILD_DEPENDS=  re2c:devel/re2c
 
 .if ${PHP_MODNAME} == "ldap"
 CONFIGURE_ARGS+=--with-ldap=${LOCALBASE} --with-ldap-sasl=${LOCALBASE}
-
-USE_OPENLDAP=	yes
+USE+=	ldap
 .endif
 
 .if ${PHP_MODNAME} == "mbstring"
diff --git a/lang/php81/Makefile b/lang/php81/Makefile
index 88e42e1399c3..d4459d4f88b7 100644
--- a/lang/php81/Makefile
+++ b/lang/php81/Makefile
@@ -363,8 +363,7 @@ BUILD_DEPENDS=		re2c:devel/re2c
 .if ${PHP_MODNAME} == "ldap"
 CONFIGURE_ARGS+=	--with-ldap-sasl=${LOCALBASE} \
 			--with-ldap=${LOCALBASE}
-
-USE_OPENLDAP=	yes
+USES+=	ldap
 .endif
 
 .if ${PHP_MODNAME} == "mbstring"
diff --git a/lang/php82/Makefile b/lang/php82/Makefile
*** 1715 LINES SKIPPED ***