-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.PL
79 lines (73 loc) · 2.41 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
require 5.008003;
use strict;
use ExtUtils::MakeMaker;
my $jsx = '';
if ( defined $ENV{ PERL_INLINE_JSX_JSX_PATH } ) {
if ( -e $ENV{ PERL_INLINE_JSX_JSX_PATH } ) {
$jsx = $ENV{ PERL_INLINE_JSX_JSX_PATH };
}
else {
print STDERR "$ENV{ PERL_INLINE_JSX_JSX_PATH } is not executable. so checking system...\n";
}
}
unless ( $jsx ) {
for ( split( /:/, $ENV{ PATH } ) ) {
my $path = $_ . '/jsx';
if ( -e $path ) {
$jsx = $path;
next;
}
}
}
if ( !$ENV{SKIP_JSX_CHECK} and $jsx ) {
print STDERR "jsx is found. - $jsx\n";
eval {
require IPC::Run;
my @cmd = ( $jsx, '--', '-' );
my ( $in, $out, $err );
$in = 'class Test { static function foo () : void {} }';
IPC::Run::run( \@cmd, \$in, \$out, \$err );
if ( $err ) {
print STDERR "Error: your jsx has some problem. ($err)\n";
exit;
}
elsif ( $out !~ /var Test\$foo\$/ ) { # var declared? - git commit 293db53787
print STDERR "Error: your jsx is older. Please install newer.\n";
exit;
}
};
if ( $@ ) {
print STDERR $@;
exit;
}
open(my $fh, '>', './t/jsx_path.pl') or die $!;
print $fh "q{$jsx};";
}
elsif ( !$ENV{SKIP_JSX_CHECK} ) {
print STDERR "Error: Can't find jsx for tests. Please check your library path to jsx.";
print STDERR " You can also set the environment variable PERL_INLINE_JSX_JSX_PATH directly.";
print STDERR " And you can set SKIP_JSX_CHECK=1 for no checking jsx.\n";
exit;
}
WriteMakefile(
'NAME' => 'Inline::JSX',
'VERSION_FROM' => 'lib/Inline/JSX.pm', # finds $VERSION
'PREREQ_PM' => {
'Test::More' => 0,
'Inline' => '0.50',
'JE' => '0.059',
'Time::Piece' => 0,
'IPC::Run' => 0,
},
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Inline/JSX.pm', # retrieve abstract from module
AUTHOR => 'Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>') : ()),
( $ExtUtils::MakeMaker::VERSION >= 6.3002 ? ('LICENSE' => 'perl', ) : () ),
( $ExtUtils::MakeMaker::VERSION >= 6.46 ? (
'META_MERGE' => {
resources => {
repository => 'http://github.com/makamaka/Inline-JSX',
},
} ) : ()
),
);