summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Stuhl <sho_pi@hotmail.com>1999-11-18 10:45:27 -0800
committerGurusamy Sarathy <gsar@cpan.org>1999-12-05 11:07:37 +0000
commit7a958ec31151f9d03a26dcab8abdf5c57315dc96 (patch)
treebf0c1582733a01b04dc1e389cf32286fba918631
parent878143fbd9fc1c2bef489be4fd428b8d222cc108 (diff)
downloadperl-7a958ec31151f9d03a26dcab8abdf5c57315dc96.tar.gz
applied somewhat modified version of suggested patch
Message-ID: <19991119024527.72749.qmail@hotmail.com> Subject: [PATCH 5.005_62] Perl on Win95, Mark IIB p4raw-id: //depot/perl@4653
-rw-r--r--MANIFEST5
-rw-r--r--ext/SDBM_File/Makefile.PL19
-rw-r--r--lib/ExtUtils/MM_Unix.pm3
-rw-r--r--lib/ExtUtils/MM_Win32.pm27
-rw-r--r--win32/PerlCRT.def701
-rw-r--r--win32/config_sh.PL71
-rw-r--r--win32/genmk95.pl33
-rw-r--r--win32/gstartup.c324
-rw-r--r--win32/makefile.mk257
-rw-r--r--win32/oldnames.def115
-rw-r--r--win32/win32.h7
11 files changed, 1434 insertions, 128 deletions
diff --git a/MANIFEST b/MANIFEST
index 919d178078..29ce7b6b3d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1542,11 +1542,14 @@ 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/gstartup.c GCC/Mingw32 runtime startup code
win32/include/arpa/inet.h Win32 port
win32/include/dirent.h Win32 port
win32/include/netdb.h Win32 port
win32/include/sys/socket.h Win32 port
-win32/makefile.mk Win32 makefile for DMAKE (BC++, VC++ builds)
+win32/makefile.mk Win32 makefile for DMAKE (BC++, VC++ builds)
+win32/oldnames.def Win32 DLL definition file for GCC-specific implib
+win32/PerlCRT.def Win32 DLL definition file for PerlCRT.dll
win32/perlglob.c Win32 port
win32/perlhost.h Perl "host" implementation
win32/perllib.c Win32 port
diff --git a/ext/SDBM_File/Makefile.PL b/ext/SDBM_File/Makefile.PL
index afce3f1a54..a1debb92a3 100644
--- a/ext/SDBM_File/Makefile.PL
+++ b/ext/SDBM_File/Makefile.PL
@@ -20,13 +20,26 @@ WriteMakefile(
);
sub MY::postamble {
- if ($^O ne 'VMS') {
+ if ($^O =~ /MSWin32/ && Win32::IsWin95()) {
+ # XXX: dmake-specific, like rest of Win95 port
+ return
+ '
+$(MYEXTLIB): sdbm/Makefile
+@[
+ cd sdbm
+ $(MAKE) all
+ cd ..
+]
+';
+ }
+ elsif ($^O ne 'VMS') {
'
$(MYEXTLIB): sdbm/Makefile
cd sdbm && $(MAKE) all
';
- } else {
- '
+ }
+ else {
+ '
$(MYEXTLIB) : [.sdbm]descrip.mms
set def [.sdbm]
$(MMS) all
diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
index f9fdcaaf58..4a07185ef5 100644
--- a/lib/ExtUtils/MM_Unix.pm
+++ b/lib/ExtUtils/MM_Unix.pm
@@ -3233,11 +3233,14 @@ sub subdir_x {
my($self, $subdir) = @_;
my(@m);
if ($Is_Win32 && Win32::IsWin95()) {
+ # XXX: dmake-specific, like rest of Win95 port
return <<EOT;
subdirs ::
+@[
cd $subdir
\$(MAKE) all \$(PASTHRU)
cd ..
+]
EOT
}
else {
diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm
index e1cb83ba80..ab8570d702 100644
--- a/lib/ExtUtils/MM_Win32.pm
+++ b/lib/ExtUtils/MM_Win32.pm
@@ -37,9 +37,14 @@ $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';
+
+ # the $^O test may be overkill, but we want to be sure Win32::IsWin95()
+ # exists before we try it
+
+ unshift @MM::ISA, 'ExtUtils::MM_Win95'
+ if ($^O =~ /Win32/ && Win32::IsWin95());
sub xs_c {
my($self) = shift;
@@ -65,8 +70,6 @@ if (Win32::IsWin95()) {
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) \\
@@ -74,7 +77,7 @@ if (Win32::IsWin95()) {
$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
';
}
-}
+} # end of command.com workarounds
sub dlsyms {
my($self,%attribs) = @_;
@@ -481,6 +484,20 @@ sub dynamic_lib {
my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
my($ldfrom) = '$(LDFROM)';
my(@m);
+
+# several things for GCC/Mingw32:
+# 1. use correct CRT startup objects (possibly unnecessary)
+# 2. try to overcome non-relocateable-DLL problems by generating
+# a (hopefully unique) image-base from the dll's name
+# -- BKS, 10-19-1999
+ if ($GCC) {
+ $otherldflags .= ' -L$(PERL_ARCHIVE:d) -nostdlib $(PERL_ARCHIVE:d)gdllcrt0.o ';
+ my $dllname = $self->{BASEEXT} . "." . $self->{DLEXT};
+ $dllname =~ /(....)(.{0,4})/;
+ my $baseaddr = unpack("n", $1 ^ $2);
+ $otherldflags .= sprintf("-Wl,--image-base,0x%x0000 ", $baseaddr);
+ }
+
push(@m,'
# This section creates the dynamically loadable $(INST_DYNAMIC)
# from $(OBJECT) and possibly $(MYEXTLIB).
diff --git a/win32/PerlCRT.def b/win32/PerlCRT.def
new file mode 100644
index 0000000000..6376e5a2cb
--- /dev/null
+++ b/win32/PerlCRT.def
@@ -0,0 +1,701 @@
+;
+; PerlCRT.def
+;
+; Dll export file for PerlCRT.dll
+; this is needed for GCC/Mingw32 builds of Perl, since GCC
+; can't understand MSVC-ish .lib files
+;
+; Created from the output of 'nm PerlCRT.lib | grep "00000000 T"'
+; -- Benjamin Stuhl <sho_pi@hotmail.com> 10-17-1999
+
+EXPORTS
+ wscanf
+ wprintf
+ wctomb
+ wcsxfrm
+ wcstoul
+ wcstombs
+ wcstol
+ wcstok
+ wcstod
+ wcsstr
+ wcsspn
+ wcsrchr
+ wcspbrk
+ wcsncpy
+ wcsncmp
+ wcsncat
+ wcslen
+ wcsftime
+ wcscspn
+ wcscpy
+ wcscoll
+ wcscmp
+ wcschr
+ wcscat
+ vwprintf
+ vswprintf
+ vsprintf
+ vprintf
+ vfwprintf
+ vfprintf
+ ungetwc
+ ungetc
+ towupper
+ towlower
+ toupper
+ tolower
+ tmpnam
+ tmpfile
+ time
+ tanh
+ tan
+ system
+ swscanf
+ swprintf
+ strxfrm
+ strtoul
+ strtol
+ strtok
+ strtod
+ strstr
+ strspn
+ strrchr
+ strpbrk
+ strncpy
+ strncmp
+ strncat
+ strlen
+ strftime
+ strerror
+ strcspn
+ strcpy
+ strcoll
+ strcmp
+ strchr
+ strcat
+ sscanf
+ srand
+ sqrt
+ sprintf
+ sinh
+ sin
+ signal
+ setvbuf
+ setlocale
+ setbuf
+ scanf
+ rewind
+ rename
+ remove
+ realloc
+ rand
+ raise
+ qsort
+ putwchar
+ putwc
+ puts
+ putchar
+ putc
+ printf
+ pow
+ perror
+ modf
+ mktime
+ memset
+ memmove
+ memcpy
+ memcmp
+ memchr
+ mbtowc
+ mbstowcs
+ mblen
+ malloc
+ longjmp
+ log10
+ log
+ localtime
+ localeconv
+ ldiv
+ ldexp
+ labs
+ isxdigit
+ iswxdigit
+ iswupper
+ iswspace
+ iswpunct
+ iswprint
+ iswlower
+ iswgraph
+ iswdigit
+ iswctype
+ iswcntrl
+ iswascii
+ iswalpha
+ iswalnum
+ isupper
+ isspace
+ ispunct
+ isprint
+ islower
+ isleadbyte
+ isgraph
+ isdigit
+ iscntrl
+ isalpha
+ isalnum
+ is_wctype
+ gmtime
+ getwchar
+ getwc
+ gets
+ getenv
+ getchar
+ getc
+ fwscanf
+ fwrite
+ fwprintf
+ ftell
+ fsetpos
+ fseek
+ fscanf
+ frexp
+ freopen
+ free
+ fread
+ fputws
+ fputwc
+ fputs
+ fputc
+ fprintf
+ fopen
+ fmod
+ floor
+ fgetws
+ fgetwc
+ fgets
+ fgetpos
+ fgetc
+ fflush
+ ferror
+ feof
+ fclose
+ fabs
+ exp
+ exit
+ div
+ difftime
+ ctime
+ cosh
+ cos
+ clock
+ clearerr
+ ceil
+ calloc
+ bsearch
+ atol
+ atoi
+ atof
+ atan2
+ atan
+ asin
+ asctime
+ acos
+ abs
+ abort
+ _yn
+ _y1
+ _y0
+ _wutime
+ _wunlink
+ _wtol
+ _wtoi64
+ _wtoi
+ _wtmpnam
+ _wtempnam
+ _wsystem
+ _wstrtime
+ _wstrdate
+ _wstati64
+ _wstat
+ _wsplitpath
+ _wspawnvpe
+ _wspawnvp
+ _wspawnve
+ _wspawnv
+ _wspawnlpe
+ _wspawnlp
+ _wspawnle
+ _wspawnl
+ _wsopen
+ _wsetlocale
+ _wsearchenv
+ _wrmdir
+ _write
+ _wrename
+ _wremove
+ _wputenv
+ _wpopen
+ _wperror
+ _wopen
+ _wmktemp
+ _wmkdir
+ _wmakepath
+ _wgetenv
+ _wgetdcwd
+ _wgetcwd
+ _wfullpath
+ _wfsopen
+ _wfreopen
+ _wfopen
+ _wfindnexti64
+ _wfindnext
+ _wfindfirsti64
+ _wfindfirst
+ _wfdopen
+ _wexecvpe
+ _wexecvp
+ _wexecve
+ _wexecv
+ _wexeclpe
+ _wexeclp
+ _wexecle
+ _wexecl
+ _wctime
+ _wcsupr
+ _wcsset
+ _wcsrev
+ _wcsnset
+ _wcsnicoll
+ _wcsnicmp
+ _wcsncoll
+ _wcslwr
+ _wcsicoll
+ _wcsicmp
+ _wcsdup
+ _wcreat
+ _wchmod
+ _wchdir
+ _wasctime
+ _waccess
+ _vsnwprintf
+ _vsnprintf
+ _utime
+ _unlock
+ _unloaddll
+ _unlink
+ _ungetch
+ _umask
+ _ultow
+ _ultoa
+ _ui64tow
+ _ui64toa
+ _tzset
+ _toupper
+ _tolower
+ _tempnam
+ _telli64
+ _tell
+ _swab
+ _sys_nerr
+ _strupr
+ _strtime
+ _strset
+ _strrev
+ _strnset
+ _strnicoll
+ _strnicmp
+ _strncoll
+ _strlwr
+ _stricoll
+ _stricmp
+ _strerror
+ _strdup
+ _strdate
+ _strcmpi
+ _statusfp
+ _stati64
+ _stat
+ _splitpath
+ _spawnvpe
+ _spawnvp
+ _spawnve
+ _spawnv
+ _spawnlpe
+ _spawnlp
+ _spawnle
+ _spawnl
+ _sopen
+ _snwprintf
+ _snprintf
+ _sleep
+ _setsystime
+ _setmode
+ _setmbcp
+ _setmaxstdio
+ _setjmp3
+ _setjmp
+ _seterrormode
+ _set_sbh_threshold
+ _set_error_mode
+ _seh_longjmp_unwind@4
+ _searchenv
+ _scalb
+ _safe_fprem1
+ _safe_fprem
+ _safe_fdivr
+ _safe_fdiv
+ _rotr
+ _rotl
+ _rmtmp
+ _rmdir
+ _read
+ _putws
+ _putw
+ _putenv
+ _putch
+ _purecall
+ _popen
+ _pipe
+ _pclose
+ _outpw
+ _outpd
+ _outp
+ _open_osfhandle
+ _open
+ _nextafter
+ _msize
+ _mktemp
+ _mkdir
+ _memicmp
+ _memccpy
+ _mbsupr
+ _mbstrlen
+ _mbstok
+ _mbsstr
+ _mbsspnp
+ _mbsspn
+ _mbsset
+ _mbsrev
+ _mbsrchr
+ _mbspbrk
+ _mbsnset
+ _mbsninc
+ _mbsnicoll
+ _mbsnicmp
+ _mbsnextc
+ _mbsncpy
+ _mbsncoll
+ _mbsncmp
+ _mbsnccnt
+ _mbsncat
+ _mbsnbset
+ _mbsnbicoll
+ _mbsnbicmp
+ _mbsnbcpy
+ _mbsnbcoll
+ _mbsnbcnt
+ _mbsnbcmp
+ _mbsnbcat
+ _mbslwr
+ _mbslen
+ _mbsinc
+ _mbsicoll
+ _mbsicmp
+ _mbsdup
+ _mbsdec
+ _mbscspn
+ _mbscpy
+ _mbscoll
+ _mbscmp
+ _mbschr
+ _mbscat
+ _mbsbtype
+ _mbctoupper
+ _mbctombb
+ _mbctolower
+ _mbctokata
+ _mbctohira
+ _mbclen
+ _mbcjmstojis
+ _mbcjistojms
+ _mbccpy
+ _mbbtype
+ _mbbtombc
+ _makepath
+ _ltow
+ _ltoa
+ _lseeki64
+ _lseek
+ _lsearch
+ _lrotr
+ _lrotl
+ _longjmpex
+ _logb
+ _locking
+ _lock
+ _local_unwind2
+ _loaddll
+ _lfind
+ _kbhit
+ _jn
+ _j1
+ _j0
+ _itow
+ _itoa
+ _isnan
+ _ismbstrail
+ _ismbslead
+ _ismbcupper
+ _ismbcsymbol
+ _ismbcspace
+ _ismbcpunct
+ _ismbcprint
+ _ismbclower
+ _ismbclegal
+ _ismbcl2
+ _ismbcl1
+ _ismbcl0
+ _ismbckata
+ _ismbchira
+ _ismbcgraph
+ _ismbcdigit
+ _ismbcalpha
+ _ismbcalnum
+ _ismbbtrail
+ _ismbbpunct
+ _ismbbprint
+ _ismbblead
+ _ismbbkpunct
+ _ismbbkprint
+ _ismbbkana
+ _ismbbkalnum
+ _ismbbgraph
+ _ismbbalpha
+ _ismbbalnum
+ _isctype
+ _isatty
+ _inpw
+ _inpd
+ _inp
+ _initterm
+ _iob
+ _i64tow
+ _i64toa
+ _hypot
+ _HUGE
+ _heapwalk
+ _heapused
+ _heapset
+ _heapmin
+ _heapchk
+ _heapadd
+ _global_unwind2
+ _getws
+ _getw
+ _getsystime
+ _getpid
+ _getmbcp
+ _getmaxstdio
+ _getdrives
+ _getdrive
+ _getdllprocaddr
+ _getdiskfree
+ _getdcwd
+ _getcwd
+ _getche
+ _getch
+ _get_sbh_threshold
+ _get_osfhandle
+ _gcvt
+ _futime
+ _fullpath
+ _ftol
+ _ftime
+ _fstati64
+ _fstat
+ _fsopen
+ _free_osfhnd
+ _fputwchar
+ _fputchar
+ _fpreset
+ _fpieee_flt
+ _fpclass
+ _fmode
+ _flushall
+ _flsbuf
+ _finite
+ _findnexti64
+ _findnext
+ _findfirsti64
+ _findfirst
+ _findclose
+ _fileno
+ _filelengthi64
+ _filelength
+ _filbuf
+ _fgetwchar
+ _fgetchar
+ _fdopen
+ _fcvt
+ _fcloseall
+ _expand
+ _exit
+ _execvpe
+ _execvp
+ _execve
+ _execv
+ _execlpe
+ _execlp
+ _execle
+ _execl
+ _except_handler3
+ _except_handler2
+ _errno
+ _eof
+ _endthreadex
+ _endthread
+ _ecvt
+ _dup2
+ _dup
+ _cwait
+ _cscanf
+ _creat
+ _cputs
+ _cprintf
+ _copysign
+ _controlfp
+ _control87
+ _commit
+ _close
+ _clearfp
+ _chsize
+ _chmod
+ _chgsign
+ _chdrive
+ _chdir
+ _cgets
+ _cexit
+ _callnewh
+ _cabs
+ _c_exit
+ _beginthreadex
+ _beginthread
+ _beep
+ _atoldbl
+ _atoi64
+ _atodbl
+ _assert
+ _amsg_exit
+ _adj_fptan
+ _adj_fprem1
+ _adj_fprem
+ _adj_fpatan
+ _adj_fdivr_m64
+ _adj_fdivr_m32i
+ _adj_fdivr_m32
+ _adj_fdivr_m16i
+ _adj_fdiv_r
+ _adj_fdiv_m64
+ _adj_fdiv_m32i
+ _adj_fdiv_m32
+ _adj_fdiv_m16i
+ _access
+ _abnormal_termination
+ __wgetmainargs
+ __unDName
+ __toascii
+ __threadid
+ __threadhandle
+ __setusermatherr
+ __set_app_type
+ __pxcptinfoptrs
+ __p__wpgmptr
+ __p__winver
+ __p__winminor
+ __p__winmajor
+ __p__wenviron
+ __p__wcmdln
+ __p__tzname
+ __p__timezone
+ __p__pwctype
+ __p__pgmptr
+ __p__pctype
+ __p__osver
+ __p__mbctype
+ __p__mbcasemap
+ __p__iob
+ __p__fmode
+ __p__fileinfo
+ __p__environ
+ __p__dstbias
+ __p__daylight
+ __p__commode
+ __p__amblksiz
+ __p__acmdln
+ __p___winitenv
+ __p___wargv
+ __p___mb_cur_max
+ __p___initenv
+ __p___argv
+ __p___argc
+ __lconv_init
+ __iscsymf
+ __iscsym
+ __isascii
+ __getmainargs
+ __fpecode
+ __doserrno
+ __dllonexit
+ __crtLCMapStringA
+ __crtGetLocaleInfoW
+ __crtCompareStringA
+ __STRINGTOLD
+ __RTtypeid
+ __RTDynamicCast
+ __RTCastToVoid
+ __CxxLongjmpUnwind@4
+ __CxxFrameHandler
+ _XcptFilter
+ _Strftime
+ _Gettnames
+ _Getmonths
+ _Getdays
+ _EH_prolog
+ _CxxThrowException@8
+ _CItanh
+ _CItan
+ _CIsqrt
+ _CIsinh
+ _CIsin
+ _CIpow
+ _CIlog10
+ _CIlog
+ _CIfmod
+ _CIexp
+ _CIcosh
+ _CIcos
+ _CIatan2
+ _CIatan
+ _CIasin
+ _CIacos
+ $I10_OUTPUT
+ _aullshr
+ _aullrem
+ _aulldiv
+ _allshr
+ _allshl
+ _allrem
+ _allmul
+ _alldiv
+ _setdefaultprecision
+ _wsetargv
+ _matherr
+ _setargv
+ __setargv
+ _CRT_INIT@12
+ _DllMainCRTStartup@12
+ _onexit
+ atexit
+ _alloca_probe
+ _chkstk
diff --git a/win32/config_sh.PL b/win32/config_sh.PL
index 9e53b54827..b1c7b9f592 100644
--- a/win32/config_sh.PL
+++ b/win32/config_sh.PL
@@ -10,12 +10,35 @@ sub mungepath {
return join(' ', @p);
}
+# generate an array of option strings from command-line args
+# or an option file
+# -- added by BKS, 10-17-1999 to fix command-line overflow problems
+sub loadopts {
+ if ($ARGV[0] =~ /--cfgsh-option-file/) {
+ shift @ARGV;
+ my $optfile = shift @ARGV;
+ local (*F);
+ open OPTF, $optfile or die "Can't open $optfile: $!\n";
+ my @opts;
+ chomp(my $line = <OPTF>);
+ my @vars = split(/\t+~\t+/, $line);
+ for (@vars) {
+ push(@opts, $_) unless (/^\s*$/);
+ }
+ close OPTF;
+ return \@opts;
+ }
+ else {
+ return \@ARGV;
+ }
+}
+
my %opt;
-while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/)
- {
- $opt{$1}=$2;
- shift(@ARGV);
- }
+my $optref = loadopts();
+while (@{$optref} && $optref->[0] =~ /^([\w_]+)=(.*)$/) {
+ $opt{$1}=$2;
+ shift(@{$optref});
+}
my $pl_h = '../patchlevel.h';
@@ -31,13 +54,13 @@ if (-e $pl_h) {
close PL;
}
elsif ($] =~ /^(\d+)\.(\d\d\d)?(\d\d)?$/) { # should always be true
- $opt{PERL_REVISION} = $1;
- $opt{PERL_VERSION} = int($2 || 0);
- $opt{PERL_SUBVERSION} = $3;
- $opt{PERL_APIVERSION} = $];
+ $opt{PERL_REVISION} = $1;
+ $opt{PERL_VERSION} = int($2 || 0);
+ $opt{PERL_SUBVERSION} = $3;
+ $opt{PERL_APIVERSION} = $];
}
else {
- die "Can't parse perl version ($])";
+ die "Can't parse perl version ($])";
}
$opt{PERL_SUBVERSION} ||= '00';
@@ -50,19 +73,19 @@ $opt{'usemymalloc'} = 'y' if $opt{'d_mymalloc'} eq 'define';
$opt{libpth} = mungepath($opt{libpth}) if exists $opt{libpth};
$opt{incpath} = mungepath($opt{incpath}) if exists $opt{incpath};
-while (<>)
- {
- s/~([\w_]+)~/$opt{$1}/g;
- if (/^([\w_]+)=(.*)$/) {
- my($k,$v) = ($1,$2);
- # this depends on cf_time being empty in the template (or we'll get a loop)
- if ($k eq 'cf_time') {
- $_ = "$k='" . localtime(time) . "'\n" if $v =~ /^\s*'\s*'/;
- }
- elsif (exists $opt{$k}) {
- $_ = "$k='$opt{$k}'\n";
+while (<>) {
+ s/~([\w_]+)~/$opt{$1}/g;
+ if (/^([\w_]+)=(.*)$/) {
+ my($k,$v) = ($1,$2);
+ # this depends on cf_time being empty in the template (or we'll
+ # get a loop)
+ if ($k eq 'cf_time') {
+ $_ = "$k='" . localtime(time) . "'\n" if $v =~ /^\s*'\s*'/;
+ }
+ elsif (exists $opt{$k}) {
+ $_ = "$k='$opt{$k}'\n";
+ }
}
- }
- print;
- }
+ print;
+}
diff --git a/win32/genmk95.pl b/win32/genmk95.pl
index 74788ff3cb..6137ce2be6 100644
--- a/win32/genmk95.pl
+++ b/win32/genmk95.pl
@@ -1,28 +1,28 @@
-# genmk95.pl - uses miniperl to generate a makefile that command.com
-# (and dmake) will understand given one that cmd.exe will understand
+# genmk95.pl - uses miniperl to generate a makefile that command.com will
+# understand given one that cmd.exe will understand
# Author: Benjamin K. Stuhl
-# Date: 8-18-1999
+# Date: 10-16-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.
+# 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 that will still be run
+# with one shell.
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: $!";
+open my $in, $filein or die "Error opening input file: $!\n";
+open my $out, "> $fileout" or die "Error opening output file: $!\n";
print $out <<_EOH_;
# *** Warning: this file is autogenerated from $filein by $0 ***
# *** Do not edit this file - edit $filein instead ***
+_HOME_DIR := \$(PWD)
+
_EOH_
my $inrec = 0;
@@ -30,12 +30,12 @@ my $inrec = 0;
while (<$in>)
{
chomp;
- if (/^[^#.\t][^#=]*?:/)
+ if (/^[^#.\t][^#=]*?:(?:[^=]|$)/)
{
if (! $inrec)
{
print $out "$_\n";
- while (/\\$/)
+ while (/\\\s*$/)
{
chomp($_ = <$in>);
print $out "$_\n";
@@ -70,7 +70,7 @@ 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";
+ print $out "\tcd \$(_HOME_DIR)\n";
next;
}
# fall through - no need for special handling
@@ -78,4 +78,5 @@ LINE_CONT:
}
print $out "]\n" if ($inrec);
-close $in; close $out;
+close $in or warn "Error closing \$in: $!\n";
+close $out or warn "Error closing \$out: $!\n";
diff --git a/win32/gstartup.c b/win32/gstartup.c
new file mode 100644
index 0000000000..fc107e202f
--- /dev/null
+++ b/win32/gstartup.c
@@ -0,0 +1,324 @@
+/*
+ * gstartup.c
+ *
+ * Startup file for GCC/Mingw32 builds
+ * (replaces gcc's default c:\egcs\...\{crt1.o,dllcrt1.o})
+ *
+ * This file is taken from the Mingw32 package.
+ * Created by Colin Peters for Mingw32
+ * Modified by Mumit Khan
+ *
+ * History with Perl:
+ * Added (in modified form) to Perl standard distribution to fix
+ * problems linking against PerlCRT or MSVCRT
+ * -- Benjamin Stuhl <sho_pi@hotmail.com> 10-17-1999
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <io.h>
+#include <fcntl.h>
+#include <process.h>
+#include <float.h>
+#include <windows.h>
+#include <signal.h>
+
+/*
+ * Access to a standard 'main'-like argument count and list. Also included
+ * is a table of environment variables.
+ */
+int _argc;
+char **_argv;
+
+extern int _CRT_glob;
+
+#ifdef __MSVCRT__
+typedef struct {
+ int newmode;
+} _startupinfo;
+extern void __getmainargs (int *, char ***, char ***, int, _startupinfo *);
+#else
+extern void __GetMainArgs (int *, char ***, char ***, int);
+#endif
+
+/*
+ * Initialize the _argc, _argv and environ variables.
+ */
+static void
+_mingw32_init_mainargs ()
+{
+ /* The environ variable is provided directly in stdlib.h through
+ * a dll function call. */
+ char **dummy_environ;
+#ifdef __MSVCRT__
+ _startupinfo start_info;
+ start_info.newmode = 0;
+#endif
+
+ /*
+ * Microsoft's runtime provides a function for doing just that.
+ */
+#ifdef __MSVCRT__
+ (void) __getmainargs (&_argc, &_argv, &dummy_environ, _CRT_glob,
+ &start_info);
+#else
+ /* CRTDLL version */
+ (void) __GetMainArgs (&_argc, &_argv, &dummy_environ, _CRT_glob);
+#endif
+}
+
+#if defined(EXESTARTUP) /* gcrt0.o - startup for an executable */
+
+extern int main (int, char **, char **);
+
+/*
+ * Must have the correct app type for MSVCRT.
+ */
+
+#ifdef __MSVCRT__
+#define __UNKNOWN_APP 0
+#define __CONSOLE_APP 1
+#define __GUI_APP 2
+__MINGW_IMPORT void __set_app_type(int);
+#endif /* __MSVCRT__ */
+
+/*
+ * Setup the default file handles to have the _CRT_fmode mode, as well as
+ * any new files created by the user.
+ */
+extern unsigned int _CRT_fmode;
+
+static void
+_mingw32_init_fmode ()
+{
+ /* Don't set the file mode if the user hasn't set any value for it. */
+ if (_CRT_fmode)
+ {
+ _fmode = _CRT_fmode;
+
+ /*
+ * This overrides the default file mode settings for stdin,
+ * stdout and stderr. At first I thought you would have to
+ * test with isatty, but it seems that the DOS console at
+ * least is smart enough to handle _O_BINARY stdout and
+ * still display correctly.
+ */
+ if (stdin)
+ {
+ _setmode (_fileno (stdin), _CRT_fmode);
+ }
+ if (stdout)
+ {
+ _setmode (_fileno (stdout), _CRT_fmode);
+ }
+ if (stderr)
+ {
+ _setmode (_fileno (stderr), _CRT_fmode);
+ }
+ }
+}
+
+/* This function will be called when a trap occurs. Thanks to Jacob
+ Navia for his contribution. */
+static CALLBACK long
+_gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
+{
+ void (*old_handler) (int);
+ long action = EXCEPTION_CONTINUE_SEARCH;
+ int reset_fpu = 0;
+
+ switch (exception_data->ExceptionRecord->ExceptionCode)
+ {
+ case EXCEPTION_ACCESS_VIOLATION:
+ /* test if the user has set SIGSEGV */
+ old_handler = signal (SIGSEGV, SIG_DFL);
+ if (old_handler == SIG_IGN)
+ {
+ /* this is undefined if the signal was raised by anything other
+ than raise (). */
+ signal (SIGSEGV, SIG_IGN);
+ action = EXCEPTION_CONTINUE_EXECUTION;
+ }
+ else if (old_handler != SIG_DFL)
+ {
+ /* This means 'old' is a user defined function. Call it */
+ (*old_handler) (SIGSEGV);
+ action = EXCEPTION_CONTINUE_EXECUTION;
+ }
+ break;
+
+ case EXCEPTION_FLT_INVALID_OPERATION:
+ case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+ case EXCEPTION_FLT_DENORMAL_OPERAND:
+ case EXCEPTION_FLT_OVERFLOW:
+ case EXCEPTION_FLT_UNDERFLOW:
+ case EXCEPTION_FLT_INEXACT_RESULT:
+ reset_fpu = 1;
+ /* fall through. */
+
+ case EXCEPTION_INT_DIVIDE_BY_ZERO:
+ /* test if the user has set SIGFPE */
+ old_handler = signal (SIGFPE, SIG_DFL);
+ if (old_handler == SIG_IGN)
+ {
+ signal (SIGFPE, SIG_IGN);
+ if (reset_fpu)
+ _fpreset ();
+ action = EXCEPTION_CONTINUE_EXECUTION;
+ }
+ else if (old_handler != SIG_DFL)
+ {
+ /* This means 'old' is a user defined function. Call it */
+ (*old_handler) (SIGFPE);
+ action = EXCEPTION_CONTINUE_EXECUTION;
+ }
+ break;
+
+ default:
+ break;
+ }
+ return action;
+}
+
+/*
+ * The function mainCRTStartup is the entry point for all console programs.
+ */
+static int
+__mingw_CRTStartup ()
+{
+ int nRet;
+
+ /*
+ * Set up the top-level exception handler so that signal handling
+ * works as expected. The mapping between ANSI/POSIX signals and
+ * Win32 SE is not 1-to-1, so caveat emptore.
+ *
+ */
+ SetUnhandledExceptionFilter (_gnu_exception_handler);
+
+ /*
+ * Initialize floating point unit.
+ */
+ _fpreset (); /* Supplied by the runtime library. */
+
+ /*
+ * Set up __argc, __argv and _environ.
+ */
+ _mingw32_init_mainargs ();
+
+ /*
+ * Sets the default file mode for stdin, stdout and stderr, as well
+ * as files later opened by the user, to _CRT_fmode.
+ * NOTE: DLLs don't do this because that would be rude!
+ */
+ _mingw32_init_fmode ();
+
+ /*
+ * Call the main function. If the user does not supply one
+ * the one in the 'libmingw32.a' library will be linked in, and
+ * that one calls WinMain. See main.c in the 'lib' dir
+ * for more details.
+ */
+ nRet = main (_argc, _argv, environ);
+
+ /*
+ * Perform exit processing for the C library. This means
+ * flushing output and calling 'atexit' registered functions.
+ */
+ _cexit ();
+
+ ExitProcess (nRet);
+
+ return 0;
+}
+
+/*
+ * The function mainCRTStartup is the entry point for all console programs.
+ */
+int
+mainCRTStartup ()
+{
+#ifdef __MSVCRT__
+ __set_app_type (__CONSOLE_APP);
+#endif
+ __mingw_CRTStartup ();
+ return 0;
+}
+
+/*
+ * For now the GUI startup function is the same as the console one.
+ * This simply gets rid of the annoying warning about not being able
+ * to find WinMainCRTStartup when linking GUI applications.
+ */
+int
+WinMainCRTStartup ()
+{
+#ifdef __MSVCRT__
+ __set_app_type (__GUI_APP);
+#endif
+ __mingw_CRTStartup ();
+}
+
+#elif defined(DLLSTARTUP) /* dllcrt0.o - startup for a DLL */
+
+/* Unlike normal crt1, I don't initialize the FPU, because the process
+ * should have done that already. I also don't set the file handle modes,
+ * because that would be rude. */
+
+#ifdef __GNUC__
+extern void __main ();
+extern void __do_global_dtors ();
+#endif
+
+extern BOOL WINAPI DllMain (HANDLE, DWORD, LPVOID);
+
+BOOL WINAPI
+DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
+{
+ BOOL bRet;
+
+ if (dwReason == DLL_PROCESS_ATTACH)
+ {
+ _mingw32_init_mainargs ();
+
+#ifdef __GNUC__
+ /* From libgcc.a, calls global class constructors. */
+ __main ();
+#endif
+ }
+
+ /*
+ * Call the user-supplied DllMain subroutine
+ * NOTE: DllMain is optional, so libmingw32.a includes a stub
+ * which will be used if the user does not supply one.
+ */
+ bRet = DllMain (hDll, dwReason, lpReserved);
+
+#ifdef __GNUC__
+ if (dwReason == DLL_PROCESS_DETACH)
+ {
+ /* From libgcc.a, calls global class destructors. */
+ __do_global_dtors ();
+ }
+#endif
+
+ return bRet;
+}
+
+/*
+ * For the moment a dummy atexit. Atexit causes problems in DLLs, especially
+ * if they are dynamically loaded. For now atexit inside a DLL does nothing.
+ * NOTE: We need this even if the DLL author never calls atexit because
+ * the global constructor function __do_global_ctors called from __main
+ * will attempt to register __do_global_dtors using atexit.
+ * Thanks to Andrey A. Smirnov for pointing this one out.
+ */
+int
+atexit (void (*pfn) ())
+{
+ return 0;
+}
+
+#else
+#error No startup target!
+#endif /* EXESTARTUP */
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 63f01c7162..5b518c27c7 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -18,7 +18,7 @@
##
#
-# Set these to wherever you want "nmake install" to put your
+# Set these to wherever you want "dmake install" to put your
# newly built perl.
#
INST_DRV *= c:
@@ -111,9 +111,10 @@ CCTYPE *= BORLAND
#CFG *= Debug
#
-# uncomment to enable use of PerlCRT.DLL when using the Visual C compiler.
-# Highly recommended. It has patches that fix known bugs in MSVCRT.DLL.
-# This currently requires VC 5.0 with Service Pack 3 or later.
+# uncomment to enable use of PerlCRT.DLL when using the Visual C compiler
+# or GCC/Mingw32. Highly recommended. It has patches that fix known bugs in
+# MSVCRT.DLL. This currently requires VC 5.0 with Service Pack 3 or later
+# or GCC/Mingw32.
# Get it from CPAN at http://www.perl.com/CPAN/authors/id/D/DO/DOUGL/
# and follow the directions in the package to install.
#
@@ -344,18 +345,31 @@ a = .a
#
# Options
#
-RUNTIME =
+
+# GCC headers need to know that we're using MSVCRT (or a clone thereof)
+RUNTIME = -D__MSVCRT__
INCLUDES = -I$(COREDIR) -I.\include -I. -I..
DEFINES = -DWIN32 $(CRYPT_FLAG)
LOCDEFS = -DPERLDLL -DPERL_CORE
SUBSYS = console
CXX_FLAG = -xc++
-# crtdll doesn't define _wopen and friends
-#LIBC = -lcrtdll
-LIBC = -lmsvcrt
-LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lnetapi32 -lwsock32 \
- -lmingw32 -lgcc -lmoldname $(LIBC) -lkernel32
+.IF "$(USE_PERLCRT)" == ""
+LIBCDLL = msvcrt.dll
+CRTIMPLIBS = $(OLDNAMES_A)
+.ELSE
+LIBCDLL = PerlCRT.dll
+CRTIMPLIBS = $(PERLCRT_A) $(OLDNAMES_A)
+.ENDIF
+
+LIBC = -l$(LIBCDLL:s/.dll//)
+GCCLIBS = -lmingw32 -lgcc
+
+# same libs as MSVC, but no -luuid32 or -lodbccp32 yet
+LIBFILES = $(GCCLIBS) $(CRYPT_LIB) $(LIBC) -loldnames -lkernel32 \
+ -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 \
+ -lole32 -loleaut32 -lnetapi32 -lwsock32 -lmpr -lwinmm \
+ -lversion -lodbc32
.IF "$(CFG)" == "Debug"
OPTIMIZE = -g $(RUNTIME) -DDEBUGGING
@@ -371,6 +385,9 @@ OBJOUT_FLAG = -o
EXEOUT_FLAG = -o
LIBOUT_FLAG =
+# tack COREDIR on for perl build
+PRIV_LINK_FLAGS = -L"$(COREDIR)"
+
.ELSE
CC = cl
@@ -430,8 +447,8 @@ LINK_DBG = -release
LIBBASEFILES = $(DELAYLOAD) $(CRYPT_LIB) \
oldnames.lib kernel32.lib user32.lib gdi32.lib \
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \
- oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
- version.lib odbc32.lib odbccp32.lib
+ oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib \
+ winmm.lib version.lib odbc32.lib odbccp32.lib
# we add LIBC here, since we may be using PerlCRT.dll
LIBFILES = $(LIBBASEFILES) $(LIBC)
@@ -452,8 +469,19 @@ OPTIMIZE += $(CXX_FLAG)
BUILDOPT += -DPERL_OBJECT
.ENDIF
+CRTIMPLIBS *= __not_needed
+PERLCRT_A *= $(COREDIR)\libPerlCRT.a
+PERLCRT_DEF *= PerlCRT.def
+OLDNAMES_A *= $(COREDIR)\liboldnames.a
+OLDNAMES_DEF *= oldnames.def
+
CFLAGS_O = $(CFLAGS) $(BUILDOPT)
+# used to allow local linking flags that are not propogated into Config.pm
+# -- BKS, 11-15-1999
+PRIV_LINK_FLAGS *=
+BLINK_FLAGS = $(PRIV_LINK_FLAGS) $(LINK_FLAGS)
+
#################### do not edit below this line #######################
############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
@@ -477,14 +505,14 @@ LKPOST = )
$(o).dll:
.IF "$(CCTYPE)" == "BORLAND"
- $(LINK32) -Tpd -ap $(LINK_FLAGS) c0d32$(o) $<,$@,,$(LIBFILES),$(*B).def
+ $(LINK32) -Tpd -ap $(BLINK_FLAGS) c0d32$(o) $<,$@,,$(LIBFILES),$(*B).def
$(IMPLIB) $(*B).lib $@
.ELIF "$(CCTYPE)" == "GCC"
- $(LINK32) -o $@ $(LINK_FLAGS) $< $(LIBFILES)
+ $(LINK32) -o $@ $(BLINK_FLAGS) $< $(LIBFILES)
$(IMPLIB) -def $(*B).def $(*B).a $@
.ELSE
$(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
- -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
+ -out:$@ $(BLINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
.ENDIF
#
@@ -697,6 +725,12 @@ X2P_OBJ = $(X2P_SRC:db:+$(o))
PERLDLL_OBJ = $(CORE_OBJ)
PERLEXE_OBJ = perlmain$(o)
+.IF "$(CCTYPE)" == "GCC"
+PERLEXE_OBJ += .\gcrt0$(o)
+MINI_OBJ += $(MINIDIR)\gcrt0$(o)
+DLL_OBJ += .\gdllcrt0$(o)
+.ENDIF
+
PERLDLL_OBJ += $(WIN32_OBJ) $(DLL_OBJ)
.IF "$(USE_SETARGV)" != ""
@@ -786,68 +820,146 @@ POD2MAN = $(PODDIR)\pod2man
POD2LATEX = $(PODDIR)\pod2latex
POD2TEXT = $(PODDIR)\pod2text
+# vars must be separated by "\t+~\t+", since we're using the tempfile
+# version of config_sh.pl (we were overflowing someone's buffer by
+# trying to fit them all on the command line)
+# -- BKS 10-17-1999
CFG_VARS = \
- "INST_DRV=$(INST_DRV)" \
- "INST_TOP=$(INST_TOP)" \
- "INST_VER=$(INST_VER)" \
- "INST_ARCH=$(INST_ARCH)" \
- "archname=$(ARCHNAME)" \
- "cc=$(CC)" \
- "ccflags=$(OPTIMIZE:s/"/\"/) $(DEFINES) $(BUILDOPT)" \
- "cf_email=$(EMAIL)" \
- "d_crypt=$(D_CRYPT)" \
- "d_mymalloc=$(PERL_MALLOC)" \
- "libs=$(LIBFILES:f)" \
- "incpath=$(CCINCDIR:s/"/\"/)" \
- "libperl=$(PERLIMPLIB:f)" \
- "libpth=$(CCLIBDIR:s/"/\"/);$(EXTRALIBDIRS:s/"/\"/)" \
- "libc=$(LIBC)" \
- "make=dmake" \
- "_o=$(o)" "obj_ext=$(o)" \
- "_a=$(a)" "lib_ext=$(a)" \
- "static_ext=$(STATIC_EXT)" \
- "dynamic_ext=$(DYNAMIC_EXT)" \
- "nonxs_ext=$(NONXS_EXT)" \
- "usethreads=$(USE_THREADS)" \
- "usemultiplicity=$(USE_MULTI)" \
- "LINK_FLAGS=$(LINK_FLAGS:s/"/\"/)" \
- "optimize=$(OPTIMIZE:s/"/\"/)"
+ INST_DRV=$(INST_DRV) ~ \
+ INST_TOP=$(INST_TOP) ~ \
+ INST_VER=$(INST_VER:s/\/\\/) ~ \
+ INST_ARCH=$(INST_ARCH) ~ \
+ archname=$(ARCHNAME) ~ \
+ cc=$(CC) ~ \
+ ccflags=$(OPTIMIZE) $(DEFINES) $(BUILDOPT) ~ \
+ cf_email=$(EMAIL) ~ \
+ d_crypt=$(D_CRYPT) ~ \
+ d_mymalloc=$(PERL_MALLOC) ~ \
+ libs=$(LIBFILES:f) ~ \
+ incpath=$(CCINCDIR) ~ \
+ libperl=$(PERLIMPLIB:f) ~ \
+ libpth=$(CCLIBDIR);$(EXTRALIBDIRS) ~ \
+ libc=$(LIBC) ~ \
+ make=dmake ~ \
+ _o=$(o) obj_ext=$(o) ~ \
+ _a=$(a) lib_ext=$(a) ~ \
+ static_ext=$(STATIC_EXT) ~ \
+ dynamic_ext=$(DYNAMIC_EXT) ~ \
+ nonxs_ext=$(NONXS_EXT) ~ \
+ usethreads=$(USE_THREADS) ~ \
+ usemultiplicity=$(USE_MULTI) ~ \
+ LINK_FLAGS=$(LINK_FLAGS:s/\/\\/) ~ \
+ optimize=$(OPTIMIZE)
+
+#
+# set up targets varying between Win95 and WinNT builds
+#
+
+.IF "$(IS_WIN95)" == "define"
+MK2 = .\makefile.95
+RIGHTMAKE = __switch_makefiles
+NOOP = @rem
+.ELSE
+MK2 = __not_needed
+RIGHTMAKE = __not_needed
+.ENDIF
#
# Top targets
#
-.IF "$(IS_WIN95)" != ""
-MK2 = .\makew95.mk
+all : $(CRTIMPLIBS) .\config.h $(GLOBEXE) $(MINIPERL) $(MK2) \
+ $(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) \
+ $(X2P) $(EXTENSION_DLL) $(EXTENSION_PM)
+
+$(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
+
+#----------------------------------------------------------------
+
+#-------------------- BEGIN Win95 SPECIFIC ----------------------
+
+# this target is a jump-off point for Win95
+# 1. it switches to the Win95-specific makefile if it exists
+# (__do_switc_makefiles)
+# 2. it prints a message when the Win95-specific one finishes (__done)
+# 3. it then kills this makefile by trying to make __no_such_target
-all : .\config.h $(GLOBEXE) $(MINIMOD) $(MK2)
-all2 : $(CONFIGPM) $(PERLEXE) $(PERL95EXE) $(X2P) $(EXTENSION_DLL) \
- $(EXTENSIOM_PM)
+__switch_makefiles: __do_switch_makefiles __done __no_such_target
+
+__do_switch_makefiles:
+.IF "$(NOTFIRST)" != "true"
+ if exist $(MK2) $(MAKE:s/-S//) -f $(MK2) $(MAKETARGETS) NOTFIRST=true
.ELSE
-all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) \
- $(X2P) $(EXTENSION_DLL) $(EXTENSION_PM)
+ $(NOOP)
.ENDIF
-$(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
+.IF "$(NOTFIRST)" != "true"
+__done:
+ @echo Build process complete. Ignore any errors after this message.
+ @echo Run "dmake test" to test and "dmake install" to install
+
+.ELSE
+# dummy targets for Win95-specific makefile
-#------------------------------------------------------------
+__done:
+ $(NOOP)
+
+__no_such_target:
+ $(NOOP)
-# 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
+# This target is used to generate the new makefile (.\makefile.95) for Win95
+
+.\makefile.95: .\makefile.mk
+ $(MINIPERL) genmk95.pl makefile.mk $(MK2)
+
+#--------------------- END Win95 SPECIFIC ---------------------
+
+#--------------------- BEGIN GCC/Mingw32 SPECIFIC -------------
+
+# make GCC-ish implib for PerlCRT.dll if needed
+$(PERLCRT_A): $(PERLCRT_DEF)
+ if not exist $(COREDIR) mkdir $(COREDIR)
+ $(IMPLIB) --def $(PERLCRT_DEF) \
+ --dllname $(LIBCDLL) \
+ --output-lib $(PERLCRT_A)
+
+# make GCC-ish oldnames implib for our CRT (whether it's MSVCRT or PerlCRT)
+$(OLDNAMES_A): $(OLDNAMES_DEF)
+ $(IMPLIB) --def $(OLDNAMES_DEF) \
+ --dllname $(LIBCDLL) \
+ --output-lib $(OLDNAMES_A) \
+ --add-underscore
+
+# MSVCRT-using runtime startup files
+$(MINIDIR)\gcrt0$(o): .\gstartup.c
+ $(CC) -c $(CFLAGS) -DEXESTARTUP $(OBJOUT_FLAG)$@ .\gstartup.c
+
+.\gcrt0$(o): .\gstartup.c
+ $(CC) -c $(CFLAGS) -DEXESTARTUP $(OBJOUT_FLAG)$@ .\gstartup.c
+
+.\gdllcrt0$(o): .\gstartup.c
+ $(CC) -c $(CFLAGS) -DDLLSTARTUP $(OBJOUT_FLAG)$@ .\gstartup.c
+ $(XCOPY) $@ $(COREDIR)
+
+
+#--------------------- END GCC/Mingw32 SPECIFIC ---------------
+
+# a blank target for when builds don't need to do certain things
+# this target added for Win95 port but used to keep the WinNT port able to
+# use this file
+__not_needed:
+
$(GLOBEXE) : perlglob$(o)
.IF "$(CCTYPE)" == "BORLAND"
$(CC) -c -w -v -tWM -I"$(CCINCDIR)" perlglob.c
- $(LINK32) -Tpe -ap $(LINK_FLAGS) c0x32$(o) perlglob$(o) \
+ $(LINK32) -Tpe -ap $(BLINK_FLAGS) c0x32$(o) perlglob$(o) \
"$(CCLIBDIR)\32BIT\wildargs$(o)",$@,,import32.lib cw32mt.lib,
.ELIF "$(CCTYPE)" == "GCC"
- $(LINK32) $(LINK_FLAGS) -o $@ perlglob$(o) $(LIBFILES)
+ $(LINK32) $(BLINK_FLAGS) -o $@ perlglob$(o) $(LIBFILES)
.ELSE
- $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
+ $(LINK32) $(BLINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
perlglob$(o) setargv$(o)
.ENDIF
@@ -861,7 +973,8 @@ config.w32 : $(CFGSH_TMPL)
copy $(CFGH_TMPL) config.h
..\config.sh : config.w32 $(MINIPERL) config_sh.PL
- $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) config.w32 > ..\config.sh
+ $(MINIPERL) -I..\lib config_sh.PL --cfgsh-option-file \
+ $(mktmp $(CFG_VARS)) config.w32 > ..\config.sh
# this target is for when changes to the main config.sh happen
# edit config.{b,v,g}c and make this target once for each supported
@@ -885,16 +998,16 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
$(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)" \
|| $(MAKE) $(MAKEMACROS) $(CONFIGPM) $(MAKEFILE)
-$(MINIPERL) : $(MINIDIR) $(MINI_OBJ)
+$(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS)
.IF "$(CCTYPE)" == "BORLAND"
- $(LINK32) -Tpe -ap $(LINK_FLAGS) \
+ $(LINK32) -Tpe -ap $(BLINK_FLAGS) \
@$(mktmp c0x32$(o) $(MINI_OBJ:s,\,\\),$(@:s,\,\\),,$(LIBFILES),)
.ELIF "$(CCTYPE)" == "GCC"
- $(LINK32) -v -o $@ $(LINK_FLAGS) \
- $(mktmp $(LKPRE) $(MINI_OBJ:s,\,\\) $(LIBFILES) $(LKPOST))
+ $(LINK32) -v -nostdlib -o $@ $(BLINK_FLAGS) \
+ $(mktmp $(LKPRE) $(MINI_OBJ:s,\,\\) $(LIBFILES) $(LKPOST))
.ELSE
$(LINK32) -subsystem:console -out:$@ \
- @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ:s,\,\\))
+ @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(MINI_OBJ:s,\,\\))
.ENDIF
$(MINIDIR) :
@@ -973,14 +1086,14 @@ $(X2P) : $(MINIPERL) $(X2P_OBJ)
$(MINIPERL) ..\x2p\find2perl.PL
$(MINIPERL) ..\x2p\s2p.PL
.IF "$(CCTYPE)" == "BORLAND"
- $(LINK32) -Tpe -ap $(LINK_FLAGS) \
+ $(LINK32) -Tpe -ap $(BLINK_FLAGS) \
@$(mktmp c0x32$(o) $(X2P_OBJ:s,\,\\),$(@:s,\,\\),,$(LIBFILES),)
.ELIF "$(CCTYPE)" == "GCC"
- $(LINK32) -v -o $@ $(LINK_FLAGS) \
+ $(LINK32) -v -o $@ $(BLINK_FLAGS) \
$(mktmp $(LKPRE) $(X2P_OBJ:s,\,\\) $(LIBFILES) $(LKPOST))
.ELSE
$(LINK32) -subsystem:console -out:$@ \
- @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,\\))
+ @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,\\))
.ENDIF
perlmain.c : runperl.c
@@ -991,15 +1104,15 @@ perlmain$(o) : perlmain.c
$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ)
.IF "$(CCTYPE)" == "BORLAND"
- $(LINK32) -Tpe -ap $(LINK_FLAGS) \
+ $(LINK32) -Tpe -ap $(BLINK_FLAGS) \
@$(mktmp c0x32$(o) $(PERLEXE_OBJ:s,\,\\)\n \
$(@:s,\,\\),\n \
$(PERLIMPLIB) $(LIBFILES)\n)
.ELIF "$(CCTYPE)" == "GCC"
- $(LINK32) -o $@ $(LINK_FLAGS) \
+ $(LINK32) -nostdlib -o $@ $(BLINK_FLAGS) \
$(PERLEXE_OBJ) $(PERLIMPLIB) $(LIBFILES)
.ELSE
- $(LINK32) -subsystem:console -out:$@ $(LINK_FLAGS) $(LIBFILES) \
+ $(LINK32) -subsystem:console -out:$@ $(BLINK_FLAGS) $(LIBFILES) \
$(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB)
copy $(PERLEXE) $(WPERLEXE)
editbin /subsystem:windows $(WPERLEXE)
@@ -1030,7 +1143,7 @@ DynaLoadmt$(o) : $(DYNALOADER).c
$(OBJOUT_FLAG)DynaLoadmt$(o) $(DYNALOADER).c
$(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ)
- $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(LINK_FLAGS) \
+ $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(BLINK_FLAGS) \
$(LIBBASEFILES) $(PERL95_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) \
libcmt.lib
@@ -1179,7 +1292,7 @@ distclean: clean
install : all installbare installhtml
-installbare : utils
+installbare : $(RIGHTMAKE) utils
$(PERLEXE) ..\installperl
.IF "$(PERL95EXE)" != ""
$(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
@@ -1217,7 +1330,7 @@ test-prep : all utils
$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
.ENDIF
-test : test-prep
+test : $(RIGHTMAKE) test-prep
cd ..\t && $(PERLEXE) -I..\lib harness
test-notty : test-prep
diff --git a/win32/oldnames.def b/win32/oldnames.def
new file mode 100644
index 0000000000..a6ffd34a6f
--- /dev/null
+++ b/win32/oldnames.def
@@ -0,0 +1,115 @@
+;
+; oldnames.def
+;
+; oldnames versions of MSVCRT/PerlCRT functions for GCC/Mingw32
+;
+; This file is taken from the Mingw32 distribution
+; Created by Colin Peters for Mingw32
+;
+; Added to Perl5 distrbution by Benjamin Stuhl <sho_pi@hotmail.com>
+
+EXPORTS
+access
+beep
+cabs
+chdir
+chmod
+chsize
+close
+creat
+cwait
+dup
+dup2
+ecvt
+eof
+execl
+execle
+execlp
+execlpe
+execv
+execve
+execvp
+execvpe
+fcvt
+fdopen
+fgetchar
+fgetwchar
+filelength
+fileno
+fputchar
+fputwchar
+fstat
+ftime
+gcvt
+getch
+getche
+getcwd
+getpid
+getw
+heapwalk
+hypot
+isatty
+itoa
+j0
+j1
+jn
+kbhit
+lseek
+ltoa
+memccpy
+memicmp
+mkdir
+mktemp
+open
+pclose
+popen
+putch
+putenv
+putw
+read
+rmdir
+searchenv
+seterrormode
+setmode
+sleep
+sopen
+spawnl
+spawnle
+spawnlp
+spawnlpe
+spawnv
+spawnve
+spawnvp
+spawnvpe
+stat
+strcmpi
+strdup
+stricmp
+stricoll
+strlwr
+strnicmp
+strnset
+strrev
+strset
+strupr
+swab
+tell
+tempnam
+tzset
+umask
+ungetch
+unlink
+utime
+wcsdup
+wcsicmp
+wcsicoll
+wcslwr
+wcsnicmp
+wcsnset
+wcsrev
+wcsset
+wcsupr
+write
+y0
+y1
+yn
diff --git a/win32/win32.h b/win32/win32.h
index 28d582a270..d3224f1e61 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -268,13 +268,6 @@ typedef long gid_t;
# endif
#endif
-#ifndef _O_NOINHERIT
-# define _O_NOINHERIT 0x0080
-# ifndef _NO_OLDNAMES
-# define O_NOINHERIT _O_NOINHERIT
-# endif
-#endif
-
#endif /* __MINGW32__ */
/* compatibility stuff for other compilers goes here */