Crypt-MatrixSSL

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

use 5.00001;
use ExtUtils::MakeMaker;
#
#  WARNING: Do not try to "make dist" under Windows; it destroys the Upper/lower CaSe of some files.
#
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
#
# Many thanks to Randy Kobes for helping me figure out how to make this work on Win32, which
# also laid the foundation for me getting it to work nicely on Linux and Macintosh
#
use Config;
use IO::Socket ();	# For checking net connectivity
my $os_src = ($^O =~ /Win32/) ? 'win/win' : 'linux/linux';
my $o = $Config{obj_ext};
my $c='.c';
my $mxbase='matrixssl-1-8-6-open';
my $mxfiles="$mxbase.files";

my $online_flag = 't/online.enabled';


# Apply cumulative patch, if any
if (-r "$mxbase.patch") {
    system("cd \Q$mxbase\E; patch -p1 -N -i ../$mxbase.patch");
}

=for ver1-82
# Increase default const to allow more than 8 certificates:
{
    local $^I   = q{};
    local @ARGV = "$mxbase/matrixCommon.h";
    while (<>) {
        s/^(\s*#define\s+MAX_CHAIN_LENGTH\s*\s)\d+(\s*$)/${1}192${2}/;
        print;
    }
}

=cut

# Increase default const to allow more than 8 certificates:
unless(-f "$mxbase/src/pki/matrixPki.h.ori") { # only do once
    rename("$mxbase/src/pki/matrixPki.h","$mxbase/src/pki/matrixPki.h.ori");
}

    open(IN,"<$mxbase/src/pki/matrixPki.h.ori") or die "Can't fix MAX_CHAIN_LENGTH: $!";
    open(OUT,">$mxbase/src/pki/matrixPki.h") or die "Can't fix MAX_CHAIN_LENGTH: $!";
    while(my $line=<IN>) {
      $line=~s/^(\s*#define\s+MAX_CHAIN_LENGTH\s*\s)\d+(\s*$)/${1}192${2}/;
      print OUT $line;
    }
    close(IN); close(OUT);



=for removal 

# Fix Macintosh line ends tht  don't compile under Win32
sub chompnl {	# Warning: don't stuff up $1
  chop $_[0] while((substr($_[0],-1) eq "\015")||(substr($_[0],-1) eq "\012"));
} # chompnl
unless(-f "$mxbase/matrixCommon.h.ori") { # only do once
    rename("$mxbase/matrixCommon.h","$mxbase/matrixCommon.h.ori");
    open(IN,"<$mxbase/matrixCommon.h.ori") or die "Can't fix MAC Line ends: $!";
    open(OUT,">$mxbase/matrixCommon.h") or die "Can't fix MAC Line ends: $!";
    while(my $line=<IN>) {
      &chompnl($line);
      print OUT $line . "\n";	# "\n" on unix, "\r\n" on Dos, ??? on Mac.
    }
    close(IN); close(OUT);
}

=cut

# NOTE: For future versions of MatrixSSL (this is v1.8.6) - if the below routine failes - you might need to do this;
#       1. cd matrixssl-x-y-z/src
#       2. make all; cd ..
#       3. find . -name '*.o' -print >/tmp/objs
#       4. vi ../Makefile.PL
#       5. include the file /tmp/objs - eg:   ":r /tmp/objs"
#       6. change all the ".o" endings to "$mxext"
#       7. change all the leading "./" to $mxbase/
#       8. join them all on to one line and assign them all to "$mxfiles"; be careful NOT to expand the "$mxext" or "$mxbase" (eg: use single quotes)
#       9. replace the os/linux/linux$mxext one with os/$os_src$mxext


# Autogenerate list with object files produced by MatrixSSL because it's
# different between MatrixSSL versions.
if (! -r $mxfiles) {
    if ($^O =~ /Win32/) {
        # TODO  I don't have windoze with installed perl and C compiler,
        #       so I can't realize this feature for Win32.



( run in 1.453 second using v1.01-cache-2.11-cpan-d8267643d1d )