[cyrus-sasl,krb5] Fix dependencies (#40117)

This commit is contained in:
Kai Pastor 2024-07-31 21:18:48 +02:00 committed by GitHub
parent 1dc5ee30eb
commit 2d27533fd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 185 additions and 26 deletions

View File

@ -0,0 +1,81 @@
diff --git a/libsasl2.pc.in b/libsasl2.pc.in
index ddad76d..5192f74 100644
--- a/libsasl2.pc.in
+++ b/libsasl2.pc.in
@@ -9,4 +9,5 @@ URL: http://www.cyrussasl.org/
Version: @VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lsasl2
-Libs.private: @LIB_DOOR@ @SASL_DL_LIB@ @LIBS@
+Libs.private: @LIB_DOOR@ @SASL_DB_LIB@ @SASL_DL_LIB@ @LIBS@
+Requires.private: mit-krb5-gssapi
diff --git a/m4/openssl.m4 b/m4/openssl.m4
index 42b31af..301dca5 100644
--- a/m4/openssl.m4
+++ b/m4/openssl.m4
@@ -20,6 +20,12 @@ case "$with_openssl" in
no)
with_openssl="no";;
*)
+ with_openssl="yes"
+ PKG_CHECK_MODULES([LIBCRYPTO],[libcrypto],[],[AC_MSG_FAILURE([Cannot find OpenSSL])])
+ CFLAGS="$CFLAGS $LIBCRYPTO_CFLAGS"
+ LIBS="$LIBS $LIBCRYPTO_LIBS"
+ ;;
+ orig)
with_openssl="yes"
dnl if openssl has been compiled with the rsaref2 libraries,
dnl we need to include the rsaref libraries in the crypto check
diff --git a/m4/sasl2.m4 b/m4/sasl2.m4
index 80371ef..77133af 100644
--- a/m4/sasl2.m4
+++ b/m4/sasl2.m4
@@ -117,8 +117,7 @@ if test "$gssapi" != no; then
if test "$gss_impl" = "auto" -o "$gss_impl" = "mit"; then
gss_failed=0
- AC_CHECK_LIB(gssapi_krb5,gss_unwrap,gss_impl="mit",gss_failed=1,
- ${GSSAPIBASE_LIBS} -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${LIB_SOCKET})
+ PKG_CHECK_MODULES([MIT_KRB5_GSSAPI],[mit-krb5-gssapi],[gss_impl="mit"],[AC_MSG_FAILURE([Cannot find MIT Kerberos])])
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
@@ -170,8 +169,9 @@ if test "$gssapi" != no; then
fi
if test "$gss_impl" = "mit"; then
- GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
- GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a"
+ GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS $MIT_KRB5_GSSAPI_LIBS"
+ GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $MIT_KRB5_GSSAPI_LIBS"
+ CFLAGS="$CFLAGS $MIT_KRB5_GSSAPI_CFLAGS"
elif test "$gss_impl" = "heimdal"; then
CPPFLAGS="$CPPFLAGS"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err"
diff --git a/m4/sasldb.m4 b/m4/sasldb.m4
index 5febf14..5848576 100644
--- a/m4/sasldb.m4
+++ b/m4/sasldb.m4
@@ -46,8 +46,9 @@ dnl named. arg.
esac
;;
lmdb)
+ AX_PTHREAD()
AC_CHECK_HEADER(lmdb.h, [
- AC_CHECK_LIB(lmdb, mdb_env_create, SASL_DB_LIB="-llmdb"; enable_keep_db_open=yes, dblib="no")],
+ AC_CHECK_LIB(lmdb, mdb_env_create, SASL_DB_LIB="-llmdb $PTHREAD_CFLAGS $PTHREAD_LIBS"; enable_keep_db_open=yes, [AC_MSG_FAILURE([Cannot find lmdb])], [$PTHREAD_CFLAGS $PTHREAD_LIBS])],
dblib="no")
;;
ndbm)
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 99c49e1..c34913f 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -43,6 +43,7 @@
################################################################
all_sasl_libs = ../lib/libsasl2.la $(SASL_DB_LIB) $(LIB_SOCKET)
+all_sasl_libs += $(GSSAPIBASE_LIBS)
all_sasl_static_libs = ../lib/.libs/libsasl2.a $(SASL_DB_LIB) $(LIB_SOCKET) $(GSSAPIBASE_LIBS) $(GSSAPI_LIBS) $(SASL_KRB_LIB) $(LIB_DES) $(PLAIN_LIBS) $(SRP_LIBS) $(LIB_MYSQL) $(LIB_PGSQL) $(LIB_SQLITE)
sbin_PROGRAMS = @SASL_DB_UTILS@ @SMTPTEST_PROGRAM@ pluginviewer

View File

@ -7,46 +7,103 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
configure.diff
)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
file(REMOVE "${SOURCE_PATH}/include/md5global.h")
file(COPY "${SOURCE_PATH}/win32/include/md5global.h" DESTINATION "${SOURCE_PATH}/include/md5global.h")
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) # only DLL build rules
set(STATIC_CRT_LINKAGE no)
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(STATIC_CRT_LINKAGE yes)
endif()
string(APPEND VCPKG_C_FLAGS " /DUNICODE /D_UNICODE /D_WINSOCK_DEPRECATED_NO_WARNINGS")
string(APPEND VCPKG_CXX_FLAGS " /DUNICODE /D_UNICODE /D_WINSOCK_DEPRECATED_NO_WARNINGS")
cmake_path(NATIVE_PATH CURRENT_INSTALLED_DIR CURRENT_INSTALLED_DIR_NATIVE)
cmake_path(NATIVE_PATH CURRENT_PACKAGES_DIR CURRENT_PACKAGES_DIR_NATIVE)
vcpkg_install_nmake(
SOURCE_PATH "${SOURCE_PATH}"
DETERMINE_BUILD_TRIPLET
PROJECT_NAME "NTMakefile"
OPTIONS
GSSAPI=MITKerberos
"DB_INCLUDE=${CURRENT_INSTALLED_DIR}/include"
"DB_LIB=libdb48.lib"
STATIC=${STATIC_CRT_LINKAGE}
"SUBDIRS=lib plugins utils"
# Note https://www.cyrusimap.org/sasl/sasl/windows.html#limitations
GSSAPI=MITKerberos # but "GSSAPI - tested using CyberSafe"
"GSSAPI_INCLUDE=${CURRENT_INSTALLED_DIR_NATIVE}\\include"
SASLDB=LMDB # but "SASLDB - only SleepyCat version can be built"
"LMDB_INCLUDE=${CURRENT_INSTALLED_DIR_NATIVE}\\include"
SRP=1
DO_SRP_SETPASS=1
OTP=1
"OPENSSL_INCLUDE=${CURRENT_INSTALLED_DIR_NATIVE}\\include"
# Silence log messages about default initialization
"DB_LIB=unused"
"DB_INCLUDE=${CURRENT_PACKAGES_DIR_NATIVE}\\unused"
"DB_LIBPATH=${CURRENT_PACKAGES_DIR_NATIVE}\\unused"
"LDAP_INCLUDE=${CURRENT_PACKAGES_DIR_NATIVE}\\unused"
"LDAP_LIB_BASE=${CURRENT_PACKAGES_DIR_NATIVE}\\unused"
"SQLITE_INCLUDE=${CURRENT_PACKAGES_DIR_NATIVE}\\unused"
"SQLITE_LIBPATH=${CURRENT_PACKAGES_DIR_NATIVE}\\unused"
"SQLITE_INCLUDE3=${CURRENT_PACKAGES_DIR_NATIVE}\\unused"
"SQLITE_LIBPATH3=${CURRENT_PACKAGES_DIR_NATIVE}\\unused"
OPTIONS_RELEASE
CFG=Release
"prefix=${CURRENT_PACKAGES_DIR}"
"OPENSSL_LIBPATH=${CURRENT_INSTALLED_DIR}/lib"
"DB_LIBPATH=${CURRENT_INSTALLED_DIR}/lib"
"prefix=${CURRENT_PACKAGES_DIR_NATIVE}"
"GSSAPI_LIBPATH=${CURRENT_INSTALLED_DIR_NATIVE}\\lib"
"LMDB_LIBPATH=${CURRENT_INSTALLED_DIR_NATIVE}\\lib"
"OPENSSL_LIBPATH=${CURRENT_INSTALLED_DIR_NATIVE}\\lib"
OPTIONS_DEBUG
CFG=Debug
"prefix=${CURRENT_PACKAGES_DIR}/debug"
"OPENSSL_LIBPATH=${CURRENT_INSTALLED_DIR}/lib/debug"
"DB_LIBPATH=${CURRENT_INSTALLED_DIR}/lib/debug"
"prefix=${CURRENT_PACKAGES_DIR_NATIVE}\\debug"
"GSSAPI_LIBPATH=${CURRENT_INSTALLED_DIR_NATIVE}\\debug\\lib"
"LMDB_LIBPATH=${CURRENT_INSTALLED_DIR_NATIVE}\\debug\\lib"
"OPENSSL_LIBPATH=${CURRENT_INSTALLED_DIR_NATIVE}\\debug\\lib"
)
vcpkg_copy_tools(TOOL_NAMES pluginviewer sasldblistusers2 saslpasswd2 testsuite AUTO_CLEAN)
block(SCOPE_FOR VARIABLES)
set(prefix [[placeholder]])
set(exec_prefix [[${prefix}]])
set(libdir [[${prefix}/lib]])
set(includedir [[${prefix}/include]])
configure_file("${SOURCE_PATH}/libsasl2.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libsasl2.pc" @ONLY)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libsasl2x.pc" " -lsasl2" " -llibsasl")
if(NOT VCPKG_BUILD_TYPE)
file(COPY_FILE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libsasl2.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libsasl2.pc")
endif()
endblock()
else()
vcpkg_find_acquire_program(PKGCONFIG)
set(ENV{PKG_CONFIG} "${PKGCONFIG}")
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
DETERMINE_BUILD_TRIPLET
AUTOCONFIG
OPTIONS
"--with-gssapi"
"--disable-macos-framework"
--enable-sample=no
--with-dblib=lmdb
--with-gss_impl=mit
--disable-macos-framework
)
vcpkg_install_make()
endif()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING"
COMMENT [[
The top-level COPYING file represents the license identified as BSD with
Attribution and HPND disclaimer. However, various source files are under
different licenses, including other BSD license variants, MIT license
variants, OpenLDAP, OpenSSL and others.
]])

View File

@ -1,16 +1,14 @@
{
"name": "cyrus-sasl",
"version": "2.1.28",
"port-version": 1,
"description": "Cyrus SASL is an implementation of SASL that makes it easy for application developers to integrate authentication mechanisms into their application in a generic way.",
"homepage": "https://github.com/cyrusimap/cyrus-sasl",
"license": "BSD-3-Clause-Attribution",
"supports": "linux | osx | (x64 & windows & !static & !uwp)",
"license": null,
"supports": "linux | osx | (windows & !uwp)",
"dependencies": [
{
"name": "berkeleydb",
"platform": "windows"
},
"krb5",
"lmdb",
"openssl"
]
}

View File

@ -1,5 +1,17 @@
diff --git a/src/aclocal.m4 b/src/aclocal.m4
index 3d66a87..cf3e3e6 100644
--- a/src/aclocal.m4
+++ b/src/aclocal.m4
@@ -226,6 +226,7 @@ old_CFLAGS="$CFLAGS"
# On Solaris, -pthreads is added to CFLAGS, no extra explicit libraries.
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_LIBS)
old_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_NOTICE(rechecking with PTHREAD_... options)
diff --git a/src/build-tools/mit-krb5.pc.in b/src/build-tools/mit-krb5.pc.in
index fdc5577..dc9c4b9 100644
index fdc5577..745d5ec 100644
--- a/src/build-tools/mit-krb5.pc.in
+++ b/src/build-tools/mit-krb5.pc.in
@@ -12,4 +12,4 @@ Description: An implementation of Kerberos network authentication
@ -7,7 +19,7 @@ index fdc5577..dc9c4b9 100644
Cflags: -I${includedir}
Libs: -L${libdir} -lkrb5 -lk5crypto @COM_ERR_LIB@
-Libs.private: -lkrb5support
+Libs.private: -lkrb5support @GEN_LIB@ @MACOS_FRAMEWORK@ @LIBS@ @DL_LIB@
+Libs.private: -lkrb5support @GEN_LIB@ @MACOS_FRAMEWORK@ @LIBS@ @DL_LIB@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
diff --git a/src/config/pre.in b/src/config/pre.in
index a0c60c7..a8432a8 100644
--- a/src/config/pre.in

View File

@ -2,6 +2,7 @@
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "krb5",
"version": "1.21.3",
"port-version": 1,
"description": [
"Kerberos is a network authentication protocol.",
"It is designed to provide strong authentication for client/server applications by using secret-key cryptography.",

View File

@ -2146,7 +2146,7 @@
},
"cyrus-sasl": {
"baseline": "2.1.28",
"port-version": 0
"port-version": 1
},
"czmq": {
"baseline": "4.2.1",
@ -4098,7 +4098,7 @@
},
"krb5": {
"baseline": "1.21.3",
"port-version": 0
"port-version": 1
},
"ktx": {
"baseline": "4.3.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f4f1c74c59daf2e8cc8826300628e887d0f1f51b",
"version": "2.1.28",
"port-version": 1
},
{
"git-tree": "1577585f5eff556f1f478ffb103713e066caf4dc",
"version": "2.1.28",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "def378059ffb932bf5f4ff18235b2d136893090e",
"version": "1.21.3",
"port-version": 1
},
{
"git-tree": "657a5de48ad7f70915fb10cbfc93aec06a4b2018",
"version": "1.21.3",