EDIT: See below the break for the original post. What follows is now instructions for how to get WeiDU to compile properly on an Intel Mac running OS X 10.6. If you are running OS X 10.5, 10.7, or 10.8 these instructions may or may not require some modifications.
Requirements:
a) Intel Mac running OS X 10.6 (10.5, 10.7, and 10.8 may also work with these instructions, but no guarantees)
b) Xcode 3.2 (or the appropriate Xcode for your version of OS X)
c) Working knowledge of how to use the Terminal applications
d) MacPorts installed and a working knowledge of how to use it
e) Working knowledge of how to use make and makefiles
Instructions:
- Install ocaml via MacPorts. You're going to need the labltk variant so use this command: sudo port install ocaml +labltk
- Take note of the directory that MacPorts installs ocaml to. For a normal MacPorts install this should be /opt/local/bin, /opt/local/lib/ocaml, and /opt/local/lib/ocaml/camlp4
- Use Terminal to navigate to /opt/local/lib/ocaml. Then type in this command: sudo ln /usr/local/lib/ocaml/libcamlstr.a /usr/local/lib/ocaml/libstr.a
- Download and extract the copy of elkhound that the_bigg links to on the compile page (http://www.weidu.org/~thebigg/compile.html), i.e., this one: http://www.weidu.org/~thebigg/elkhound-2009.01.26.tar.gz
- Navigate to the extracted elkhound folder and run ./configure
At this point you'll end up going down one of two paths. If you're running a 32-bit system. You should be able to just run
make and everything will compile just fine. However, if you're running a 64-bit system (which is very likely... I'm not sure Apple has sold a 32-bit system for a long time) you're going to have to convert a number of (int) casts of void* types into (intptr_t) casts. That's because the int type is only 32 bits, but on a 64-bit system void* is going to be 64 bits. The pointers get chopped in half with the code as it is. However, intptr_t is guaranteed to be large enough (64 bits), so you'll have to change a number of those. I will proceed to list them for you here...
Instances where an (int) cast of void* (or sometimes other pointer types) must be changed to (intptr_t) (all folders assumed to originate from the elkhound root folder - note that one of the subfolders in the elkhound root is called elkhound itself):
- smbase/mysig.cc, line 80
- elkhound/c/c_type.h, line 49
- elkhound/c/c_type.h, line 238
- elkhound/c/c.ast, line 253
- elkhound/c/c_type.cc, line 229
Now that that is done...
- Run make in the elkhound root. At this point it should build without a problem.
- Copy the resulting elkhound executable to /usr/local/bin so that the weidu build can use it.
- Navigate to the WeiDU source code folder. Open the Configuration file.
- Uncomment section (2) and change the paths from beginning with /usr to beginning with /opt. Do the same down in the "autodetection" section
- If everything else was done correctly, this should build successfully and the obj folder will have a Mac executable called weidu.asm.exe
So that's how to build WeiDU on the Mac. It's not exactly a one-click solution, but it gets the job done. Since the first instruction had you install the labltk variant of ocaml you should be able to build everything except weimorph, which seems to be sort of in the "not so supported" category (see
the bigg's comment below).
ORIGINAL POST:OK... from the pinned "How to compile" thread it's clear that devSin is still compiling WeiDU for Mac on a PowerPC machine. Very cool! Especially for those still running the original Mac version of the BG games.
On the other hand... most modern Mac players of the game are going to be using the PC version via Wine.
That's where I step in. I'm willing to help or even take ownership of the issue of getting WeiDU to compile on Intel Macs. But I'm going to need some help. I'm a total newbie to OCaml and I'm not exactly a makefile wizard either.
So I'm going to use this thread for asking questions to get this all figured out if possible. If anyone from the community is able to give me clues, tips, pointers, help, etc. I would
sincerely appreciate it.
Thanks!