diff options
author | Vadim Konovalov <vkonovalov@lucent.com> | 2006-05-02 19:30:59 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-05-02 15:37:35 +0000 |
commit | 284edc75255273afc54ce4bfa99576ccc7d34c45 (patch) | |
tree | edc0aadfa36f03156735130caac547d9426c7322 /win32/ce-helpers | |
parent | f4257e4d90c288c896435eca90d56255a0334871 (diff) | |
download | perl-284edc75255273afc54ce4bfa99576ccc7d34c45.tar.gz |
Move some scripts under win32/ce-helpers.
Subject: RE: Merge WinCE into Win32 directory and remove the the WinCE dir ectory
From: "Konovalov, Vadim Vladimirovich (Vadim)** CTR **" <vkonovalov@Lucent.com>
Message-ID: <E3FB32585BF1D411B9E900805FF51A0801BB3F03@ru0022exch001u.ru.lucent.com>
p4raw-id: //depot/perl@28062
Diffstat (limited to 'win32/ce-helpers')
-rw-r--r-- | win32/ce-helpers/cecopy-lib.pl | 208 | ||||
-rw-r--r-- | win32/ce-helpers/comp.pl | 84 | ||||
-rw-r--r-- | win32/ce-helpers/compile-all.bat | 62 | ||||
-rw-r--r-- | win32/ce-helpers/compile.bat | 42 | ||||
-rw-r--r-- | win32/ce-helpers/makedist.pl | 296 | ||||
-rw-r--r-- | win32/ce-helpers/registry.bat | 28 |
6 files changed, 720 insertions, 0 deletions
diff --git a/win32/ce-helpers/cecopy-lib.pl b/win32/ce-helpers/cecopy-lib.pl new file mode 100644 index 0000000000..f1cff4dbc9 --- /dev/null +++ b/win32/ce-helpers/cecopy-lib.pl @@ -0,0 +1,208 @@ +# just copy modules +# TODO: copy tests and try to run them... +# this file may be used as example on how to use comp.pl + +my @files; + +my %dirs; +sub mk { + my $r = shift; + return if exists $dirs{$r}; + if ($r=~/\//) { + $r=~/^(.*)\/[^\/]*?$/; + mk($1); + } + print STDERR "..\\miniperl.exe -MCross comp.pl --do cemkdir [p]\\lib\\$r\n"; + system("..\\miniperl.exe -I..\\lib -MCross comp.pl --do cemkdir [p]\\lib\\$r"); + $dirs{$r}++; +} +for (@files) { + if (/\//) { + /^(.*)\/[^\/]*?$/; + mk($1); + } + # currently no stripping POD + system("..\\miniperl.exe -I..\\lib -MCross comp.pl --copy pc:..\\lib\\$_ ce:[p]\\lib\\$_"); +} + +sub BEGIN { + @files = qw( + attributes.pm + AutoLoader.pm + AutoSplit.pm + autouse.pm + base.pm + Benchmark.pm + bigint.pm + bignum.pm + bigrat.pm + blib.pm + bytes.pm + Carp.pm + charnames.pm + Config.pm + constant.pm + Cwd.pm + DB.pm + diagnostics.pm + Digest.pm + DirHandle.pm + Dumpvalue.pm + DynaLoader.pm + English.pm + Env.pm + Exporter.pm + Fatal.pm + fields.pm + FileCache.pm + FileHandle.pm + filetest.pm + FindBin.pm + if.pm + integer.pm + less.pm + locale.pm + Memoize.pm + NEXT.pm + open.pm + overload.pm + PerlIO.pm + re.pm + SelectSaver.pm + SelfLoader.pm + Shell.pm + sigtrap.pm + sort.pm + strict.pm + subs.pm + Switch.pm + Symbol.pm + Test.pm + Thread.pm + UNIVERSAL.pm + utf8.pm + vars.pm + vmsish.pm + warnings.pm + XSLoader.pm + warnings/register.pm + Unicode/Collate.pm + Unicode/UCD.pm + Time/gmtime.pm + Time/Local.pm + Time/localtime.pm + Time/tm.pm + Tie/Array.pm + Tie/File.pm + Tie/Handle.pm + Tie/Hash.pm + Tie/Memoize.pm + Tie/RefHash.pm + Tie/Scalar.pm + Tie/SubstrHash.pm + Text/Abbrev.pm + Text/Balanced.pm + Text/ParseWords.pm + Text/Soundex.pm + Text/Tabs.pm + Text/Wrap.pm + Test/Builder.pm + Test/Harness.pm + Test/More.pm + Test/Simple.pm + Test/Harness/Assert.pm + Test/Harness/Iterator.pm + Test/Harness/Straps.pm + Term/ANSIColor.pm + Term/Cap.pm + Term/Complete.pm + Term/ReadLine.pm + Search/Dict.pm + Pod/Checker.pm + Pod/Find.pm + Pod/Functions.pm + Pod/Html.pm + Pod/InputObjects.pm + Pod/LaTeX.pm + Pod/Man.pm + Pod/ParseLink.pm + Pod/Parser.pm + Pod/ParseUtils.pm + Pod/Plainer.pm + Pod/Select.pm + Pod/Text.pm + Pod/Usage.pm + Pod/Text/Color.pm + Pod/Text/Overstrike.pm + Pod/Text/Termcap.pm + Math/BigFloat.pm + Math/BigInt.pm + Math/BigRat.pm + Math/Complex.pm + Math/Trig.pm + Math/BigInt/Calc.pm + Math/BigInt/Trace.pm + Math/BigFloat/Trace.pm + Locale/Constants.pm + Locale/Country.pm + Locale/Currency.pm + Locale/Language.pm + Locale/Maketext.pm + Locale/Script.pm + IPC/Open2.pm + IPC/Open3.pm + I18N/Collate.pm + I18N/LangTags.pm + I18N/LangTags/List.pm + Hash/Util.pm + Getopt/Long.pm + Getopt/Std.pm + Filter/Simple.pm + File/Basename.pm + File/CheckTree.pm + File/Compare.pm + File/Copy.pm + File/DosGlob.pm + File/Find.pm + File/Path.pm + File/Spec.pm + File/stat.pm + File/Temp.pm + File/Spec/Functions.pm + File/Spec/Mac.pm + File/Spec/Unix.pm + File/Spec/Win32.pm + ExtUtils/Command.pm + ExtUtils/Constant.pm + ExtUtils/Embed.pm + ExtUtils/Install.pm + ExtUtils/Installed.pm + ExtUtils/Liblist.pm + ExtUtils/MakeMaker.pm + ExtUtils/Manifest.pm + ExtUtils/Miniperl.pm + ExtUtils/Mkbootstrap.pm + ExtUtils/Mksymlists.pm + ExtUtils/MM.pm + ExtUtils/MM_Any.pm + ExtUtils/MM_DOS.pm + ExtUtils/MM_Unix.pm + ExtUtils/MM_UWIN.pm + ExtUtils/MM_Win32.pm + ExtUtils/MM_Win95.pm + ExtUtils/MY.pm + ExtUtils/Packlist.pm + ExtUtils/testlib.pm + ExtUtils/Liblist/Kid.pm + ExtUtils/Command/MM.pm + Exporter/Heavy.pm + Devel/SelfStubber.pm + Class/ISA.pm + Class/Struct.pm + Carp/Heavy.pm + Attribute/Handlers.pm + Attribute/Handlers/demo/Demo.pm + Attribute/Handlers/demo/Descriptions.pm + Attribute/Handlers/demo/MyClass.pm + ); +} diff --git a/win32/ce-helpers/comp.pl b/win32/ce-helpers/comp.pl new file mode 100644 index 0000000000..3fab27ccce --- /dev/null +++ b/win32/ce-helpers/comp.pl @@ -0,0 +1,84 @@ +=comments + +helper script to make life for PerlCE easier. + +There are different modes for running this script: + perl comp.pl --run [any-command-line-arguments] +and + perl comp.pl --do [any-command-line-arguments] +and + perl comp.pl --copy pc:[pc-location] ce:[ce-location] + +--run executes this build of perl on CE device with arguments provided +--run=test will display a predefined messagebox that say everything is ok. + +--do Executes on local computer command that is presented by arguments + immediately following after --do + Most reason why you may want to execute script in this mode is that + arguments preprocessed to replace [p] occurrences into current perl + location. Typically it is handy to run + perl comp.pl --do cecopy pc:..\lib\Exporter.pm ce:[p]\lib + +--copy copies file to CE device + here also [p] will be expanded to current PerlCE path, and additionally + when --copy=compact specified then, if filename looks like perl module, + then POD will be stripped away from that file + modules + + +=cut + +use strict; +use Cross; +use Config; + +# edit value of $inst_root variable to reflect your desired location of +# built perl +my $inst_root = $Config{prefix}; + +my %opts = ( + # %known_opts enumerates allowed opts as well as specifies default and initial values + my %known_opts = ( + 'do' => '', + 'run' => '', + 'copy' => '', + ), + #options itself + my %specified_opts = ( + (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth + (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt --no-opt --noopt + ), +); +die "option '$_' is not recognized" for grep {!exists $known_opts{$_}} keys %specified_opts; +@ARGV = grep {!/^--/} @ARGV; + +if ($opts{'do'}) { + s/\[p\]/$inst_root/g for @ARGV; + system(@ARGV); +} +elsif ($opts{'run'}) { + if ($opts{'run'} eq 'test') { + system("ceexec","$inst_root\\bin\\perl","-we","Win32::MessageBox(\$].qq(\n).join'','cc'..'dx')"); + } + else { + system("ceexec","$inst_root\\bin\\perl", map {/^".*"$/s?$_:"\"$_\""} @ARGV); + } +} +elsif ($opts{'copy'}) { + if ($opts{'copy'} eq 'compact') { + die "todo"; + } + s/\[p\]/$inst_root/g for @ARGV; + if ($ARGV[0]=~/^pc:/i) {system("cedel",$ARGV[1])} + system("cecopy",@ARGV); +} +else { + # todo +} + + +=comments + + Author Vadim Konovalov. + +=cut diff --git a/win32/ce-helpers/compile-all.bat b/win32/ce-helpers/compile-all.bat new file mode 100644 index 0000000000..c546bb201e --- /dev/null +++ b/win32/ce-helpers/compile-all.bat @@ -0,0 +1,62 @@ +@echo off +rem +rem Normally you do not need to run this file. +rem Instead you should edit and execute compile.bat . +rem +rem This file assumes that you have a set of appropriate +rem bat-files that prepare environment variables for build process +rem and execute commands passed as arguments +rem + +call wcearm-300 compile.bat "MACHINE=wince-arm-hpc-wce300" +call wcearm-300 compile.bat "MACHINE=wince-arm-hpc-wce300" zipdist +..\miniperl makedist.pl --clean-exts + +call wcearm-211 compile.bat "MACHINE=wince-arm-hpc-wce211" +call wcearm-211 compile.bat "MACHINE=wince-arm-hpc-wce211" zipdist +..\miniperl makedist.pl --clean-exts + +call wcesh3-211 compile.bat "MACHINE=wince-sh3-hpc-wce211" +call wcesh3-211 compile.bat "MACHINE=wince-sh3-hpc-wce211" zipdist +..\miniperl makedist.pl --clean-exts + +call wcemips-211 compile.bat "MACHINE=wince-mips-hpc-wce211" +call wcemips-211 compile.bat "MACHINE=wince-mips-hpc-wce211" zipdist +..\miniperl makedist.pl --clean-exts + +rem TODO call wcesh3-200 compile.bat "MACHINE=wince-sh3-hpc-wce200" +rem TODO call wcesh3-200 compile.bat "MACHINE=wince-sh3-hpc-wce200" zipdist +rem TODO ..\miniperl makedist.pl --clean-exts + +rem TODO call compile.bat "MACHINE=wince-mips-hpc-wce200" +rem TODO call compile.bat "MACHINE=wince-mips-hpc-wce200" zipdist +rem TODO ..\miniperl makedist.pl --clean-exts + +call WCEARM-p300 compile.bat "MACHINE=wince-arm-pocket-wce300" +call WCEARM-p300 compile.bat "MACHINE=wince-arm-pocket-wce300" zipdist +..\miniperl makedist.pl --clean-exts + +call WCEMIPS-300 compile.bat "MACHINE=wince-mips-pocket-wce300" +call WCEMIPS-300 compile.bat "MACHINE=wince-mips-pocket-wce300" zipdist +..\miniperl makedist.pl --clean-exts + +call WCESH3-300 compile.bat "MACHINE=wince-sh3-pocket-wce300" +call WCESH3-300 compile.bat "MACHINE=wince-sh3-pocket-wce300" zipdist +..\miniperl makedist.pl --clean-exts + +call WCEx86-300 compile.bat "MACHINE=wince-x86em-pocket-wce300" +call WCEx86-300 compile.bat "MACHINE=wince-x86em-pocket-wce300" zipdist +..\miniperl makedist.pl --clean-exts + +call WCEMIPS-palm211 compile.bat "MACHINE=wince-mips-palm-wce211" +call WCEMIPS-palm211 compile.bat "MACHINE=wince-mips-palm-wce211" zipdist +..\miniperl makedist.pl --clean-exts + +call WCESH3-palm211 compile.bat "MACHINE=wince-sh3-palm-wce211" +call WCESH3-palm211 compile.bat "MACHINE=wince-sh3-palm-wce211" zipdist +..\miniperl makedist.pl --clean-exts + +call WCEx86-palm211 compile.bat "MACHINE=wince-x86em-palm-wce211" +call WCEx86-palm211 compile.bat "MACHINE=wince-x86em-palm-wce211" zipdist +..\miniperl makedist.pl --clean-exts + diff --git a/win32/ce-helpers/compile.bat b/win32/ce-helpers/compile.bat new file mode 100644 index 0000000000..79ed2fb80c --- /dev/null +++ b/win32/ce-helpers/compile.bat @@ -0,0 +1,42 @@ +@echo off +rem +rem edit ARG-xxx variable to reflect your system and run +rem compile.bat [target] [additional parameters for nmake] +rem + +set ARG-1=PV= +set ARG-2=INST_VER= +set ARG-3=INSTALL_ROOT=\Storage Card\perl58m +set ARG-4=WCEROOT=%SDKROOT% +set ARG-5=CEPATH=%WCEROOT% +set ARG-6=CELIBDLLDIR=d:\personal\pocketPC\celib-palm-3.0 +set ARG-7=CECONSOLEDIR=d:\personal\pocketPC\w32console + +rem Only for WIN2000 +set ARG-8=YES=/y + +set ARG-9=CFG=RELEASE + +rem +rem uncomment one of following lines that matches your configuration + +rem set ARG-10=MACHINE=wince-mips-pocket-wce300 +rem set ARG-10=MACHINE=wince-arm-hpc-wce300 +rem set ARG-10=MACHINE=wince-arm-hpc-wce211 +rem set ARG-10=MACHINE=wince-sh3-hpc-wce211 +rem set ARG-10=MACHINE=wince-mips-hpc-wce211 +rem set ARG-10=MACHINE=wince-sh3-hpc-wce200 +rem set ARG-10=MACHINE=wince-mips-hpc-wce200 +rem set ARG-10=MACHINE=wince-arm-pocket-wce300 +rem set ARG-10=MACHINE=wince-mips-pocket-wce300 +rem set ARG-10=MACHINE=wince-sh3-pocket-wce300 +rem set ARG-10=MACHINE=wince-x86em-pocket-wce300 +rem set ARG-10=MACHINE=wince-mips-palm-wce211 +rem set ARG-10=MACHINE=wince-sh3-palm-wce211 +rem set ARG-10=MACHINE=wince-x86em-palm-wce211 + +set ARG-11=PERLCEDIR=$(MAKEDIR) +set ARG-12=MSVCDIR=D:\MSVStudio\VC98 +set ARG-13=CECOPY=$(HPERL) -I$(PERLCEDIR)\lib $(PERLCEDIR)\comp.pl --copy + +nmake -f Makefile.ce "%ARG-1%" "%ARG-2%" "%ARG-3%" "%ARG-4%" "%ARG-5%" "%ARG-6%" "%ARG-7%" "%ARG-8%" "%ARG-9%" "%ARG-10%" "%ARG-11%" "%ARG-12%" "%ARG-13%" %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/win32/ce-helpers/makedist.pl b/win32/ce-helpers/makedist.pl new file mode 100644 index 0000000000..1332d23475 --- /dev/null +++ b/win32/ce-helpers/makedist.pl @@ -0,0 +1,296 @@ +use strict; +use Cwd; +use File::Path; +use File::Find; + +my %opts = ( + #defaults + 'verbose' => 1, # verbose level, in range from 0 to 2 + 'distdir' => 'distdir', + 'unicode' => 1, # include unicode by default + 'minimal' => 0, # minimal possible distribution. + # actually this is just perl.exe and perlXX.dll + # but can be extended by additional exts + # ... (as soon as this will be implemented :) + 'cross-name' => 'wince', + 'strip-pod' => 0, # strip POD from perl modules + 'adaptation' => 1, # do some adaptation, such as stripping such + # occurences as "if ($^O eq 'VMS'){...}" for Dynaloader.pm + 'zip' => 0, # perform zip + 'clean-exts' => 0, + #options itself + (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth + (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt --no-opt --noopt + ); + +# TODO +# -- error checking. When something goes wrong, just exit with rc!=0 +# -- may be '--zip' option should be made differently? + +my $cwd = cwd; + +if ($opts{'clean-exts'}) { + # unfortunately, unlike perl58.dll and like, extensions for different + # platforms are built in same directory, therefore we must be able to clean + # them often + unlink '../config.sh'; # delete cache config file, which remembers our previous config + chdir '../ext'; + find({no_chdir=>1,wanted => sub{ + unlink if /((?:\.obj|\/makefile|\/errno\.pm))$/i; + } + },'.'); + exit; +} + +# zip +if ($opts{'zip'}) { + if ($opts{'verbose'} >=1) { + print STDERR "zipping...\n"; + } + chdir $opts{'distdir'}; + unlink <*.zip>; + `zip -R perl-$opts{'cross-name'} *`; + exit; +} + +my (%libexclusions, %extexclusions); +my @lfiles; +sub copy($$); + +# lib +chdir '../lib'; +find({no_chdir=>1,wanted=>sub{push @lfiles, $_ if /\.p[lm]$/}},'.'); +chdir $cwd; +# exclusions +@lfiles = grep {!exists $libexclusions{$_}} @lfiles; +#inclusions +#... +#copy them +if ($opts{'verbose'} >=1) { + print STDERR "Copying perl lib files...\n"; +} +for (@lfiles) { + /^(.*)\/[^\/]+$/; + mkpath "$opts{distdir}/lib/$1"; + copy "../lib/$_", "$opts{distdir}/lib/$_"; +} + +#ext +my @efiles; +chdir '../ext'; +find({no_chdir=>1,wanted=>sub{push @efiles, $_ if /\.pm$/}},'.'); +chdir $cwd; +# exclusions +#... +#inclusions +#... +#copy them +#{s[/(\w+)/\1\.pm][/$1.pm]} @efiles; +if ($opts{'verbose'} >=1) { + print STDERR "Copying perl core extensions...\n"; +} +for (@efiles) { + if (m#^.*?/lib/(.*)$#) { + copy "../ext/$_", "$opts{distdir}/lib/$1"; + } + else { + /^(.*)\/([^\/]+)\/([^\/]+)$/; + copy "../ext/$_", "$opts{distdir}/lib/$1/$3"; + } +} +my ($dynaloader_pm); +if ($opts{adaptation}) { + # let's copy our Dynaloader.pm (make this optional?) + open my $fhdyna, ">$opts{distdir}/lib/Dynaloader.pm"; + print $fhdyna $dynaloader_pm; + close $fhdyna; +} + +# Config.pm, perl binaries +if ($opts{'verbose'} >=1) { + print STDERR "Copying Config.pm, perl.dll and perl.exe...\n"; +} +copy "../xlib/$opts{'cross-name'}/Config.pm", "$opts{distdir}/lib/Config.pm"; +copy "$opts{'cross-name'}/perl.exe", "$opts{distdir}/bin/perl.exe"; +copy "$opts{'cross-name'}/perl.dll", "$opts{distdir}/bin/perl.dll"; +# how do we know exact name of perl.dll? + +# auto +my %aexcl = (socket=>'Socket_1'); +# Socket.dll and may be some other conflict with same file in \windows dir +# on WinCE, %aexcl needed to replace it with a different name that however +# will be found by Dynaloader +my @afiles; +chdir "../xlib/$opts{'cross-name'}/auto"; +find({no_chdir=>1,wanted=>sub{push @afiles, $_ if /\.(dll|bs)$/}},'.'); +chdir $cwd; +if ($opts{'verbose'} >=1) { + print STDERR "Copying binaries for perl core extensions...\n"; +} +for (@afiles) { + if (/^(.*)\/(\w+)\.dll$/i && exists $aexcl{lc($2)}) { + copy "../xlib/$opts{'cross-name'}/auto/$_", "$opts{distdir}/lib/auto/$1/$aexcl{lc($2)}.dll"; + } + else { + copy "../xlib/$opts{'cross-name'}/auto/$_", "$opts{distdir}/lib/auto/$_"; + } +} + +sub copy($$) { + my ($fnfrom, $fnto) = @_; + open my $fh, "<$fnfrom" or die "can not open $fnfrom: $!"; + binmode $fh; + local $/; + my $ffrom = <$fh>; + if ($opts{'strip-pod'}) { + # actually following regexp is suspicious to not work everywhere. + # but we've checked on our set of modules, and it's fit for our purposes + $ffrom =~ s/^=\w+.*?^=cut(?:\n|\Z)//msg; + unless ($ffrom=~/\bAutoLoader\b/) { + # this logic actually strip less than could be stripped, but we're + # not risky. Just strip only of no mention of AutoLoader + $ffrom =~ s/^__END__.*\Z//msg; + } + } + mkpath $1 if $fnto=~/^(.*)\/([^\/]+)$/; + open my $fhout, ">$fnto"; + binmode $fhout; + print $fhout $ffrom; + if ($opts{'verbose'} >=2) { + print STDERR "copying $fnfrom=>$fnto\n"; + } +} + +BEGIN { +%libexclusions = map {$_=>1} split/\s/, <<"EOS"; +abbrev.pl bigfloat.pl bigint.pl bigrat.pl cacheout.pl complete.pl ctime.pl +dotsh.pl exceptions.pl fastcwd.pl flush.pl ftp.pl getcwd.pl getopt.pl +getopts.pl hostname.pl look.pl newgetopt.pl pwd.pl termcap.pl +EOS +%extexclusions = map {$_=>1} split/\s/, <<"EOS"; +EOS +$dynaloader_pm=<<'EOS'; +# This module designed *only* for WinCE +# if you encounter a problem with this file, try using original Dynaloader.pm +# from perl distribution, it's larger but essentially the same. +package DynaLoader; +our $VERSION = 1.04; + +$dl_debug ||= 0; + +@dl_require_symbols = (); # names of symbols we need + +#@dl_librefs = (); # things we have loaded +#@dl_modules = (); # Modules we have loaded + +boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && !defined(&dl_error); + +print STDERR "DynaLoader not linked into this perl\n" + unless defined(&boot_DynaLoader); + +1; # End of main code + +sub croak{require Carp;Carp::croak(@_)} +sub bootstrap_inherit { + my $module = $_[0]; + local *isa = *{"$module\::ISA"}; + local @isa = (@isa, 'DynaLoader'); + bootstrap(@_); +} +sub bootstrap { + # use local vars to enable $module.bs script to edit values + local(@args) = @_; + local($module) = $args[0]; + local(@dirs, $file); + + unless ($module) { + require Carp; + Carp::confess("Usage: DynaLoader::bootstrap(module)"); + } + + croak("Can't load module $module, dynamic loading not available in this perl.\n") + unless defined(&dl_load_file); + + my @modparts = split(/::/,$module); + my $modfname = $modparts[-1]; + my $modpname = join('/',@modparts); + + for (@INC) { + my $dir = "$_/auto/$modpname"; + next unless -d $dir; + my $try = "$dir/$modfname.dll"; + last if $file = ( (-f $try) && $try); + + $try = "$dir/${modfname}_1.dll"; + last if $file = ( (-f $try) && $try); + push @dirs, $dir; + } + $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file; + + croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)") + unless $file; + + (my $bootname = "boot_$module") =~ s/\W/_/g; + @dl_require_symbols = ($bootname); + + # optional '.bootstrap' perl script + my $bs = $file; + $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; + if (-s $bs) { # only read file if it's not empty + eval { do $bs; }; + warn "$bs: $@\n" if $@; + } + + my $libref = dl_load_file($file, 0) or + croak("Can't load '$file' for module $module: ".dl_error()); + + push(@dl_librefs,$libref); # record loaded object + + my @unresolved = dl_undef_symbols(); + if (@unresolved) { + require Carp; + Carp::carp("Undefined symbols present after loading $file: @unresolved\n"); + } + + my $boot_symbol_ref = dl_find_symbol($libref, $bootname) or + croak("Can't find '$bootname' symbol in $file\n"); + + push(@dl_modules, $module); + + boot: + my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file); + &$xs(@args); +} + +sub dl_findfile { + my (@args) = @_; + my (@dirs, $dir); + my (@found); + + arg: foreach(@args) { + if (m:/: && -f $_) { + push(@found,$_); + last arg unless wantarray; + next; + } + + if (s:^-L::) {push(@dirs, $_); next;} + if (m:/: && -d $_) {push(@dirs, $_); next;} + + for $dir (@dirs) { + next unless -d $dir; + for my $name (/\.dll$/i?($_):("$_.dll",$_)) { + print STDERR " checking in $dir for $name\n" if $dl_debug; + if (-f "$dir/$name") { + push(@found, "$dir/$name"); + next arg; + } + } + } + } + return $found[0] unless wantarray; + @found; +} +EOS +} + diff --git a/win32/ce-helpers/registry.bat b/win32/ce-helpers/registry.bat new file mode 100644 index 0000000000..0fd58c3d3c --- /dev/null +++ b/win32/ce-helpers/registry.bat @@ -0,0 +1,28 @@ +@echo off + +::- This script must be executed on the PC with an ActiveSync +::- connection. If it does not work, create the entries with +::- a remote registry editor or get a registry editor for your +::- devices. +::- +::- You need my cereg.exe program. + +::- My paths... +set perlexe=\speicherkarte2\bin\perl.exe +set perllib=\speicherkarte2\usr\lib\perl5 + +::- PERL5LIB +cereg -k "HKLM\Environment" -n "PERL5LIB" -v "%perllib%" + +::- For ShellExecute +cereg -k "HKCR\.pl" -n "" -v "perlfile" +cereg -k "HKCR\perlfile" -n "" -v "Perl Script" +cereg -k "HKCR\perlfile\DefaultIcon" -n "" -v "%perlexe%,-1" + +::- You might need to fix the quotes if your paths contain spaces! +cereg -k "HKCR\perlfile\Shell\open\command" -n "" -v "%perlexe% %%1" + +cereg -k "HKLM\Environment" -n "ROWS" -v "10" +cereg -k "HKLM\Environment" -n "COLS" -v "75" +cereg -k "HKLM\Environment" -n "PATH" -v "/Speicherkarte2/bin" +cereg -k "HKLM\Environment" -n "UNIXROOTDIR" -v "/Speicherkarte2" |