Subject: | patch to compile Tripletail::SMIME under Windows |
Patched ext/Makefile.PL to look for openssl in c:/openssl and add
directories for compiler.
Patched ext/Tripletail-SMIME/Makefile.PL the same and to link correct
libraries.
This all will make compiling it under Windows possible and convinient.
Patches and patched Makefiles.PL are included.
-------
Alexandr Ciornii, http://chorny.net
Subject: | ext-Tripletail-SMIME-Makefile.PL |
use strict;
use warnings;
use ExtUtils::MakeMaker;
my $OPENSSL_LIBS = $ENV{LDFLAGS} || '';
my $OPENSSL_CFLAGS = $ENV{CFLAGS} || '';
my $openssl_path='';
if($^O eq 'MSWin32') {
$openssl_path='c:/openssl' if -x 'c:/openssl/bin/openssl.exe';
if ($openssl_path) {
$OPENSSL_CFLAGS.=" -I$openssl_path/include";
$OPENSSL_LIBS.=" -L$openssl_path/lib -lssleay32 -llibeay32";
}
} else {
$OPENSSL_LIBS.=" -L$openssl_path/lib -lcrypto";
}
WriteMakefile(
NAME => 'Tripletail::SMIME',
AUTHOR => 'Ymirlink <tl@tripletail.jp>',
VERSION_FROM => 'SMIME.pm',
ABSTRACT_FROM => 'SMIME.pm',
PL_FILES => {},
PREREQ_PM => {
'Test::More' => 0,
},
LIBS => ["$OPENSSL_LIBS"],
INC => "$OPENSSL_CFLAGS",
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Tripletail-SMIME-*' },
);
Subject: | ext-Makefile.PL.patch |
*** ext/Makefile.PL.dist Tue Aug 15 08:10:07 2006
--- ext/Makefile.PL Wed Aug 16 18:37:10 2006
***************
*** 46,53 ****
use ExtUtils::Embed;
my $cc = exists $argv{CC} ? $argv{CC} : $Config{cc};
my $ccopts = $argv{CCFLAGS}||ExtUtils::Embed::ccopts();
!
my $cmd = "$cc $ccopts $xstest_src -o $xstest_out";
print "Checking XS Compiling... : $cmd\n";
my $rc = 0xffff & system($cmd);
unlink($xstest_out);
--- 46,62 ----
use ExtUtils::Embed;
my $cc = exists $argv{CC} ? $argv{CC} : $Config{cc};
my $ccopts = $argv{CCFLAGS}||ExtUtils::Embed::ccopts();
! my $windows=0;
! my $openssl_path='';
my $cmd = "$cc $ccopts $xstest_src -o $xstest_out";
+ if($^O eq 'MSWin32') {
+ $openssl_path='c:/openssl' if -x 'c:/openssl/bin/openssl.exe';
+ $windows=1;
+ if ($openssl_path) {
+ $cmd = "$cc -I$openssl_path/include $ccopts $xstest_src -o $xstest_out -L$openssl_path/lib";
+ }
+ }
+
print "Checking XS Compiling... : $cmd\n";
my $rc = 0xffff & system($cmd);
unlink($xstest_out);
Subject: | ext-Makefile.PL |
use strict;
use warnings;
use ExtUtils::MakeMaker;
our %OPTS;
&check_openssl();
WriteMakefile(
NAME => 'Tripletail-ext',
%OPTS,
);
sub check_openssl
{
if( !openssl_is_available() )
{
$OPTS{DIR} = ['Tripletail-HtmlFilter'];
}
}
sub openssl_is_available
{
my $xstest_src = "openssl_check.c";
my $xstest_out = "openssl_check";
if( !open(FILE, "> $xstest_src") )
{
return;
}
print FILE <<XSTEST_CODE;
#include <string.h>
#include <openssl/crypto.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/pkcs12.h>
#include <openssl/x509.h>
int main()
{
return 0;
}
XSTEST_CODE
close(FILE);
# compile.
my %argv = map{ /^(\w+)=(.*)$/ } @ARGV;
use Config;
use ExtUtils::Embed;
my $cc = exists $argv{CC} ? $argv{CC} : $Config{cc};
my $ccopts = $argv{CCFLAGS}||ExtUtils::Embed::ccopts();
my $windows=0;
my $openssl_path='';
my $cmd = "$cc $ccopts $xstest_src -o $xstest_out";
if($^O eq 'MSWin32') {
$openssl_path='c:/openssl' if -x 'c:/openssl/bin/openssl.exe';
$windows=1;
if ($openssl_path) {
$cmd = "$cc -I$openssl_path/include $ccopts $xstest_src -o $xstest_out -L$openssl_path/lib";
}
}
print "Checking XS Compiling... : $cmd\n";
my $rc = 0xffff & system($cmd);
unlink($xstest_out);
unlink($xstest_src);
if( $rc )
{
if( $rc == 0xffff )
{
print " >> Here environment cannot use XS.\n";
print " >> Because : command failed : $!\n";
return;
}elsif( $rc > 0x80 )
{
print " >> Here environment cannot use XS.\n";
print " >> Because : ran with non-zero exit status $rc\n";
return;
}elsif( $rc & 0x80 )
{
$rc &= ~0x80;
print " >> Compile failed..\n";
print " >> Because : ran with coredump from signal $rc\n";
exit 1;
}else
{
print " >> Compile failed..\n";
print " >> Because : ran with signal $rc\n";
exit 1;
}
}
print " >> ok, compile succeed.\n";
1;
}
# -----------------------------------------------------------------------------
# End of File.
# -----------------------------------------------------------------------------
Subject: | ext-Tripletail-SMIME-Makefile.PL.patch |
*** ext/Tripletail-SMIME/Makefile.PL.dist Wed Aug 16 18:36:18 2006
--- ext/Tripletail-SMIME/Makefile.PL Wed Aug 16 18:20:59 2006
***************
*** 5,10 ****
--- 5,21 ----
my $OPENSSL_LIBS = $ENV{LDFLAGS} || '';
my $OPENSSL_CFLAGS = $ENV{CFLAGS} || '';
+ my $openssl_path='';
+ if($^O eq 'MSWin32') {
+ $openssl_path='c:/openssl' if -x 'c:/openssl/bin/openssl.exe';
+ if ($openssl_path) {
+ $OPENSSL_CFLAGS.=" -I$openssl_path/include";
+ $OPENSSL_LIBS.=" -L$openssl_path/lib -lssleay32 -llibeay32";
+ }
+ } else {
+ $OPENSSL_LIBS.=" -L$openssl_path/lib -lcrypto";
+ }
+
WriteMakefile(
NAME => 'Tripletail::SMIME',
AUTHOR => 'Ymirlink <tl@tripletail.jp>',
***************
*** 14,20 ****
PREREQ_PM => {
'Test::More' => 0,
},
! LIBS => ["$OPENSSL_LIBS -lcrypto"],
INC => "$OPENSSL_CFLAGS",
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Tripletail-SMIME-*' },
--- 25,31 ----
PREREQ_PM => {
'Test::More' => 0,
},
! LIBS => ["$OPENSSL_LIBS"],
INC => "$OPENSSL_CFLAGS",
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Tripletail-SMIME-*' },