From d18f8aac8a990fb485e311f585b420879d8d19fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?= =?UTF-8?q?=20=28Mehdi=20Chinoune=29?= Date: Thu, 22 Sep 2022 12:15:23 +0100 Subject: [PATCH] Add python-bcrypt3 for clang32 and clangarm64 --- .../001-fix-undeclared-function.patch | 10 +++ mingw-w64-python-bcrypt3/PKGBUILD | 78 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 mingw-w64-python-bcrypt3/001-fix-undeclared-function.patch create mode 100644 mingw-w64-python-bcrypt3/PKGBUILD diff --git a/mingw-w64-python-bcrypt3/001-fix-undeclared-function.patch b/mingw-w64-python-bcrypt3/001-fix-undeclared-function.patch new file mode 100644 index 0000000000..336b94607a --- /dev/null +++ b/mingw-w64-python-bcrypt3/001-fix-undeclared-function.patch @@ -0,0 +1,10 @@ +--- a/src/_csrc/sha2.c ++++ b/src/_csrc/sha2.c +@@ -34,6 +34,7 @@ + * $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $ + */ + ++#include + #include "pycabcrypt.h" + #include "sha2.h" + diff --git a/mingw-w64-python-bcrypt3/PKGBUILD b/mingw-w64-python-bcrypt3/PKGBUILD new file mode 100644 index 0000000000..deff5f17d7 --- /dev/null +++ b/mingw-w64-python-bcrypt3/PKGBUILD @@ -0,0 +1,78 @@ +# Maintainer: Smo + +_realname=bcrypt +pkgbase=mingw-w64-python-${_realname}3 +pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}3") +provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}" + "${MINGW_PACKAGE_PREFIX}-python-${_realname}") +conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}" + "${MINGW_PACKAGE_PREFIX}-python-${_realname}") +replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}" + "${MINGW_PACKAGE_PREFIX}-python-${_realname}") +pkgver=3.2.2 +pkgrel=2 +pkgdesc="Modern password hashing for your software and your servers (mingw-w64)" +arch=('any') +mingw_arch=('clang32' 'clangarm64') +url='https://github.com/pyca/bcrypt/' +license=('spdx:Apache-2.0') +depends=("${MINGW_PACKAGE_PREFIX}-python" + "${MINGW_PACKAGE_PREFIX}-python-cffi" + "${MINGW_PACKAGE_PREFIX}-python-six") +makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools" "${MINGW_PACKAGE_PREFIX}-cc") +options=('staticlibs' 'strip' '!debug') +source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/pyca/bcrypt/archive/${pkgver}.tar.gz" + 001-fix-undeclared-function.patch) +sha512sums=('2aa5cf2a1c117cb6c7c92cbd41515da332f2bec1d37c36e0732add12e61fb2e83837e3c980f7f77ffc454b3a85ecb6829981d77662218aa4e56efba07d9d7070' + '6a04c6f20b733360709caa323e8690afe859a02763a9349722c676c3f3b0539f0c0a063791f098f1f1c9fd2a546918a9d7437e87a2b28170512e058740d9e195') + +apply_patch_with_msg() { + for _patch in "$@" + do + msg2 "Applying $_patch" + patch -Nbp1 -i "${srcdir}/$_patch" + done +} + +del_file_exists() { + for _fname in "$@" + do + if [ -f $_fname ]; then + rm -rf $_fname + fi + done +} + +prepare() { + cd "${srcdir}"/${_realname}-${pkgver} + apply_patch_with_msg \ + 001-fix-undeclared-function.patch + + cd "${srcdir}" + rm -rf python-build-${MSYSTEM} | true + cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" + + # Set version for setuptools_scm + export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver} +} + +build() { + msg "Python build for ${MSYSTEM}" + cd "${srcdir}/python-build-${MSYSTEM}" + ${MINGW_PREFIX}/bin/python setup.py build +} + +check() { + msg "Python test for ${MSYSTEM}" + cd "${srcdir}/python-build-${MSYSTEM}" + ${MINGW_PREFIX}/bin/python setup.py check +} + +package() { + cd "${srcdir}/python-build-${MSYSTEM}" + MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ + ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \ + --root="${pkgdir}" --optimize=1 --skip-build + + install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/COPYING" +}