From cd2ef9761781901c01198c73c48a4dfc48c6f479 Mon Sep 17 00:00:00 2001 From: Andrew Clemons Date: Wed, 9 Feb 2022 22:41:17 +1300 Subject: python/pycryptopp: Fix build on newer gcc. Signed-off-by: Andrew Clemons Signed-off-by: Willy Sudiarto Raharjo --- .../pycryptopp/pycryptopp-0.7.1-abi-change.patch | 55 ++++++++++++++++++++++ python/pycryptopp/pycryptopp.SlackBuild | 7 +++ 2 files changed, 62 insertions(+) create mode 100644 python/pycryptopp/pycryptopp-0.7.1-abi-change.patch (limited to 'python') diff --git a/python/pycryptopp/pycryptopp-0.7.1-abi-change.patch b/python/pycryptopp/pycryptopp-0.7.1-abi-change.patch new file mode 100644 index 0000000000..d6edd2ecc6 --- /dev/null +++ b/python/pycryptopp/pycryptopp-0.7.1-abi-change.patch @@ -0,0 +1,55 @@ +https://github.com/tahoe-lafs/pycryptopp/issues/42 + +--- old/src/pycryptopp/cipher/aesmodule.cpp ++++ old/src/pycryptopp/cipher/aesmodule.cpp +@@ -20,6 +20,8 @@ + #include + #endif + ++typedef unsigned char byte; ++ + static const char*const aes___doc__ = "_aes counter mode cipher\n\ + You are advised to run aes.start_up_self_test() after importing this module."; + +--- old/src/pycryptopp/cipher/xsalsa20module.cpp ++++ old/src/pycryptopp/cipher/xsalsa20module.cpp +@@ -16,6 +16,8 @@ + #include + #endif + ++typedef unsigned char byte; ++ + static const char* const xsalsa20__doc__ = "_xsalsa20 cipher"; + + static PyObject *xsalsa20_error; +--- old/src/pycryptopp/hash/sha256module.cpp ++++ old/src/pycryptopp/hash/sha256module.cpp +@@ -21,6 +21,8 @@ + #include + #endif + ++typedef unsigned char byte; ++ + static const char*const sha256___doc__ = "_sha256 hash function"; + + static PyObject *sha256_error; +--- old/src/pycryptopp/publickey/rsamodule.cpp ++++ old/src/pycryptopp/publickey/rsamodule.cpp +@@ -87,7 +87,7 @@ + VerifyingKey_serialize(VerifyingKey *self, PyObject *dummy) { + std::string outstr; + StringSink ss(outstr); +- self->k->DEREncode(ss); ++ self->k->GetMaterial().Save(ss); + PyStringObject* result = reinterpret_cast(PyString_FromStringAndSize(outstr.c_str(), outstr.size())); + if (!result) + return NULL; +@@ -216,7 +216,7 @@ + SigningKey_serialize(SigningKey *self, PyObject *dummy) { + std::string outstr; + StringSink ss(outstr); +- self->k->DEREncode(ss); ++ self->k->GetMaterial().Save(ss); + PyStringObject* result = reinterpret_cast(PyString_FromStringAndSize(outstr.c_str(), outstr.size())); + if (!result) + return NULL; diff --git a/python/pycryptopp/pycryptopp.SlackBuild b/python/pycryptopp/pycryptopp.SlackBuild index d7a936377b..70ae017884 100644 --- a/python/pycryptopp/pycryptopp.SlackBuild +++ b/python/pycryptopp/pycryptopp.SlackBuild @@ -76,6 +76,8 @@ cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION +# thanks arch maintainers +patch -p1 -i $CWD/pycryptopp-0.7.1-abi-change.patch chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -83,6 +85,11 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +export PYCRYPTOPP_DISABLE_EMBEDDED_CRYPTOPP=1 + +CFLAGS="$SLKCFLAGS -fno-strict-aliasing" \ +CXXFLAGS="$SLKCFLAGS -fno-strict-aliasing" \ +python setup.py build python setup.py install --root=$PKG find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ -- cgit v1.2.3