diff --git a/build/pkgs/pycrypto/SPKG.txt b/build/pkgs/pycrypto/SPKG.txt index d6a259770bd..345382f9ac9 100644 --- a/build/pkgs/pycrypto/SPKG.txt +++ b/build/pkgs/pycrypto/SPKG.txt @@ -27,10 +27,15 @@ Python 2.2 license. == Special Update/Build Instructions == - * None +=== Patches === + + * freebsd.patch: let pycrypto build on FreeBSD. == Changelog == +=== pycrypto-2.1.0.p0 (Jean-Pierre Flori, 4 July 2013) === + * #12399: Let pycrypto build on FreeBSD. + === pycrypto-2.1.0 (Minh Van Nguyen, June 26th, 2010) === * Ticket #9338; upgrade to PyCrypto 2.1.0. diff --git a/build/pkgs/pycrypto/package-version.txt b/build/pkgs/pycrypto/package-version.txt index 7ec1d6db408..7e41e597591 100644 --- a/build/pkgs/pycrypto/package-version.txt +++ b/build/pkgs/pycrypto/package-version.txt @@ -1 +1 @@ -2.1.0 +2.1.0.p0 diff --git a/build/pkgs/pycrypto/patches/freebsd.patch b/build/pkgs/pycrypto/patches/freebsd.patch new file mode 100644 index 00000000000..267b0505394 --- /dev/null +++ b/build/pkgs/pycrypto/patches/freebsd.patch @@ -0,0 +1,13 @@ +--- src/src/libtom/tomcrypt_pk.h-orig 2012-01-21 +19:43:56.000000000 +0000 ++++ src/src/libtom/tomcrypt_pk.h 2012-01-21 +19:45:01.000000000 +0000 +@@ -496,7 +496,7 @@ + int der_printable_value_decode(int v); + + /* UTF-8 */ +-#if (defined(SIZE_MAX) || __STDC_VERSION__ >= 199901L || defined(WCHAR_MAX) || defined(_WCHAR_T) || defined(_WCHAR_T_DEFINED)) && !defined(LTC_NO_WCHAR) ++#if (defined(SIZE_MAX) || __STDC_VERSION__ >= 199901L || defined(WCHAR_MAX) || defined(_WCHAR_T) || defined(_WCHAR_T_DEFINED) || defined(_GCC_WCHAR_T)) && !defined(LTC_NO_WCHAR) + #include + #else + typedef ulong32 wchar_t; diff --git a/build/pkgs/pycrypto/spkg-check b/build/pkgs/pycrypto/spkg-check index 878f884c9af..7f25a7d9040 100755 --- a/build/pkgs/pycrypto/spkg-check +++ b/build/pkgs/pycrypto/spkg-check @@ -1,41 +1,16 @@ #!/usr/bin/env bash -if [ -z $SAGE_LOCAL ]; then - echo "SAGE_LOCAL undefined... exiting" - echo "Maybe run 'sage -sh'?" +if [ -z "$SAGE_LOCAL" ]; then + echo >&2 "SAGE_LOCAL undefined ... exiting" + echo >&2 "Maybe run 'sage --sh'?" exit 1 fi -# Let the user set an environment variable CFLAG64 to indicate the flag -# for the C compiler to build 64-bit code. If not set, assume it is -m64 -# as that is what is used by both GCC and SunStudio, but -m64 is not used -# by IBM's compiler on AIX or HP's compiler on HP-UX. - -if [ -z $CFLAG64 ]; then - # -m64 is used by gcc and SunStudio - CFLAG64=-m64 -fi - -# Likewise to build C++ code. -if [ -z $CXXFLAG64 ]; then - # -m64 is used by gcc and SunStudio - CXXFLAG64=-m64 -fi - -if [ "x$SAGE64" = xyes ]; then - CFLAGS="$CFLAGS $CFLAG64" && export CFLAGS - CXXFLAGS="$CXXFLAGS $CXXFLAG64" && export CXXFLAGS - LDFLAGS="$LDFLAGS $CFLAG64" && export LDFLAGS - # Very rare is CPPFLAGS needed, but sometimes it is. - CPPFLAGS="$CPPFLAGS $CFLAG64" && export CPPFLAGS -fi - cd src echo "PyCrypto will now be tested" python setup.py test - if [ $? -ne 0 ]; then - echo "An error occurred while testing PyCrypto... exiting" + echo >&2 "Error: PyCrypto failed to pass its test suite." exit 1 fi diff --git a/build/pkgs/pycrypto/spkg-install b/build/pkgs/pycrypto/spkg-install index fec56ba41b4..1af6e790d6d 100755 --- a/build/pkgs/pycrypto/spkg-install +++ b/build/pkgs/pycrypto/spkg-install @@ -1,24 +1,41 @@ #!/usr/bin/env bash -if [ "$SAGE_LOCAL" = "" ]; then - echo "SAGE_LOCAL undefined... exiting" - echo "Maybe run 'sage -sh'?" +if [ -z "$SAGE_LOCAL" ]; then + echo >&2 "SAGE_LOCAL undefined ... exiting" + echo >&2 "Maybe run 'sage --sh'?" exit 1 fi -if [ "x$SAGE64" = xyes ]; then - echo "64-bit build" - CFLAGS="-O2 -g -m64 "; export CFLAGS - LDFLAGS="-m64 "; export LDFLAGS +cd src + +# Apply patches. See SPKG.txt for information about what each patch +# does. +for patch in ../patches/*.patch; do + [ -r "$patch" ] || continue # Skip non-existing or non-readable patches + patch -p1 <"$patch" + if [ $? -ne 0 ]; then + echo >&2 "Error applying '$patch'" + exit 1 + fi +done + +if [ "$SAGE_DEBUG" = "yes" ]; then + echo "Building a debug version of PyCrypto." + export CFLAGS="-O0 -g $CFLAGS" +else + export CFLAGS="-O2 -g $CFLAGS" fi -CFLAGS="-I$SAGE_LOCAL/include -L$SAGE_LOCAL/lib $CFLAGS" -export CFLAGS +if [ "$SAGE64" = "yes" ]; then + echo "Building a 64-bit version of PyCrypto." + export ABI=64 + CFLAGS="-m64 $CFLAGS" +fi -cd src +CFLAGS="-I$SAGE_LOCAL/include -L$SAGE_LOCAL/lib $CFLAGS" python setup.py install if [ $? -ne 0 ]; then - echo "Error installing PyCrypto... exiting" + echo >&2 "Error: Failed to install PyCrypto." exit 1 fi