Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix win32 install / use meta "resources"
Problem: File::Bundled is outdated and needs to be replaced. But
%?RESOURCES fails to handle situations where the lib name cannot
be guessed (given ssl it would need to produce libssl.so and
ssleay.dll AND libeay.dll. This leaves windows openssl-less

Solution: Replace File::Bundled with %?RESOURCES anyway. The ugly
part of this means non-windows users still have to store the .dll
files even though they will never be used. This is accomplished
by not using the actual %?RESOURCES api internally on anything
except windows (see: OpenSSL::NativeLib.pm6). Its better to
support openssl on windows than to wait for other possible
fixes in rakudo itself, but in the future this should be
replaced

Bonus: Build.PM is no longer needed. So dependencies on panda
and Shell::Command can be dropped (in addition to File::Bundled)
  • Loading branch information
Nick Logan committed May 7, 2016
1 parent 03076a2 commit 85f4413
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 59 deletions.
33 changes: 0 additions & 33 deletions Build.pm

This file was deleted.

8 changes: 4 additions & 4 deletions META.info
@@ -1,10 +1,9 @@
{
"name" : "OpenSSL",
"version" : "0.0.2",
"version" : "0.0.3",
"author" : "github:sergot",
"description" : "OpenSSL bindings",
"depends" : ["Digest","Find::Bundled"],
"build-depends" : ["Shell::Command","panda"],
"depends" : ["Digest"],
"provides" : {
"OpenSSL" : "lib/OpenSSL.pm6",
"OpenSSL::Bio" : "lib/OpenSSL/Bio.pm6",
Expand All @@ -22,5 +21,6 @@
"OpenSSL::SSL" : "lib/OpenSSL/SSL.pm6",
"OpenSSL::X509" : "lib/OpenSSL/X509.pm6"
},
"source-url" : "git://github.com/sergot/openssl.git"
"source-url" : "git://github.com/sergot/openssl.git",
"resources" : [ "ssleay32.dll", "libeay32.dll" ]
}
29 changes: 7 additions & 22 deletions lib/OpenSSL/NativeLib.pm6
@@ -1,28 +1,13 @@
unit module OpenSSL::NativeLib;
use Find::Bundled;

sub ssl-lib is export {
state $lib;
unless $lib {
if $*DISTRO.is-win {
# try to find a bundled .dll
$lib = Find::Bundled.find('ssleay32.dll', 'OpenSSL', :return-original, :keep-filename);
} else {
$lib = $*VM.platform-library-name('ssl'.IO).Str;
}
}
$lib
state $lib = $*DISTRO.is-win
?? %?RESOURCES<ssleay32.dll>.absolute
!! $*VM.platform-library-name('ssl'.IO).Str;
}

sub gen-lib is export {
state $lib;
unless $lib {
if $*DISTRO.is-win {
# try to find a bundled .dll
$lib = Find::Bundled.find('libeay32.dll', 'OpenSSL', :return-original, :keep-filename);
} else {
$lib = $*VM.platform-library-name('ssl'.IO).Str;
}
}
$lib
}
state $lib = $*DISTRO.is-win
?? %?RESOURCES<libeay32.dll>.absolute
!! $*VM.platform-library-name('ssl'.IO).Str;
}
File renamed without changes.
File renamed without changes.

0 comments on commit 85f4413

Please sign in to comment.