Skip to content

Commit 6b5fc6c

Browse files
committed
Add pkcs11-provider
1 parent a2d39f8 commit 6b5fc6c

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

Diff for: mingw-w64-pkcs11-provider/PKGBUILD

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
_realname=pkcs11-provider
2+
pkgbase=mingw-w64-${_realname}
3+
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
4+
pkgver=0.5.r92.gcff4036
5+
pkgrel=1
6+
pkgdesc="A pkcs#11 provider for OpenSSL 3.0+ (mingw-w64)"
7+
arch=('any')
8+
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
9+
url='https://github.com/latchset/pkcs11-provider'
10+
msys2_references=('archlinux: pkcs11-provider')
11+
license=('COPYING')
12+
makedepends=("${MINGW_PACKAGE_PREFIX}-meson"
13+
"${MINGW_PACKAGE_PREFIX}-ninja"
14+
"${MINGW_PACKAGE_PREFIX}-pkg-config"
15+
"${MINGW_PACKAGE_PREFIX}-cc"
16+
"${MINGW_PACKAGE_PREFIX}-dlfcn"
17+
"git")
18+
depends=("${MINGW_PACKAGE_PREFIX}-openssl")
19+
# optdepends("${MINGW_PACKAGE_PREFIX}-p11-kit: seamless PKCS#11 modules integration")
20+
_commit='cff40360e4b47d38911999c625249683b7445170'
21+
source=("${_realname}"::"git+https://github.com/latchset/pkcs11-provider.git#commit=${_commit}"
22+
"patch.patch")
23+
sha256sums=('54e253b1f2363f4f5fa626394538da62734dd641a47c352b5b9b9970827d0b12'
24+
'91d16126be2d86136a79d285627d263957129b02046269a1c3dfeba38c5016a6')
25+
26+
pkgver() {
27+
cd "${_realname}"
28+
29+
git describe --long "${_commit}" | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g'
30+
}
31+
32+
prepare() {
33+
cd "${_realname}"
34+
35+
patch -p1 -i ${srcdir}/patch.patch
36+
}
37+
38+
build() {
39+
MSYS2_ARG_CONV_EXCL="--prefix=" \
40+
LDFLAGS="-ldl" CFLAGS="-pthread -Wno-incompatible-pointer-types -D_XOPEN_SOURCE=700" \
41+
meson setup \
42+
--prefix="${MINGW_PREFIX}" \
43+
--wrap-mode=nodownload \
44+
--auto-features=enabled \
45+
--buildtype=release \
46+
"build-${MSYSTEM}" \
47+
"${_realname}"
48+
49+
meson compile -C "build-${MSYSTEM}"
50+
}
51+
52+
check() {
53+
meson test -C "build-${MSYSTEM}"
54+
}
55+
56+
package() {
57+
# meson install -C "build-${MSYSTEM}" --destdir "${pkgdir}"
58+
install -Dm755 "${srcdir}/build-${MSYSTEM}/src/pkcs11.dll" "${pkgdir}${MINGW_PREFIX}/lib/ossl-modules/pkcs11.dll"
59+
# install -Dm644 "${srcdir}/build-${MSYSTEM}/src/pkcs11.dll.a" "${pkgdir}${MINGW_PREFIX}/lib/ossl-modules/pkcs11.dll.a"
60+
install -Dm644 "${srcdir}/${_realname}/docs/provider-pkcs11.7" "${pkgdir}${MINGW_PREFIX}/share/man/man7/provider-pkcs11.7"
61+
62+
install -Dm644 "${srcdir}/${_realname}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
63+
}

Diff for: mingw-w64-pkcs11-provider/patch.patch

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--- pkcs11-provider-0.5/meson.build.orig 2024-06-05 09:04:12.000000000 -0500
2+
+++ pkcs11-provider-0.5/meson.build 2024-11-21 13:02:07.061978600 -0600
3+
@@ -86,5 +86,4 @@
4+
5+
subdir('src')
6+
subdir('docs')
7+
-subdir('tests')
8+
9+
--- pkcs11-provider-0.5/src/platform/endian.h.orig 2024-06-05 09:04:12.000000000 -0500
10+
+++ pkcs11-provider-0.5/src/platform/endian.h 2024-11-21 12:27:32.809167300 -0600
11+
@@ -59,8 +59,8 @@
12+
#define bswap_32(x) BSWAP_32(x)
13+
#define bswap_64(x) BSWAP_64(x)
14+
15+
-#elif defined(__ANDROID__) || defined(__CYGWIN__) || defined(__GNUC__) || \
16+
- defined(__GNU__)
17+
+#elif defined(__ANDROID__) || defined(__CYGWIN__) || (defined(__GNUC__) || \
18+
+ defined(__GNU__)) && !defined(__MINGW32__)
19+
20+
#include <byteswap.h>
21+
#include <endian.h>
22+
--- pkcs11-provider/src/provider.h.orig 2024-11-21 19:58:48.087544800 -0600
23+
+++ pkcs11-provider/src/provider.h 2024-11-21 19:52:00.823425400 -0600
24+
@@ -9,9 +9,18 @@
25+
#include "config.h"
26+
27+
#include <stdbool.h>
28+
+#if defined(_WIN32) && !defined(_MSC_VER)
29+
+#include <pthread.h>
30+
+#endif
31+
#include <sys/types.h>
32+
33+
+#ifdef _WIN32
34+
+#pragma pack(push, 1)
35+
+#endif
36+
#include "pkcs11.h"
37+
+#ifdef _WIN32
38+
+#pragma pack(pop)
39+
+#endif
40+
#include <openssl/core_dispatch.h>
41+
#include <openssl/core_object.h>
42+
#include <openssl/types.h>

0 commit comments

Comments
 (0)