| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
233577
|
use alienfile; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Alien::ckdl always installs from source ("share"). |
|
4
|
|
|
|
|
|
|
# Pinned to a specific upstream commit of https://github.com/tjol/ckdl |
|
5
|
|
|
|
|
|
|
# so builds are reproducible. Bump $CKDL_COMMIT to roll forward. |
|
6
|
|
|
|
|
|
|
# Built statically; ckdl's CMake build is intentionally bypassed so we |
|
7
|
|
|
|
|
|
|
# do not pull in Python/Cython, the C++ bindings, or the upstream test |
|
8
|
|
|
|
|
|
|
# suite. |
|
9
|
|
|
|
|
|
|
probe sub { 'share' }; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Pinned upstream commit (tjol/ckdl). Update both the SHA and the short |
|
12
|
|
|
|
|
|
|
# version tag together when bumping. |
|
13
|
|
|
|
|
|
|
my $CKDL_COMMIT = 'c9c33fe64446287215e80705545139d92a48f829'; |
|
14
|
|
|
|
|
|
|
my $CKDL_VERSION = '0.0.0-' . substr($CKDL_COMMIT, 0, 12); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
share { |
|
17
|
|
|
|
|
|
|
my $tarball = "https://github.com/tjol/ckdl/archive/$CKDL_COMMIT.tar.gz"; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
start_url $tarball; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
plugin 'Fetch::HTTPTiny' => $tarball; |
|
22
|
|
|
|
|
|
|
plugin 'Decode::HTML' => (); |
|
23
|
|
|
|
|
|
|
plugin 'Extract' => 'tar.gz'; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
meta->around_hook( |
|
26
|
|
|
|
|
|
|
fetch => sub { |
|
27
|
|
|
|
|
|
|
my ($orig, $build, @args) = @_; |
|
28
|
|
|
|
|
|
|
my $res = $orig->($build, @args); |
|
29
|
|
|
|
|
|
|
# GitHub's commit tarballs carry no upstream version metadata; |
|
30
|
|
|
|
|
|
|
# stamp the pinned commit so Alien::Build has something stable. |
|
31
|
|
|
|
|
|
|
$res->{version} = $CKDL_VERSION; |
|
32
|
|
|
|
|
|
|
$res; |
|
33
|
|
|
|
|
|
|
}, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
build sub { |
|
37
|
|
|
|
|
|
|
my ($build) = @_; |
|
38
|
|
|
|
|
|
|
require ExtUtils::CBuilder; |
|
39
|
|
|
|
|
|
|
require File::Copy; |
|
40
|
|
|
|
|
|
|
require File::Path; |
|
41
|
|
|
|
|
|
|
require File::Find; |
|
42
|
|
|
|
|
|
|
require File::Spec; |
|
43
|
|
|
|
|
|
|
require Config; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Locate the unpacked ckdl source tree. Alien::Build sometimes chdirs |
|
46
|
|
|
|
|
|
|
# into the extracted directory and sometimes leaves cwd as its parent. |
|
47
|
|
|
|
|
|
|
my $srcdir; |
|
48
|
|
|
|
|
|
|
if (-f 'CMakeLists.txt' && -d 'src' && -d 'include') { |
|
49
|
|
|
|
|
|
|
$srcdir = '.'; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
else { |
|
52
|
|
|
|
|
|
|
($srcdir) = grep { -d $_ && -f File::Spec->catfile($_, 'CMakeLists.txt') } |
|
53
|
|
|
|
|
|
|
glob 'ckdl-*'; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
die "could not locate extracted ckdl source tree (cwd=" . `pwd` . ")" |
|
56
|
|
|
|
|
|
|
unless $srcdir; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $cb = ExtUtils::CBuilder->new(quiet => 0); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my @units = qw(bigint compat emitter parser str tokenizer utf8); |
|
61
|
|
|
|
|
|
|
my @objects; |
|
62
|
|
|
|
|
|
|
for my $unit (@units) { |
|
63
|
|
|
|
|
|
|
my $src = File::Spec->catfile($srcdir, 'src', "$unit.c"); |
|
64
|
|
|
|
|
|
|
my $obj = $cb->compile( |
|
65
|
|
|
|
|
|
|
source => $src, |
|
66
|
|
|
|
|
|
|
include_dirs => [ |
|
67
|
|
|
|
|
|
|
File::Spec->catdir($srcdir, 'include'), |
|
68
|
|
|
|
|
|
|
File::Spec->catdir($srcdir, 'src'), |
|
69
|
|
|
|
|
|
|
], |
|
70
|
|
|
|
|
|
|
extra_compiler_flags => [ |
|
71
|
|
|
|
|
|
|
'-DBUILDING_KDL=1', |
|
72
|
|
|
|
|
|
|
'-DKDL_STATIC_LIB=1', |
|
73
|
|
|
|
|
|
|
'-O2', |
|
74
|
|
|
|
|
|
|
], |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
push @objects, $obj; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $ar = $Config::Config{ar} || 'ar'; |
|
80
|
|
|
|
|
|
|
my $lib = 'libkdl' . ($Config::Config{lib_ext} || '.a'); |
|
81
|
|
|
|
|
|
|
unlink $lib; |
|
82
|
|
|
|
|
|
|
system($ar, 'rcs', $lib, @objects) == 0 |
|
83
|
|
|
|
|
|
|
or die "static archive step failed: $ar rcs $lib ... -> $?"; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Install: $build->install_prop->{prefix} is the staging dir. |
|
86
|
|
|
|
|
|
|
my $prefix = $build->install_prop->{prefix}; |
|
87
|
|
|
|
|
|
|
my $libdir = File::Spec->catdir($prefix, 'lib'); |
|
88
|
|
|
|
|
|
|
my $incdir = File::Spec->catdir($prefix, 'include', 'kdl'); |
|
89
|
|
|
|
|
|
|
my $licdir = File::Spec->catdir($prefix, 'share', 'doc', 'ckdl'); |
|
90
|
|
|
|
|
|
|
File::Path::make_path($libdir, $incdir, $licdir); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
File::Copy::copy($lib, File::Spec->catfile($libdir, $lib)) |
|
93
|
|
|
|
|
|
|
or die "copy $lib: $!"; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my $hdr_src = File::Spec->catdir($srcdir, 'include', 'kdl'); |
|
96
|
|
|
|
|
|
|
opendir my $dh, $hdr_src or die "opendir $hdr_src: $!"; |
|
97
|
|
|
|
|
|
|
for my $hdr (grep { /\.h$/ } readdir $dh) { |
|
98
|
|
|
|
|
|
|
File::Copy::copy( |
|
99
|
|
|
|
|
|
|
File::Spec->catfile($hdr_src, $hdr), |
|
100
|
|
|
|
|
|
|
File::Spec->catfile($incdir, $hdr), |
|
101
|
|
|
|
|
|
|
) or die "copy header $hdr: $!"; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
closedir $dh; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
for my $note (qw(COPYING README.md CHANGELOG.md)) { |
|
106
|
|
|
|
|
|
|
my $p = File::Spec->catfile($srcdir, $note); |
|
107
|
|
|
|
|
|
|
next unless -f $p; |
|
108
|
|
|
|
|
|
|
File::Copy::copy($p, File::Spec->catfile($licdir, $note)) |
|
109
|
|
|
|
|
|
|
or die "copy $note: $!"; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
}; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Static-library consumers: -I/include and -L/lib -lkdl. |
|
114
|
|
|
|
|
|
|
gather sub { |
|
115
|
|
|
|
|
|
|
my ($build) = @_; |
|
116
|
|
|
|
|
|
|
my $prefix = $build->runtime_prop->{prefix}; |
|
117
|
|
|
|
|
|
|
$build->runtime_prop->{cflags} = "-I$prefix/include"; |
|
118
|
|
|
|
|
|
|
$build->runtime_prop->{cflags_static} = "-I$prefix/include -DKDL_STATIC_LIB=1"; |
|
119
|
|
|
|
|
|
|
$build->runtime_prop->{libs} = "-L$prefix/lib -lkdl"; |
|
120
|
|
|
|
|
|
|
$build->runtime_prop->{libs_static} = "-L$prefix/lib -lkdl"; |
|
121
|
|
|
|
|
|
|
}; |
|
122
|
|
|
|
|
|
|
}; |