From: Gurusamy Sarathy Date: Sun, 10 Oct 1999 04:28:38 +0000 (+0000) Subject: rudimentary support for building under Windows 95/98 (from X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8ec448833410aa8e65370beaffc968d46272417a;p=p5sagit%2Fp5-mst-13.2.git rudimentary support for building under Windows 95/98 (from Benjamin Stuhl ) p4raw-id: //depot/perl@4329 --- diff --git a/MANIFEST b/MANIFEST index 94ab980..09939b4 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1491,6 +1491,7 @@ win32/config_h.PL Perl code to convert Win32 config.sh to config.h win32/config_sh.PL Perl code to update Win32 config.sh from Makefile win32/des_fcrypt.patch Win32 port win32/dl_win32.xs Win32 port +win32/genmk95.pl Perl code to generate command.com-usable makew95.mk win32/include/arpa/inet.h Win32 port win32/include/dirent.h Win32 port win32/include/netdb.h Win32 port diff --git a/README.win32 b/README.win32 index 3d37330..880a8b4 100644 --- a/README.win32 +++ b/README.win32 @@ -9,12 +9,12 @@ perlwin32 - Perl under Win32 =head1 SYNOPSIS These are instructions for building Perl under Windows NT (versions -3.51 or 4.0). Currently, this port is reported to build -under Windows95 using the 4DOS shell--the default shell that infests -Windows95 will not work (see below). Note this caveat is only about -B perl. Once built, you should be able to B it on -either Win32 platform (modulo the problems arising from the inferior -command shell). +3.51 or 4.0). Currently, this port is reported to build under +Windows95 using the 4DOS shell--the default shell that infests +Windows95 may not work fully (but see below). Note that this caveat +is only about B perl. Once built, you should be able to +B it on either Win32 platform (modulo the problems arising from +the inferior command shell). =head1 DESCRIPTION @@ -67,13 +67,16 @@ See L below for general hints about this. Use the default "cmd" shell that comes with NT. Some versions of the popular 4DOS/NT shell have incompatibilities that may cause you trouble. If the build fails under that shell, try building again with the cmd -shell. The Makefile also has known incompatibilites with the "command.com" -shell that comes with Windows95, so building under Windows95 should -be considered "unsupported". However, there have been reports of successful -build attempts using 4DOS/NT version 6.01 under Windows95, using dmake, but -your mileage may vary. +shell. The nmake Makefile also has known incompatibilites with the +"command.com" shell that comes with Windows95. -The surest way to build it is on WindowsNT, using the cmd shell. +However, there have been reports of successful build attempts using +4DOS/NT version 6.01 under Windows95, using dmake, but your mileage +may vary. There is also some basic support for building using dmake +under command.com. Nevertheless, if building under command.com +doesn't work, try 4DOS/NT. + +The surest way to build it is on Windows NT, using the cmd shell. Make sure the path to the build directory does not contain spaces. The build usually works in this circumstance, but some tests will fail. @@ -87,14 +90,14 @@ work for MakeMaker builds.) A port of dmake for win32 platforms is available from: - http://www-personal.umich.edu/~gsar/dmake-4.1-win32.zip + ftp://ftp.linux.activestate.com/pub/staff/gsar/dmake-4.1-win32.zip Fetch and install dmake somewhere on your path (follow the instructions in the README.NOW file). =item Microsoft Visual C++ -The NMAKE that comes with Visual C++ will suffice for building. +The nmake that comes with Visual C++ will suffice for building. You will need to run the VCVARS32.BAT file usually found somewhere like C:\MSDEV4.2\BIN. This will set your build environment. @@ -136,7 +139,7 @@ You also need dmake. See L above on how to get it. Make sure you are in the "win32" subdirectory under the perl toplevel. This directory contains a "Makefile" that will work with -versions of NMAKE that come with Visual C++, and a dmake "makefile.mk" +versions of nmake that come with Visual C++, and a dmake "makefile.mk" that will work for all supported compilers. The defaults in the dmake makefile are setup to build using the Borland compiler. diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index f6d19a2..e1cb83b 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -36,6 +36,46 @@ $NMAKE = 1 if $Config{'make'} =~ /^nmake/i; $PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i; $OBJ = 1 if $Config{'ccflags'} =~ /PERL_OBJECT/i; +# a few workarounds for command.com (very basic) +if (Win32::IsWin95()) { + package ExtUtils::MM_Win95; + unshift @MM::ISA, 'ExtUtils::MM_Win95'; + + sub xs_c { + my($self) = shift; + return '' unless $self->needs_linking(); + ' +.xs.c: + $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ + $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c + ' + } + + sub xs_cpp { + my($self) = shift; + return '' unless $self->needs_linking(); + ' +.xs.cpp: + $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ + $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp + '; + } + + # many makes are too dumb to use xs_c then c_o + sub xs_o { + my($self) = shift; + return '' unless $self->needs_linking(); + # Dmake gets confused with 2 ways of making things + return '' if $ExtUtils::MM_Win32::DMAKE; + ' +.xs$(OBJ_EXT): + $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ + $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c + $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c + '; + } +} + sub dlsyms { my($self,%attribs) = @_; diff --git a/win32/genmk95.pl b/win32/genmk95.pl new file mode 100644 index 0000000..74788ff --- /dev/null +++ b/win32/genmk95.pl @@ -0,0 +1,81 @@ +# genmk95.pl - uses miniperl to generate a makefile that command.com +# (and dmake) will understand given one that cmd.exe will understand + +# Author: Benjamin K. Stuhl +# Date: 8-18-1999 + +# how it works: +# dmake supports an alternative form for its recipes, called "group +# recipes", in which all elements of a recipe are run with only one +# shell. This program converts the standard dmake makefile.mk to +# one using group recipes. This is done so that lines using && or +# || (which command.com doesn't understand) may be split into two +# lines. + +my ($filein, $fileout) = @ARGV; + +chomp (my $loc = `cd`); + +open my $in, $filein or die "Error opening input file: $!"; +open my $out, "> $fileout" or die "Error opening output file: $!"; + +print $out <<_EOH_; +# *** Warning: this file is autogenerated from $filein by $0 *** +# *** Do not edit this file - edit $filein instead *** + +_EOH_ + +my $inrec = 0; + +while (<$in>) +{ + chomp; + if (/^[^#.\t][^#=]*?:/) + { + if (! $inrec) + { + print $out "$_\n"; + while (/\\$/) + { + chomp($_ = <$in>); + print $out "$_\n"; + } + print $out "@[\n"; + $inrec = 1; + next; + } + else { + seek ($out, -3, 2); # no recipe, so back up and undo grouping + print $out "$_\n"; + $inrec = 0; + next; + } + } + if ((/^\s*$/ || /^[^#.\t][^#=]*?:/) && $inrec) + { + print $out "]\n"; + print $out "$_\n"; + $inrec = 0; + next; + } + if (/^(.*?)(&&|\|\|)(.*)$/) # two commands separated by && or || + { + my ($one, $sep, $two) = ($1, $2, $3); +LINE_CONT: + if ($two =~ /\\\s*$/) + { + chomp ($two .= "\n" . scalar <$in>); + goto LINE_CONT; + } + s/^\s*// for ($one, $two); + print $out "\t$one\n\t$two\n" if ($sep eq "&&"); + print $out "\t$one\n\tif errorlevel 1 $two\n" if ($sep eq "||"); + print $out "\tcd $loc\n"; + next; + } + # fall through - no need for special handling + print $out "$_\n"; +} +print $out "]\n" if ($inrec); + +close $in; close $out; diff --git a/win32/makefile.mk b/win32/makefile.mk index 034ae3d..5bf4415 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -25,6 +25,11 @@ INST_DRV *= c: INST_TOP *= $(INST_DRV)\perl # +# Uncomment this if you are compiling under Windows 95/98 and command.com +# (not needed if you're running under 4DOS/NT 6.01 or later) +#IS_WIN95 *= define + +# # Comment this out if you DON'T want your perl installation to be versioned. # This means that the new installation will overwrite any files from the # old installation at the same INST_TOP location. Leaving it enabled is @@ -308,7 +313,9 @@ LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console CXX_FLAG = -xc++ -LIBC = -lcrtdll +# crtdll doesn't define _wopen and friends +#LIBC = -lcrtdll +LIBC = -lmsvcrt LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lnetapi32 -lwsock32 \ -lmingw32 -lgcc -lmoldname $(LIBC) -lkernel32 @@ -765,13 +772,28 @@ CFG_VARS = \ # Top targets # +.IF "$(IS_WIN95)" != "" +MK2 = .\makew95.mk + +all : .\config.h $(GLOBEXE) $(MINIMOD) $(MK2) +all2 : $(CONFIGPM) $(PERLEXE) $(PERL95EXE) $(X2P) $(EXTENSION_DLL) \ + $(EXTENSIOM_PM) +.ELSE all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) \ $(X2P) $(EXTENSION_DLL) $(EXTENSION_PM) +.ENDIF $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c #------------------------------------------------------------ +# This target is used to generate the makew95.mk for Win95 +.IF "$(IS_WIN95)" != "" +$(MK2): makefile.mk + $(MINIPERL) genmk95.pl makefile.mk $(MK2) + $(MAKE) -f $(MK2) all2 +.ENDIF + $(GLOBEXE) : perlglob$(o) .IF "$(CCTYPE)" == "BORLAND" $(CC) -c -w -v -tWM -I"$(CCINCDIR)" perlglob.c