From 2c018ca65687fce488ef10f434fc2cdbed53d967 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Tue, 4 May 2021 01:48:09 +0530 Subject: [PATCH] cyrus-sasl: Workaround for ucrt. Changes: * Rebase the patches. * S_IRUSR and S_IWUSR is already defined in mingw-w64, hence remove the patch. * Fix usage of TCHAR, define _UNICODE project wise. * Fix path relocation to use *nix style paths. --- mingw-w64-cyrus-sasl/04-manpage-paths.patch | 12 ++-- ...-LIBSASL_API-to-function-definitions.patch | 8 +-- ...EAN_AND_MEAN-avoiding-handle_t-redef.patch | 4 +- ...MinGW-w64-define-S_IRUSR-and-S_IWUSR.patch | 12 ---- .../19-paths-relocation.patch | 12 ++-- mingw-w64-cyrus-sasl/20-mingw-tchar.patch | 43 ++++++++++---- ...utoconf-prevent-full-path-resolution.patch | 56 +++++++++++++++++++ mingw-w64-cyrus-sasl/PKGBUILD | 31 ++++++---- 8 files changed, 124 insertions(+), 54 deletions(-) delete mode 100644 mingw-w64-cyrus-sasl/17-MinGW-w64-define-S_IRUSR-and-S_IWUSR.patch create mode 100644 mingw-w64-cyrus-sasl/22-autoconf-prevent-full-path-resolution.patch diff --git a/mingw-w64-cyrus-sasl/04-manpage-paths.patch b/mingw-w64-cyrus-sasl/04-manpage-paths.patch index 3af29034fc..92949d16b7 100644 --- a/mingw-w64-cyrus-sasl/04-manpage-paths.patch +++ b/mingw-w64-cyrus-sasl/04-manpage-paths.patch @@ -25,8 +25,8 @@ diff --git a/saslauthd/saslauthd.8 b/saslauthd/saslauthd.8 index 843edb0..07b5358 100644 --- a/saslauthd/saslauthd.8 +++ b/saslauthd/saslauthd.8 -@@ -156,10 +156,10 @@ AAUUTTHHEENNTTIICCAATTIIOONN MMEECCHHAANNIISSMMSS - ldap _(_A_l_l _p_l_a_t_f_o_r_m_s _t_h_a_t _s_u_p_p_o_r_t _O_p_e_n_L_D_A_P _2_._0 _o_r _h_i_g_h_e_r_) +@@ -169,10 +169,10 @@ + ldap (All platforms that support OpenLDAP 2.0 or higher) Authenticate against an ldap server. The ldap configuration - parameters are read from /usr/local/etc/saslauthd.conf. The @@ -38,14 +38,14 @@ index 843edb0..07b5358 100644 + LDAP_SASLAUTHD file included with the distribution for the + list of available parameters. - sia _(_D_i_g_i_t_a_l _U_N_I_X_) + sia (Digital UNIX) -@@ -181,7 +181,7 @@ NNOOTTEESS - FFIILLEESS +@@ -194,7 +194,7 @@ + FILES /var/run/saslauthd/mux The default communications socket. - /usr/local/etc/saslauthd.conf + /etc/saslauthd.conf The default configuration file for ldap support. - SSEEEE AALLSSOO + SEE ALSO diff --git a/mingw-w64-cyrus-sasl/14-MinGW-w64-add-LIBSASL_API-to-function-definitions.patch b/mingw-w64-cyrus-sasl/14-MinGW-w64-add-LIBSASL_API-to-function-definitions.patch index a5efff73f5..d7dbf10abf 100644 --- a/mingw-w64-cyrus-sasl/14-MinGW-w64-add-LIBSASL_API-to-function-definitions.patch +++ b/mingw-w64-cyrus-sasl/14-MinGW-w64-add-LIBSASL_API-to-function-definitions.patch @@ -79,7 +79,7 @@ diff -urN a/sasldb/db_gdbm.c b/sasldb/db_gdbm.c diff -urN a/sasldb/db_ndbm.c b/sasldb/db_ndbm.c --- a/sasldb/db_ndbm.c 2014-08-12 22:40:34.276570300 +0100 +++ b/sasldb/db_ndbm.c 2014-08-12 22:40:35.112618100 +0100 -@@ -221,7 +221,7 @@ +@@ -231,7 +231,7 @@ #define SUFLEN 5 #endif @@ -88,7 +88,7 @@ diff -urN a/sasldb/db_ndbm.c b/sasldb/db_ndbm.c sasl_conn_t *conn) { const char *path = SASL_DB_PATH; -@@ -294,7 +294,7 @@ +@@ -304,7 +304,7 @@ int first; } handle_t; @@ -97,7 +97,7 @@ diff -urN a/sasldb/db_ndbm.c b/sasldb/db_ndbm.c sasl_conn_t *conn) { const char *path = SASL_DB_PATH; -@@ -339,7 +339,7 @@ +@@ -350,7 +350,7 @@ return (sasldb_handle)handle; } @@ -106,7 +106,7 @@ diff -urN a/sasldb/db_ndbm.c b/sasldb/db_ndbm.c sasldb_handle handle, char *out, const size_t max_out, size_t *out_len) { -@@ -369,7 +369,7 @@ +@@ -380,7 +380,7 @@ return SASL_CONTINUE; } diff --git a/mingw-w64-cyrus-sasl/16-MinGW-w64-define-WIN32_LEAN_AND_MEAN-avoiding-handle_t-redef.patch b/mingw-w64-cyrus-sasl/16-MinGW-w64-define-WIN32_LEAN_AND_MEAN-avoiding-handle_t-redef.patch index fa83d4772e..6a083fe2ee 100644 --- a/mingw-w64-cyrus-sasl/16-MinGW-w64-define-WIN32_LEAN_AND_MEAN-avoiding-handle_t-redef.patch +++ b/mingw-w64-cyrus-sasl/16-MinGW-w64-define-WIN32_LEAN_AND_MEAN-avoiding-handle_t-redef.patch @@ -1,7 +1,7 @@ diff -urN a/configure.ac b/configure.ac --- a/configure.ac 2014-08-12 22:40:36.914721200 +0100 +++ b/configure.ac 2014-08-12 22:40:37.473753200 +0100 -@@ -1042,6 +1042,9 @@ +@@ -1117,6 +1117,9 @@ darwin*) AC_ARG_ENABLE(macos-framework, [ --disable-macos-framework disable building and installing replacement SASL2 Framework for MacOS X-provided SASL Framework [[no]]],building_for_macosx=no,building_for_macosx=yes) ;; @@ -10,4 +10,4 @@ diff -urN a/configure.ac b/configure.ac + ;; esac AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes) - + AM_CONDITIONAL(WINDOWS, test "$host_os" = "mingw32") diff --git a/mingw-w64-cyrus-sasl/17-MinGW-w64-define-S_IRUSR-and-S_IWUSR.patch b/mingw-w64-cyrus-sasl/17-MinGW-w64-define-S_IRUSR-and-S_IWUSR.patch deleted file mode 100644 index 4dc743c316..0000000000 --- a/mingw-w64-cyrus-sasl/17-MinGW-w64-define-S_IRUSR-and-S_IWUSR.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN cyrus-sasl-2.1.26.orig/configure.ac cyrus-sasl-2.1.26/configure.ac ---- cyrus-sasl-2.1.26.orig/configure.ac 2014-08-12 22:58:37.785543500 +0100 -+++ cyrus-sasl-2.1.26/configure.ac 2014-08-12 23:01:36.330755700 +0100 -@@ -1044,6 +1044,8 @@ - ;; - mingw*) - AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Define to 1, avoids handle_t redefinition.]) -+AC_DEFINE(S_IRUSR, _S_IREAD, [Define to _S_IREAD for MinGW-w64]) -+AC_DEFINE(S_IWUSR, _S_IWRITE, [Define to _S_IWRITE for MinGW-w64]) - ;; - esac - AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes) diff --git a/mingw-w64-cyrus-sasl/19-paths-relocation.patch b/mingw-w64-cyrus-sasl/19-paths-relocation.patch index 3fab9590b1..7d05c1e8e5 100644 --- a/mingw-w64-cyrus-sasl/19-paths-relocation.patch +++ b/mingw-w64-cyrus-sasl/19-paths-relocation.patch @@ -13,9 +13,9 @@ diff -Naur cyrus-sasl-2.1.26-orig/m4/varexpand.m4 cyrus-sasl-2.1.26/m4/varexpand diff -Naur cyrus-sasl-2.1.26-orig/configure.ac cyrus-sasl-2.1.26/configure.ac --- cyrus-sasl-2.1.26-orig/configure.ac 2014-12-15 23:10:23.125400000 +0300 +++ cyrus-sasl-2.1.26/configure.ac 2014-12-16 00:23:05.167200000 +0300 -@@ -1027,6 +1027,8 @@ - configdir=$plugindir:/etc/sasl2) - AC_DEFINE_UNQUOTED(CONFIGDIR, "$configdir", [Runtime config file location]) +@@ -1102,6 +1102,8 @@ + configdir=$withval, + configdir='${plugindir}:${sysconfdir}/sasl2') AC_SUBST(configdir) +FULL_EXPAND_VARIABLE(sasl_bindir, "$bindir") +AC_DEFINE_UNQUOTED(BINDIR, "$sasl_bindir", [Runtime executables location]) @@ -25,7 +25,7 @@ diff -Naur cyrus-sasl-2.1.26-orig/configure.ac cyrus-sasl-2.1.26/configure.ac diff -Naur cyrus-sasl-2.1.26-orig/include/sasl.h cyrus-sasl-2.1.26/include/sasl.h --- cyrus-sasl-2.1.26-orig/include/sasl.h 2014-12-15 23:10:22.454600000 +0300 +++ cyrus-sasl-2.1.26/include/sasl.h 2014-12-15 23:43:10.374600000 +0300 -@@ -667,6 +667,8 @@ +@@ -669,6 +669,8 @@ #define SASL_PATH_TYPE_PLUGIN 0 #define SASL_PATH_TYPE_CONFIG 1 @@ -122,7 +122,7 @@ diff -Naur cyrus-sasl-2.1.26-orig/lib/common.c cyrus-sasl-2.1.26/lib/common.c diff -Naur cyrus-sasl-2.1.26-orig/lib/Makefile.am cyrus-sasl-2.1.26/lib/Makefile.am --- cyrus-sasl-2.1.26-orig/lib/Makefile.am 2014-12-15 23:10:23.094200000 +0300 +++ cyrus-sasl-2.1.26/lib/Makefile.am 2014-12-15 23:24:10.600800000 +0300 -@@ -60,8 +60,8 @@ +@@ -62,8 +62,8 @@ DLOPEN_C = dlopen.c endif @@ -735,7 +735,7 @@ diff -Naur cyrus-sasl-2.1.26-orig/lib/pathtools.h cyrus-sasl-2.1.26/lib/pathtool diff -Naur cyrus-sasl-2.1.26-orig/utils/pluginviewer.c cyrus-sasl-2.1.26/utils/pluginviewer.c --- cyrus-sasl-2.1.26-orig/utils/pluginviewer.c 2014-12-15 23:10:22.407800000 +0300 +++ cyrus-sasl-2.1.26/utils/pluginviewer.c 2014-12-15 23:45:36.037600000 +0300 -@@ -201,7 +201,7 @@ +@@ -197,7 +197,7 @@ if (searchpath) { *path = searchpath; } else { diff --git a/mingw-w64-cyrus-sasl/20-mingw-tchar.patch b/mingw-w64-cyrus-sasl/20-mingw-tchar.patch index 51bdd79a37..9a46ccab68 100644 --- a/mingw-w64-cyrus-sasl/20-mingw-tchar.patch +++ b/mingw-w64-cyrus-sasl/20-mingw-tchar.patch @@ -1,13 +1,32 @@ ---- cyrus-sasl-2.1.27/lib/windlopen.c.orig 2020-01-21 12:19:27.108854500 +0300 -+++ cyrus-sasl-2.1.27/lib/windlopen.c 2020-01-21 12:19:50.681720100 +0300 -@@ -51,6 +51,10 @@ - #include "saslint.h" - #include "staticopen.h" +--- cyrus-sasl-2.1.27.orig/configure.ac 2021-05-04 00:43:26.301737400 +0530 ++++ cyrus-sasl-2.1.27/configure.ac 2021-05-04 00:44:14.503209900 +0530 +@@ -1121,6 +1121,8 @@ + ;; + mingw*) + AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Define to 1, avoids handle_t redefinition.]) ++AC_DEFINE(_UNICODE, [], [Enable unicode environment.]) ++AC_DEFINE(UNICODE, [], [Enable unicode environment.]) + ;; + esac + AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes) +@@ -1452,6 +1454,7 @@ + # endif + #else /* WIN32 */ + # include ++# include + #endif /* WIN32 */ + #include -+#ifdef __MINGW32__ -+#include -+#endif -+ - #define DLL_SUFFIX _T(".dll") - #define DLL_MASK _T("*") DLL_SUFFIX - #define DLL_MASK_LEN 5 /* in symbols */ +@@ -1524,9 +1527,9 @@ + #endif + + #ifdef WIN32 +-#define SASL_ROOT_KEY "SOFTWARE\\Carnegie Mellon\\Project Cyrus\\SASL Library" +-#define SASL_PLUGIN_PATH_ATTR "SearchPath" +-#define SASL_CONF_PATH_ATTR "ConfFile" ++#define SASL_ROOT_KEY _T("SOFTWARE\\Carnegie Mellon\\Project Cyrus\\SASL Library") ++#define SASL_PLUGIN_PATH_ATTR _T("SearchPath") ++#define SASL_CONF_PATH_ATTR _T("ConfFile") + + #include + inline static unsigned int sleep(unsigned int seconds) { diff --git a/mingw-w64-cyrus-sasl/22-autoconf-prevent-full-path-resolution.patch b/mingw-w64-cyrus-sasl/22-autoconf-prevent-full-path-resolution.patch new file mode 100644 index 0000000000..cef3d1c0bc --- /dev/null +++ b/mingw-w64-cyrus-sasl/22-autoconf-prevent-full-path-resolution.patch @@ -0,0 +1,56 @@ +diff --unified -r cyrus-sasl-2.1.27.orig/configure.ac cyrus-sasl-2.1.27/configure.ac +--- cyrus-sasl-2.1.27.orig/configure.ac 2018-10-09 20:28:04.000000000 +0530 ++++ cyrus-sasl-2.1.27/configure.ac 2021-05-03 23:19:32.289742100 +0530 +@@ -1095,13 +1095,16 @@ + be found [[LIBDIR/sasl2]] ], + plugindir=$withval, + plugindir='${libdir}/sasl2') ++AC_DEFINE_UNQUOTED(PLUGINDIR, "$plugindir", [Runtime plugin location]) + AC_SUBST(plugindir) + + AC_ARG_WITH(configdir, [ --with-configdir=DIR set the directory where config files will + be found [PLUGINDIR:SYSCONFDIR/sasl2] ], + configdir=$withval, + configdir='${plugindir}:${sysconfdir}/sasl2') ++AC_DEFINE_UNQUOTED(CONFIGDIR, "$configdir", [Runtime config file location]) + AC_SUBST(configdir) ++ + FULL_EXPAND_VARIABLE(sasl_bindir, "$bindir") + AC_DEFINE_UNQUOTED(BINDIR, "$sasl_bindir", [Runtime executables location]) + +diff --unified -r cyrus-sasl-2.1.27.orig/lib/Makefile.am cyrus-sasl-2.1.27/lib/Makefile.am +--- cyrus-sasl-2.1.27.orig/lib/Makefile.am 2018-10-05 20:10:16.000000000 +0530 ++++ cyrus-sasl-2.1.27/lib/Makefile.am 2021-05-03 23:20:45.644604600 +0530 +@@ -46,7 +46,7 @@ + sasl_version = 3:0:0 + + AM_CPPFLAGS=-DLIBSASL_EXPORTS=1 -I$(top_srcdir)/include -I$(top_srcdir)/plugins \ +- -I$(top_builddir)/include -I$(top_srcdir)/sasldb -I$(top_srcdir)/common -DCONFIGDIR='"${configdir}"' -DPLUGINDIR='"${plugindir}"' ++ -I$(top_builddir)/include -I$(top_srcdir)/sasldb -I$(top_srcdir)/common + PLUGIN_COMMON_OBJS = $(top_builddir)/common/libplugin_common.la + + EXTRA_DIST = windlopen.c dlopen.c staticopen.h NTMakefile +diff --unified -r cyrus-sasl-2.1.27.orig/sample/Makefile.am cyrus-sasl-2.1.27/sample/Makefile.am +--- cyrus-sasl-2.1.27.orig/sample/Makefile.am 2018-10-05 20:10:16.000000000 +0530 ++++ cyrus-sasl-2.1.27/sample/Makefile.am 2021-05-03 23:21:06.965457200 +0530 +@@ -42,7 +42,7 @@ + # + ################################################################ + +-AM_CPPFLAGS=-I$(top_srcdir)/include -DPLUGINDIR='"${plugindir}"' ++AM_CPPFLAGS=-I$(top_srcdir)/include + + noinst_PROGRAMS = client server http_digest_client + EXTRA_PROGRAMS = sample-client sample-server +diff --unified -r cyrus-sasl-2.1.27.orig/utils/Makefile.am cyrus-sasl-2.1.27/utils/Makefile.am +--- cyrus-sasl-2.1.27.orig/utils/Makefile.am 2018-10-05 20:10:16.000000000 +0530 ++++ cyrus-sasl-2.1.27/utils/Makefile.am 2021-05-03 23:21:35.991353300 +0530 +@@ -89,7 +89,7 @@ + libsfsasl2_la_LIBADD = sfsasl.lo + libsfsasl2_la_LDFLAGS = -version-info 1:0:0 -export-dynamic -rpath $(libdir) + +-AM_CPPFLAGS=-DLIBSASL_EXPORTS=1 -I$(top_srcdir)/include -I$(top_builddir)/include @SASL_DB_INC@ -DPLUGINDIR='"${plugindir}"' ++AM_CPPFLAGS=-DLIBSASL_EXPORTS=1 -I$(top_srcdir)/include -I$(top_builddir)/include @SASL_DB_INC@ + + EXTRA_DIST = saslpasswd2.8 sasldblistusers2.8 pluginviewer.8 sfsasl.h sfsasl.c smtptest.c testsuite.c pluginviewer.c NTMakefile + diff --git a/mingw-w64-cyrus-sasl/PKGBUILD b/mingw-w64-cyrus-sasl/PKGBUILD index 325d816fe8..c0493ea7a3 100644 --- a/mingw-w64-cyrus-sasl/PKGBUILD +++ b/mingw-w64-cyrus-sasl/PKGBUILD @@ -25,7 +25,7 @@ _realname=cyrus-sasl pkgbase=mingw-w64-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") pkgver=2.1.27 -pkgrel=1 +pkgrel=2 pkgdesc="Cyrus Simple Authentication Service Layer (SASL) library" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64') @@ -35,28 +35,30 @@ depends=("${MINGW_PACKAGE_PREFIX}-gdbm" "${MINGW_PACKAGE_PREFIX}-openssl" "${MINGW_PACKAGE_PREFIX}-sqlite3") options=('emptydirs' 'strip' '!makeflags') -source=(https://cyrusimap.org/releases/${_realname}-${pkgver}.tar.gz +source=(https://github.com/cyrusimap/${_realname}/releases/download/${_realname}-${pkgver}/${_realname}-${pkgver}.tar.gz{,.sig} 02-exeext.patch 03-fix-plugins.patch 04-manpage-paths.patch 14-MinGW-w64-add-LIBSASL_API-to-function-definitions.patch 15-MinGW-w64-define-LIBSASL_EXPORTS_eq_1-for-sasldb.patch 16-MinGW-w64-define-WIN32_LEAN_AND_MEAN-avoiding-handle_t-redef.patch - 17-MinGW-w64-define-S_IRUSR-and-S_IWUSR.patch 19-paths-relocation.patch 20-mingw-tchar.patch - 21-fix-getopt-guard.patch) + 21-fix-getopt-guard.patch + 22-autoconf-prevent-full-path-resolution.patch) sha256sums=('26866b1549b00ffd020f188a43c258017fa1c382b3ddadd8201536f72efb05d5' + 'SKIP' '0d0220f721b07f821e14f00c04250c2243620301200f825e7f0532b581d63a7d' '62fca7407d288e021fac6fed47d8a94ef2775c257ddcb79071428fe7719485f5' - 'a4abc51b2509e0792f7dc019afcb0bf6dacfdcf1132d28cf7562bbb18828a8fc' - 'c40ab13f6f9a6ea1dcd602e308a51caf162f9853821123a3f8fe88897eda3b98' + 'b8bedacab5fc992eb2afd259ce2e898291d2bec685030108be3f51e6ce30977c' + '795196a9db0c8155d59c08dcbb0df15dfe7bb4eb47b30df511649573ac59b39f' '148c2062d22011f731ad93fb603cde9c519e73322c89add0408772c434c6bf17' - '5b0104ec5fd190c7c6bd5b8d49c76e9c02609e449b499c0382cacd0e0f5032dd' - 'd058e921d5b7b292371cff2e0334c067bfb8ce0ba85e82726b18961ae2e4f509' - '2823f70b1584d24cf9d4978ebcc1480087ed0764c342951a91563ef911878133' - '01b3145dd008f024b5f27accbad1e56a01a8819ded66271adc600ce71b6eea6b' - 'f51412367d893cb4c2e4ee2ec76a6a641abaaf6d3086af93a9b579a8d0ce26c5') + 'e101e1bd3ee03650e89e05c18d5f699d2f69aecc4f7aac4b11db2d1755783c5c' + '5baa235667ee597a52120a48bc2acf15471ac3e096affdff5c644fb1b68f5568' + '57b1b40017fa2a3fb189deedc01959673ed96cc01e088fd85ae0d59e1e13f25f' + 'f51412367d893cb4c2e4ee2ec76a6a641abaaf6d3086af93a9b579a8d0ce26c5' + '8cca4435b2d8bc5c04490bd16092bc9c5fcf3eb5c113778674b8393342302c65') +validpgpkeys=('829F339F8C296FE80F409D93E3D7C118C7B9F46A') # Partha Susarla prepare() { cd ${srcdir}/${_realname}-${pkgver} @@ -67,11 +69,16 @@ prepare() { patch -p1 -i ${srcdir}/14-MinGW-w64-add-LIBSASL_API-to-function-definitions.patch patch -p1 -i ${srcdir}/15-MinGW-w64-define-LIBSASL_EXPORTS_eq_1-for-sasldb.patch patch -p1 -i ${srcdir}/16-MinGW-w64-define-WIN32_LEAN_AND_MEAN-avoiding-handle_t-redef.patch - patch -p1 -i ${srcdir}/17-MinGW-w64-define-S_IRUSR-and-S_IWUSR.patch patch -p1 -i ${srcdir}/19-paths-relocation.patch patch -p1 -i ${srcdir}/20-mingw-tchar.patch patch -p1 -i ${srcdir}/21-fix-getopt-guard.patch + # Partially revert upstream b017b437bef7b329097945172b8516d434754d41 commit. + patch -p1 -i ${srcdir}/22-autoconf-prevent-full-path-resolution.patch + + # For clang + sed -i "s/-fPIC //g" common/Makefile.am sasldb/Makefile.am + autoreconf -fiv cp -f ${srcdir}/${_realname}-${pkgver}/win32/include/md5global.h ${srcdir}/${_realname}-${pkgver}/include/md5global.h }