From 380c11c28d87c5e01c18403a3d034c0720781542 Mon Sep 17 00:00:00 2001 From: OscarL Date: Mon, 2 Jan 2023 06:02:02 -0300 Subject: [PATCH] pycryptodome: new recipe (#7714) * pycryptodome: new recipe * 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). --- dev-python/pycryptodome/licenses/Unlicense | 24 +++++ .../patches/pycryptodome-3.16.0.patchset | 22 +++++ .../pycryptodome/pycryptodome-3.16.0.recipe | 92 +++++++++++++++++++ .../pycryptodome/pycryptodomex-3.16.0.recipe | 92 +++++++++++++++++++ 4 files changed, 230 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 create mode 100644 dev-python/pycryptodome/pycryptodomex-3.16.0.recipe diff --git a/dev-python/pycryptodome/licenses/Unlicense b/dev-python/pycryptodome/licenses/Unlicense new file mode 100644 index 000000000..68a49daad --- /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 000000000..67bdbd57a --- /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 000000000..cba6d019c --- /dev/null +++ b/dev-python/pycryptodome/pycryptodome-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\ + \"" +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 + " + +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 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 +} 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 000000000..fe3bd3e2d --- /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 +}