MathMoon — a mathematical game

Compilation

Compilation for GNU/Linux

Compiling for GNU/Linux using a GNU/Linux system is easy. It should also work like this on most UNIX-like systems. You simply ./configure, make and make install. You will need wxWidgets (also known as wxWindows) version 2.4 with "PrologIO" support enabled. Your distribution might ship with binary wxWindows packages, but if these do not have "PrologIO" enabled, you will have to compile wxWindows for yourself. You might also need to fix lexer.l, as shown below for Windows compilation.

Compilation for Windows

I have never compiled for Windows using a Windows machine. If you succeed in doing that, please write a short summary of what you did, and I will include it here.

Cross-compiling for Windows using Debian GNU/Linux is fairly easy, but not as easy as compiling for GNU/Linux. First apt-get install mingw32 mingw32-binutils mingw32-runtime to get the cross-platform compiler and a DLL that is needed at runtime. (Note: I couldn't make it work with mingw32 3.4, you can use 3.3 instead) Then follow these instructions:

  1. Download the current version of wxWidgets for Windows from www.wxwidgets.org (i.e. wxMSW-2.4.2.zip).
  2. unzip wxMSW-2.4.2.zip (This creates the directory wxWindows-2.4.2 containing the source code.)
  3. cd wxWindows-2.4.2
  4. dos2unix config.guess config.sub (You have to convert these files to the UNIX text format, with linefeed indicating a new line.)
  5. chmod a+x config.guess config.sub
  6. dos2unix $(find . -name configure.in) (Convert all the configure.in files to UNIX text format)
  7. autoconf; (cd contrib; autoconf); (cd demos; autoconf); (cd samples; autoconf); (cd utils; autoconf) (The configure scripts shipped does not seem to work for cross-compilation, so we have to generate new ones.)
  8. mkdir /home/christian/software/wxWindows (Make a directory to install wxWindows in.)
  9. ./configure --prefix=/home/christian/software/wxWindows --host=i586-mingw32msvc --enable-debug --disable-compat22 --enable-prologio (Instead of --enable-debug, you might want --enable-optimise; to get a smaller DLL you can use --disable-protocols --disable-sockets --disable-ipc --disable-timedate --disable-dialupman --disable-apple_ieee --disable-fraction --disable-geometry --disable-fs_inet --disable-fs_zip --disable-mshtmlhelp --disable-clipboard --disable-dnd --disable-gif --disable-iff --disable-pnm --without-libtiff)
  10. sed 's/yy_current_buffer/YY_CURRENT_BUFFER/g' src/common/lexer.l > /tmp/lexer.l
  11. mv /tmp/lexer.l src/common/lexer.l (Unless we change lexer.l like this, wxWindows won't compile.)
  12. make
  13. make install
  14. rm /home/christian/software/wxWindows/lib/libwx_mswd-2.4-i586-mingw32msvc.dll (The installation procedure makes one big error: it installs $prefix/lib/libwx_mswd-2.4-i586-mingw32msvc.dll as a symbolic link to itself. So you have to remove it and install it yourself)
  15. cp lib/libwx_mswd-2.4-i586-mingw32msvc.dll /home/christian/software/wxWindows/lib/
  16. dos2unix /home/christian/software/wxWindows/bin/wx-config

When you have successfully compiled wxWindows for Windows, go to the MathMoon directory and do WXCONFIG=/path/to/bin/wx-config ./configure --host=i586-mingw32msvc, followed by make. Then find . -name '*.dll' and copy these to appropriate places in a Windows system (I suggest the same directory as the main executable). Also copy the mingw32 DLL and the newly compiled wxWindows DLL to appropriate places (perhaps C:\Windows or the same directory as the main executable). Finally, get the executable from ./src/.libs/mathmoon.exe and place in the same directory as the module DLL:s. Find all the images and HTML files and place them there too. If you like one of the translation files in the po directory, copy the .mo file to mathmoon.mo and put it in the same directory. Now it should be possible to run the program.


Christian von Schultz <admcvs@skolwebben.tibro.se>