line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::TinyCC; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
52052
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
86
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
140
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Follow Golden's Version Rule: http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/ |
7
|
|
|
|
|
|
|
our $VERSION = "0.06"; |
8
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
2703
|
use File::ShareDir; |
|
3
|
|
|
|
|
20747
|
|
|
3
|
|
|
|
|
175
|
|
11
|
3
|
|
|
3
|
|
25
|
use File::Spec; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
81
|
|
12
|
3
|
|
|
3
|
|
20846
|
use Env qw( @PATH ); |
|
3
|
|
|
|
|
7433
|
|
|
3
|
|
|
|
|
19
|
|
13
|
3
|
|
|
3
|
|
512
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
151
|
|
14
|
3
|
|
|
3
|
|
11
|
use Config; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1358
|
|
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
|
17
|
return $dist_dir if $^O =~ /MSWin/; |
42
|
4
|
|
|
|
|
104
|
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
|
13
|
return $dist_dir if $^O =~ /MSWin/; |
53
|
4
|
|
|
|
|
60
|
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
|
23
|
return File::Spec->catdir($dist_dir, 'libtcc') if $^O =~ /MSWin/; |
67
|
1
|
|
|
|
|
67
|
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__ |