<h1><aname="building-on-unix-like-systems-e-g-linux-and-os-x">Building on Unix-like Systems (e.g. Linux and OS X)</a></h1>
<p>These platforms are built almost the same way while in development
so I'll combine the descriptions about their build process here.
First we will build wxWindows and install it to an out of the way
place, then do the same for wxPython.</p>
<olclass="arabic">
<li><pclass="first">Create a build directory in the main wxWindows dir, and configure
wxWindows. If you want to have multiple builds with different
configure options, just use different subdirectories. I normally
put the configure command in a script named ".configure" in each
build dir so I can easily blow away everything in the build dir and
rerun the script without having to remember the options I used
before:</p>
<preclass="literal-block">
mkdir bld
cd bld
../configure --prefix=/opt/wx/2.5 \
--with-gtk \
--with-opengl \
--disable-monolithic \
--enable-debug \
--enable-geometry \
</pre>
<p>On OS X of course you'll want to use --with-mac instead of
--with-gtk. For GTK2 and unicode add:</p>
<blockquote>
<p>--enable-gtk2 --enable-unicode </p>
</blockquote>
<p>Notice that I used a prefix of /opt/wx/2.5. You can use whatever
path you want, such as a path in your HOME dir or even one of the
standard prefix paths such as /usr or /usr/local if you like, but
using /opt this way lets me easily have multiple versions and ports
of wxWindows "installed" and makes it easy to switch between them,
without impacting any versions of wxWindows that may have been
installed via an RPM or whatever. For the rest of the steps below
be sure to also substitute "/opt/wx/2.5" with whatever prefix you
choose for your build.</p>
<p>If you want to use the image and zlib libraries included with
wxWindows instead of those already installed on your system, (for
example, to reduce dependencies on 3rd party libraries) then you
can add these flags to the configure command:</p>
<preclass="literal-block">
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
</pre>
</li>
<li><pclass="first">To build and install wxWindows you could just use the "make"
command but there are other libraries besides the main wxWindows
libs that also need to be built so again I make a script to do it
all for me so I don't forget anything. This time it is called
".make" (I use the leading ". so when I do <ttclass="literal"><spanclass="pre">rm</span><spanclass="pre">-r</span><spanclass="pre">*</span></tt> in my build
dir I don't lose my scripts too.) This is what it looks like:</p>
<preclass="literal-block">
make $* \
&& make -C contrib/src/gizmos $* \
&& make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" $* \
&& make -C contrib/src/stc $* \
&& make -C contrib/src/xrc $*
</pre>
<p>So you just use .make as if it where make, but don't forget to set
the execute bit on .make first!:</p>
<preclass="literal-block">
.make
.make install
</pre>
<p>When it's done you should have an installed set of files under
/opt/wx/2.5 containing just wxWindows. Now to use this version of
wxWindows you just need to add /opt/wx/2.5/bin to the PATH and set
LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH on OS X) to /opt/wx/2.5/lib.</p>
</li>
<li><pclass="first">I also have a script to help me build wxPython and it is checked in
to the CVS as wxWindows/wxPython/b, but probably don't want to use
it as it's very cryptic and expects that you want to run SWIG, so
if you don't have the latest patched up version of SWIG then you'll
probably get stuck. So I'll just give the raw commands instead.</p>
<p>We're not going to install the development version of wxPython with
these commands, so it won't impact your already installed version
of the latest release. You'll be able test with this version when
you want to, and use the installed release version the rest of the
time. If do want to install the development verison please read
INSTALL.txt.</p>
<p>If you have more than one version of Python on your system then be
sure to use the version of Python that you want to use when running
wxPython programs to run the setup.py commands below. I'll be
using python2.3.</p>
<p>Make sure that the first wx-config found on the PATH is the one you
installed above, and then change to the wxWindows/wxPython dir and
run the this command:</p>
<preclass="literal-block">
cd wxPython
python2.3 setup.py build_ext --inplace --debug
</pre>
<p>If your new wx-config script is not on the PATH, or there is some
other version of it found first, then you can add this to the
command line to ensure your new one is used instead:</p>
<preclass="literal-block">
WX_CONFIG=/opt/wx/2.5/bin/wx-config
</pre>
<p>If you are building with GTK2 then add the following flags to the
command line:</p>
<preclass="literal-block">
WXPORT=gtk2 UNICODE=1
</pre>
<p>If you are wanting to have the source files regenerated with swig,
then you need to turn on the USE_SWIG flag and optionally tell it
where to find the new swig executable, so add these flags:</p>
<preclass="literal-block">
USE_SWIG=1 SWIG=/opt/swig/bin/swig
</pre>
<p>If you get errors about wxGLCanvas or being unable to find libGLU
or something like that then you can add BUILD_GLCANVAS=0 to the
setup.py command line to disable the building of the glcanvas
module.</p>
<p>When the setup.py command is done you should have fully populated
wxPython and wx packages locally in wxWindows/wxPython/wxPython and
.../wx, with all the extension modules (<ttclass="literal"><spanclass="pre">*.so</span></tt> files) located in the
wx package.</p>
</li>
<li><pclass="first">To run code with the development verison of wxPython, just set the
PYTHONPATH to the wxPython dir in the CVS tree. For example:</p>
<preclass="literal-block">
export LD_LIBRARY=/opt/wx/2.5/lib
export PYTHONPATH=/myprojects/wxWindows/wxPython
cd /myprojects/wxWindows/wxPython/demo
python2.3 demo.py
</pre>
<p>OS X NOTE: You need to use "pythonw" on the command line to run
wxPython applications. This version of the Python executable is
part of the Python Framework and is allowed to interact with the