Building Wx with ActivePerl on MS Windows
Ensure you have the prerequisite modules installed using PPM first.
Tested Compilers
mingw-w64 Compiler
The mingw-w64 project provides gcc compiler releases for x86 32 bit and x64 64 bit Windows. Alien-wxWidgets versions from svn or CPAN >= 0.51 will build with these compilers. The required Wx version is svn or >= 0.98.
Direct links for the tested compiler releases are below, or you can visit the mingw-w64 project page. The tested builds are the 'sezero personal builds.' The mingw-w64 x64 release is used to build the 64 bit PPMs for this site.
Download the zip. Extract it. Add the mingw64\bin directory to your path.
Download the zip. Extract it. Add the mingw32\bin directory to your path.
These two installations happily coexist on the same system. You just have to put the required environment ( ...\mingw32\bin or ...\mingw64\bin ) on your path. The mingw-w64 project also provides a build environment that allows you to build x64 binaries on an x86 machine, and linux cross-compilers too. I don't think these are of general use to Perl development as you may be able to compile c and c++ code, but you can't run tests or use the Perl build environment.
dmake
You will need the dmake utility to build using the above compilers. You can download dmake from CPAN. Extract the the zip archive and add the root folder of your extract location to your path. Test that dmake -help works from the command prompt.
ExtUtils::FakeConfig
You will need to install ExtUtils::FakeConfig from CPAN to use the compilers in Perl. With your target Perl bin directory on your path, your dmake directory on your path, and the correct mingw bin on your path (mingw64\bin if your Perl is 64 bit, mingw32\bin if your Perl is 32 bit) , you can install ExtUtils::FakeConfig from CPAN by typing at the command prompt:
cpan ExtUtils::FakeConfig
Do not install ExtUtils::FakeConfig using PPM on Windows. During the cpan build and install process on Windows, ExtUtils::FakeConfig will create the necessary libperl library file which you will not get with a PPM install.
Once ExtUtils::FakeConfig is installed, you need to download and place the module Config_w64.pm in your .../perl/site/lib directory. General usage is perl -MConfig_w64 or you may want to set PERL5OPT=-MConfig_w64
For ease of use, you may want to set up a batch file like the following to open a correctly set up environment.
set PERLPATH=C:\Perl64
set DMAKEPATH=C:\dmake
set MINGWPATH=C:\mingw32
set PATH=%PERLPATH%\site\bin;%PERLPATH%\bin;%DMAKEPATH%;%MINGWPATH%\bin;%PATH%
set PERL5OPT=-MConfig_w64
cmd /k
Within this environment you can call
perl Makefile.PL
or
perl Build.PL
and all should work.
MinGW Compiler
The original MinGW gcc compiler release can build 32 bit binaries for Windows. This gcc release is used to build the x86 32 bit PPMs for this site. You can install MinGW direct from the Perl Package Manager or you can download an installer direct from the MinGW project page.
If you install yourself, you will also need to install dmake (see notes under mingw-w64 ). If you have another compiler on your path, ensure that dmake, mingw32-make and gcc appear first on your path before any other make utilities or compilers. As with the mingw-w64 compiler, it is useful to setup your environment using a batch file.
The MinGW compiler should work with ActivePerl without any further action other than the compiler and dmake being first on the path. However, occasionally ActivePerl releases break this. If your particular release fails to build using MinGW, you can try using ExtUtils::FakeConfig. Install ExtUtils::FakeConfig from CPAN exactly as described for mingw-w64. ExtUtils::FakeConfig comes with an appropriate configuration utility for MinGW - Config_m. For MinGW you should
set PERL5OPT=-MConfig_m
but hopefully you should not need this.
Microsoft Platform SDK 2003 R2
This downloadable Platform SDK from Microsoft includes a 64 bit compiler that you can use without an installation of Visual C++. It has the advantage of building against the base msvcrt.dll runtime so you don't have to distribute visual c runtime libraries with PPMs you might create. It's disadvantage is that there is no 32 bit compiler. This compiler has been tested against Alien::wxWidgets 0.50_01 and Wx 0.9701. An additional option must be passed to build Alien::wxWidgets and this is covered under Windows Build Commands below.
Microsoft Visual C++ 6
32 bit versions of wxPerl can be built using this compiler. It has the advantage of building against the base msvcrt.dll runtime so you don't have to distribute visual c runtime libraries with PPMs you might create. It's disadvantages are that there is no 32 bit compiler and you cannot build wxWidgets against gdiplus with this compiler.
Microsoft Visual C++ 7/8/9 + recent Platform SDK
These compilers are not tested for the PPMs built for this site. They almost certainly work so if you happen to have one installed or like to build with these compilers, then all should be OK. The problem for portable binaries is that these compilers will link against specific 'side by side' assemblies which would have to be redistributed with the binaries. Whilst not impossible, it is not realistic to redistribute these runtime libraries using the necessary install procedures with PPM. Building for use solely on the target machine should give you no problems at all.
Windows Build Commands
Alien::wxWidgets
The PPM's at this site are build by downloading the source and using specific build parameters rather than using the cpan shell directly.
perl Build.PL --wxWidgets-extraflags="USE_OPENGL=1 USE_GDIPLUS=1 USE_QA=1 VENDOR=custom"--wxWidgets-source=tar.gz --wxWidgets-unicode=1 --wxWidgets-build-opengl=1 --wxWidgets-mslu=0 --wxWidgets-version=2.8.10
If building with the 64 bit compiler from the Platform SDK 2003 R2, you will need to either pass the necessary extra flags to link in bufferoverflowU.lib, or you can switch the code that requires this off in --wxWidgets-extraflags with CPPFLAGS=/GS- . This SDK can build gdiplus so your full wxWidgets-extraflags param can be:
"CPPFLAGS=/GS- USE_OPENGL=1 USE_GDIPLUS=1 USE_QA=1"
The USE_GDIPLUS option requires the presence of a Microsoft Platform SDK and if using the gcc complier some patching to the gdiplus headers and reimplementation of the lib files. If you don't have these, don't use the USE_GDIPLUS option. See information for building Wx with gdiplus and mingw compilers.
The VENDOR option can be used to add a specific vendor part to the wxWidgets DLL names. The default, if not specified, is 'custom'.
To build you can then do
perl Build
perl Build test
perl Build install
Once Alien::wxWidgets is built to your requirement, Wx and related modules can be built directly from CPAN in your build environment if you wish.
cpan Wx
cpan Wx::TreeListCtrl
cpan Wx::ActiveX
Creating PPMs
To create PPMs we don't do this, of course, but download the source, build, and then package the blib directories. To create PPMs yourself, start by installing a copy of bsdtar on your path. This is not a gnu tool, but you can get a copy from the gnuwin32 site. Once installed, add the bin directory to your path.
As an example, to create a PPM for Wx, download and build the Wx source.
perl Makefile.PL
dmake
dmake test
dmake install
dmake ppd
bsdtar cvzf Wx.tar.gz blib
Edit the Wx.ppd file that has been created in the source directory so that the CODEBASE element contains 'Wx.tar.gz'.
Now, as long as the Wx.ppd and Wx.tar.gz files are side by side, you can install them from the command line using:
ppm install Wx.ppd
If you wanted to maintain a repository yourself, you could place all your ppd and tar.gz files in a directory and add that directory as a repository in the Perl package Manager. If you want to produce a package.xml for your repository as used by PPM4, then see PPM::Make::RepositorySummary.