HowToCompileWinGUI

From MLDonkey
Revision as of 01:01, 1 January 2006 by PHP2Media (Talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

How to compile the mldonkey-gui for windows, a guide by Taros666 (http://www.scherthan.com)

First you need a working development environment for Windows. As I use Cygwin, I will not cover how to compile it via the native WIN32 ports of OCAML or any other way. Here we go:

1. Get Cygwin (http://www.cygwin.com) and install it. Don't forget to install the develpment tools (gcc, automake, make, autoconf...). To be sure just install everything (if you want to save some space, you don't need Apache, Tex, Emacs...). Now start up cygwin (you have a desktop icon called \"Cygwin\". If you are a bit more experienced you really should use the X-Server and a nice window-manager (window-maker is included in Cygwin...there is even a KDE port, but that is a bit overkill for Cygwin).

2. Get the mldonkey-sources. Best way is to make a fresh CVS check-out with the cvs command:

	cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/mldonkey co mldonkey

Now you have a new directory called mldonkey. Go there and make a

	./configure
	make

There should be no problem and you end up with all the bins, but NO GUI! Why? Because you don't have gtk installed and configure searches for gtk-config. But we will trick the system.

3. Praise Emmanuel Dieul. He did the real work and compiled lablgtk for cygwin and he includes all needed gtk-.dlls! Get the Cygwin-port of lablgtk at: http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/dist/lablgtk-1.2.5-cygwin-3.06.tgz

Do a

	tar -xzvf lablgtk-1.2.5-cygwin-3.06.tgz

change to the new dir, go deeper once more (were the Makefile is located) and before we start to compile, we have to tell the system, where our ocaml-bins are. It depends on your shell, as I use BASH I do a

	export PATH=$PATH:/<the PATH to your mldonkey-cvs dir>/mldonkey/patches/bin

and now try a

	make configure
	make
	make opt
	make install

If make fails cause it can't find varcc.exe (happens on Win9X/ME. Just search for varcc and change it to varcc.exe and continue with make. The same might happen with ocamlmklib. Just change that name to ocamlmklib.exe).

Now we have everything to finally get the GUI :)

4. Go to your mldonkey-dir. Don't try a ./configure or even make, that will fail (./configure will still not find gtk-config!) Use a texteditor and open the file config/config.cache and search for

	ac_cv_prog_GTK_CONFIG<code>${ac_cv_prog_GTK_CONFIG</code>'no'}

Change the no to yes to trick the system :)

	ac_cv_prog_GTK_CONFIG<code>${ac_cv_prog_GTK_CONFIG</code>'yes'}

Now open the file config/configure and search for GTK_LIBS. It looks like this:

        GTK_LIBS=`$GTK_CONFIG --libs`
        GTK_CFLAGS=`$GTK_CONFIG --cflags`
        GTK_VERSION=`$GTK_CONFIG --version`

Now we only have to tell the system manually about the info it couldn't get from the file gtk-config. Change the 3 lines to something like this:

        GTK_LIBS=\"-L<the PATH to your mldonkey-cvs dir>/mldonkey/patches/local/lib/ocaml/lablgtk/cclibs -lgmodule-1.3 -lglib-1.3 -lgdk-1.3 -lgtk-1.3\"
        GTK_CFLAGS=\"\"
        GTK_VERSION=\"2.0\"

Now a make will build us the GUI :) And a lot of other files you might have never seen.

5. Well, everything now works fine, but on Win-systems, files that start with a dot \".\" give Windows some aches. You can't e.g. change that file manually with an editor, 'cause Windows doesn't save files, beginning with a dot! (You still can use cygwin to change these files :) ) Another thing is, that the System tries to install .ini-files to a cygwin-dir, that might not be available on other Systems.

Let's do some changes to the sources... (only 5 lines to changes!)

OLD:
let message_file_name = try
    Sys.getenv \"MLDONKEY_GUI_MESSAGES\"
  with _ ->
      Filename.concat ~CommonOptions.home_basedir \".mldonkey_gui_messages.ini\"
NEW:
let message_file_name = try
    Sys.getenv \"MLDONKEY_GUI_MESSAGES\"
  with _ ->
      \"mldonkey_gui_messages.ini\"
OLD:
let mldonkey_gui_ini = create_options_file
    (Filename.concat ~CommonOptions.home_basedir \".mldonkey_gui.ini\")
NEW:
let mldonkey_gui_ini = create_options_file
    (\"mldonkey_gui.ini\")
OLD:
let mldonkey_gui_ini = create_options_file
    (Filename.concat ~CommonOptions.home_basedir \".mldonkey_gui.ini\")
NEW:
let mldonkey_gui_ini = create_options_file
    (\"mldonkey_gui.ini\")
OLD:
let accounts_ini = create_options_file
    (Filename.concat  ~CommonOptions.home_basedir \".mldonkey_im.ini\")
NEW:
let accounts_ini = create_options_file
    (\"mldonkey_im.ini\")
OLD:
  let rc_file =
    match iter arg_list with
      None -> Filename.concat Chat_messages.home \".mlchatrc\"
NEW:
  let rc_file =
    match iter arg_list with
      None -> \"mlchatrc\"

Now a make will give you all you ever wanted ;)

Taros666, 15.3.2003

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox