Ticket #17179: openssl-universal_archs-64.diff

File openssl-universal_archs-64.diff, 8.5 KB (added by arcata@…, 15 years ago)

Patch to enable universal_archs and 32/64 bit universal build for openssl

  • dports/devel/openssl/files/patch-opensslconf.h.in-universal-32-64.diff

     
     1diff -ur Configure openssl-0.9.8i/Configure
     2--- Configure   2008-11-10 13:10:42.000000000 -0800
     3+++ Configure   2008-11-10 13:16:19.000000000 -0800
     4@@ -1530,21 +1530,6 @@
     5                $unistd = "<unistd.h>" if $unistd eq "";
     6                print OUT "#define OPENSSL_UNISTD $unistd\n";
     7                }
     8-       elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
     9-               { printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
     10-       elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
     11-               { printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
     12-       elsif   (/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
     13-               { printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
     14-       elsif   (/^#((define)|(undef))\s+SIXTEEN_BIT/)
     15-               { printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
     16-       elsif   (/^#((define)|(undef))\s+EIGHT_BIT/)
     17-               { printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
     18-       elsif   (/^#((define)|(undef))\s+BN_LLONG\s*$/)
     19-               { printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
     20-       elsif   (/^\#define\s+DES_LONG\s+.*/)
     21-               { printf OUT "#define DES_LONG unsigned %s\n",
     22-                       ($des_int)?'int':'long'; }
     23        elsif   (/^\#(define|undef)\s+DES_PTR/)
     24                { printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
     25        elsif   (/^\#(define|undef)\s+DES_RISC1/)
     26@@ -1572,12 +1557,6 @@
     27                {printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
     28        elsif   (/^#define\s+RC2_INT\s/)
     29                {printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
     30-       elsif (/^#(define|undef)\s+BF_PTR/)
     31-               {
     32-               printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
     33-               printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
     34-               printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
     35-               }
     36        else
     37                { print OUT $_; }
     38        }
     39diff -ur crypto/opensslconf.h.in openssl-0.9.8i/crypto/opensslconf.h.in
     40--- crypto/opensslconf.h.in     2008-11-10 13:10:41.000000000 -0800
     41+++ crypto/opensslconf.h.in     2008-11-10 13:15:02.000000000 -0800
     42@@ -52,13 +52,21 @@
     43 /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
     44  * %20 speed up (longs are 8 bytes, int's are 4). */
     45 #ifndef DES_LONG
     46+# ifdef __LP64__
     47+#define DES_LONG unsigned int
     48+# else
     49 #define DES_LONG unsigned long
     50+# endif
     51 #endif
     52 #endif
     53 
     54 #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
     55 #define CONFIG_HEADER_BN_H
     56+# ifdef __LP64__
     57+#define BN_LLONG
     58+# else
     59 #undef BN_LLONG
     60+# endif
     61 
     62 /* Should we define BN_DIV2W here? */
     63 
     64@@ -66,12 +74,20 @@
     65 /* The prime number generation stuff may not work when
     66  * EIGHT_BIT but I don't care since I've only used this mode
     67  * for debuging the bignum libraries */
     68+# ifdef __LP64__
     69+#define SIXTY_FOUR_BIT_LONG
     70+#undef SIXTY_FOUR_BIT
     71+#undef THIRTY_TWO_BIT
     72+#undef SIXTEEN_BIT
     73+#undef EIGHT_BIT
     74+# else
     75 #undef SIXTY_FOUR_BIT_LONG
     76 #undef SIXTY_FOUR_BIT
     77 #define THIRTY_TWO_BIT
     78 #undef SIXTEEN_BIT
     79 #undef EIGHT_BIT
     80+# endif
     81 #endif
     82 
     83 #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
     84 #define CONFIG_HEADER_RC4_LOCL_H
     85@@ -82,7 +98,11 @@
     86 
     87 #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
     88 #define CONFIG_HEADER_BF_LOCL_H
     89-#undef BF_PTR
     90+# ifdef __LP64__
     91+#define BF_PTR2
     92+# else
     93+#define BF_PTR
     94+# endif
     95 #endif /* HEADER_BF_LOCL_H */
     96 
     97 #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
  • dports/devel/openssl/Portfile

     
    5252
    5353#make 4-way universal build ready
    5454variant universal {
     55        patchfiles-append patch-opensslconf.h.in-universal-32-64.diff
     56
    5557        post-patch {
    56 #               foreach arch {i386 x86_64 ppc ppc64}
    57                 foreach arch {i386 ppc} {
     58                foreach arch ${universal_archs} {
    5859                        file copy ${worksrcpath} ${workpath}/${arch}
    5960                }
    6061        }
    6162
    6263        configure {
    63                 foreach arch {i386 ppc} {
    64                         system "cd ${workpath}/${arch} && ./Configure darwin-${arch}-cc ${configure.pre_args} ${configure.args}"
    65                 }
    66 #               system "cd ${workpath}/x86_64 && ./Configure darwin64-x86_64-cc ${configure.pre_args} ${configure.args}"
    67 #               system "cd ${workpath}/ppc64 && ./Configure darwin64-ppc-cc ${configure.pre_args} ${configure.args}"
     64                if {[lsearch ${universal_archs} i386] != -1} {
     65                    system "cd ${workpath}/i386 && ./Configure darwin-i386-cc ${configure.pre_args} ${configure.args}"
     66                }
     67                if {[lsearch ${universal_archs} ppc] != -1} {
     68                    system "cd ${workpath}/ppc && ./Configure darwin-ppc-cc ${configure.pre_args} ${configure.args}"
     69                }
     70                if {[lsearch ${universal_archs} x86_64] != -1} {
     71                    system "cd ${workpath}/x86_64 && ./Configure darwin64-x86_64-cc ${configure.pre_args} ${configure.args}"
     72                }
     73                if {[lsearch ${universal_archs} ppc64] != -1} {
     74                    system "cd ${workpath}/ppc64 && ./Configure darwin64-ppc-cc ${configure.pre_args} ${configure.args}"
     75                }
    6876        }
    6977
    7078        build {
    71 #               foreach arch {i386 x86_64 ppc ppc64}
    72                 foreach arch {i386 ppc} {
     79                foreach arch ${universal_archs} {
    7380                        system "cd ${workpath}/${arch} && make all"
    7481                }
    7582        }
    7683
    7784        destroot {
    78 # in port 1.7, just call:
    79 #               merge "${workpath}/pre-dest"
    80 # till then, do this:
    81 #               foreach arch {i386 x86_64 ppc ppc64}
    82                 foreach arch {i386 ppc} {
     85                foreach arch ${universal_archs} {
    8386                        xinstall -d ${workpath}/pre-dest/${arch}
    8487                        system "cd ${workpath}/${arch} && make install INSTALL_PREFIX=${workpath}/pre-dest/${arch} MANDIR=${prefix}/share/man"
    8588                }
    86 
    87                 set basepath "${workpath}/pre-dest/i386"
    88                 fs-traverse file "${basepath}" {
    89                         set fpath [string range "${file}" [string length "${basepath}"] [string length "${file}"]]
    90                         if {${fpath} != ""} {
    91                                 ui_debug ":: ${fpath}"
    92 
    93                                 switch -exact [file type "${basepath}${fpath}"] {
    94                                         directory {
    95                                                 # just create directories
    96                                                 ui_debug "-- dir:: ${fpath}"
    97                                                 file mkdir "${destroot}${fpath}"
    98                                         }
    99                                         link {
    100                                                 # copy symlinks (TODO: check if target matches)
    101                                                 ui_debug "-- lnk:: ${fpath}"
    102                                                 file copy "${basepath}${fpath}" "${destroot}${fpath}"
    103                                         }
    104                                         file {
    105                                                 # treat files depending on their filetype
    106                                                 ui_debug "-- file:: ${fpath}"
    107                                                 set filetype [exec "/usr/bin/file" "-b" "${basepath}${fpath}"]
    108                                                 switch -regexp ${filetype} {
    109                                                         Mach-O.* {
    110                                                                 # Mach-O binaries get lipo-ed
    111                                                                 ui_debug "Mach-O file -- lipo-ing"
    112 #                                                               system "lipo -arch i386 ${workpath}/pre-dest/i386/${fpath} -arch x86_64 ${workpath}/pre-dest/x86_64/${fpath} -arch ppc ${workpath}/pre-dest/ppc/${fpath} -arch ppc64 ${workpath}/pre-dest/ppc64/${fpath} -create -output ${destroot}${fpath}"
    113                                                                 system "lipo -arch i386 ${workpath}/pre-dest/i386/${fpath} -arch ppc ${workpath}/pre-dest/ppc/${fpath} -create -output ${destroot}${fpath}"
    114                                                         }
    115                                                         current\ ar\ archive {
    116                                                                 # ar archives get lipo-ed
    117                                                                 ui_debug "ar archive -- lipo-ing"
    118 #                                                               system "lipo -arch i386 ${workpath}/pre-dest/i386/${fpath} -arch x86_64 ${workpath}/pre-dest/x86_64/${fpath} -arch ppc ${workpath}/pre-dest/ppc/${fpath} -arch ppc64 ${workpath}/pre-dest/ppc64/${fpath} -create -output ${destroot}${fpath}"
    119                                                                 system "lipo -arch i386 ${workpath}/pre-dest/i386/${fpath} -arch ppc ${workpath}/pre-dest/ppc/${fpath} -create -output ${destroot}${fpath}"
    120                                                         }
    121                                                         default {
    122                                                                 # unknown file types are copied IF they do not differ across ALL architectures -- if they do: This is an error!
    123                                                                 ui_debug "unknown filetype: ${filetype}"
    124                                                                 set differ1 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/i386/${fpath}" "${workpath}/pre-dest/ppc/${fpath}"]
    125 #                                                               set differ2 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/i386/${fpath}" "${workpath}/pre-dest/x86_64/${fpath}"]
    126 #                                                               set differ3 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/i386/${fpath}" "${workpath}/pre-dest/ppc64/${fpath}"]
    127                                                                 if {${differ1} != ""} {
    128                                                                         ui_debug "ERROR"
    129                                                                 } else {
    130                                                                         ui_debug "files match, just copying"
    131                                                                         file copy "${basepath}${fpath}" "${destroot}${fpath}"
    132                                                                 }
    133                                                         }
    134                                                 }
    135                                         }
    136                                         default { ui_debug "serious error" }
    137                                 }
    138                         }
    139                 }
    140         }
     89                merge "${workpath}/pre-dest"
     90        }
    14191}
    14292
    14393# the test suite can only be run *after* destrooting