Ever since I used it years ago on a geek-project for my Zaurus, the Metakit DB has always been a favorite of mine. I had the chance to use it again on another personal project and this time on MacOSX. Unfortunately, the prebuilt binaries on the Metakit site are for older versions of MacOSX, so I had to build it myself.
Normally one would simply follow the “Metakit installation instructions”:http://www.equi4.com/pub/mk/, but they are old and didn’t work correctly with 10.5 Leopard. I scraped enough information together from the Internet to get it working, but I had to do a lot of research. To save others the same hassle, I have put together all of the changes and put them here in their entirety:
Make sure you have Xcode installed on your system before starting.
Get the latest source from the “Metakit downloads page”:http://www.equi4.com/pub/mk/. At this time the latest version is @metakit-126.96.36.199.tar.gz@.
Uncompress the archive in a work directory and run the following commands:
> cd builds > ../unix/configure --with-python=/System/Library/Frameworks/Python.framework/Versions/2.5
Note: Your Python install might be in a different location. If so, give the @–with-python@ arg the proper value.
“Fat” binary setup
If you need this to run on the PPC architecture you will need to make a couple of modifications to @./builds/Makefile@ after running @configure@, otherwise you can skip this step and build the binaries with @make@.
Find @CXXFLAGS = $(CXX_FLAGS)@ and change to the following:
CXXFLAGS = $(CXX_FLAGS) -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk
Find @SHLIB_LD = g++ -dynamiclib -flat_namespace -undefined suppress@ and change to the following:
SHLIB_LD = g++ -dynamiclib -flat_namespace -undefined suppress -arch ppc -arch i386
Build the binaries
Run your typical @Makefile@ commands:
> make > make test
Rename the shared library which is now in the @./builds@ directory:
> mv Mk4py.dylib Mk4py.so
And copy the following files to @/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python@ (be sure to adjust the path name for your version of Python):
At this point you should have a working system and ought to be able to run the following command in a Python shell without issue:
>>>from metakit import *
“Metakit for Python website”:http://www.equi4.com/metakit/python.html
“helpful instructions from www.ospace.net”:http://www.ospace.net/wiki/index.php/ServerHowTo