From 12bbb69adb6b2c86277afc97033e43afce08e195 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Sun, 1 Jan 2023 08:44:07 -0300 Subject: [PATCH 1/2] pycryptodome: new recipe --- dev-python/pycryptodome/licenses/Unlicense | 24 +++++ .../patches/pycryptodome-3.16.0.patchset | 22 +++++ .../pycryptodome/pycryptodome-3.16.0.recipe | 91 +++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 dev-python/pycryptodome/licenses/Unlicense create mode 100644 dev-python/pycryptodome/patches/pycryptodome-3.16.0.patchset create mode 100644 dev-python/pycryptodome/pycryptodome-3.16.0.recipe diff --git a/dev-python/pycryptodome/licenses/Unlicense b/dev-python/pycryptodome/licenses/Unlicense new file mode 100644 index 0000000000..68a49daad8 --- /dev/null +++ b/dev-python/pycryptodome/licenses/Unlicense @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/dev-python/pycryptodome/patches/pycryptodome-3.16.0.patchset b/dev-python/pycryptodome/patches/pycryptodome-3.16.0.patchset new file mode 100644 index 0000000000..67bdbd57a7 --- /dev/null +++ b/dev-python/pycryptodome/patches/pycryptodome-3.16.0.patchset @@ -0,0 +1,22 @@ +From 4fde02e923cc6f62a000caa66c12705ae5d2c6d3 Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Sun, 1 Jan 2023 07:35:12 -0300 +Subject: Change header guard to not clash with the one from Haiku's Errors.h + +It was causing some compilation errors that were a bit puzzling. + +diff --git a/src/errors.h b/src/errors.h +index 831980d..89834ce 100644 +--- a/src/errors.h ++++ b/src/errors.h +@@ -1,5 +1,5 @@ +-#ifndef _ERRORS_H +-#define _ERRORS_H ++#ifndef _ERRORS_CRYPTODOME_H ++#define _ERRORS_CRYPTODOME_H + + /** Standard errors common to all ciphers **/ + #define ERR_NULL 1 +-- +2.37.3 + diff --git a/dev-python/pycryptodome/pycryptodome-3.16.0.recipe b/dev-python/pycryptodome/pycryptodome-3.16.0.recipe new file mode 100644 index 0000000000..86eedabda2 --- /dev/null +++ b/dev-python/pycryptodome/pycryptodome-3.16.0.recipe @@ -0,0 +1,91 @@ +SUMMARY="Cryptographic library for Python" +DESCRIPTION="PyCryptodome is a self-contained Python package of low-level cryptographic \ +primitives. + +PyCryptodome is a fork of PyCrypto. It brings several enhancements with respect \ +to the last official version of PyCrypto (2.6.1). +" +HOMEPAGE="https://www.pycryptodome.org/" +LICENSE="BSD (2-clause) + Public Domain + Unlicense + " +COPYRIGHT="2014-2022 Legrandin" +REVISION="1" +SOURCE_URI="https://pypi.python.org/packages/source/p/pycryptodome/pycryptodome-$portVersion.tar.gz" +CHECKSUM_SHA256="0e45d2d852a66ecfb904f090c3f87dc0dfb89a499570abad8590f10d9cffb350" +PATCHES="pycryptodome-$portVersion.patchset" + +ARCHITECTURES="x86_64 !x86_gcc2" + +PROVIDES=" + $portName = $portVersion + " +REQUIRES=" + haiku + " + +BUILD_REQUIRES=" + haiku_devel + devel:libgmp + " +BUILD_PREREQUIRES=" + cmd:cc + " +PYTHON_PACKAGES=(python39) +PYTHON_VERSIONS=(3.9) +for i in "${!PYTHON_PACKAGES[@]}"; do +pythonPackage=${PYTHON_PACKAGES[i]} +pythonVersion=${PYTHON_VERSIONS[$i]} +eval "PROVIDES_${pythonPackage}=\"\ + ${portName}_$pythonPackage = $portVersion\ + \"; \ +REQUIRES_$pythonPackage=\"\ + haiku\n\ + lib:libgmp\n\ + cmd:python$pythonVersion\ + \"" +BUILD_REQUIRES="$BUILD_REQUIRES + setuptools_$pythonPackage" +BUILD_PREREQUIRES="$BUILD_PREREQUIRES + cmd:python$pythonVersion" +eval "CONFLICTS_$pythonPackage=' + pycrypto_$pythonPackage + '" +done + + +TEST_REQUIRES=" + cmd:make + " + +INSTALL() +{ + for i in "${!PYTHON_PACKAGES[@]}"; do + pythonPackage=${PYTHON_PACKAGES[i]} + pythonVersion=${PYTHON_VERSIONS[$i]} + + python=python$pythonVersion + installLocation=$prefix/lib/$python/vendor-packages/ + export PYTHONPATH=$installLocation:$PYTHONPATH + mkdir -p $installLocation + rm -rf build + + $python setup.py build + $python setup.py install \ + --root=/ --prefix=$prefix + + packageEntries $pythonPackage \ + $prefix/lib/python* + done +} + + +TEST() +{ + python3 setup.py test + + export PYTHON=/system/bin/python3 + cd src/test + make +} From 35808802773192b1bb037fd13631abedf85a5639 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Sun, 1 Jan 2023 09:48:44 -0300 Subject: [PATCH 2/2] Add the "separate_namespace" version: pycryptodomex. This one installs as "Cryptodome", as to not conflict with pycrypto. Minor clean ups on both recipes. Build, installed, and smoke-tested on both x86_64 and x86_32 (GCC11). --- .../pycryptodome/pycryptodome-3.16.0.recipe | 39 ++++---- .../pycryptodome/pycryptodomex-3.16.0.recipe | 92 +++++++++++++++++++ 2 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 dev-python/pycryptodome/pycryptodomex-3.16.0.recipe diff --git a/dev-python/pycryptodome/pycryptodome-3.16.0.recipe b/dev-python/pycryptodome/pycryptodome-3.16.0.recipe index 86eedabda2..cba6d019ce 100644 --- a/dev-python/pycryptodome/pycryptodome-3.16.0.recipe +++ b/dev-python/pycryptodome/pycryptodome-3.16.0.recipe @@ -6,32 +6,28 @@ PyCryptodome is a fork of PyCrypto. It brings several enhancements with respect to the last official version of PyCrypto (2.6.1). " HOMEPAGE="https://www.pycryptodome.org/" +COPYRIGHT="2014-2022 Legrandin" LICENSE="BSD (2-clause) Public Domain Unlicense " -COPYRIGHT="2014-2022 Legrandin" REVISION="1" SOURCE_URI="https://pypi.python.org/packages/source/p/pycryptodome/pycryptodome-$portVersion.tar.gz" CHECKSUM_SHA256="0e45d2d852a66ecfb904f090c3f87dc0dfb89a499570abad8590f10d9cffb350" +SOURCE_FILENAME="pycryptodome-$portVersion.tar.gz" +SOURCE_DIR="pycryptodome-$portVersion" PATCHES="pycryptodome-$portVersion.patchset" ARCHITECTURES="x86_64 !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" PROVIDES=" $portName = $portVersion " REQUIRES=" - haiku + haiku$secondaryArchSuffix " -BUILD_REQUIRES=" - haiku_devel - devel:libgmp - " -BUILD_PREREQUIRES=" - cmd:cc - " PYTHON_PACKAGES=(python39) PYTHON_VERSIONS=(3.9) for i in "${!PYTHON_PACKAGES[@]}"; do @@ -41,20 +37,22 @@ eval "PROVIDES_${pythonPackage}=\"\ ${portName}_$pythonPackage = $portVersion\ \"; \ REQUIRES_$pythonPackage=\"\ - haiku\n\ - lib:libgmp\n\ + haiku$secondaryArchSuffix\n\ + lib:libgmp$secondaryArchSuffix\n\ cmd:python$pythonVersion\ \"" -BUILD_REQUIRES="$BUILD_REQUIRES - setuptools_$pythonPackage" -BUILD_PREREQUIRES="$BUILD_PREREQUIRES - cmd:python$pythonVersion" eval "CONFLICTS_$pythonPackage=' pycrypto_$pythonPackage '" +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libgmp$secondaryArchSuffix + setuptools_$pythonPackage" +BUILD_PREREQUIRES=" + cmd:cc$secondaryArchSuffix + cmd:python$pythonVersion" done - TEST_REQUIRES=" cmd:make " @@ -71,11 +69,14 @@ INSTALL() mkdir -p $installLocation rm -rf build - $python setup.py build - $python setup.py install \ + $python setup.py build install \ --root=/ --prefix=$prefix - packageEntries $pythonPackage \ + # You don't get the docs with `pip install` either, skip docs for now. + # install -m 755 -d "$docDir" + # install -m 644 -t "$docDir" README.rst + + packageEntries $pythonPackage \ $prefix/lib/python* done } diff --git a/dev-python/pycryptodome/pycryptodomex-3.16.0.recipe b/dev-python/pycryptodome/pycryptodomex-3.16.0.recipe new file mode 100644 index 0000000000..fe3bd3e2df --- /dev/null +++ b/dev-python/pycryptodome/pycryptodomex-3.16.0.recipe @@ -0,0 +1,92 @@ +SUMMARY="Cryptographic library for Python" +DESCRIPTION="PyCryptodome is a self-contained Python package of low-level cryptographic \ +primitives. + +PyCryptodome is a fork of PyCrypto. It brings several enhancements with respect \ +to the last official version of PyCrypto (2.6.1). +" +HOMEPAGE="https://www.pycryptodome.org/" +COPYRIGHT="2014-2022 Legrandin" +LICENSE="BSD (2-clause) + Public Domain + Unlicense + " +REVISION="1" +SOURCE_URI="https://pypi.python.org/packages/source/p/pycryptodome/pycryptodome-$portVersion.tar.gz" +CHECKSUM_SHA256="0e45d2d852a66ecfb904f090c3f87dc0dfb89a499570abad8590f10d9cffb350" +SOURCE_FILENAME="pycryptodome-$portVersion.tar.gz" +SOURCE_DIR="pycryptodome-$portVersion" +PATCHES="pycryptodome-$portVersion.patchset" + +ARCHITECTURES="x86_64 !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + $portName = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + " + +PYTHON_PACKAGES=(python39) +PYTHON_VERSIONS=(3.9) +for i in "${!PYTHON_PACKAGES[@]}"; do +pythonPackage=${PYTHON_PACKAGES[i]} +pythonVersion=${PYTHON_VERSIONS[$i]} +eval "PROVIDES_${pythonPackage}=\"\ + ${portName}_$pythonPackage = $portVersion\ + \"; \ +REQUIRES_$pythonPackage=\"\ + haiku$secondaryArchSuffix\n\ + lib:libgmp$secondaryArchSuffix\n\ + cmd:python$pythonVersion\ + \"" +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libgmp$secondaryArchSuffix + setuptools_$pythonPackage" +BUILD_PREREQUIRES=" + cmd:cc$secondaryArchSuffix + cmd:python$pythonVersion" +done + +TEST_REQUIRES=" + cmd:make + " + +INSTALL() +{ + for i in "${!PYTHON_PACKAGES[@]}"; do + pythonPackage=${PYTHON_PACKAGES[i]} + pythonVersion=${PYTHON_VERSIONS[$i]} + + python=python$pythonVersion + installLocation=$prefix/lib/$python/vendor-packages/ + export PYTHONPATH=$installLocation:$PYTHONPATH + mkdir -p $installLocation + rm -rf build + + # to build as pycryptodomex (Cryptodome): + touch ".separate_namespace" + + $python setup.py build install \ + --root=/ --prefix=$prefix + + # You don't get the docs with `pip install` either, skip docs for now. + # install -m 755 -d "$docDir" + # install -m 644 -t "$docDir" README.rst + + packageEntries $pythonPackage \ + $prefix/lib/python* + done +} + + +TEST() +{ + python3 setup.py test + + export PYTHON=/system/bin/python3 + cd src/test + make +}