This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert change #22520 (optimise away my $foo = undef and similar
[perl5.git] / wince / comp.pl
CommitLineData
42165d27
VK
1=comments
2
3helper script to make life for PerlCE easier.
4
18f68570 5There are different modes for running this script:
42165d27
VK
6 perl comp.pl --run [any-command-line-arguments]
7and
8 perl comp.pl --do [any-command-line-arguments]
9and
18f68570 10 perl comp.pl --copy pc:[pc-location] ce:[ce-location]
42165d27
VK
11
12--run executes this build of perl on CE device with arguments provided
13--run=test will display a predefined messagebox that say everything is ok.
14
15--do Executes on local computer command that is presented by arguments
16 immediately following after --do
17 Most reason why you may want to execute script in this mode is that
fb8eeed8 18 arguments preprocessed to replace [p] occurrences into current perl
42165d27
VK
19 location. Typically it is handy to run
20 perl comp.pl --do cecopy pc:..\lib\Exporter.pm ce:[p]\lib
21
22--copy copies file to CE device
3c4b39be 23 here also [p] will be expanded to current PerlCE path, and additionally
42165d27
VK
24 when --copy=compact specified then, if filename looks like perl module,
25 then POD will be stripped away from that file
26 modules
27
28
29=cut
30
42165d27 31use strict;
18f68570
VK
32use Cross;
33use Config;
42165d27
VK
34
35# edit value of $inst_root variable to reflect your desired location of
36# built perl
18f68570 37my $inst_root = $Config{prefix};
42165d27
VK
38
39my %opts = (
18f68570 40 # %known_opts enumerates allowed opts as well as specifies default and initial values
42165d27
VK
41 my %known_opts = (
42 'do' => '',
43 'run' => '',
44 'copy' => '',
45 ),
46 #options itself
47 my %specified_opts = (
48 (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth
49 (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt --no-opt --noopt
50 ),
51);
52die "option '$_' is not recognized" for grep {!exists $known_opts{$_}} keys %specified_opts;
53@ARGV = grep {!/^--/} @ARGV;
54
55if ($opts{'do'}) {
56 s/\[p\]/$inst_root/g for @ARGV;
57 system(@ARGV);
58}
59elsif ($opts{'run'}) {
60 if ($opts{'run'} eq 'test') {
61 system("ceexec","$inst_root\\bin\\perl","-we","Win32::MessageBox(\$].qq(\n).join'','cc'..'dx')");
62 }
63 else {
64 system("ceexec","$inst_root\\bin\\perl", map {/^".*"$/s?$_:"\"$_\""} @ARGV);
65 }
66}
67elsif ($opts{'copy'}) {
68 if ($opts{'copy'} eq 'compact') {
69 die "todo";
70 }
71 s/\[p\]/$inst_root/g for @ARGV;
72 if ($ARGV[0]=~/^pc:/i) {system("cedel",$ARGV[1])}
73 system("cecopy",@ARGV);
74}
75else {
18f68570 76 # todo
42165d27
VK
77}
78
79
80=comments
81
82 Author Vadim Konovalov.
83
84=cut