source: trunk/third/perl/wince/comp.pl @ 18450

Revision 18450, 2.3 KB checked in by zacheiss, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18449, which included commits to RCS files with non-trunk default branches.
Line 
1=comments
2
3helper script to make life for PerlCE easier.
4
5There are different modes for running this script:
6  perl comp.pl --run [any-command-line-arguments]
7and
8  perl comp.pl --do [any-command-line-arguments]
9and
10  perl comp.pl --copy pc:[pc-location] ce:[ce-location]
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
18      arguments preprocessed to replace [p] occurrences into current perl
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
23  here also [p] will be expanded to corrent PerlCE path, and additionally
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
31use strict;
32use Cross;
33use Config;
34
35# edit value of $inst_root variable to reflect your desired location of
36# built perl
37my $inst_root = $Config{prefix};
38
39my %opts = (
40  # %known_opts enumerates allowed opts as well as specifies default and initial values
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 {
76  # todo
77}
78
79
80=comments
81
82  Author Vadim Konovalov.
83
84=cut
Note: See TracBrowser for help on using the repository browser.