Ticket #13126: trac_13126-openssl.patch

File trac_13126-openssl.patch, 8.1 KB (added by jhpalmieri, 10 years ago)

patch for openssl spkg; for review only

  • SPKG.txt

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1340827237 25200
    # Node ID e78c996eb32e653ad148b3a6331ffcf0a9116401
    # Parent  8f43a14da9f1de0de0c88bd1b91510977de1c1fe
    Trac #13126: update and clean up openssl
     * Update source to 1.0.1c
     * Created hg repository
     * Cleaned up spkg-install
     * Created spkg-check
     * Patch to build on OS X Lion
     * Patch to build on Solaris
    
    diff --git a/SPKG.txt b/SPKG.txt
    a b library in a variety of computer languag 
    2020
    2121 * None yet
    2222
     23=== Patches ===
     24
     25 * src/Configure: Sage's gcc doesn't recognize the '-arch' option,
     26   while Apple's gcc does, so we remove this flag.
     27 * src/config: patched to fix a problem on Solaris.
     28
    2329== Changelog ==
    2430
     31=== openssl-1.0.1c.p0 (John Palmieri, 17 June 2012) ===
     32 * Trac #13126: Update source to 1.0.1c
     33 * Created hg repository
     34 * Cleaned up spkg-install
     35 * Created spkg-check
     36 * Patch to build on OS X Lion
     37 * Patch to build on Solaris
     38
    2539=== openssl-1.0.1a (Mariah Lenox, 23 April 2012) ===
    2640 * upgraded source
    2741
  • new file patches/Configure.patch

    diff --git a/patches/Configure.patch b/patches/Configure.patch
    new file mode 100644
    - +  
     1diff -ru src/Configure b/Configure
     2--- src/Configure       2012-03-14 15:20:40.000000000 -0700
     3+++ b/Configure 2012-06-20 13:42:25.000000000 -0700
     4@@ -575,11 +575,11 @@
     5 
     6 ##### MacOS X (a.k.a. Rhapsody or Darwin) setup
     7 "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
     8-"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     9-"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     10-"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     11-"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     12-"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     13+"darwin-ppc-cc","cc:-O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     14+"darwin64-ppc-cc","cc:-O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     15+"darwin-i386-cc","cc:-O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     16+"debug-darwin-i386-cc","cc:-g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     17+"darwin64-x86_64-cc","cc:-O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     18 "debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
     19 # iPhoneOS/iOS
     20 "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
  • new file patches/config.patch

    diff --git a/patches/config.patch b/patches/config.patch
    new file mode 100644
    - +  
     1diff -ru src/config b/config
     2--- src/config  2011-11-14 22:12:53.000000000 +0100
     3+++ b/config    2012-06-20 21:19:42.753359418 +0200
     4@@ -411,8 +411,10 @@
     5 # this is where the translation occurs into SSLeay terms
     6 # ---------------------------------------------------------------------------
     7 
     8-# Only set CC if not supplied already
     9-if [ -z "$CROSS_COMPILE$CC" ]; then
     10+# Save given CC
     11+userCC="$CC"
     12+
     13+if true; then
     14   GCCVER=`sh -c "gcc -dumpversion" 2>/dev/null`
     15   if [ "$GCCVER" != "" ]; then
     16     # then strip off whatever prefix egcs prepends the number with...
     17@@ -486,6 +488,11 @@
     18 
     19 CCVER=${CCVER:-0}
     20 
     21+# Restore given $CC
     22+if [ -n "$userCC" ]; then
     23+    CC="$userCC"
     24+fi
     25+
     26 # read the output of the embedded GuessOS
     27 read GUESSOS
     28 
  • new file spkg-check

    diff --git a/spkg-check b/spkg-check
    new file mode 100755
    - +  
     1#!/usr/bin/env bash
     2
     3if [ -z "$SAGE_LOCAL" ]; then
     4    echo >&2 "SAGE_LOCAL undefined ... exiting"
     5    echo >&2 "Maybe run 'sage --sh'?"
     6    exit 1
     7fi
     8
     9cd src
     10
     11echo "Testing openssl..."
     12$MAKE test
     13
     14if [ $? -ne 0 ]; then
     15    echo >&2 "Error running self tests."
     16    exit 1
     17fi
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    1 #!/bin/sh
     1#!/usr/bin/env bash
    22
    3 cd src/
    4 
    5 # this avoids a bug later in the build scripts.
    6 touch apps/openssl 
    7 touch apps/openssl.exe   # in case user is on Windows 
    8 
    9 ./config --libdir=lib --prefix="$SAGE_LOCAL" --openssldir="$SAGE_LOCAL"/openssl shared
    10 
    11 if [ $? -ne 0 ]; then
    12     echo "Error configuring openssl."
     3if [ -z "$SAGE_LOCAL" ]; then
     4    echo >&2 "SAGE_LOCAL undefined ... exiting"
     5    echo >&2 "Maybe run 'sage --sh'?"
    136    exit 1
    147fi
    158
    16 # do not use MAKE environment variable -- if given -j option install breaks
    17 make
     9cd src
     10
     11# Apply patches
     12echo "Patching openssl..."
     13for p in ../patches/*.patch; do
     14    patch -p1 <"$p"
     15    if [ $? -ne 0 ]; then
     16        echo >&2 "Error applying '$patch'"
     17        exit 1
     18    fi
     19done
     20echo
     21
     22# Building on OS X Lion 64-bit seems to fail unless we build a 64-bit library.
     23echo "Configuring openssl..."
     24if [ "$UNAME" = "Darwin" ]; then
     25    # This check for 64-bit is taken from src/config.
     26    ISA64=`(sysctl -n hw.optional.x86_64) 2>/dev/null`
     27    if [ "$ISA64" = "1" ]; then
     28        # 64-bit
     29        ./Configure darwin64-x86_64-cc --libdir=lib --prefix="$SAGE_LOCAL" --openssldir="$SAGE_LOCAL"/openssl shared
     30    else
     31        ./config --libdir=lib --prefix="$SAGE_LOCAL" --openssldir="$SAGE_LOCAL"/openssl shared
     32    fi
     33else
     34    ./config --libdir=lib --prefix="$SAGE_LOCAL" --openssldir="$SAGE_LOCAL"/openssl shared
     35fi
    1836
    1937if [ $? -ne 0 ]; then
    20     echo "Error building openssl."
     38    echo >&2 "Error configuring openssl."
    2139    exit 1
    2240fi
     41echo
    2342
    24 make install
     43# Do not build in parallel.
     44MAKE="$MAKE -j1"
     45echo "Building openssl..."
     46$MAKE
    2547
    2648if [ $? -ne 0 ]; then
    27     echo "Error installing openssl."
     49    echo >&2 "Error building openssl."
    2850    exit 1
    2951fi
     52echo
    3053
     54echo "Installing openssl..."
     55$MAKE install
    3156
     57if [ $? -ne 0 ]; then
     58    echo >&2 "Error installing openssl."
     59    exit 1
     60fi