Building Wx with ActivePerl on Linux
Ensure you have the prerequisite modules installed using PPM first.
These instructions are for building portable binaries on Linux for ActivePerl. The information may be useful in other situations, such as building generally portable binaries, but it is primarily a description of the build process used for the PPM's at this site.
Selecting a Build Distribution
The standard and probably preferred way of building code for Linux is compilation either on the target machine itself or as part of a distribution specific release. For PPM's neither of these is possible. I also wanted to be able to distribute packaged Perl applications so the issues that must be addressed for PPM's also make the binaries usable within packaged applications.
If you want portable binaries, the simplest approach is to select a standard distribution that is as old as you can possibly use and still get the functionality you want. This should mean that you can run those binaries on more recent distributions and on a variety of different distributions. The main PPMs at this site are built on CentOS 5 32bit and 64bit. They are tested for basic functionality including packaging using the PDK on Debian 5 and Ubuntu 9.1. A list of Linux distributions that the PPM's and therefore any packaged applications should run on is at the Linux Dependencies Page. The site also has a sub repository with PPMs built on CentOS 4 which will run on somewhat older Linux versions and distribution releases. The main missing functions are advanced graphics (no Cairo) and there is a dependency on gstreamer 8. Only use these PPM's if you know your system or the target system for your application has glibc less than 2.5 or gtk2 less than 2.8. Because of changes in the underlying GTK, these binaries probably won't work properly on later distributions of Linux. This actually covers quite a narrow band of Linux distributions, but it does cover RHEL 4 which is still in wide use in the corporate world.
Linux Build Parameters
The Alien::wxWidgets PPMs for Linux are built with the following params:
perl Build.PL --wxWidgets-extraflags="--enable-graphics_ctx --disable-compat26 --enable-mediactrl --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --with-libxpm=builtin" --wxWidgets-build='yes' --wxWidgets-source='tar.gz' --wxWidgets-unicode=1 --wxWidgets-build-opengl=1 --wxWidgets-version=2.8.10
Using built in libraries where possible rather than the libraries present in the distribution increases the chances of portability. Of course, you must have the development libraries installed on your system for GTK etc. The only libraries and development files which are normally missing if you select the general development packages for a distribution are the freeglut libraries used for OpenGL. Just search for freeglut in your Linux package manager and install them.
perl Build
perl Build test
perl Build install
After Alien::wxWidgets is built as above, Wx, Wx::GLCanvas and Wx::TreeListCtrl can be built with standard 'perl Makefile.PL' commands, or even using the cpan shell.
Building PPMs
Creating a PPM is straightforward if you are building the modules directly using perl Build.PL and perl Makefile.PL.
make
make test
make install
make ppd
tar cvzf DistName.tar.gz blib
edit the ppd file to point the CODEBASE element at DistName.tar.gz
For the Wx PPM on this site, two custom changes are made.
1). A Wx::Loader::Custom is added to the blib. When Wx is created, the paths to the wxWidgets shared libraries is hard coded. To allow the libraries to be loaded without the need for any changes in LD_LIBRARY_PATH when they are installed on a different system and perhaps in a different location, Wx::Loader::Custom handles loading the shared libraries.
2). The shared libraries are also normally correctly installed on a system when built with sym-linking that handles side by side versions etc. As the libraries distributed with the PPMs are solely for the use of this installation of Wx, they are not installed in the normal fashion, but named so that they can be loaded either directly by known names or within a packaging system (such as PAR) that sets the LD_LIBRARY_PATH. This should also mean that any packaging method that sets the LD_LIBRARY_PATH should not cause issues for any downstream applications started that also link to other wxWidgets libraries on the system. It would probably be possible to install the libraries correctly via PPM, but this would not handle the issue of distributing the binaries in a packaged application.
Of course, as always, if you prefer the CPAN option then
cpan Alien:wxWidgets
cpan Wx
is open to you on ActivePerl and should work for your target machine just as well as the PPM approach would.