%define name python3-pycrypto %define srcname pycrypto %define version 2.6.1 %define release 1 %{!?dotests: %define dotests 1} %{!?gcc_compiler: %define gcc_compiler 1} %{!?default_bits: %define default_bits 32} %define is_python %(test -e /opt/freeware/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib64 %define is_python_64 %(test -e /usr/bin/python3 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif Summary: Cryptographic modules for Python Name: %{name} Version: %{version} Release: %{release} License: Public Domain and Python Group: Development/Libraries URL: http://www.pycrypto.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} Source0: http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-%{version}.tar.gz Patch0: pycrypto-2.6-aix.patch Patch1: python-crypto-2.4-fix-pubkey-size-divisions.patch Patch2: pycrypto-2.6.1-CVE-2013-7459.patch BuildRequires: coreutils >= 8.29 BuildRequires: python3 >= 3.7.4 BuildRequires: python3-devel >= 3.7.4 BuildRequires: gmp-devel >= 6.1.2 BuildRequires: gmp >= 6.1.2 Provides: pycrypto = %{version}-%{release} %{?python_provide:%python_provide python-pycrypto} %description PyCrypto is a collection of both secure hash functions (such as MD5 and SHA), and various encryption algorithms (AES, DES, RSA, ElGamal, etc.). The library is available as 32-bit and 64-bit. if [ "%{gcc_compiler}" == 1 ] then echo "This version has been compiled with GCC" else echo "This version has been compiled with XLC." fi %prep %setup -q -n %{srcname}-%{version} echo "dotests=%{dotests} echo "default_bits=%{default_bits}" echo "gcc_compiler=%{gcc_compiler}" %patch0 -p1 -b .aix %patch1 -p1 %patch2 -p1 %build export ac_cv_func_malloc_0_nonnull=yes /usr/bin/env rpm -qa export AR="/usr/bin/ar -X32_64" if [[ %{gcc_compiler} == 1 ]] then export CC__="/opt/freeware/bin/gcc" export FLAG32="-maix32" export FLAG64="-maix64" echo "CC Version:" $CC__ --version else export CC__="xlc_r" export FLAG32="-q32" export FLAG64="-q64" echo "CC Version:" $CC__ -qversion fi type $CC__ export CC32=" ${CC__} ${FLAG32} -D_LARGE_FILES" export CC64=" ${CC__} ${FLAG64} -D_LARGE_FILES" export CC="${CC64} " export OBJECT_MODE=64 /opt/freeware/bin/python3 setup.py build %install # Probably not needed export AR="/usr/bin/ar -X32_64" [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT /opt/freeware/bin/python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} if [ "%{dotests}" == 1 ] then (/opt/freeware/bin/python3 setup.py test || true) fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc ./ACKS ./COPYRIGHT ./ChangeLog ./LEGAL/ ./PKG-INFO ./README ./TODO ./Doc/ %doc ./Doc #%{python_sitelib}/* %{python_sitelib64}/* %changelog * Mon Jan 20 2020 Ashwini Chandrappa - 2.6.1-1 - Build with python3 * Fri Feb 03 2017 Michael Wilson - 2.6.1-1 - New version 2.6.1 and Fedora inspired changes * Fri Feb 03 2017 Michael Wilson - 2.6-2 - Corrections for compiler options and build GCC/XLC * Thu Jul 17 2013 Tristan Delhalle - 2.6-1 - first version for AIX V6.1 and higher