| 1 |
use 5.010001; |
| 2 |
use ExtUtils::MakeMaker; |
| 3 |
use ExtUtils::PkgConfig; |
| 4 |
use Devel::CheckLib; |
| 5 |
|
| 6 |
my %openssl_info = ExtUtils::PkgConfig->find(qw/ eopenssl openssl /); |
| 7 |
die "OpenSSL must be v1.0 or higher" unless ExtUtils::PkgConfig->atleast_version('openssl', '1.0'); |
| 8 |
|
| 9 |
my $libpath = ExtUtils::PkgConfig->libs_only_L($openssl_info{pkg}); |
| 10 |
$libpath =~ s/-L//g; |
| 11 |
# If this is not set, non-default paths such as eopenssl's are not found on OpenBSD |
| 12 |
$ENV{LD_LIBRARY_PATH} //= ''; |
| 13 |
$ENV{LD_LIBRARY_PATH} .= ':' if length $ENV{LD_LIBRARY_PATH}; |
| 14 |
$ENV{LD_LIBRARY_PATH} .= $libpath; |
| 15 |
|
| 16 |
check_lib( |
| 17 |
lib => 'ssl', |
| 18 |
header => 'openssl/ssl.h', |
| 19 |
libpath => $libpath, |
| 20 |
function => ' |
| 21 |
SSL_CTX *ctx; |
| 22 |
SSL_library_init(); |
| 23 |
if(!(ctx = SSL_CTX_new(SSLv23_client_method()))) return 1; |
| 24 |
SSL_CTX_set_psk_client_callback(ctx, (unsigned int (*)(SSL*,const char*,char*,unsigned int,unsigned char*,unsigned int))NULL); |
| 25 |
return 0; |
| 26 |
', |
| 27 |
) or do { |
| 28 |
print STDERR <<EOF; |
| 29 |
ERROR: your OpenSSL implementation does not include RFC4279 pre-shared key |
| 30 |
functions, so NSCA-ng will not work. If this is LibreSSL, you probably have |
| 31 |
a package called `eopenssl' that installs the original OpenSSL. |
| 32 |
EOF |
| 33 |
exit 0; |
| 34 |
}; |
| 35 |
|
| 36 |
WriteMakefile( |
| 37 |
NAME => 'Net::NSCAng::Client', |
| 38 |
VERSION_FROM => 'lib/Net/NSCAng/Client.pm', |
| 39 |
MIN_PERL_VERSION => '5.10.1', |
| 40 |
PREREQ_PM => {}, |
| 41 |
CONFIGURE_REQUIRES => { |
| 42 |
'ExtUtils::MakeMaker' => 6.52, |
| 43 |
'ExtUtils::PkgConfig' => 0, |
| 44 |
'Devel::CheckLib' => 0, |
| 45 |
'version' => 0.77, |
| 46 |
}, |
| 47 |
TEST_REQUIRES => { |
| 48 |
'Test::Exception' => 0, |
| 49 |
'Test::More' => 0, |
| 50 |
'Test::Pod' => 0, |
| 51 |
'Test::CheckManifest' => 0, |
| 52 |
}, |
| 53 |
ABSTRACT_FROM => 'lib/Net/NSCAng/Client.pm', # retrieve abstract from module |
| 54 |
AUTHOR => 'Matthias Bethke <[email protected]>', |
| 55 |
LICENSE => 'perl', |
| 56 |
LIBS => [ ExtUtils::PkgConfig->libs($openssl_info{pkg}) ], |
| 57 |
DEFINE => '', |
| 58 |
INC => '-I.', |
| 59 |
OBJECT => '$(O_FILES)', |
| 60 |
META_ADD => { |
| 61 |
repository => { |
| 62 |
type => 'git', |
| 63 |
url => '[email protected]:mbethke/nsca-ng.git', |
| 64 |
web => 'https://github.com/mbethke/nsca-ng/tree/perl-module/perl', |
| 65 |
}, |
| 66 |
}, |
| 67 |
dist => { COMPRESS => 'bzip2', SUFFIX => 'bz2', }, |
| 68 |
clean => { FILES => 'Net-NSCAng-Client-*' }, |
| 69 |
); |