Skip to content

Commit

Permalink
[openldap] Add new port (microsoft#26122)
Browse files Browse the repository at this point in the history
* [openlap] Add new port

Merge pull request #1 from dg0yt/openldap

Signed-off-by: Gordon Smith <[email protected]>

* [openlap] Add new port

m4.patch is needed when libtool < 2.4.6
m4.patch will only work with autoconf < 2.70

Signed-off-by: Gordon Smith <[email protected]>

* wip:  Make cyrus-sasl optional

Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith authored Aug 12, 2022
1 parent 2c7862c commit 83ef251
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 0 deletions.
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()

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
openssl.patch
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 @@ -5240,6 +5240,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
}
]
}

0 comments on commit 83ef251

Please sign in to comment.