Sebastian Andersson | 15 Feb 11:51 2012

Compiling 1.60 on OSX.

Its been ages since I really played crossfire. I've looked at the
crossfire web's client's list now and then and there has never been a
new enough OS X client.
I tried the java client some year ago, but it was not really playable,
the character would often start to run and not stop until I typed a
stop running command.

Yesterday I thought, how hard can it be to port a C application to
OSX? After all, I've got both Xcode and homebrew installed. :-)

I looked at http://crossfire.real-time.com/clients/macosx-intel.html
but it seems a bit dated. I also didn't have or want fink.

Here's a small text describing the experience.

I checked out the source code from the tag for 1.60. svn complained
about invalid SSL/TLS certificate, but I temporarily accepted it.
Don't know where the problem lies.

Then I read the README and INSTALL files and was told to run
./configure. Of course, that is not checked in, nor is there any
description about how to make one.

Its been ages since I last used autoconf/automake so I didn't remeber
the order they should be run, but eventually I got a configure file. I
guess the correct order should be:
aclocal; autoconf; automake --add-missing    (I forgot aclocal and had
to change the aclocal.m4 file to get it to run...).

It would have been nice to have some text about what to run, with what
options, in the INSTALL file (or having the configure and utils files
checked in).

Finally I could run ./configure. It complained that it could not find
libpng. Running:
LD_FLAGS=/usr/X11 ./configure made it find libpng correctly. I think
it has come with the X11 installation.

The configure script complained it couldn't find a lot of other
dependencies. "brew install" a couple of times fixed that too.

It would have been nice to have a list of what the dependencies are in
the INSTALL file and what is optional. Configure sometimes doesn't say
the real package name. I'm not too familiar with GTK and was first
looking for libgtk-v2 and variants of it, when the package name in
homebrew is gtk+ (with a version number of 2.24). Other dependencies
were easier to find.

Finally I had a makefile and could run make.
It went on for a while until it complained about setljmp and libpng. I
fixed it and saw today that David McIlwraith had already provided a
patch for it. A case of having the wrong version installed perhaps?

Then linking complained about some _pre_func* and _post_func*
functions that were missing. The common code was compiled with
-finstrumental-functions for some reason. I removed the flag from the
Makefile and recompiled the common code.

After that the linking complained about missing functions from X11,
which I added to the makefile (-lX11 added to some LIBS= setting).

The compilation had also produced a huge amount of warnings. Some
about unused local variables (I fixed some with dd in vim), but some
about incorrect variable sizes (I've got a 64 bit system), is there
some pointer being put in an integer perhaps? I made a half hearted
attempt at fixing the code (using the proper GTK macros instead of
direct casts), but the warning remained. Anyway, the client had
compiled so I decided to try it.

The homebrew version of GTK+ was the X11 version. Oh well, at least it
started and complained about not finding glade files.

A make install (which sucks; couldn't the client just find the needed
files relative to the binary's location, at least when argv[0] is a
path?) and a new try.

This time a really ugly client starts up. I try to switch glade file
in the config, but nothing happened (even after restart). Oh well. At
least it seems to work.

I connect to a server and it complains my client is too old. I try the
next server, make a character and then the server restricts the
character to the starting map...
I try the third server that was available via the meta server. I can
create my character and end up in some start town. I resize my
client's window and the whole map goes black. After running around for
a bit the map is refreshed enough to not be all black. Related to the
lack of correct glade file? I then take a few more steps and the
network or server goes down, I can't connect to it anymore.

Btw. what happened to the old process of character creation by walking
around on a map? The gtk-v2 client's character creation dialogs was a
bit confusing with buttons that were not dimmed out when they could
not be used. "Add character" should perhaps be called Import/Transfer
character or something instead (if it does what I think it does and
transfers an old character into the account). It should also not be to
the left of the "create character" button since it is expected to be
used less frequently (but perhaps that's a glade file thingy). Oh
well.

I go to the crossfire web forum (http://forum.metalforge.net/) and get:
Forbidden

You don't have permission to access / on this server because you are
currently blacklisted by a DNSBL server at: se.countries.nerd.dk

I go to http://countries.nerd.dk/ to see what's up and it tells me
that it is not a black list server, but an IP to country mapper, so
why is it used like one?

I don't know, but I think I've got a little hunch about why there were
no players on the two servers I connected to...

Anyway perhaps the home page can be updated a bit with a text about it
being possible to compile the OSX client?

Regards,
/Sebastian
--

-- 
One laptop per child project: http://laptop.org/

Gmane