| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alien::TinyCC; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
50606
|
use strict; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
104
|
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
185
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Follow Golden's Version Rule: http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/ |
|
7
|
|
|
|
|
|
|
our $VERSION = "0.06_01"; |
|
8
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
|
9
|
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
1896
|
use File::ShareDir; |
|
|
3
|
|
|
|
|
20876
|
|
|
|
3
|
|
|
|
|
234
|
|
|
11
|
3
|
|
|
3
|
|
27
|
use File::Spec; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
83
|
|
|
12
|
3
|
|
|
3
|
|
3225
|
use Env qw( @PATH ); |
|
|
3
|
|
|
|
|
9138
|
|
|
|
3
|
|
|
|
|
22
|
|
|
13
|
3
|
|
|
3
|
|
560
|
use Carp; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
202
|
|
|
14
|
3
|
|
|
3
|
|
17
|
use Config; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
2129
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
################################### |
|
17
|
|
|
|
|
|
|
# Find the Distribution Directory # |
|
18
|
|
|
|
|
|
|
################################### |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# The prefix will depend on whether or not the thing was finally installed. |
|
21
|
|
|
|
|
|
|
# The easiest way to know that is if *this* *module* *file* is in a blib |
|
22
|
|
|
|
|
|
|
# directory or not: |
|
23
|
|
|
|
|
|
|
my $dist_dir; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $mod_path = $INC{'Alien/TinyCC.pm'}; |
|
26
|
|
|
|
|
|
|
if ($mod_path =~ s/(.*)blib.*/$1share/) { |
|
27
|
|
|
|
|
|
|
$dist_dir = $mod_path; |
|
28
|
|
|
|
|
|
|
croak('Looks like Alien::TinyCC is being invoked from blib, but I cannot find build-time sharedir!') |
|
29
|
|
|
|
|
|
|
unless -d $dist_dir; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
else { |
|
32
|
|
|
|
|
|
|
$dist_dir = File::ShareDir::dist_dir('Alien-TinyCC'); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
############################ |
|
36
|
|
|
|
|
|
|
# Path retrieval functions # |
|
37
|
|
|
|
|
|
|
############################ |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Find the path to the tcc executable |
|
40
|
|
|
|
|
|
|
sub path_to_tcc { |
|
41
|
4
|
50
|
|
4
|
1
|
21
|
return $dist_dir if $^O =~ /MSWin/; |
|
42
|
4
|
|
|
|
|
83
|
return File::Spec->catdir($dist_dir, 'bin'); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Modify the PATH environment variable to include tcc's directory |
|
46
|
|
|
|
|
|
|
unshift @PATH, path_to_tcc(); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Find the path to the compiled libraries. Note that this is only applicable |
|
49
|
|
|
|
|
|
|
# on Unixish systems; Windows simply uses the %PATH%, which was already |
|
50
|
|
|
|
|
|
|
# appropriately set. |
|
51
|
|
|
|
|
|
|
sub libtcc_library_path { |
|
52
|
4
|
50
|
|
4
|
1
|
17
|
return $dist_dir if $^O =~ /MSWin/; |
|
53
|
4
|
|
|
|
|
62
|
return File::Spec->catdir($dist_dir, 'lib'); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Add library path on Unixish: |
|
57
|
|
|
|
|
|
|
if ($ENV{LD_LIBRARY_PATH}) { |
|
58
|
|
|
|
|
|
|
$ENV{LD_LIBRARY_PATH} = libtcc_library_path() . ':' . $ENV{LD_LIBRARY_PATH}; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
elsif ($^O !~ /MSWin/) { |
|
61
|
|
|
|
|
|
|
$ENV{LD_LIBRARY_PATH} = libtcc_library_path(); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Determine path for libtcc.h |
|
65
|
|
|
|
|
|
|
sub libtcc_include_path { |
|
66
|
1
|
50
|
|
1
|
1
|
15
|
return File::Spec->catdir($dist_dir, 'libtcc') if $^O =~ /MSWin/; |
|
67
|
1
|
|
|
|
|
53
|
return File::Spec->catdir($dist_dir, 'include'); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
########################### |
|
71
|
|
|
|
|
|
|
# Module::Build Functions # |
|
72
|
|
|
|
|
|
|
########################### |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub MB_linker_flags { |
|
75
|
0
|
|
|
0
|
1
|
|
return ('-L' . libtcc_library_path, '-ltcc'); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
################################# |
|
79
|
|
|
|
|
|
|
# ExtUtils::MakeMaker Functions # |
|
80
|
|
|
|
|
|
|
################################# |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub EUMM_LIBS { |
|
83
|
0
|
0
|
|
0
|
0
|
|
return (LIBS => ['-L' . libtcc_library_path . '\libtcc -ltcc']) if $^O =~ /MSWin/; |
|
84
|
0
|
|
|
|
|
|
return; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub EUMM_OBJECT { |
|
88
|
0
|
0
|
|
0
|
0
|
|
return OBJECT => '$(O_FILES)' if $^O =~ /MSWin/; |
|
89
|
0
|
|
|
|
|
|
return OBJECT => '$(O_FILES) ' . File::Spec->catdir(libtcc_library_path, 'libtcc'.$Config{lib_ext}), |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# version |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |