Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[openldap] Add new port #26122

Merged
merged 3 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ports/openldap/m4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/configure.ac b/configure.ac
index 71dd7a6..6741ec6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ m4_ifndef([PKG_PREREQ],

AC_CONFIG_AUX_DIR(build)dnl
AC_CONFIG_MACRO_DIRS([build])
+AC_CONFIG_MACRO_DIR([m4])

eval `$ac_aux_dir/version.sh`
if test -z "$OL_STRING"; then
35 changes: 35 additions & 0 deletions ports/openldap/openssl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/configure.ac b/configure.ac
index 626d024..e97f548 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1223,6 +1223,9 @@ fi

ol_link_tls=no
if test $ol_with_tls = openssl || test $ol_with_tls = auto ; then
+ PKG_CHECK_MODULES(OPENSSL, openssl >= 1.1.1, [have_openssl=yes], [AC_MSG_FAILURE([OpenSSL is required])])
+ CFLAGS="${OPENSSL_CFLAGS} ${CFLAGS}"
+ ac_cv_lib_ssl_SSL_export_keying_material_early=yes
AC_CHECK_HEADERS(openssl/ssl.h)

if test $ac_cv_header_openssl_ssl_h = yes ; then
@@ -1245,7 +1248,8 @@ if test $ol_with_tls = openssl || test $ol_with_tls = auto ; then
AC_DEFINE(HAVE_OPENSSL, 1,
[define if you have OpenSSL])

- TLS_LIBS="-lssl -lcrypto"
+ TLS_LIBS="${OPENSSL_LIBS}"
+ AC_SUBST(TLS_MODULE, openssl, [TLS pkg-config module])
fi
fi
fi
diff --git a/libraries/libldap/ldap.pc.in b/libraries/libldap/ldap.pc.in
index 3f7dd46..43b2e52 100644
--- a/libraries/libldap/ldap.pc.in
+++ b/libraries/libldap/ldap.pc.in
@@ -10,4 +10,5 @@ Version: @VERSION@
Requires: lber
Cflags: -I${includedir}
Libs: -L${libdir} -lldap
-Libs.private: @LIBS@ @SASL_LIBS@ @TLS_LIBS@ @AUTH_LIBS@
+Libs.private: @LIBS@ @SASL_LIBS@ @AUTH_LIBS@
+Requires.private: @TLS_MODULE@
66 changes: 66 additions & 0 deletions ports/openldap/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
vcpkg_download_distfile(ARCHIVE
URLS "https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.5.13.tgz"
FILENAME "openldap-2.5.13.tgz"
SHA512 30fdc884b513c53169910eec377c2ad05013b9f06bab3123d50d028108b24548791f7f47f18bcb3a2b4868edeab02c10d81ffa320c02d7b562f2e8f2fa25d6c9
)

vcpkg_list(SET EXTRA_PATCHES)

# Check autoconf version < 2.70
execute_process(COMMAND autoconf --version OUTPUT_VARIABLE AUTOCONF_VERSION_STR)
if(NOT "${AUTOCONF_VERSION_STR}" STREQUAL "" AND "${AUTOCONF_VERSION_STR}" MATCHES ".*2\\.[0-6].*")
vcpkg_list(APPEND EXTRA_PATCHES m4.patch)
endif()
Comment on lines +9 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer it the patch could be rewritten in a way so that it always applies. If it is only used on some systems, it may be ignored by CI and bitrot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree - unfortunately I have zero experience with configure and pkg-config...

The reason the m4 patch is being added is to trick the autoconfig -vfi to work. The other option is to remove the AUTOCONFIG and replace with a manual call to: autoreconf -vf and then there is no need to for the m4 patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the portfile.cmake "clean" for libtool=2.4.6 breaks it for 2.4.2 and vice versa (the suggestion to add AC_CONFIG_MACRO_DIR([m4]) doesn't work when autoconf >= 2.70)


vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
openssl.patch
GordonSmith marked this conversation as resolved.
Show resolved Hide resolved
subdirs.patch
${EXTRA_PATCHES}
)

vcpkg_list(SET FEATURE_OPTIONS)
if("tools" IN_LIST FEATURES)
vcpkg_list(APPEND FEATURE_OPTIONS --enable-tools)
endif()

if("cyrus-sasl" IN_LIST FEATURES)
vcpkg_list(APPEND FEATURE_OPTIONS --with-cyrus-sasl)
else()
vcpkg_list(APPEND FEATURE_OPTIONS --without-cyrus-sasl)
endif()

# Disable build environment details in binaries
set(ENV{SOURCE_DATE_EPOCH} "1659614616")

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_VERBOSE_FLAGS
AUTOCONFIG
OPTIONS
${FEATURE_OPTIONS}
--disable-cleartext
--disable-mdb
--disable-relay
--disable-slapd
--disable-syncprov
--with-tls=openssl
--without-systemd
--without-fetch
--without-argon2
ac_cv_lib_iodbc_SQLDriverConnect=no
ac_cv_lib_odbc_SQLDriverConnect=no
ac_cv_lib_odbc32_SQLDriverConnect=no
)

vcpkg_build_make(BUILD_TARGET depend LOGFILE_ROOT depend)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
34 changes: 34 additions & 0 deletions ports/openldap/subdirs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/Makefile.in b/Makefile.in
index 5c6bec0..c654210 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -13,7 +13,11 @@
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.

-SUBDIRS= include libraries clients servers tests doc
+ifeq ($(patsubst %/debug,DEBUG,$(prefix)),DEBUG)
+SUBDIRS= include libraries
+else
+SUBDIRS= include libraries @TOOLS_SUBDIRS@
+endif
CLEANDIRS=
INSTALLDIRS=

diff --git a/configure.ac b/configure.ac
index e97f548..71dd7a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -235,6 +235,12 @@ dnl OL_ARG_ENABLE(referrals,[AS_HELP_STRING([--enable-referrals], [enable LDAPv2
ol_enable_referrals=${ol_enable_referrals-no}
OL_ARG_ENABLE(ipv6, [AS_HELP_STRING([--enable-ipv6], [enable IPv6 support])], auto)dnl
OL_ARG_ENABLE(local, [AS_HELP_STRING([--enable-local], [enable AF_LOCAL (AF_UNIX) socket support])], auto)dnl
+OL_ARG_ENABLE(tools, [AS_HELP_STRING([--enable-tools], [Build client tools])],no,[no yes])
+TOOLS_SUBDIRS=""
+if test "$ol_enable_tools" = "yes" ; then
+ TOOLS_SUBDIRS="clients"
+fi
+AC_SUBST(TOOLS_SUBDIRS)

dnl ----------------------------------------------------------------
dnl General "with" options
6 changes: 6 additions & 0 deletions ports/openldap/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The package openldapp can be imported via CMake FindPkgConfig module:

find_package(PkgConfig)
pkg_check_modules(OPENLDAP REQUIRED IMPORTED_TARGET ldap)

target_link_libraries(main PRIVATE PkgConfig::OPENLDAP)
19 changes: 19 additions & 0 deletions ports/openldap/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "openldap",
"version": "2.5.13",
"description": "OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol.",
"homepage": "https://www.openldap.org/software/",
"license": "OLDAP-2.8",
"supports": "!windows, (mingw & !x86)",
"dependencies": [
"openssl"
],
"features": {
"cyrus-sasl": {
"description": "with Cyrus SASL support"
},
"tools": {
"description": "Enable client tools"
}
}
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5224,6 +5224,10 @@
"baseline": "2.5.0",
"port-version": 0
},
"openldap": {
"baseline": "2.5.13",
"port-version": 0
},
"openmama": {
"baseline": "6.3.1",
"port-version": 1
Expand Down
9 changes: 9 additions & 0 deletions versions/o-/openldap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "63f4c67d336142daba83711983e54a8954794331",
"version": "2.5.13",
"port-version": 0
}
]
}