diff options
author | Sisyphus <sisyphus1@optusnet.com.au> | 2009-11-09 22:56:14 -0500 |
---|---|---|
committer | David Golden <dagolden@cpan.org> | 2009-11-09 22:56:14 -0500 |
commit | fa58a56f3cdf71021d7d7a49e98845f57652a3fe (patch) | |
tree | 7f1bcb4b29fa6d5d8645346f7871a9dedeeee64c /win32 | |
parent | cca43f7877df27a183ef8184587126e106940d27 (diff) | |
download | perl-fa58a56f3cdf71021d7d7a49e98845f57652a3fe.tar.gz |
Add mingw64 support
Hi,
Using the attached patch to the blead source (as of a few hours ago), I can
build perl with the following OS/compiler/make combos.
On 32-bit XP:
MSVC++ 7.0 / dmake (uses win32/makefile.mk)
MSVC++ 7.0 / nmake (uses win32/Makefile)
Borland C++ 5.5.1 / dmake
mingw.org's gcc-4.3.0 / dmake
mingw.org's gcc-3.4.5 / dmake
mingw-w64.sf's 32-bit gcc-4.4.3 / dmake
(There's a bug with that last compiler on XP.
The perl it builds on XP hangs on XP, but runs ok if copied across to Vista.
I think this is unrelated to the patches - probably even unrelated to perl.
Without these patches perl will not even build using that last compiler.)
On 64-bit Vista:
32-bit MSVC++ 7.0 / nmake (uses win32/Makefile)
32-bit MSVC++ 7.0 / dmake (uses win32/makfile.mk)
32-bit Borland C++ 5.5.1 / dmake
mingw.org's 32-bit gcc-4.4.0 / dmake
mingw.org's 32-bit gcc-3.4.5 / dmake
mingw-w64.sf's 32-bit gcc-4.4.3 / dmake
mingw-w64.sf's 64-bit gcc-4.4.3 / dmake
mingw-w64.sf's 64-bit x86_64-w64-mingw32-gcc-4.4.3 / dmake
64-bit MicrosoftPlatform SDK for Windows Server 2003 R2 / dmake (uses
win32/makefile.mk)
64-bit MicrosoftPlatform SDK for Windows Server 2003 R2 / nmake (uses
win32/Makefile)
Not all of those builds pass all tests - but where the removal of the
patches still permits perl to build, the same tests still fail. That is,
*nothing* is lost by including these patches - but there are significant
gains.
Each of the above builds was done according to the normal win32
configuration parameters - ie multi-threaded, non debug. No unusual config
settings were applied. (I did build one debug perl on Vista using
mingw-w64.sf's 32-bit gcc-4.4.3 and it built fine.)
Please feel free to apply these patches (with or without modification) -
and, yes, you're more than welcome to blame me if they cause any breakages
;-)
Of course, some of those compilers (Borland, Microsoft, and the compilers
from mingw.org) already build perl *without* having to apply any patches.
It's just the other compilers that need the patches. The purpose of testing
with Borland, Microsoft, and the mingw.org compilers is just to check that
these patches don't break them.
As a final check, I've done a build on my aging linux (mandrake-9.1) box,
gcc-3.2.2. I built with '-des -Duselongdouble -Duse64bitint -Dusedevel'. No
problem with that, either.
If there's additional testing requirements please let me know, and I'll try
to oblige.
I believe the patch applied successfully for me - see below my sig for the
output.
Cheers,
Rob
Rob@desktop2 ~/GIT/blead
$ patch -p0 <blead_diff.diff
patching file dist/threads/threads.xs
patching file handy.h
patching file cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm
patching file op.c
Hunk #1 succeeded at 5774 (offset 47 lines).
patching file pp_pack.c
patching file util.c
Hunk #1 succeeded at 5366 (offset -28 lines).
patching file win32/makefile.mk
patching file win32/perlhost.h
patching file win32/win32.c
patching file win32/win32.h
patching file README.win32
patching file XSUB.h
Diffstat (limited to 'win32')
-rw-r--r-- | win32/makefile.mk | 59 | ||||
-rw-r--r-- | win32/perlhost.h | 2 | ||||
-rw-r--r-- | win32/win32.c | 2 | ||||
-rw-r--r-- | win32/win32.h | 17 |
4 files changed, 71 insertions, 9 deletions
diff --git a/win32/makefile.mk b/win32/makefile.mk index d46db1b2c3..a3924729d1 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -112,7 +112,7 @@ USE_LARGE_FILES *= define #CCTYPE *= MSVC90 # Borland 5.02 or later #CCTYPE *= BORLAND -# MinGW with gcc-2.95.2 or later +# MinGW or mingw-w64 with gcc-2.95.2 or later CCTYPE *= GCC # @@ -220,6 +220,29 @@ CCINCDIR *= $(CCHOME)\include CCLIBDIR *= $(CCHOME)\lib # +# If building with gcc-4.x.x (or x86_64-w64-mingw32-gcc-4.x.x), then +# uncomment the following assignment to GCC_4XX, make sure that CCHOME +# has been set correctly above, and uncomment the appropriate +# GCCHELPERDLL line. +# The name of the dll can change, depending upon which vendor has supplied +# your 4.x.x compiler, and upon the values of "x". +# (The dll will be in your mingw/bin folder, so check there if you're +# unsure about the correct name.) +# Without these corrections, the op/taint.t test script will fail. +# +#GCC_4XX *= define +#GCCHELPERDLL *= $(CCHOME)\bin\libgcc_s_sjlj-1.dll +#GCCHELPERDLL *= $(CCHOME)\bin\libgcc_s_dw2-1.dll +#GCCHELPERDLL *= $(CCHOME)\bin\libgcc_s_1.dll + +# +# uncomment this if you are using x86_64-w64-mingw32 cross-compiler +# ie if your gcc executable is called 'x86_64-w64-mingw32-gcc' +# instead of the usual 'gcc'. +# +#GCCCROSS *= define + +# # Additional compiler flags can be specified here. # BUILDOPT *= $(BUILDOPTEXTRA) @@ -475,11 +498,15 @@ LINK_FLAGS += -L"$(CCLIBDIR)\Release" .ELIF "$(CCTYPE)" == "GCC" -CC = gcc -LINK32 = g++ -LIB32 = ar rc -IMPLIB = dlltool -RSC = windres +.IF "$(GCCCROSS)" == "define" +ARCHPREFIX = x86_64-w64-mingw32- +.ENDIF + +CC = $(ARCHPREFIX)gcc +LINK32 = $(ARCHPREFIX)g++ +LIB32 = $(ARCHPREFIX)ar rc +IMPLIB = $(ARCHPREFIX)dlltool +RSC = $(ARCHPREFIX)windres i = .i o = .o @@ -491,6 +518,9 @@ a = .a INCLUDES = -I.\include -I. -I.. -I$(COREDIR) DEFINES = -DWIN32 $(CRYPT_FLAG) +.IF "$(WIN64)" == "define" +DEFINES += -DWIN64 -DCONSERVATIVE +.ENDIF LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console CXX_FLAG = -xc++ @@ -783,8 +813,18 @@ CFGH_TMPL = config_H.bc .ELIF "$(CCTYPE)" == "GCC" +.IF "$(WIN64)" == "define" +.IF "$(GCCCROSS)" == "define" +CFGSH_TMPL = config.gc64 +CFGH_TMPL = config_H.gc64 +.ELSE +CFGSH_TMPL = config.gc64nox +CFGH_TMPL = config_H.gc64nox +.ENDIF +.ELSE CFGSH_TMPL = config.gc CFGH_TMPL = config_H.gc +.ENDIF PERLIMPLIB = ..\libperl511$(a) PERLSTATICLIB = ..\libperl511s$(a) @@ -1220,7 +1260,7 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static $(mktmp $(LKPRE) $(PERLDLL_OBJ) \ $(shell @type Extensions_static) \ $(LIBFILES) $(LKPOST)) - dlltool --output-lib $(PERLIMPLIB) \ + $(IMPLIB) --output-lib $(PERLIMPLIB) \ --dllname $(PERLDLL:b).dll \ --def perldll.def \ --base-file perl.base \ @@ -1582,6 +1622,11 @@ test-prep : all utils .ELSE $(XCOPY) $(GLOBEXE) ..\t\$(NULL) .ENDIF +.IF "$(CCTYPE)" == "GCC" +.IF "$(GCC_4XX)" == "define" + $(XCOPY) $(GCCHELPERDLL) ..\t\$(NULL) +.ENDIF +.ENDIF test : $(RIGHTMAKE) test-prep cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES) diff --git a/win32/perlhost.h b/win32/perlhost.h index c2473c93f7..d486246234 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -1747,7 +1747,7 @@ win32_start_child(LPVOID arg) parent_message_hwnd = w32_message_hwnd; w32_message_hwnd = win32_create_message_window(); if (parent_message_hwnd != NULL) - PostMessage(parent_message_hwnd, WM_USER_MESSAGE, w32_pseudo_id, (LONG)w32_message_hwnd); + PostMessage(parent_message_hwnd, WM_USER_MESSAGE, w32_pseudo_id, (LPARAM)w32_message_hwnd); /* push a zero on the stack (we are the child) */ { diff --git a/win32/win32.c b/win32/win32.c index 41fae60b66..e6674e1101 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2014,7 +2014,7 @@ win32_uname(struct utsname *name) GetSystemInfo(&info); #if (defined(__BORLANDC__)&&(__BORLANDC__<=0x520)) \ - || (defined(__MINGW32__) && !defined(_ANONYMOUS_UNION)) + || (defined(__MINGW32__) && !defined(_ANONYMOUS_UNION) && !defined(__MINGW_EXTENSION)) procarch = info.u.s.wProcessorArchitecture; #else procarch = info.wProcessorArchitecture; diff --git a/win32/win32.h b/win32/win32.h index c14367a4c5..3916b2e1f6 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -58,6 +58,23 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> +/* + * Bug in winbase.h in mingw-w64 4.4.0-1 at least... they + * do #define GetEnvironmentStringsA GetEnvironmentStrings and fail + * to declare GetEnvironmentStringsA. + */ +#if defined(__MINGW64__) && defined(GetEnvironmentStringsA) && !defined(UNICODE) +#ifdef __cplusplus +extern "C" { +#endif +#undef GetEnvironmentStringsA +WINBASEAPI LPCH WINAPI GetEnvironmentStringsA(VOID); +#define GetEnvironmentStrings GetEnvironmentStringsA +#ifdef __cplusplus +} +#endif +#endif + #ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */ #define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */ #endif /*WIN32_LEAN_AND_MEAN */ |