This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
restore building perl5**.dll and perl.exe on WinCE
authorDaniel Dragan <bulk88@hotmail.com>
Wed, 30 Jan 2013 23:44:50 +0000 (18:44 -0500)
committerKarl Williamson <public@khwilliamson.com>
Wed, 13 Mar 2013 04:20:13 +0000 (22:20 -0600)
extension building problems remain but the 2 above files will build be
built for WinCE with the following 3 commands, replace the folder name with
what you selected for $(MACHINE) in makefile.ce

nmake all
nmake -f makefile.ce wince-x86-hpc-wce300\perl517.dll
nmake -f makefile.ce wince-x86-hpc-wce300\perl.exe

makefile.ce:
- -debug:full and -pdb:none are obsolete compiler flags,
  and add -opt:ref:icf, to sync eVC makefile with modern VC's makefile
- create a shortcut for easily creating preprocessed (.i) files for
  debugging on the command line
- add new interp .c files that were added over the years
- the Dynaloader build process for Win32 was drastically changed in
  commit 281da5eaa8 , fix to reflect this, a "nmake all" on the Win32 build
  will create the correct dynaloader .c files for the ce makefile to use
  later
- nothing depended on .\xconfig.h in the ce makefile, so there was an error
  that it was missing, fix that
- rebase the CE perl5**.dll to same as on Win32 makefile, makes
  debugging/diassembly much easier when the dll is not relocated at runtime
- config.sh seems to be a win32 build file, while the script configpm
  wants a .sh file in \Cross, so change config.sh dependency to that

win32/Makefile:
- add a preprocess target to easily create .i files for debugging by hand

makedef.pl:
- read the comments in the script
- config.h is Win32 file, not a WinCE file, so use xconfig.h when
  under WinCE

lib/.gitignore
- Cross.pm is made during the build process, it shouldn't ever be commited

win32/.gitignore
- xconfig.h is made during the build process, it shouldn't ever be commited

win32/wince.c
- identifier isnan is defed to _isnan somewhere, this created an infinite
  loop when CE perl was run

lib/.gitignore
makedef.pl
win32/.gitignore
win32/Makefile
win32/Makefile.ce
win32/wince.c

index 5e05cc9..3ce8ed1 100644 (file)
 /Config/Perl/V.pm
 /Config_git.pl
 /Config_heavy.pl
+/Cross.pm
 /Cwd.pm
 /DB_File.pm
 /Data
index bcfed24..950af85 100644 (file)
@@ -87,9 +87,12 @@ process_cc_flags(@Config{qw(ccflags optimize)})
 # the user might have chosen to disable because the canned configs are
 # minimal configs that don't include any of those options.
 
-my @options = sort(Config::bincompat_options(), Config::non_bincompat_options());
-print STDERR "Options: (@options)\n" unless $ARGS{PLATFORM} eq 'test';
-$define{$_} = 1 foreach @options;
+#don't use the host Perl's -V defines for the WinCE Perl
+if($ARGS{PLATFORM} ne 'wince') {
+    my @options = sort(Config::bincompat_options(), Config::non_bincompat_options());
+    print STDERR "Options: (@options)\n" unless $ARGS{PLATFORM} eq 'test';
+    $define{$_} = 1 foreach @options;
+}
 
 my %exportperlmalloc =
     (
@@ -101,7 +104,8 @@ my %exportperlmalloc =
 
 my $exportperlmalloc = $ARGS{PLATFORM} eq 'os2';
 
-open(CFG, '<', 'config.h') || die "Cannot open config.h: $!\n";
+my $config_h = $ARGS{PLATFORM} eq 'wince' ? 'xconfig.h' : 'config.h';
+open(CFG, '<', $config_h) || die "Cannot open $config_h: $!\n";
 while (<CFG>) {
     $define{$1} = 1 if /^\s*\#\s*define\s+(MYMALLOC|MULTIPLICITY
                                            |SPRINTF_RETURNS_STRLEN
@@ -811,6 +815,10 @@ if ($ARGS{PLATFORM} eq 'win32') {
                 ));
 }
 
+if ($ARGS{PLATFORM} eq 'wince') {
+    ++$skip{'win32_isatty'}; # commit 4342f4d6df is win32-only
+}
+
 if ($ARGS{PLATFORM} =~ /^win(?:32|ce)$/) {
     try_symbols(qw(
                            Perl_init_os_extras
index e9422f2..fd84848 100644 (file)
@@ -1,4 +1,5 @@
 /config.h
+/xconfig.h
 /config.w32
 /perl.base
 bin/*.bat
index 99986ca..5c0be56 100644 (file)
@@ -520,6 +520,9 @@ o = .obj
 .c$(o):
        $(CC) -c -I$(<D) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
 
+.c.i:
+       $(CC) -c -I$(<D) $(CFLAGS_O) -P $(OBJOUT_FLAG)$@ $<
+
 .y.c:
        $(NOOP)
 
index 8de0d3e..9013eb8 100644 (file)
@@ -81,6 +81,7 @@ MACHINE=wince-arm-hpc-wce300
 #MACHINE=wince-mips-palm-wce211
 #MACHINE=wince-sh3-palm-wce211
 #MACHINE=wince-x86em-palm-wce211
+#MACHINE=wince-x86-hpc-wce300
 !endif
 
 # set this to your email address
@@ -335,6 +336,24 @@ STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
              $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
 !endif
 
+!if "$(MACHINE)" == "wince-x86-hpc-wce300"
+CC         = cl.exe
+ARCH       = X86EM
+CPU        = X86
+TARGETCPU  = X86
+CEVersion  = 400
+OSVERSION  = WCE400
+PLATFORM   = MS Pocket PC
+MCFLAGS    = -DX86 -D_X86_ -Dx86 -DPROCESSOR_X86 -D _MT -D _DLL \
+             -DPALM_SIZE -DPOCKET_SIZE -I $(CELIBDLLDIR)\inc
+MACH       = -machine:IX86
+SUBSYS     = -subsystem:windowsce,2.0
+CELIBPATH  = $(CELIBDLLDIR)\wince-x86-hpc-wce300-release
+LDLIBPATH  = -libpath:$(CELIBPATH)
+STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
+             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
+!endif
+
 ######################################################################
 # common section
 
@@ -362,6 +381,9 @@ RCDEFS    = /l 0x407 /r /d "UNICODE" /d UNDER_CE=$(CEVersion) \
 
 PATH=$(CEPATH);$(PATH)
 
+# attention, for eVC 4, these paths are not generated correctly since the
+# WinCE SDK is organized differently from eVC 3, replace the next 2 macros
+# with absolute paths to the correct directories on your system
 INCLUDE=$(WCEROOT)\$(OSVERSION)\$(PLATFORM)\include
 LIB=$(WCEROOT)\$(OSVERSION)\$(PLATFORM)\lib\$(ARCH)
 
@@ -471,8 +493,9 @@ CELIB           = celib.lib
 CELIB           = celib.lib
 !endif
 
+#use ws2.lib instead of winsock.lib for WSAGetLastError
 CELIBS          = -nodefaultlib \
-                  winsock.lib $(CELIB) coredll.lib
+                  ws2.lib $(CELIB) coredll.lib
 
 !if $(CEVersion) > 200
 CELIBS          = $(CELIBS) corelibc.lib
@@ -487,10 +510,10 @@ LIBFILES  = $(LIBBASEFILES) $(LIBC)
 CFLAGS         = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) \
                $(PCHFLAGS) $(OPTIMIZE)
 
-LINK_FLAGS     = -nologo -machine:$(PROCESSOR_ARCHITECTURE)
+LINK_FLAGS     = -nologo -opt:ref,icf -machine:$(PROCESSOR_ARCHITECTURE)
 
 !if "$(CFG)" == "DEBUG"
-LINK_FLAGS      = $(LINK_FLAGS) -debug:full -pdb:none
+LINK_FLAGS      = $(LINK_FLAGS) -debug
 !else
 LINK_FLAGS      = $(LINK_FLAGS) -release
 !endif
@@ -511,6 +534,9 @@ o = .obj
 .c$(o):
        $(CC) -c -I$(<D) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
 
+.c.i:
+       $(CC) -c -I$(<D) $(CFLAGS_O) -P $(OBJOUT_FLAG)$@ $<
+
 .y.c:
        $(NOOP)
 
@@ -571,8 +597,11 @@ MICROCORE_SRC      =               \
                ..\gv.c         \
                ..\mro.c        \
                ..\hv.c         \
+               ..\locale.c     \
                ..\keywords.c   \
+               ..\mathoms.c    \
                ..\mg.c         \
+               ..\numeric.c    \
                ..\op.c         \
                ..\pad.c        \
                ..\perl.c       \
@@ -613,8 +642,6 @@ WIN32_SRC   =               \
 WIN32_SRC      = $(WIN32_SRC) .\$(CRYPT_SRC)
 !ENDIF
 
-DLL_SRC                = $(DYNALOADER).c
-
 CORE_NOCFG_H   =               \
                ..\av.h         \
                ..\cop.h        \
@@ -712,7 +739,7 @@ all: hostminiperl $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) MakePPPort E
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c xconfig.h $(EXTDIR)\DynaLoader\dlutils.c
 
-$(CONFIGPM) : $(HPERL) ..\config.sh config_h.PL ..\minimod.pl
+$(CONFIGPM) : $(HPERL) ..\Cross\config-$(MACHINE).sh config_h.PL ..\minimod.pl
        cd .. && $(HPERL) -Ilib configpm --cross=$(CROSS_NAME) --no-glossary
        -mkdir $(XCOREDIR)
        $(XCOPY) ..\*.h $(XCOREDIR)\*.*
@@ -727,25 +754,12 @@ $(CONFIGPM) : $(HPERL) ..\config.sh config_h.PL ..\minimod.pl
        -$(HPERL) -I..\lib $(ICWD) -MCross=$(CROSS_NAME) config_h.PL "INST_VER=$(INST_VER)" "CORE_DIR=$(XCOREDIR)" "CONFIG_H=xconfig.h"
        $(XCOPY) xconfig.h $(XCOREDIR)\config.h
 
-..\config.sh: config.ce config_sh.PL
-       $(HPERL) -I..\lib -I. config_sh.PL $(CFG_VARS) config.ce > ..\config.sh
+..\Cross\config-$(MACHINE).sh: config.ce config_sh.PL
+       $(HPERL) -I..\lib -I. config_sh.PL $(CFG_VARS) config.ce > ..\Cross\config-$(MACHINE).sh
 
 $(MINIMOD) : ..\minimod.pl
        cd .. && $(HPERL) minimod.pl > lib\ExtUtils\Miniperl.pm
 
-$(DYNALOADER).c: $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
-       if not exist $(AUTODIR) mkdir $(AUTODIR)
-       cd $(EXTDIR)\$(*B)
-       $(HPERL) -I..\..\lib -MCross=$(CROSS_NAME) $(*B)_pm.PL
-       cd ..\..\win32
-       $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
-       cd $(EXTDIR)\$(*B)
-       $(XSUBPP) dl_win32.xs > $(*B).c
-       cd ..\..\win32
-
-$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
-       $(COPY) dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
-
 MakePPPort: $(MINIPERL) $(CONFIGPM)
        $(HPERL) -I..\lib -MCross=$(CROSS_NAME) ..\mkppport
 
@@ -779,7 +793,7 @@ clean:
        -rm -f $(MACHINE)/*.exe
        -rm -f $(MACHINE)/*.dll
        -rm -f $(MACHINE)/*.lib
-       -rm -f ../config.sh ../lib/Config.pm
+       -rm -f ..\Cross\config-$(MACHINE).sh ../lib/Config.pm
        -rm -f config.h xconfig.h perl.res
        -rm -f ../t/test_state
 
@@ -853,13 +867,13 @@ $(DLLDIR)\perllib$(o)     : perllib.c .\perlhost.h .\vdir.h .\vmem.h
        rem (frustrated) mv perllib.obj $(DLLDIR)
 !ENDIF
 
-perldll.def : $(HPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl
+perldll.def : $(HPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl .\xconfig.h
        $(HPERL) -I..\lib -MCross create_perllibst_h.pl
        $(HPERL) -I..\lib -MCross -w ..\makedef.pl PLATFORM=wince $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \
            CCTYPE=$(CCTYPE) -DPERL_DLL=$(PERLDLL) TARG_DIR=..\ > perldll.def
 
 $(PERLDLL) : $(DLLDIR) perldll.def $(XDLLOBJS) $(PERLDLL_RES)
-       $(LINK32) -dll -def:perldll.def -out:$@ \
+       $(LINK32) -dll -def:perldll.def -base:0x28000000 -out:$@ \
                   $(SUBSYS) $(LDLIBPATH) \
                  $(LINK_FLAGS) $(LIBFILES) \
                  $(XDLLOBJS) $(PERLDLL_RES)
index b4fc96c..a1e810d 100644 (file)
@@ -2778,12 +2778,6 @@ getcwd(char *buf, size_t size)
   return xcegetcwd(buf, size);
 }
 
-int
-isnan(double d)
-{
-  return _isnan(d);
-}
-
 
 DllExport PerlIO*
 win32_popenlist(const char *mode, IV narg, SV **args)