This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #123763] Clear target on my $_; split
[perl5.git] / README.ce
index ecb574d..3559f1f 100644 (file)
--- a/README.ce
+++ b/README.ce
@@ -8,6 +8,16 @@ perlce - Perl for WinCE
 
 =head1 Building Perl for WinCE
 
 
 =head1 Building Perl for WinCE
 
+=head2 WARNING
+
+B<< Much of this document has become very out of date and needs updating,
+rewriting or deleting. The build process was overhauled during the 5.19
+development track and the current instructions as of that time are given
+in L</CURRENT BUILD INSTRUCTIONS>; the previous build instructions, which
+are largely superseded but may still contain some useful information, are
+left in L</OLD BUILD INSTRUCTIONS> but really need removing after anything
+of use has been extracted from them. >>
+
 =head2 DESCRIPTION
 
 This file gives the instructions for building Perl5.8 and above for
 =head2 DESCRIPTION
 
 This file gives the instructions for building Perl5.8 and above for
@@ -20,45 +30,174 @@ software is distributed.
 
 =item *
 
 
 =item *
 
-C<miniperl> is built. This is a single executable (without DLL), intended
+F<miniperl> is built. This is a single executable (without DLL), intended
 to run on Win32, and it will facilitate remaining build process; all binaries
 built after it are foreign and should not run locally.
 
 to run on Win32, and it will facilitate remaining build process; all binaries
 built after it are foreign and should not run locally.
 
-C<miniperl> is built using ../win32/Makefile; this is part of normal
+F<miniperl> is built using F<./win32/Makefile>; this is part of normal
 build process invoked as dependency from wince/Makefile.ce
 
 =item *
 
 build process invoked as dependency from wince/Makefile.ce
 
 =item *
 
-After C<miniperl> is built, 'configpm' is invoked to create right Config.pm
+After F<miniperl> is built, F<configpm> is invoked to create right F<Config.pm>
 in right place and its corresponding Cross.pm.
 
 in right place and its corresponding Cross.pm.
 
-Unlike Win32 build, miniperl will not have Config.pm of host within reach;
-it rather will use Config.pm from within cross-compilation directories.
+Unlike Win32 build, miniperl will not have F<Config.pm> of host within reach;
+it rather will use F<Config.pm> from within cross-compilation directories.
 
 
-File Cross.pm is dead simple: for given cross-architecture places in @INC
-a path where perl modules are, and right Config.pm in that place.
+File F<Cross.pm> is dead simple: for given cross-architecture places in @INC
+a path where perl modules are, and right F<Config.pm> in that place.
 
 That said, C<miniperl -Ilib -MConfig -we 1> should report an error, because
 
 That said, C<miniperl -Ilib -MConfig -we 1> should report an error, because
-it can not find Config.pm. If it does not gives an error -- wrong Config.pm
+it can not find F<Config.pm>. If it does not give an error -- wrong F<Config.pm>
 is substituted, and resulting binaries will be a mess.
 
 C<miniperl -MCross -MConfig -we 1> should run okay, and it will provide right
 is substituted, and resulting binaries will be a mess.
 
 C<miniperl -MCross -MConfig -we 1> should run okay, and it will provide right
-Config.pm for further compilations.
+F<Config.pm> for further compilations.
 
 =item *
 
 
 =item *
 
-During extensions build phase, a script C<./win32/buldext.pl> is invoked,
-which in turn steps in ./ext subdirectories and performs a build of
+During extensions build phase, a script F<./win32/buldext.pl> is invoked,
+which in turn steps in F<./ext> subdirectories and performs a build of
 each extension in turn.
 
 each extension in turn.
 
-All invokes of Makefile.PL are provided with C<-MCross> so to enable cross-
+All invokes of F<Makefile.PL> are provided with C<-MCross> so to enable cross-
 compile.
 
 compile.
 
-=item *
-
 =back
 
 =back
 
-=head2 BUILD
+=head2 CURRENT BUILD INSTRUCTIONS
+
+(These instructions assume the host is 32-bit Windows. If you're on 64-bit
+Windows then change "C:\Program Files" to "C:\Program Files (x86)" throughout.)
+
+1. Install EVC4 from
+
+    http://download.microsoft.com/download/c/3/f/c3f8b58b-9753-4c2e-8b96-2dfe3476a2f7/eVC4.exe 
+
+Use the key mentioned at 
+
+    http://download.cnet.com/Microsoft-eMbedded-Visual-C/3000-2212_4-10108490.html?tag=bc 
+
+The installer is ancient and has a few bugs on the paths it uses. You 
+will have to fix them later. Basically, some things go into "C:/Program 
+Files/Windows CE Tools", others go into "C:/Windows CE Tools" regardless 
+of the path you gave to the installer (the default will be "C:/Windows 
+CE Tools"). Reboots will be required for the installer to proceed. Also 
+.c and .h associations with Visual Studio might get overridden when 
+installing EVC4. You have been warned.
+
+2. Download celib from GitHub (using "Download ZIP") at
+
+    https://github.com/bulk88/celib 
+
+Extract it to a spaceless path but not into the perl build source.
+I call this directory "celib-palm-3.0" but in the GitHub 
+snapshot it will be called "celib-master". Make a copy of the 
+"wince-arm-pocket-wce300-release" folder and rename the copy to 
+"wince-arm-pocket-wce400". This is a hack so we can build a CE 4.0 
+binary by linking in CE 3.0 ARM asm; the linker doesn't care. Windows 
+Mobile/WinCE are backwards compatible with machine code like Desktop Windows.
+
+3. Download console-1.3-src.tar.gz from 
+
+    http://sourceforge.net/projects/perlce/files/PerlCE%20support%20files/console/ 
+
+Extract it to a spaceless path but not into the perl build source. 
+Don't extract it into the same directory as celib. Make a copy of the 
+"wince-arm-pocket-wce300" folder and rename the copy to 
+"wince-arm-pocket-wce400". This is a hack so we can build a CE 4.0 
+binary by linking in CE 3.0 ARM asm; the linker doesn't care. Windows 
+Mobile/WinCE are backwards compatible with machine code like Desktop Windows.
+
+4. Open a command prompt, run your regular batch file to set the environment
+for desktop Visual C building, goto the perl source directory, cd into win32/,
+fill out Makefile, and do a "nmake all" to build a Desktop Perl.
+
+5. Open win32/Makefile.ce in a text editor and do something similar to the 
+following patch.
+
+    -CELIBDLLDIR  = h:\src\wince\celib-palm-3.0
+    -CECONSOLEDIR = h:\src\wince\w32console
+    +CELIBDLLDIR  = C:\sources\celib-palm-3.0
+    +CECONSOLEDIR = C:\sources\w32console
+
+Also change
+
+    !if "$(MACHINE)" == ""
+    MACHINE=wince-arm-hpc-wce300
+    #MACHINE=wince-arm-hpc-wce211
+    #MACHINE=wince-sh3-hpc-wce211
+    #MACHINE=wince-mips-hpc-wce211
+    #MACHINE=wince-sh3-hpc-wce200
+    #MACHINE=wince-mips-hpc-wce200
+    #MACHINE=wince-arm-pocket-wce300
+    #MACHINE=wince-mips-pocket-wce300
+    #MACHINE=wince-sh3-pocket-wce300
+    #MACHINE=wince-x86em-pocket-wce300
+    #MACHINE=wince-mips-palm-wce211
+    #MACHINE=wince-sh3-palm-wce211
+    #MACHINE=wince-x86em-palm-wce211
+    #MACHINE=wince-x86-hpc-wce300
+    #MACHINE=wince-arm-pocket-wce400
+    !endif
+
+to
+
+    !if "$(MACHINE)" == ""
+    #MACHINE=wince-arm-hpc-wce300
+    #MACHINE=wince-arm-hpc-wce211
+    #MACHINE=wince-sh3-hpc-wce211
+    #MACHINE=wince-mips-hpc-wce211
+    #MACHINE=wince-sh3-hpc-wce200
+    #MACHINE=wince-mips-hpc-wce200
+    #MACHINE=wince-arm-pocket-wce300
+    #MACHINE=wince-mips-pocket-wce300
+    #MACHINE=wince-sh3-pocket-wce300
+    #MACHINE=wince-x86em-pocket-wce300
+    #MACHINE=wince-mips-palm-wce211
+    #MACHINE=wince-sh3-palm-wce211
+    #MACHINE=wince-x86em-palm-wce211
+    #MACHINE=wince-x86-hpc-wce300
+    MACHINE=wince-arm-pocket-wce400
+    !endif
+
+so wince-arm-pocket-wce400 is the MACHINE type.
+
+6. Use a text editor to open "C:\Program Files\Microsoft eMbedded C++ 
+4.0\EVC\WCE400\BIN\WCEARMV4.BAT". Look for
+
+    if "%SDKROOT%"=="" set SDKROOT=...
+
+On a new install it is "C:\Windows CE Tools". Goto 
+"C:\Windows CE Tools" in a file manager and see if "C:\Windows CE 
+Tools\wce400\STANDARDSDK\Include\Armv4" exists on your disk. If not
+the SDKROOT need to be changed to "C:\Program Files\Windows CE Tools".
+
+Goto celib-palm-3.0\inc\cewin32.h, search for
+
+    typedef struct _ABC {
+
+and uncomment the struct.
+
+7. Open another command prompt, ensure PLATFORM is not set to anything
+already unless you know what you're doing (so that the correct default
+value is set by the next command), and run "C:\Program Files\Microsoft
+eMbedded C++ 4.0\EVC\WCE400\BIN\WCEARMV4.BAT"
+
+8. In the WinCE command prompt you made with WCEARMV4.BAT, goto the perl 
+source directory, cd into win32/ and run "nmake -f Makefile.ce".
+
+9. The ARM perl interpreter (perl519.dll and perl.exe) will be in something
+like "C:\perl519\src\win32\wince-arm-pocket-wce400", with the XS DLLs in
+"C:\perl519\src\xlib\wince-arm-hpc-wce400\auto".
+
+To prove success on the host machine, run
+"dumpbin /headers wince-arm-pocket-wce400\perl.exe" from the win32/ folder
+and look for "machine (ARM)" in the FILE HEADER VALUES and
+"subsystem (Windows CE GUI)" in the OPTIONAL HEADER VALUES.
+
+=head2 OLD BUILD INSTRUCTIONS
 
 This section describes the steps to be performed to build PerlCE.
 You may find additional information about building perl for WinCE
 
 This section describes the steps to be performed to build PerlCE.
 You may find additional information about building perl for WinCE
@@ -81,25 +220,25 @@ For compiling, you need following:
 =back
 
 Needed source files can be downloaded at
 =back
 
 Needed source files can be downloaded at
-L<http://www.rainer-keuchel.de/wince/dirlist.html>
+L<http://perlce.sourceforge.net>
 
 =head3 Make
 
 
 =head3 Make
 
-Normally you only need to edit ./wince/compile.bat
+Normally you only need to edit F<./win32/ce-helpers/compile.bat>
 to reflect your system and run it.
 
 to reflect your system and run it.
 
-File ./wince/compile.bat is actually a wrapper to call
-nmake -f makefile.ce with appropriate parameters and it accepts extra
-parameters and forwards them to "nmake" command as additional
+File F<./win32/ce-helpers/compile.bat> is actually a wrapper to call
+C<nmake -f makefile.ce> with appropriate parameters and it accepts extra
+parameters and forwards them to C<nmake> command as additional
 arguments. You should pass target this way.
 
 To prepare distribution you need to do following:
 
 =over 4
 
 arguments. You should pass target this way.
 
 To prepare distribution you need to do following:
 
 =over 4
 
-=item * go to ./wince subdirectory
+=item * go to F<./win32> subdirectory
 
 
-=item * edit file compile.bat
+=item * edit file F<./win32/ce-helpers/compile.bat>
 
 =item * run 
   compile.bat
 
 =item * run 
   compile.bat
@@ -109,7 +248,7 @@ To prepare distribution you need to do following:
 
 =back
 
 
 =back
 
-makefile.ce has CROSS_NAME macro, and it is used further to refer to
+F<Makefile.ce> has C<CROSS_NAME> macro, and it is used further to refer to
 your cross-compilation scheme. You could assign a name to it, but this
 is not necessary, because by default it is assigned after your machine
 configuration name, such as "wince-sh3-hpc-wce211", and this is enough
 your cross-compilation scheme. You could assign a name to it, but this
 is not necessary, because by default it is assigned after your machine
 configuration name, such as "wince-sh3-hpc-wce211", and this is enough
@@ -117,25 +256,27 @@ to distinguish different builds at the same time. This option could be
 handy for several different builds on same platform to perform, say,
 threaded build. In a following example we assume that all required
 environment variables are set properly for C cross-compiler (a special
 handy for several different builds on same platform to perform, say,
 threaded build. In a following example we assume that all required
 environment variables are set properly for C cross-compiler (a special
-*.bat file could fit perfectly to this purpose) and your compile.bat
-has proper "MACHINE" parameter set, to, say, "wince-mips-pocket-wce300".
+*.bat file could fit perfectly to this purpose) and your F<compile.bat>
+has proper "MACHINE" parameter set, to, say, C<wince-mips-pocket-wce300>.
 
   compile.bat
   compile.bat dist
 
   compile.bat
   compile.bat dist
-  compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" "USE_IMP_SYS=define" "USE_MULTI=define"
-  compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" "USE_IMP_SYS=define" "USE_MULTI=define" dist
+  compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" ^
+    "USE_IMP_SYS=define" "USE_MULTI=define"
+  compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" ^
+    "USE_IMP_SYS=define" "USE_MULTI=define" dist
 
 If all goes okay and no errors during a build, you'll get two independent
 
 If all goes okay and no errors during a build, you'll get two independent
-distributions: "wince-mips-pocket-wce300" and "mips-wce300-thr".
+distributions: C<wince-mips-pocket-wce300> and C<mips-wce300-thr>.
 
 
-Target 'dist' prepares distribution file set. Target 'zipdist' performs
-same as 'dist' but additionally compresses distribution files into zip
+Target C<dist> prepares distribution file set. Target C<zipdist> performs
+same as C<dist> but additionally compresses distribution files into zip
 archive.
 
 archive.
 
-NOTE: during a build there could be created a number (or one) of Config.pm
-for cross-compilation ("foreign" Config.pm) and those are hidden inside
-../xlib/$(CROSS_NAME) with other auxilary files, but, and this is important to
-note, there should be *no* Config.pm for host miniperl.
+NOTE: during a build there could be created a number (or one) of F<Config.pm>
+for cross-compilation ("foreign" F<Config.pm>) and those are hidden inside
+F<../xlib/$(CROSS_NAME)> with other auxiliary files, but, and this is important to
+note, there should be B<no> F<Config.pm> for host miniperl.
 If you'll get an error that perl could not find Config.pm somewhere in building
 process this means something went wrong. Most probably you forgot to
 specify a cross-compilation when invoking miniperl.exe to Makefile.PL
 If you'll get an error that perl could not find Config.pm somewhere in building
 process this means something went wrong. Most probably you forgot to
 specify a cross-compilation when invoking miniperl.exe to Makefile.PL
@@ -151,7 +292,7 @@ or just
 to refer a cross-compilation that was created last time.
 
 All questions related to building for WinCE devices could be asked in
 to refer a cross-compilation that was created last time.
 
 All questions related to building for WinCE devices could be asked in
-perlce-users@lists.sourceforge.net mailing list.
+F<perlce-user@lists.sourceforge.net> mailing list.
 
 =head1 Using Perl on WinCE
 
 
 =head1 Using Perl on WinCE
 
@@ -160,16 +301,18 @@ perlce-users@lists.sourceforge.net mailing list.
 PerlCE is currently linked with a simple console window, so it also
 works on non-hpc devices.
 
 PerlCE is currently linked with a simple console window, so it also
 works on non-hpc devices.
 
-The simple stdio implementation creates the files stdin.txt,
-stdout.txt and stderr.txt, so you might examine them if your
-console has only a liminted number of cols.
+The simple stdio implementation creates the files F<stdin.txt>,
+F<stdout.txt> and F<stderr.txt>, so you might examine them if your
+console has only a limited number of cols.
 
 When exitcode is non-zero, a message box appears, otherwise the
 console closes, so you might have to catch an exit with
 status 0 in your program to see any output.
 
 
 When exitcode is non-zero, a message box appears, otherwise the
 console closes, so you might have to catch an exit with
 status 0 in your program to see any output.
 
-stdout/stderr now go into the files /perl-stdout.txt and
-/perl-stderr.txt.
+stdout/stderr now go into the files F</perl-stdout.txt> and
+F</perl-stderr.txt.>
+
+PerlIDE is handy to deal with perlce.
 
 =head2 LIMITATIONS
 
 
 =head2 LIMITATIONS
 
@@ -180,14 +323,37 @@ No fork(), pipe(), popen() etc.
 All environment vars must be stored in HKLM\Environment as
 strings. They are read at process startup.
 
 All environment vars must be stored in HKLM\Environment as
 strings. They are read at process startup.
 
-       PERL5LIB        - Usual perl lib path (semi-list).
-       PATH            - Semi-list for executables.
-       TMP             - Tempdir.
-       UNIXROOTPATH    - Root for accessing some special files,
-                         i.e. /dev/null, /etc/services.
-       ROWS/COLS       - Rows/cols for console.
-       HOME            - Home directory.
-       CONSOLEFONTSIZE - Size for console font.
+=over
+
+=item PERL5LIB
+
+Usual perl lib path (semi-list).
+
+=item PATH
+
+Semi-list for executables.
+
+=item TMP
+
+- Tempdir.
+
+=item UNIXROOTPATH
+
+- Root for accessing some special files, i.e. F</dev/null>, F</etc/services>.
+
+=item ROWS/COLS
+
+- Rows/cols for console.
+
+=item HOME
+
+- Home directory.
+
+=item CONSOLEFONTSIZE
+
+- Size for console font.
+
+=back
 
 You can set these with cereg.exe, a (remote) registry editor
 or via the PerlIDE.
 
 You can set these with cereg.exe, a (remote) registry editor
 or via the PerlIDE.
@@ -195,51 +361,12 @@ or via the PerlIDE.
 =head2 REGISTRY
 
 To start perl by clicking on a perl source file, you have
 =head2 REGISTRY
 
 To start perl by clicking on a perl source file, you have
-to make the according entries in HKCR (see wince-reg.bat).
+to make the according entries in HKCR (see F<ce-helpers/wince-reg.bat>).
 cereg.exe (which must be executed on a desktop pc with
 ActiveSync) is reported not to work on some devices.
 You have to create the registry entries by hand using a 
 registry editor.
 
 cereg.exe (which must be executed on a desktop pc with
 ActiveSync) is reported not to work on some devices.
 You have to create the registry entries by hand using a 
 registry editor.
 
-=head2 PERLFILES
-
-The following files are a reasonable minimum if you want to do
-some socket stuff:
-
-       ./auto
-       ./auto/DynaLoader
-       ./auto/DynaLoader/autosplit.ix
-       ./auto/DynaLoader/dl_expandspec.al
-       ./auto/DynaLoader/dl_findfile.al
-       ./auto/DynaLoader/dl_find_symbol_anywhere.al
-       ./auto/IO
-       ./auto/IO/IO.bs
-       ./auto/IO/IO.dll
-       ./auto/Socket
-       ./auto/Socket/Socket.bs
-       ./auto/Socket/Socket.dll
-       ./Carp
-       ./Carp/Heavy.pm
-       ./Carp.pm
-       ./Config.pm
-       ./DynaLoader.pm
-       ./Exporter
-       ./Exporter/Heavy.pm
-       ./Exporter.pm
-       ./IO
-       ./IO/File.pm
-       ./IO/Handle.pm
-       ./IO/Socket.pm
-       ./IO.pm
-       ./SelectSaver.pm
-       ./Socket.pm
-       ./strict.pm
-       ./Symbol.pm
-       ./warnings
-       ./warnings/register.pm
-       ./warnings.pm
-       ./XSLoader.pm
-
 =head2 XS
 
 The following Win32-Methods are built-in:
 =head2 XS
 
 The following Win32-Methods are built-in:
@@ -280,6 +407,31 @@ be more precise.
 
 The port for Win32 was used as a reference.
 
 
 The port for Win32 was used as a reference.
 
+=head1 History of WinCE port
+
+=over
+
+=item 5.6.0
+
+Initial port of perl to WinCE. It was performed in separate directory
+named F<wince>. This port was based on contents of F<./win32> directory.
+F<miniperl> was not built, user must have HOST perl and properly edit
+F<makefile.ce> to reflect this.
+
+=item 5.8.0
+
+wince port was kept in the same F<./wince> directory, and F<wince/Makefile.ce>
+was used to invoke native compiler to create HOST miniperl, which then
+facilitates cross-compiling process.
+Extension building support was added.
+
+=item 5.9.4
+
+Two directories F<./win32> and F<./wince> were merged, so perlce build
+process comes in F<./win32> directory.
+
+=back
+
 =head1 AUTHORS
 
 =over
 =head1 AUTHORS
 
 =over
@@ -294,5 +446,8 @@ Many thanks and obligations to Rainer!
 
 made further support of WinCE port.
 
 
 made further support of WinCE port.
 
-=back
+=item Daniel Dragan
+
+updated the build process during the 5.19 development track.
 
 
+=back