From: Gurusamy Sarathy Date: Tue, 2 Dec 1997 03:28:23 +0000 (+0000) Subject: [win32] various hacks to get mingw32 to build. Sync Makefile with makefile.mk. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=910dfcc863de04bd9adf089d5f905cb1c045b99f;p=p5sagit%2Fp5-mst-13.2.git [win32] various hacks to get mingw32 to build. Sync Makefile with makefile.mk. makegcc.mk to be merged into makefile.mk soon. p4raw-id: //depot/win32/perl@346 --- diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 778710c..101f76a 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -352,7 +352,9 @@ END push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB}; push @m, -q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")' : '-out:$@ $(OBJECT)').q{ +q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")' + : ($GCC ? '-ru $@ $(OBJECT)' + : '-out:$@ $(OBJECT)')).q{ }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld $(CHMOD) 755 $@ }; @@ -425,7 +427,8 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists '); if ($GCC) { push(@m, - q{ $(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp + q{ dlltool --def $(EXPORT_LIST) --output-exp dll.exp + $(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp $(LD) -o $@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp }); } else { diff --git a/win32/Makefile b/win32/Makefile index 2411ff4..191e584 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -11,11 +11,10 @@ # newly built perl. INST_DRV=c: INST_TOP=$(INST_DRV)\perl5004.5x -#BUILDOPT=-DUSE_THREADS +BUILDOPT=-DUSE_THREADS #BUILDOPT=-DMULTIPLICITY #BUILDOPT=-DMULTIPLICITY -DUSE_THREADS -BUILDOPT=-DPERL_GLOBAL_STRUCT -DMULTIPLICITY -CORECCOPT= +#BUILDOPT=-DPERL_GLOBAL_STRUCT -DMULTIPLICITY # # uncomment next line if you are using Visual C++ 2.x @@ -55,7 +54,7 @@ RUNTIME = -MD INCLUDES = -I.\include -I. -I.. #PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) -LOCDEFS = -DPERLDLL $(CORECCOPT) +LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console !IF "$(RUNTIME)" == "-MD" @@ -68,9 +67,9 @@ WINIOMAYBE = !IF "$(CFG)" == "Debug" ! IF "$(CCTYPE)" == "MSVC20" -OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG +OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG -DDEBUGGING ! ELSE -OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG +OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG -DDEBUGGING ! ENDIF LINK_DBG = -debug -pdb:none !ELSE @@ -198,7 +197,7 @@ CORE_OBJ= ..\av.obj \ ..\toke.obj \ ..\universal.obj\ ..\util.obj \ - ..\malloc.obj + ..\malloc.obj WIN32_C = perllib.c \ win32.c \ @@ -207,7 +206,7 @@ WIN32_C = perllib.c \ WIN32_OBJ = win32.obj \ win32sck.obj \ - win32thread.obj + win32thread.obj PERL95_OBJ = perl95.obj \ win32mt.obj \ @@ -279,7 +278,7 @@ DYNALOADMODULES= \ $(OPCODE_DLL) \ $(SDBM_FILE_DLL)\ $(IO_DLL) \ - $(ATTRS_DLL) \ + $(ATTRS_DLL) \ $(THREAD_DLL) POD2HTML=$(PODDIR)\pod2html @@ -314,16 +313,23 @@ config.w32 : $(CFGSH_TMPL) .\config.h : $(CFGH_TMPL) -del /f config.h copy $(CFGH_TMPL) config.h - ..\config.sh : config.w32 $(MINIPERL) config_sh.PL - $(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" \ - "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(OPTIMIZE) $(DEFINES)" \ - "cf_email=$(EMAIL)" "libs=$(LIBFILES)" "incpath=$(CCINCDIR)" \ - "libpth=$(CCLIBDIR)" "libc=$(LIBC)" \ - "static_ext=$(STATIC_EXT)" "dynamic_ext=$(DYNAMIC_EXT)" \ - "ldflags=$(LINK_FLAGS)" "optimize=$(OPTIMIZE)" \ - config.w32 > ..\config.sh + $(MINIPERL) -I..\lib config_sh.PL \ + "INST_DRV=$(INST_DRV)" \ + "INST_TOP=$(INST_TOP)" \ + "cc=$(CC)" \ + "ccflags=$(OPTIMIZE) $(DEFINES)" \ + "cf_email=$(EMAIL)" \ + "libs=$(LIBFILES)" \ + "incpath=$(CCINCDIR)" \ + "libpth=$(CCLIBDIR)" \ + "libc=$(LIBC)" \ + "static_ext=$(STATIC_EXT)" \ + "dynamic_ext=$(DYNAMIC_EXT)" \ + "ldflags=$(LINK_FLAGS)" \ + "optimize=$(OPTIMIZE)" \ + config.w32 > ..\config.sh $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl cd .. && miniperl configpm @@ -344,8 +350,9 @@ $(CORE_OBJ) : $(CORE_H) $(DLL_OBJ) : $(CORE_H) $(PERL95_OBJ) : $(CORE_H) -perldll.def : $(MINIPERL) $(CONFIGPM) makedef.pl ..\global.sym - $(MINIPERL) -w makedef.pl $(DEFINES) $(CCTYPE) > perldll.def +perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym makedef.pl + $(MINIPERL) -w makedef.pl $(OPTIMIZE) $(DEFINES) \ + CCTYPE=$(CCTYPE) > perldll.def $(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ) $(LINK32) -dll -def:perldll.def -out:$@ @<< diff --git a/win32/config.gc b/win32/config.gc index a78198f..b267f54 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -45,7 +45,7 @@ State='' afs='false' alignbytes='8' aphostname='' -ar='lib' +ar='ar' archlib='~INST_TOP~\lib' archobjs='' awk='awk' diff --git a/win32/makedef.pl b/win32/makedef.pl index 1bda71e..eb33f66 100644 --- a/win32/makedef.pl +++ b/win32/makedef.pl @@ -14,10 +14,13 @@ # that does not present in the WIN32 port but there is no easy # way to find them so I just put a exception list here -while (@ARGV && $ARGV[0] =~ /^-/) +my $CCTYPE = "MSVC"; # default + +while (@ARGV) { my $flag = shift; $define{$1} = 1 if ($flag =~ /^-D(\w+)$/); + $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/); } open(CFG,'config.h') || die "Cannot open config.h:$!"; @@ -29,8 +32,6 @@ close(CFG); warn join(' ',keys %define)."\n"; -my $CCTYPE = shift || "MSVC"; - if ($CCTYPE ne 'GCC') { print "LIBRARY Perl\n"; @@ -235,7 +236,11 @@ Perl_sv_true Perl_sv_uv Perl_sv_pvn Perl_newRV_noinc)]; + } +unless ($define{'FAKE_THREADS'}) + { + skip_symbols [qw(Perl_curthr)]; } sub readvar diff --git a/win32/makefile.mk b/win32/makefile.mk index f700036..bddf16b 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -12,6 +12,9 @@ INST_DRV=c: INST_TOP=$(INST_DRV)\perl5004.5x BUILDOPT=-DUSE_THREADS +#BUILDOPT=-DMULTIPLICITY +#BUILDOPT=-DMULTIPLICITY -DUSE_THREADS +#BUILDOPT=-DPERL_GLOBAL_STRUCT -DMULTIPLICITY # -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include @@ -72,14 +75,14 @@ LIBFILES = import32.lib $(LIBC) odbc32.lib odbccp32.lib WINIOMAYBE = .IF "$(CFG)" == "Debug" -OPTIMIZE = -v $(RUNTIME) +OPTIMIZE = -v $(RUNTIME) -DDEBUGGING LINK_DBG = -v .ELSE OPTIMIZE = -5 -O2 $(RUNTIME) LINK_DBG = .ENDIF -CFLAGS = -w -tWM -tWD $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE) +CFLAGS = -w -d -tWM -tWD $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE) LINK_FLAGS = $(LINK_DBG) -L$(CCLIBDIR) OBJOUT_FLAG = -o @@ -110,9 +113,9 @@ WINIOMAYBE = .IF "$(CFG)" == "Debug" .IF "$(CCTYPE)" == "MSVC20" -OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG +OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG -DDEBUGGING .ELSE -OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG +OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG -DDEBUGGING .ENDIF LINK_DBG = -debug -pdb:none .ELSE @@ -262,7 +265,7 @@ CORE_OBJ= ..\av.obj \ ..\taint.obj \ ..\toke.obj \ ..\universal.obj\ - ..\util.obj \ + ..\util.obj \ ..\malloc.obj WIN32_C = perllib.c \ @@ -309,6 +312,9 @@ CORE_H = ..\av.h \ ..\XSUB.h \ .\config.h \ ..\EXTERN.h \ + ..\perlvars.h \ + ..\intrpvar.h \ + ..\thrdvar.h \ .\include\dirent.h \ .\include\netdb.h \ .\include\sys\socket.h \ @@ -384,13 +390,21 @@ config.w32 : $(CFGSH_TMPL) copy $(CFGH_TMPL) config.h ..\config.sh : config.w32 $(MINIPERL) config_sh.PL - $(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" \ - "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(OPTIMIZE) $(DEFINES)" \ - "cf_email=$(EMAIL)" "libs=$(LIBFILES:f)" "incpath=$(CCINCDIR)" \ - "libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" "libc=$(LIBC)" \ - "static_ext=$(STATIC_EXT)" "dynamic_ext=$(DYNAMIC_EXT)" \ - "ldflags=$(LINK_FLAGS)" "optimize=$(OPTIMIZE)" \ - config.w32 > ..\config.sh + $(MINIPERL) -I..\lib config_sh.PL \ + "INST_DRV=$(INST_DRV)" \ + "INST_TOP=$(INST_TOP)" \ + "cc=$(CC)" \ + "ccflags=$(OPTIMIZE) $(DEFINES)" \ + "cf_email=$(EMAIL)" \ + "libs=$(LIBFILES:f)" \ + "incpath=$(CCINCDIR)" \ + "libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" \ + "libc=$(LIBC)" \ + "static_ext=$(STATIC_EXT)" \ + "dynamic_ext=$(DYNAMIC_EXT)" \ + "ldflags=$(LINK_FLAGS)" \ + "optimize=$(OPTIMIZE)" \ + config.w32 > ..\config.sh $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl cd .. && miniperl configpm @@ -417,7 +431,8 @@ $(CORE_OBJ) : $(CORE_H) $(DLL_OBJ) : $(CORE_H) perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym makedef.pl - $(MINIPERL) -w makedef.pl $(DEFINES) $(CCTYPE) > perldll.def + $(MINIPERL) -w makedef.pl $(OPTIMIZE) $(DEFINES) \ + CCTYPE=$(CCTYPE) > perldll.def $(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ) .IF "$(CCTYPE)" == "BORLAND" @@ -447,7 +462,6 @@ perlmain.c : runperl.c perlmain.obj : perlmain.c $(CC) $(CFLAGS) -UPERLDLL -c perlmain.c - $(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.obj .IF "$(CCTYPE)" == "BORLAND" $(LINK32) -Tpe -ap $(LINK_FLAGS) \ @@ -469,13 +483,13 @@ perl95.c : runperl.c copy runperl.c perl95.c perl95.obj : perl95.c - $(CC) $(CFLAGS) -MT -UPERLDLL -c perl95.c + $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c perl95.c win32sckmt.obj : win32sck.c - $(CC) $(CFLAGS) -MT -c $(OBJOUT_FLAG)win32sckmt.obj win32sck.c + $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c $(OBJOUT_FLAG)win32sckmt.obj win32sck.c win32mt.obj : win32.c - $(CC) $(CFLAGS) -MT -c $(OBJOUT_FLAG)win32mt.obj win32.c + $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c $(OBJOUT_FLAG)win32mt.obj win32.c $(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ) $(LINK32) -subsystem:console -out:perl95.exe $(LINK_FLAGS) $(LIBFILES) \ diff --git a/win32/makegcc.mk b/win32/makegcc.mk index 56daeca..8b4bfd9 100644 --- a/win32/makegcc.mk +++ b/win32/makegcc.mk @@ -320,8 +320,8 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl $(XCOPY) ..\*.h ..\lib\CORE\*.* $(XCOPY) *.h ..\lib\CORE\*.* $(RCOPY) include ..\lib\CORE\*.* - $(MINIPERL) -I..\lib config_h.PL || $(MAKE) CCTYPE=$(CCTYPE) \ - RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM) + $(MINIPERL) -I..\lib config_h.PL || $(MAKE) -f makegcc.mk \ + CCTYPE=$(CCTYPE) RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM) LKPRE = INPUT ( LKPOST = ) diff --git a/win32/win32.h b/win32/win32.h index 9b53a9a..c1e0121 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -94,7 +94,7 @@ struct tms { /* Compiler-specific stuff. */ -#ifdef __BORLANDC__ /* Microsoft Visual C++ */ +#ifdef __BORLANDC__ /* Borland C++ */ #define _access access #define _chdir chdir @@ -114,7 +114,7 @@ struct tms { #pragma warn -csu #pragma warn -pro -#else +#endif #ifdef _MSC_VER /* Microsoft Visual C++ */ @@ -124,9 +124,15 @@ typedef long gid_t; #endif /* _MSC_VER */ +#ifdef __MINGW32__ /* Minimal Gnu-Win32 */ + +typedef long uid_t; +typedef long gid_t; + +#endif /* __MINGW32__ */ + /* compatibility stuff for other compilers goes here */ -#endif START_EXTERN_C