From 6b5fc6c4336a11b452a03a7396d617a0ee7b3dc5 Mon Sep 17 00:00:00 2001 From: Mikhail Titov Date: Thu, 21 Nov 2024 14:31:49 -0600 Subject: [PATCH] Add pkcs11-provider --- mingw-w64-pkcs11-provider/PKGBUILD | 63 +++++++++++++++++++++++++++ mingw-w64-pkcs11-provider/patch.patch | 42 ++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 mingw-w64-pkcs11-provider/PKGBUILD create mode 100644 mingw-w64-pkcs11-provider/patch.patch diff --git a/mingw-w64-pkcs11-provider/PKGBUILD b/mingw-w64-pkcs11-provider/PKGBUILD new file mode 100644 index 0000000000000..2bf82ee3ec748 --- /dev/null +++ b/mingw-w64-pkcs11-provider/PKGBUILD @@ -0,0 +1,63 @@ +_realname=pkcs11-provider +pkgbase=mingw-w64-${_realname} +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") +pkgver=0.5.r92.gcff4036 +pkgrel=1 +pkgdesc="A pkcs#11 provider for OpenSSL 3.0+ (mingw-w64)" +arch=('any') +mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') +url='https://github.com/latchset/pkcs11-provider' +msys2_references=('archlinux: pkcs11-provider') +license=('COPYING') +makedepends=("${MINGW_PACKAGE_PREFIX}-meson" + "${MINGW_PACKAGE_PREFIX}-ninja" + "${MINGW_PACKAGE_PREFIX}-pkg-config" + "${MINGW_PACKAGE_PREFIX}-cc" + "${MINGW_PACKAGE_PREFIX}-dlfcn" + "git") +depends=("${MINGW_PACKAGE_PREFIX}-openssl") +# optdepends("${MINGW_PACKAGE_PREFIX}-p11-kit: seamless PKCS#11 modules integration") +_commit='cff40360e4b47d38911999c625249683b7445170' +source=("${_realname}"::"git+https://github.com/latchset/pkcs11-provider.git#commit=${_commit}" + "patch.patch") +sha256sums=('54e253b1f2363f4f5fa626394538da62734dd641a47c352b5b9b9970827d0b12' + '91d16126be2d86136a79d285627d263957129b02046269a1c3dfeba38c5016a6') + +pkgver() { + cd "${_realname}" + + git describe --long "${_commit}" | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g' +} + +prepare() { + cd "${_realname}" + + patch -p1 -i ${srcdir}/patch.patch +} + +build() { + MSYS2_ARG_CONV_EXCL="--prefix=" \ + LDFLAGS="-ldl" CFLAGS="-pthread -Wno-incompatible-pointer-types -D_XOPEN_SOURCE=700" \ + meson setup \ + --prefix="${MINGW_PREFIX}" \ + --wrap-mode=nodownload \ + --auto-features=enabled \ + --buildtype=release \ + "build-${MSYSTEM}" \ + "${_realname}" + + meson compile -C "build-${MSYSTEM}" +} + +check() { + meson test -C "build-${MSYSTEM}" +} + +package() { + # meson install -C "build-${MSYSTEM}" --destdir "${pkgdir}" + install -Dm755 "${srcdir}/build-${MSYSTEM}/src/pkcs11.dll" "${pkgdir}${MINGW_PREFIX}/lib/ossl-modules/pkcs11.dll" + # install -Dm644 "${srcdir}/build-${MSYSTEM}/src/pkcs11.dll.a" "${pkgdir}${MINGW_PREFIX}/lib/ossl-modules/pkcs11.dll.a" + install -Dm644 "${srcdir}/${_realname}/docs/provider-pkcs11.7" "${pkgdir}${MINGW_PREFIX}/share/man/man7/provider-pkcs11.7" + + install -Dm644 "${srcdir}/${_realname}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING" +} diff --git a/mingw-w64-pkcs11-provider/patch.patch b/mingw-w64-pkcs11-provider/patch.patch new file mode 100644 index 0000000000000..324bc74c274d3 --- /dev/null +++ b/mingw-w64-pkcs11-provider/patch.patch @@ -0,0 +1,42 @@ +--- pkcs11-provider-0.5/meson.build.orig 2024-06-05 09:04:12.000000000 -0500 ++++ pkcs11-provider-0.5/meson.build 2024-11-21 13:02:07.061978600 -0600 +@@ -86,5 +86,4 @@ + + subdir('src') + subdir('docs') +-subdir('tests') + +--- pkcs11-provider-0.5/src/platform/endian.h.orig 2024-06-05 09:04:12.000000000 -0500 ++++ pkcs11-provider-0.5/src/platform/endian.h 2024-11-21 12:27:32.809167300 -0600 +@@ -59,8 +59,8 @@ + #define bswap_32(x) BSWAP_32(x) + #define bswap_64(x) BSWAP_64(x) + +-#elif defined(__ANDROID__) || defined(__CYGWIN__) || defined(__GNUC__) || \ +- defined(__GNU__) ++#elif defined(__ANDROID__) || defined(__CYGWIN__) || (defined(__GNUC__) || \ ++ defined(__GNU__)) && !defined(__MINGW32__) + + #include + #include +--- pkcs11-provider/src/provider.h.orig 2024-11-21 19:58:48.087544800 -0600 ++++ pkcs11-provider/src/provider.h 2024-11-21 19:52:00.823425400 -0600 +@@ -9,9 +9,18 @@ + #include "config.h" + + #include ++#if defined(_WIN32) && !defined(_MSC_VER) ++#include ++#endif + #include + ++#ifdef _WIN32 ++#pragma pack(push, 1) ++#endif + #include "pkcs11.h" ++#ifdef _WIN32 ++#pragma pack(pop) ++#endif + #include + #include + #include