diff options
-rw-r--r-- | XSUB.h | 11 | ||||
-rw-r--r-- | lib/ExtUtils/Command.pm | 3 | ||||
-rw-r--r-- | lib/ExtUtils/MM_Win32.pm | 37 | ||||
-rw-r--r-- | lib/ExtUtils/Mksymlists.pm | 8 | ||||
-rw-r--r-- | win32/config.gc | 26 | ||||
-rw-r--r-- | win32/makegcc.mk | 110 | ||||
-rw-r--r-- | win32/runperl.c | 12 | ||||
-rw-r--r-- | win32/win32.c | 22 | ||||
-rw-r--r-- | win32/win32iop.h | 2 |
9 files changed, 135 insertions, 96 deletions
@@ -6,6 +6,12 @@ #define XS(name) void name(cv) CV* cv; #endif +#if defined(WIN32) && defined(__GNUC__) +#define FORCE_ARG_STRING(x) #x +#else +#define FORCE_ARG_STRING(x) x +#endif + #define dXSARGS \ dSP; dMARK; \ I32 ax = mark - stack_base + 1; \ @@ -43,6 +49,7 @@ #ifdef XS_VERSION # define XS_VERSION_BOOTCHECK \ STMT_START { \ + char *xs_version = FORCE_ARG_STRING(XSVERSION); \ char *vn = "", *module = SvPV(ST(0),na); \ if (items >= 2) /* version supplied as bootstrap arg */ \ Sv = ST(1); \ @@ -54,9 +61,9 @@ Sv = perl_get_sv(form("%s::%s", module, \ vn = "VERSION"), FALSE); \ } \ - if (Sv && (!SvOK(Sv) || strNE(XS_VERSION, SvPV(Sv, na)))) \ + if (Sv && (!SvOK(Sv) || strNE(xs_version, SvPV(Sv, na)))) \ croak("%s object version %s does not match $%s::%s %_", \ - module, XS_VERSION, module, vn, Sv); \ + module, xs_version, module, vn, Sv); \ } STMT_END #else # define XS_VERSION_BOOTCHECK diff --git a/lib/ExtUtils/Command.pm b/lib/ExtUtils/Command.pm index d37d0f3c25..2f5f1e1689 100644 --- a/lib/ExtUtils/Command.pm +++ b/lib/ExtUtils/Command.pm @@ -107,11 +107,13 @@ Makes files exist, with current timestamp sub touch { expand_wildcards(); + my $t = time; while (@ARGV) { my $file = shift(@ARGV); open(FILE,">>$file") || die "Cannot write $file:$!"; close(FILE); + utime($t,$t,$file); } } @@ -187,6 +189,7 @@ sub test_f exit !-f shift(@ARGV); } + 1; __END__ diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 3545f2c5a4..778710cabc 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -30,6 +30,7 @@ $ENV{EMXSHELL} = 'sh'; # to run `commands` unshift @MM::ISA, 'ExtUtils::MM_Win32'; $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i; +$GCC = 1 if $Config{'cc'} =~ /^gcc/i; $DMAKE = 1 if $Config{'make'} =~ /^dmake/i; $NMAKE = 1 if $Config{'make'} =~ /^nmake/i; @@ -153,13 +154,20 @@ sub init_others $self->{'TEST_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e test_f'; $self->{'LD'} = $Config{'ld'} || 'link'; $self->{'AR'} = $Config{'ar'} || 'lib'; - $self->{'LDLOADLIBS'} - ||= ( $BORLAND - ? 'import32.lib cw32mti.lib ' - : 'msvcrt.lib oldnames.lib kernel32.lib comdlg32.lib winspool.lib gdi32.lib ' - .'advapi32.lib user32.lib shell32.lib netapi32.lib ole32.lib ' - .'oleaut32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib ' - ) . ' odbc32.lib odbccp32.lib'; + if ($GCC) + { + $self->{'LDLOADLIBS'} ||= ' '; + } + else + { + $self->{'LDLOADLIBS'} + ||= ( $BORLAND + ? 'import32.lib cw32mti.lib ' + : 'msvcrt.lib oldnames.lib kernel32.lib comdlg32.lib winspool.lib gdi32.lib ' + .'advapi32.lib user32.lib shell32.lib netapi32.lib ole32.lib ' + .'oleaut32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib ' + ) . ' odbc32.lib odbccp32.lib'; + } $self->{'DEV_NULL'} = '> NUL'; # $self->{'NOECHO'} = ''; # till we have it working } @@ -415,11 +423,17 @@ INST_DYNAMIC_DEP = '.$inst_dynamic_dep.' $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP) '); - - push(@m, $BORLAND ? -q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) $(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,),$(RESFILES)} : -q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)} + if ($GCC) { + push(@m, + q{ $(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 { + push(@m, $BORLAND ? + q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) $(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,),$(RESFILES)} : + q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)} ); + } push @m, ' $(CHMOD) 755 $@ '; @@ -782,3 +796,4 @@ __END__ =cut + diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm index 350136455f..6bd49f2b73 100644 --- a/lib/ExtUtils/Mksymlists.pm +++ b/lib/ExtUtils/Mksymlists.pm @@ -107,9 +107,11 @@ sub _write_win32 { open(DEF,">$data->{FILE}.def") or croak("Can't create $data->{FILE}.def: $!\n"); # put library name in quotes (it could be a keyword, like 'Alias') - print DEF "LIBRARY \"$data->{DLBASE}\"\n"; - print DEF "CODE LOADONCALL\n"; - print DEF "DATA LOADONCALL NONSHARED MULTIPLE\n"; + if ($Config::Config{'cc'} !~ /^gcc/i) { + print DEF "LIBRARY \"$data->{DLBASE}\"\n"; + print DEF "CODE LOADONCALL\n"; + print DEF "DATA LOADONCALL NONSHARED MULTIPLE\n"; + } print DEF "EXPORTS\n "; my @syms; # Export public symbols both with and without underscores to diff --git a/win32/config.gc b/win32/config.gc index 096444c6d0..a78198ffe1 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -7,8 +7,8 @@ archlibexp='~INST_TOP~\lib' archname='MSWin32' -cc='cl' -ccflags='-MD -DWIN32' +cc='gcc' +ccflags='-DWIN32' cppflags='-DWIN32' dlsrc='dl_win32.xs' dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread' @@ -16,7 +16,7 @@ extensions='~static_ext~ ~dynamic_ext~' installarchlib='~INST_TOP~\lib' installprivlib='~INST_TOP~\lib' libpth='' -libs='' +libs=' ' osname='MSWin32' osvers='4.0' prefix='~INST_DRV~' @@ -59,7 +59,7 @@ byteorder='1234' c='' castflags='0' cat='type' -cccdlflags=' ' +cccdlflags='-dll' ccdlflags=' ' cf_by='nobody' cf_email='nobody@no.where.net' @@ -76,9 +76,9 @@ cpio='' cpp='cpp' cpp_stuff='42' cpplast='' -cppminus='' -cpprun='cl -E' -cppstdin='cl -E' +cppminus='-' +cpprun='gcc -E' +cppstdin='gcc -E' cryptlib='' csh='undef' d_Gconvert='sprintf((b),"%.*g",(n),(x))' @@ -363,16 +363,16 @@ intsize='4' known_extensions='DB_File Fcntl GDBM_File NDBM_File ODBM_File Opcode POSIX SDBM_File Socket IO attrs Thread' ksh='' large='' -ld='link' +ld='gcc' lddlflags='-dll' -ldflags='-nologo -subsystem:windows' +ldflags='' less='less' lib_ext='.lib' libc='msvcrt.lib' libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x' line='line' lint='' -lkflags='' +lkflags=' ' ln='' lns='copy' locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include' @@ -384,7 +384,7 @@ ls='dir' lseektype='off_t' mail='' mailx='' -make='nmake' +make='dmake' mallocobj='malloc.o' mallocsrc='malloc.c' malloctype='void *' @@ -411,10 +411,10 @@ nm_opt='' nm_so_opt='' nroff='' o_nonblock='O_NONBLOCK' -obj_ext='.obj' +obj_ext='.o' oldarchlib='' oldarchlibexp='' -optimize='-O' +optimize='-O2' orderlib='false' package='perl5' pager='more /e' diff --git a/win32/makegcc.mk b/win32/makegcc.mk index a61d4bea5c..a6c574e32a 100644 --- a/win32/makegcc.mk +++ b/win32/makegcc.mk @@ -71,7 +71,7 @@ WINIOMAYBE = OPTIMIZE = -g -O2 $(RUNTIME) LINK_DBG = -g .ELSE -OPTIMIZE = -O2 $(RUNTIME) +OPTIMIZE = -g -O2 $(RUNTIME) LINK_DBG = .ENDIF @@ -86,15 +86,15 @@ OBJOUT_FLAG = -o # Rules # .SUFFIXES : -.SUFFIXES : .c .obj .dll .lib .exe +.SUFFIXES : .c .o .dll .lib .exe -.c.obj: +.c.o: $(CC) -c $(CFLAGS) $(OBJOUT_FLAG) $@ $< .c.i: $(CC) -E $(CFLAGS) $(OBJOUT_FLAG) $@ $< -.obj.dll: +.o.dll: $(LINK32) -o $@ $(LINK_FLAGS) $< $(LIBFILES), $(IMPLIB) -def $(*B).def $(*B).lib $@ @@ -164,48 +164,48 @@ CORE_C= ..\av.c \ ..\util.c \ ..\malloc.c -CORE_OBJ= ..\av.obj \ - ..\deb.obj \ - ..\doio.obj \ - ..\doop.obj \ - ..\dump.obj \ - ..\globals.obj \ - ..\gv.obj \ - ..\hv.obj \ - ..\mg.obj \ - ..\op.obj \ - ..\perl.obj \ - ..\perlio.obj \ - ..\perly.obj \ - ..\pp.obj \ - ..\pp_ctl.obj \ - ..\pp_hot.obj \ - ..\pp_sys.obj \ - ..\regcomp.obj \ - ..\regexec.obj \ - ..\run.obj \ - ..\scope.obj \ - ..\sv.obj \ - ..\taint.obj \ - ..\toke.obj \ - ..\universal.obj\ - ..\util.obj \ - ..\malloc.obj +CORE_OBJ= ..\av.o \ + ..\deb.o \ + ..\doio.o \ + ..\doop.o \ + ..\dump.o \ + ..\globals.o \ + ..\gv.o \ + ..\hv.o \ + ..\mg.o \ + ..\op.o \ + ..\perl.o \ + ..\perlio.o \ + ..\perly.o \ + ..\pp.o \ + ..\pp_ctl.o \ + ..\pp_hot.o \ + ..\pp_sys.o \ + ..\regcomp.o \ + ..\regexec.o \ + ..\run.o \ + ..\scope.o \ + ..\sv.o \ + ..\taint.o \ + ..\toke.o \ + ..\universal.o\ + ..\util.o \ + ..\malloc.o WIN32_C = perllib.c \ win32.c \ win32sck.c \ win32thread.c -WIN32_OBJ = win32.obj \ - win32sck.obj \ - win32thread.obj +WIN32_OBJ = win32.o \ + win32sck.o \ + win32thread.o -PERL95_OBJ = perl95.obj \ - win32mt.obj \ - win32sckmt.obj +PERL95_OBJ = perl95.o \ + win32mt.o \ + win32sckmt.o -DLL_OBJ = perllib.obj $(DYNALOADER).obj +DLL_OBJ = perllib.o $(DYNALOADER).o CORE_H = ..\av.h \ ..\cop.h \ @@ -283,20 +283,20 @@ MAKE = dmake all: $(PERLEXE) $(PERL95EXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD) $(GLOBBAT) -$(DYNALOADER).obj : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c +$(DYNALOADER).o : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c #------------------------------------------------------------ -$(GLOBEXE): perlglob.obj +$(GLOBEXE): perlglob.o $(LINK32) $(LINK_FLAGS) -o $@ \ - perlglob.obj $(LIBFILES) + perlglob.o $(LIBFILES) $(GLOBBAT) : ..\lib\File\DosGlob.pm $(MINIPERL) $(MINIPERL) $(PL2BAT) - < ..\lib\File\DosGlob.pm > $(GLOBBAT) -perlglob.obj : perlglob.c +perlglob.o : perlglob.c -..\miniperlmain.obj : ..\miniperlmain.c $(CORE_H) +..\miniperlmain.o : ..\miniperlmain.c $(CORE_H) config.w32 : $(CFGSH_TMPL) copy $(CFGSH_TMPL) config.w32 @@ -326,15 +326,15 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl LKPRE = INPUT ( LKPOST = ) -linkscript : ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ) - type $(mktmp $(LKPRE) ..\miniperlmain.obj \ +linkscript : ..\miniperlmain.o $(CORE_OBJ) $(WIN32_OBJ) + type $(mktmp $(LKPRE) ..\miniperlmain.o \ $(CORE_OBJ:s,\,\\) $(WIN32_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) -$(MINIPERL) : ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ) +$(MINIPERL) : ..\miniperlmain.o $(CORE_OBJ) $(WIN32_OBJ) $(LINK32) -v -o $@ $(LINK_FLAGS) \ - $(mktmp $(LKPRE) ..\miniperlmain.obj \ + $(mktmp $(LKPRE) ..\miniperlmain.o \ $(CORE_OBJ:s,\,\\) $(WIN32_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) $(WIN32_OBJ) : $(CORE_H) @@ -367,13 +367,13 @@ $(MINIMOD) : $(MINIPERL) ..\minimod.pl perlmain.c : runperl.c copy runperl.c perlmain.c -perlmain.obj : perlmain.c +perlmain.o : perlmain.c $(CC) $(CFLAGS) -UPERLDLL -o $@ -c perlmain.c -$(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.obj +$(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.o $(LINK32) -o perl.exe $(LINK_FLAGS) \ - perlmain.obj $(WINIOMAYBE) $(PERLIMPLIB) $(LIBFILES) + perlmain.o $(WINIOMAYBE) $(PERLIMPLIB) $(LIBFILES) copy perl.exe $@ del perl.exe copy splittree.pl .. @@ -456,7 +456,7 @@ distclean: clean -del /f perl95.c .ENDIF -del /f bin\*.bat - -cd $(EXTDIR) && del /s *.lib *.def *.map *.bs Makefile *.obj pm_to_blib + -cd $(EXTDIR) && del /s *.lib *.def *.map *.bs Makefile *.o pm_to_blib -rmdir /s /q ..\lib\auto -rmdir /s /q ..\lib\CORE @@ -509,10 +509,10 @@ test-notty : test-prep cd ..\t && $(PERLEXE) -I.\lib harness clean : - -@erase miniperlmain.obj + -@erase miniperlmain.o -@erase $(MINIPERL) - -@erase perlglob.obj - -@erase perlmain.obj + -@erase perlglob.o + -@erase perlmain.o -@erase config.w32 -@erase /f config.h -@erase $(GLOBEXE) @@ -521,7 +521,7 @@ clean : -@erase $(CORE_OBJ) -@erase $(WIN32_OBJ) -@erase $(DLL_OBJ) - -@erase ..\*.obj ..\*.lib ..\*.exp *.obj *.lib *.exp + -@erase ..\*.o ..\*.lib ..\*.exp *.o *.lib *.exp -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat -@erase *.ilk -@erase *.pdb diff --git a/win32/runperl.c b/win32/runperl.c index ff0a5718ee..954460739f 100644 --- a/win32/runperl.c +++ b/win32/runperl.c @@ -1,8 +1,20 @@ /* Say NO to CPP! Hallelujah! */ #ifdef __GNUC__ +/* + * GNU C does not do __declspec() + */ #define __declspec(foo) + +/* Mingw32 defaults to globing command line + * This is inconsistent with other Win32 ports and + * seems to cause trouble with passing -DXSVERSION=\"1.6\" + * So we turn it off like this: + */ +int _CRT_glob = 0; + #endif + __declspec(dllimport) int RunPerl(int argc, char **argv, char **env, void *ios); int diff --git a/win32/win32.c b/win32/win32.c index a01ff6fb44..613d9815ca 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -28,11 +28,21 @@ #include "XSUB.h" #include <fcntl.h> #include <sys/stat.h> +#ifndef __GNUC__ +/* assert.h conflicts with #define of assert in perl.h */ #include <assert.h> +#endif #include <string.h> #include <stdarg.h> #include <float.h> +#ifdef __GNUC__ +/* Mingw32 defaults to globing command line + * So we turn it off like this: + */ +int _CRT_glob = 0; +#endif + #define EXECF_EXEC 1 #define EXECF_SPAWN 2 #define EXECF_SPAWN_NOWAIT 3 @@ -1126,21 +1136,13 @@ win32_pipe(int *pfd, unsigned int size, int mode) DllExport FILE* win32_popen(const char *command, const char *mode) { -#ifdef __GNUC__ - return NULL; -#else return _popen(command, mode); -#endif } DllExport int win32_pclose(FILE *pf) { -#ifdef __GNUC__ - return fclose(pf); -#else return _pclose(pf); -#endif } DllExport int @@ -1263,17 +1265,13 @@ win32_setvbuf(FILE *pf, char *buf, int type, size_t size) DllExport int win32_flushall(void) { -#ifndef __GNUC__ return flushall(); -#endif } DllExport int win32_fcloseall(void) { -#ifndef __GNUC__ return fcloseall(); -#endif } DllExport char* diff --git a/win32/win32iop.h b/win32/win32iop.h index c862cada26..ccc1a65218 100644 --- a/win32/win32iop.h +++ b/win32/win32iop.h @@ -211,7 +211,9 @@ END_EXTERN_C #define perror win32_perror #define setbuf win32_setbuf #define setvbuf win32_setvbuf +#undef flushall #define flushall win32_flushall +#undef fcloseall #define fcloseall win32_fcloseall #define fgets win32_fgets #define gets win32_gets |