1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
use ExtUtils::MakeMaker qw(prompt WriteMakefile);
use Config;
print "\n\nNet::LDAPapi Perl5 Module - by Quanah Gibson-Mount <mishikal\@yahoo.com>\n\n";
print "OpenLDAP support by Symas Corporation -- http://www.symas.com\n";
print "Updated by Quanah Gibson-Mount to match modern products and vendors.\n";
print "Updated by Dmitri Priimak to use the v3 OpenLDAP API.\n";
print "\nOriginally by Clayton Donley <donley\@cig.mcel.mot.com>\n\n";
$pl_path = $Config{'perlpath'};
unless (@ARGV) {
warn <<END;
NOTICE: This module requires the OpenLDAP C API or Mozilla C SDK.
It will NOT work with ISODE or the UMich LDAP api.
Type perl Makefile.PL -h for command-line option summary.
END
}
#############################################################################################
# Build options passed in to script to support reproducible builds via Makefiles
#############################################################################################
use Getopt::Long;
my $result = GetOptions("sdk=s" => \$sdk,
"lib_path=s" => \$lib_ldap,
"include_path=s" => \$include_ldap,
"sasl_include_path=s" => \$include_sasl,
);
unless ($result) {
print STDERR <<END;
Usage: perl Makefile.PL [options]
Configure Net::LDAPapi module.
Options:
-sdk SDK which SDK to use(openldap or mozilla)
-lib_path path path to the LDAP libraries
-include_path path path to the LDAP includes
-sasl_include_path path path to the SASL includes (optional)
If no options are passed on the command line will prompt for these
values interactively.
END
}
if ($sdk eq "mozilla" || $sdk eq "MOZILLA") {
$sdk = 2;
}
unless ($sdk)
{
print "\nSelect your Development Kit:\n";
print " 1. OpenLDAP (default)\n";
print " 2. Mozilla\n";
$sdk=prompt("Choose:",1);
}
$version = ($sdk == 2 ? 'MOZILLA' :
'OPENLDAP');
if ($include_ldap eq "")
{
$include_ldap=prompt("Location of LDAP include files:","/usr/include");
chomp($include_ldap);
$include_ldap = "/usr/include" unless $include_ldap =~ /\S/;
}
if ($lib_ldap eq "")
{
$df_lib = ($include_ldap =~ m%^(\S+)/include% ? "$1/lib" : "/usr/lib");
$lib_ldap=prompt("Location of LDAP library files:",$df_lib);
chomp($lib_ldap);
$lib_ldap = $df_lib unless $lib_ldap =~ /\S/;
}
if ( $sdk == 1 && $include_sasl eq "") {
$include_sasl=prompt("Location of SASL include files if needed:");
chomp($include_sasl);
}
if ($version eq "MOZILLA")
{
if ($Config::Config{'osname'} eq 'MSWin32')
{
$ldap_lib = 'nsldapssl32v30';
} else {
$ldap_lib = 'ldapssl30';
}
}
if ($version eq "OPENLDAP")
{
if ($^O eq "MSWin32")
{
$ldap_lib = 'ldap.lib lber.lib';
}
else
{
$ldap_lib = '-lldap -llber';
}
}
sub MY::postamble
{
"
constant.h: constant.gen
$pl_path constant.gen >constant.h
";
}
WriteMakefile(
'NAME' => 'Net::LDAPapi',
'VERSION_FROM' => 'LDAPapi.pm',
'PREREQ_PM' => { 'Convert::ASN1' => '0.19'},
($include_sasl ne "" ? (
'INC' => "-I$include_ldap -I$include_sasl -I/usr/include",
) : (
'INC' => "-I$include_ldap -I/usr/include",
)),
($version eq "MOZILLA" ? (
'LIBS' => ["-L$lib_ldap -l$ldap_lib"],
'DEFINE' => '-DMOZILLA_LDAP',
) : (
'LIBS' => ["-L$lib_ldap $ldap_lib"],
'DEFINE' => '-DOPENLDAP -DLDAP_DEPRECATED=1',
)),
'depend' => { 'LDAPapi.c' => 'constant.h' },
'clean' => { 'FILES' => 'constant.h' },
META_MERGE => {
'meta-spec' => { version => 2 },
resources => {
repository => {
type => 'git',
url => 'https://github.com/quanah/net-ldapapi.git',
web => 'https://github.com/quanah/net-ldapapi',
},
},
},
);
|