wince/perlhost.h Perl "host" implementation
wince/perllib.c WinCE port
wince/perlmain.c WinCE port
-wince/README.compile WinCE port
wince/README.perlce WinCE port
wince/registry.bat WinCE port
wince/runperl.c WinCE port
This section describes the steps to be performed to build PerlCE.
You may find additional and newer information about building perl
-for WincE using following URL:
+for WinCE using following URL:
http://perlce.sourceforge.net
There should also be pre-built binaries there.
+Don't be confused by large size of downloaded distribution or constructed
+binaries: entire distribution could be large for WinCE ideology, but
+you may strip it at your wish and use only required parts.
+
=head2 Tools & SDK
For compiling, you need following:
parameters and forwards them to "nmake" command as additional
arguments. You should pass target this way.
-Currently default target build all required perls, also there exists
-target 'dist' that prepares distribution file set. Other targets
-are currently in development stage.
-
-So, to prepare distribution you need to do following:
+To prepare distribution you need to do following:
=over 4
=back
-Before you start, you need to build celib.dll and w32console.
-See instructions in these packages for building.
+makefile.ce has 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
+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
+*.bat file could fit perfectly to this purpose) and your compile.bat
+has proper "MACHINE" parameter set, to, say, "wince-mips-pocket-wce300".
+
+ 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
+
+If all goes okay and no errors during a build, you'll get two independent
+distributions: "wince-mips-pocket-wce300" and "mips-wce300-thr".
+
+Target 'dist' prepares distribution file set. Target 'zipdist' performs
+same as 'dist' but additionally compresses distribution files into zip
+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.
+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
+When building an extension for cross-compilation your command line should
+look like
+
+ ..\miniperl.exe -I..\lib -MCross=mips-wce300-thr Makefile.PL
+
+or just
+
+ ..\miniperl.exe -I..\lib -MCross Makefile.PL
+
+to refer a cross-compilation that was created last time.
+
+
+If you decided to build with fcrypt.c file, please refer to README.win32
+file, as long as all legal considerations and steps to do are exactly same
+in this case.
+
+All questions related to building for WinCE devices could be asked in
+perlce-users@lists.sourceforge.net mailing list.
=head1 Acknowledgements
#----------------------------------------------------------------------------------
Extensions: ..\win32\buildext.pl $(PERLDEP) $(CONFIGPM)
$(HPERL) -I..\lib -I..\win32 -MCross=$(CROSS_NAME) ..\win32\buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) \
- !POSIX !Time/HiRes !XS/Typemap
+ !POSIX
Extensions_clean:
-if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) clean
!IF "$(CRYPT_SRC)" != ""
XDLLOBJS = $(XDLLOBJS) $(DLLDIR)\fcrypt.obj
!ENDIF
-!IF "$(CRYPT_SRC)" != ""
-XDLLOBJS = $(XDLLOBJS) $(DLLDIR)\fcrypt.obj
-!ENDIF
{$(SRCDIR)}.c{$(DLLDIR)}.obj:
$(CC) -c $(CFLAGS_O) -DPERL_EXTERNAL_GLOB -Fo$(DLLDIR)\ $<
# -DPERL_IMPLICIT_SYS needs C++ for perllib.c
# This is the only file that depends on perlhost.h, vmem.h, and vdir.h
!IF "$(USE_IMP_SYS)" == "define"
-$(DLLDIR)\perllib$(o) : perllib.c ..\win32\perlhost.h .\vdir.h .\vmem.h
+$(DLLDIR)\perllib$(o) : perllib.c .\perlhost.h .\vdir.h .\vmem.h
$(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c
rem (frustrated) mv perllib.obj $(DLLDIR)
!ENDIF
+++ /dev/null
-Change config.ce. The makefile will automatically generate new
-config.h.
-
-To generate a new Config.pm, delete config.h or
-touch config.ce.
-
-The socket stuff has been rewritten so fds from ceio are used. This
-makes it easy to use them as perl file handles.
-
-Socket and IO dlls compiled. Seem to work.
-
-The sequence for building a new target is:
-
-make -f Makefile.ce clean # clean up
-make -f Makefile.ce all # build for target
-
-CROSS_NAME macro is provided to name your current cross compilation.
-It is "wince" by default, but may be any other identifier to
-differentiate and co-exist miscellaneous configurations.
-So your command often will be
-
-make -f Makefile.ce all CROSS_NAME=[my-cross-name]
-
-It is implemented an easy way to build most of module extensions.
-First, you need to do
-
- nmake host-install CROSS_NAME=[my-cross-name]
-
-This command will install a set of files into your perl directory.
-That will allow you to do cross-compiling for your CE device.
-Those files are C libraries, h-files, Cross.pm, Config.pm. Note
-that it will use first found perl in your path. You should think about
-your PATH variable and change it at your will before copying such files.
-
-After that to do cross-compiling you need to invoke
-
- perl -MCross Makefile.PL
-
-or
-
- perl -MCross=[my-cross-name] Makefile.PL
-
-to prepare Makefile, and then nmake, nmake install, as usually you do.
-'test' tartget is still not ready.
files from a perl for win32 installation and put the
distributed files into the right directories.
- Do not copy any Win32/X86 dlls from your PC to the device...
-
The following files are a reasonable minimum if you want to do
some socket stuff:
set ARG-1=PV=
set ARG-2=INST_VER=
-set ARG-3=INSTALL_ROOT=\Storage Card\perl-tests\perl@19053
+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
return FALSE;
}
-DllExport void
-win32_clearenv()
-{
- return;
-}
-
DllExport char ***
win32_environ(void)
void
sig_terminate(pTHX_ int sig)
{
- Perl_warn(aTHX_ "Terminating on signal SIG%s(%d)\n",PL_sig_name[sig], sig);
+ Perl_warn(aTHX_ "Terminating on signal SIG%s(%d)\n",PL_sig_name[sig], sig);
/* exit() seems to be safe, my_exit() or die() is a problem in ^C
thread
*/
exit(sig);
}
+void
DllExport int
win32_async_check(pTHX)
{
goto Raise;
break;
#endif
-
/* We use WM_USER to fake kill() with other signals */
case WM_USER: {
sig = msg.wParam;
return 1;
}
+/* Timing related stuff */
+
+int
+do_raise(pTHX_ int sig)
+{
+ if (sig < SIG_SIZE) {
+ Sighandler_t handler = w32_sighandler[sig];
+ if (handler == SIG_IGN) {
+ return 0;
+ }
+ else if (handler != SIG_DFL) {
+ (*handler)(sig);
+ return 0;
+ }
+ else {
+ /* Choose correct default behaviour */
+ switch (sig) {
+#ifdef SIGCLD
+ case SIGCLD:
+#endif
+#ifdef SIGCHLD
+ case SIGCHLD:
+#endif
+ case 0:
+ return 0;
+ case SIGTERM:
+ default:
+ break;
+ }
+ }
+ }
+ /* Tell caller to exit thread/process as approriate */
+ return 1;
+}
+
static UINT timerid = 0;
static VOID CALLBACK TimerProc(HWND win, UINT msg, UINT id, DWORD time)
return Nullch;
}
+/* The following are just place holders.
+ * Some hosts may provide and environment that the OS is
+ * not tracking, therefore, these host must provide that
+ * environment and the current directory to CreateProcess
+ */
+
+DllExport void*
+win32_get_childenv(void)
+{
+ return NULL;
+}
+
+DllExport void
+win32_free_childenv(void* d)
+{
+}
+
+DllExport void
+win32_clearenv(void)
+{
+ char *envv = GetEnvironmentStrings();
+ char *cur = envv;
+ STRLEN len;
+ while (*cur) {
+ char *end = strchr(cur,'=');
+ if (end && end != cur) {
+ *end = '\0';
+ xcesetenv(cur, "", 0);
+ *end = '=';
+ cur = end + strlen(end+1)+2;
+ }
+ else if ((len = strlen(cur)))
+ cur += len+1;
+ }
+ FreeEnvironmentStrings(envv);
+}
+
+DllExport char*
+win32_get_childdir(void)
+{
+ dTHX;
+ char* ptr;
+ char szfilename[(MAX_PATH+1)*2];
+ if (USING_WIDE()) {
+ WCHAR wfilename[MAX_PATH+1];
+ GetCurrentDirectoryW(MAX_PATH+1, wfilename);
+ W2AHELPER(wfilename, szfilename, sizeof(szfilename));
+ }
+ else {
+ GetCurrentDirectoryA(MAX_PATH+1, szfilename);
+ }
+
+ New(0, ptr, strlen(szfilename)+1, char);
+ strcpy(ptr, szfilename);
+ return ptr;
+}
+
+DllExport void
+win32_free_childdir(char* d)
+{
+ dTHX;
+ Safefree(d);
+}
+
/* XXX this needs to be made more compatible with the spawnvp()
* provided by the various RTLs. In particular, searching for
* *.{com,bat,cmd} files (as done by the RTLs) is unimplemented.
MALLOC_INIT;
}
-void
-Perl_win32_term(void)
-{
- OP_REFCNT_TERM;
- MALLOC_TERM;
-}
-
DllExport void
Perl_win32_term(void)
{
}
int
-do_spawn(char *cmd)
-{
- return xcesystem(cmd);
-}
-
-int
Perl_do_spawn(pTHX_ char *cmd)
{
return do_spawn(aTHX_ cmd);
#define ftime xceftime
#define ctime xcectime
#define gettimeofday xcegettimeofday
+#define GetSystemTimeAsFileTime XCEGetSystemTimeAsFileTime
XCE_EXPORT int xcesetuid(uid_t id);
XCE_EXPORT int xceseteuid(uid_t id);