-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.PL
94 lines (80 loc) · 2.91 KB
/
Makefile.PL
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
# Net::ZooKeeper - Perl extension for Apache ZooKeeper
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use 5.008_008;
use Config;
use ExtUtils::MakeMaker;
use Getopt::Long;
my $ZOO_MAJOR_VERSION = 3;
my $ZOO_REQUIRED_VERSION = qr{^$ZOO_MAJOR_VERSION\.\d+.\d+$}ismx;
my @zk_inc_paths;
my @zk_lib_paths;
GetOptions(
'zookeeper-include=s' => \@zk_inc_paths,
'zookeeper-lib=s' => \@zk_lib_paths
);
my $zk_inc_paths = join(' ', map("-I$_", @zk_inc_paths));
my $zk_lib_paths = join(' ', map("-L$_", @zk_lib_paths));
$zk_inc_paths .= ' ' unless ($zk_inc_paths eq '');
$zk_lib_paths .= ' ' unless ($zk_lib_paths eq '');
my $cc = $Config{'cc'};
my $check_file = 'build/check_zk_version';
my $check_out = qx($cc $zk_inc_paths $zk_lib_paths -I. -o $check_file $check_file.c 2>&1);
if ($?) {
if ($check_out =~ /zookeeper_version\.h/) {
die("Could not determine ZooKeeper version:\n\n$check_out");
}
else {
## keep in sync with build/check_zk_version.h
die("Net::ZooKeeper requires at least ZooKeeper version 3.2.0: $check_out\n");
}
}
chomp(my $zk_ver = qx($check_file));
if ($? >> 8 != 0) {
die "Couldn't check zookeeper version: $zk_ver: $r";
}
elsif ($zk_ver !~ $ZOO_REQUIRED_VERSION) {
warn "Net::ZooKeeper requires ZooKeeper 3.x, found $zk_ver!";
}
WriteMakefile(
'INC' => "$zk_inc_paths-I.",
'LIBS' => [ "$zk_lib_paths-lzookeeper_mt" ],
'NAME' => 'Net::ZooKeeper',
'VERSION_FROM' => 'ZooKeeper.pm',
'clean' => { 'FILES' => 'build/check_zk_version.o' },
'META_MERGE' => {
'meta-spec' => { version => 2 },
prereqs => {
test => {
requires => {
version => '0.77',
},
},
},
resources => {
homepage => "https://github.com/mark-5/p5-net-zookeeper",
bugtracker => {
web => "https://github.com/mark-5/p5-net-zookeeper/issues",
},
repository => {
web => "https://github.com/mark-5/p5-net-zookeeper",
url => "https://github.com/mark-5/p5-net-zookeeper.git",
type => 'git',
},
},
},
);