As requested by pudge.
[p5sagit/p5-mst-13.2.git] / wince / comp.pl
CommitLineData
42165d27 1=comments
2
3helper script to make life for PerlCE easier.
4
5You need edit values for @defs array to reflect your changes and then do
6
7 perl comp.pl [any-additional-options]
8
9This will call
10 nmake -f Makefile.ce
11with most parameters overrided as you specified and additional options
12(such as build target) will also be prepended to command line to execute.
13
14There are also additional different modes for running this script:
15 perl comp.pl --run [any-command-line-arguments]
16and
17 perl comp.pl --do [any-command-line-arguments]
18and
19 perl comp.pl --copy-pm pc:[pc-location] ce:[ce-location]
20
21--run executes this build of perl on CE device with arguments provided
22--run=test will display a predefined messagebox that say everything is ok.
23
24--do Executes on local computer command that is presented by arguments
25 immediately following after --do
26 Most reason why you may want to execute script in this mode is that
27 arguments preprocessed to replace [p] occurences into current perl
28 location. Typically it is handy to run
29 perl comp.pl --do cecopy pc:..\lib\Exporter.pm ce:[p]\lib
30
31--copy copies file to CE device
32 here also [p] will be expanded to corrent PerlCE path, and additionally
33 when --copy=compact specified then, if filename looks like perl module,
34 then POD will be stripped away from that file
35 modules
36
37
38=cut
39
40use Cwd;
41use strict;
42
43# edit value of $inst_root variable to reflect your desired location of
44# built perl
45my $inst_root = "\\Storage Card\\perl-tests\\perl\@16225";
46my @defs = (
47 "\"PV=\"",
48 "\"INST_VER=\"",
49 "\"INSTALL_ROOT=$inst_root\"",
50 "\"WCEROOT=$ENV{SDKROOT}\"",
51 "NTPERL=$^X", #todo: check version: this must be (almost?) current version
52 "\"CEPATH=$ENV{WCEROOT}\"",
53 "CELIBDLLDIR=d:\\personal\\pocketPC\\celib-palm-3.0",
54 "CECONSOLEDIR=d:\\personal\\pocketPC\\w32console",
55 "YES=/y",
56 "CFG=RELEASE",
57 "MACHINE=wince-mips-pocket-wce300",
58 "PERLCEDIR=".cwd,
59 #NIY "\"CECOPY=\$(NTPERL) \$(PERLCEDIR)\\$0 --copy=compact\"",
60 "\"CECOPY=\$(NTPERL) \$(PERLCEDIR)\\$0 --copy\"",
61);
62
63my %opts = (
64 # %known_opts enumerates allowed opts as well as specifies default
65 # and initial values
66 my %known_opts = (
67 'do' => '',
68 'run' => '',
69 'copy' => '',
70 ),
71 #options itself
72 my %specified_opts = (
73 (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth
74 (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt --no-opt --noopt
75 ),
76);
77die "option '$_' is not recognized" for grep {!exists $known_opts{$_}} keys %specified_opts;
78@ARGV = grep {!/^--/} @ARGV;
79
80if ($opts{'do'}) {
81 s/\[p\]/$inst_root/g for @ARGV;
82 system(@ARGV);
83}
84elsif ($opts{'run'}) {
85 if ($opts{'run'} eq 'test') {
86 system("ceexec","$inst_root\\bin\\perl","-we","Win32::MessageBox(\$].qq(\n).join'','cc'..'dx')");
87 }
88 else {
89 system("ceexec","$inst_root\\bin\\perl", map {/^".*"$/s?$_:"\"$_\""} @ARGV);
90 }
91}
92elsif ($opts{'copy'}) {
93 if ($opts{'copy'} eq 'compact') {
94 die "todo";
95 }
96 s/\[p\]/$inst_root/g for @ARGV;
97 if ($ARGV[0]=~/^pc:/i) {system("cedel",$ARGV[1])}
98 system("cecopy",@ARGV);
99}
100else {
101 my $cmd = "nmake -f Makefile.ce @defs @ARGV";
102 print $cmd;
103 system($cmd);
104}
105
106
107=comments
108
109 Author Vadim Konovalov.
110
111=cut