Subject: | Crypt-SSLeay-0.56 build issues on Win32 platform |
Date: | Mon, 23 Jul 2007 14:20:49 +0200 |
To: | bug-Crypt-SSLeay [...] rt.cpan.org |
From: | Guenter Knauf <info [...] gknw.de> |
Hi David,
I did some more hacking around, and fixed some build whoes on Win32 when build with MSVC / ActivePerl:
- added option to specify static linking (since its often a mess to depend on external DLLs)
- added support for relative paths to OpenSSL directory
- moved "$dir/inc32/openssl/opensslv.h" to top place to avoid wrong detection of "$dir/crypto/opensslv.h" because this file is at least in OpenSSL 0.9.8e always present.
here's my unified diff against Makefile.PL from Crypt-SSLeay-0.56 (also attached):
--- Makefile.PL.orig Mon Jul 23 13:03:21 2007
+++ Makefile.PL Mon Jul 23 14:02:54 2007
@@ -9,11 +9,12 @@
eval "use ExtUtils::MakeMaker::Coverage";
$@ or print "Adding testcover target\n";
-use vars qw($opt_default $opt_libpath);
+use vars qw($opt_default $opt_libpath $opt_static);
GetOptions(
"default", \$opt_default,
"lib=s", \$opt_libpath,
+ "static", \$opt_static,
);
$opt_default ||= $ENV{CRYPT_SSLEAY_DEFAULT};
@@ -139,12 +140,12 @@
# external tools probably expect \ and not / for path separators
$SSL_DIR =~ tr{/}{\\};
- # default to drive C:
- $SSL_DIR = "c:$SSL_DIR" if $SSL_DIR !~ /\A[a-z]:/i;
+ # default to drive C: if no relative path
+ $SSL_DIR = "c:$SSL_DIR" if ($SSL_DIR !~ /\A[a-z]:|^../i);
my $inc = $pkg_config->{inc};
$inc =~ tr{/}{\\};
- $inc !~ /^[a-z]:/i and $inc = "c:$inc";
+ $inc !~ /^[a-z]:|^../i and $inc = "c:$inc";
push @INC_FLAGS, "-I$inc";
push @INC_FLAGS, "-I$SSL_DIR\\inc32" if -d "$SSL_DIR/inc32";
@@ -157,10 +158,14 @@
elsif(-d "$SSL_DIR/lib") {
push @LIB_FLAGS, "-L$SSL_DIR\\lib";
}
- elsif(-d "$SSL_DIR/out32dll") {
+ elsif(-d "$SSL_DIR/out32dll" && !$opt_static) {
# patch from Ben Laurie
push @LIB_FLAGS, "-L$SSL_DIR\\out32dll";
}
+ elsif(-d "$SSL_DIR/out32" && $opt_static) {
+ # patch from Ben Laurie
+ push @LIB_FLAGS, "-L$SSL_DIR\\out32";
+ }
else {
# Allow developers to point at OpenSSL source...
push @LIB_FLAGS, "-L$SSL_DIR";
@@ -287,8 +292,8 @@
my $inc_dir;
my $version_file;
for (
- "$dir/crypto/opensslv.h", # cygwin32 builds
"$dir/inc32/openssl/opensslv.h", # old win32 builds
+ "$dir/crypto/opensslv.h", # cygwin32 builds
"$dir/include/openssl/opensslv.h",
"$dir/include/opensslv.h",
"$dir/include/crypto.h"
thanks, Guenter.
--- Makefile.PL.orig Mon Jul 23 13:03:21 2007
+++ Makefile.PL Mon Jul 23 14:02:54 2007
@@ -9,11 +9,12 @@
eval "use ExtUtils::MakeMaker::Coverage";
$@ or print "Adding testcover target\n";
-use vars qw($opt_default $opt_libpath);
+use vars qw($opt_default $opt_libpath $opt_static);
GetOptions(
"default", \$opt_default,
"lib=s", \$opt_libpath,
+ "static", \$opt_static,
);
$opt_default ||= $ENV{CRYPT_SSLEAY_DEFAULT};
@@ -139,12 +140,12 @@
# external tools probably expect \ and not / for path separators
$SSL_DIR =~ tr{/}{\\};
- # default to drive C:
- $SSL_DIR = "c:$SSL_DIR" if $SSL_DIR !~ /\A[a-z]:/i;
+ # default to drive C: if no relative path
+ $SSL_DIR = "c:$SSL_DIR" if ($SSL_DIR !~ /\A[a-z]:|^../i);
my $inc = $pkg_config->{inc};
$inc =~ tr{/}{\\};
- $inc !~ /^[a-z]:/i and $inc = "c:$inc";
+ $inc !~ /^[a-z]:|^../i and $inc = "c:$inc";
push @INC_FLAGS, "-I$inc";
push @INC_FLAGS, "-I$SSL_DIR\\inc32" if -d "$SSL_DIR/inc32";
@@ -157,10 +158,14 @@
elsif(-d "$SSL_DIR/lib") {
push @LIB_FLAGS, "-L$SSL_DIR\\lib";
}
- elsif(-d "$SSL_DIR/out32dll") {
+ elsif(-d "$SSL_DIR/out32dll" && !$opt_static) {
# patch from Ben Laurie
push @LIB_FLAGS, "-L$SSL_DIR\\out32dll";
}
+ elsif(-d "$SSL_DIR/out32" && $opt_static) {
+ # patch from Ben Laurie
+ push @LIB_FLAGS, "-L$SSL_DIR\\out32";
+ }
else {
# Allow developers to point at OpenSSL source...
push @LIB_FLAGS, "-L$SSL_DIR";
@@ -287,8 +292,8 @@
my $inc_dir;
my $version_file;
for (
- "$dir/crypto/opensslv.h", # cygwin32 builds
"$dir/inc32/openssl/opensslv.h", # old win32 builds
+ "$dir/crypto/opensslv.h", # cygwin32 builds
"$dir/include/openssl/opensslv.h",
"$dir/include/opensslv.h",
"$dir/include/crypto.h"