Friday, January 18, 2008

64bit Firebird for MacOS 10.5 (Leopard)

Today I put the finishing touches to a native 64bit port of Firebird for MacOS 10.5 (Leopard).
This required the following changes to the Firebird 2.1 code base (B2_1_Release). For anybody else considering adding a new platform to Firebird then you may find this useful.

Changes:
1. src/jrd/common.h (line 289)
#ifdef __x86_64__
#define DARWIN64
#define IMPLEMENTATION isc_info_db_impl_darwin_x64 /* 73 */
#endif

2. src/jrd/inf_pub.h (line 203)
add
isc_info_db_impl_darwin_x64 = 73,

3. src/jrd/license.h (line 135)
amend
#ifdef DARWIN
#if defined(i386)
#define FB_PLATFORM "UI" /* Darwin/Intel */
to
#if defined(i386) || defined (__x86_64__)

4. src/jrd/pag.cpp (line 155)
insert (last)
static const int CLASS_DARWIN_X64 = 31; // Darwin x64
amend (line 158)
static const int CLASS_MAX = CLASS_DARWIN_X64;
since this is the last one added

5. src/jrd/pag.cpp (line 245)
insert (last)
archLittleEndian // CLASS_DARWIN_X64
make sure you add a , to the class above...

6. src/jrd/pag.cpp (line 322)
Pick up the right class for the right architecture..
add
#ifdef DARWIN64
const SSHORT CLASS = CLASS_DARWIN_X64
#endif

7. src/remote/protocol.h (line 150)
add a new architecture
arch_darwin_64 = 41,
and update arch_max
arch_max = 42

8. src/remote/remote_def.h (line 72)
add a new architecture
#elif defined(DARWIN64)
const P_ARCH ARCHITECTURE = arch_darwin_64;

9. src/remote/xdr.cpp
Make sure SWOP DOUBLE is defined correctly
by appending
|| defined(DARWIN64)
to the intel crowd.

10. src/jrd/utl.cpp (line 218)
add
"Firebird/Darwin/Intel64" /* 73 */

11. src/common/classes/fb_atomic.h (line 82)
add || defined (__x86_64__)

12. configure.in (line 62)
In the target darwin section add
dnl CPU_TYPE=x86_64
This can be uncommented when you do a 64bit build


Now read the notes in builds/posix/prefix.darwin_x86_64

1. edit configure.in so that MAKEFILE_PREFIX=darwin_x86_64
2. Uncomment the CPU_TYPE
3. edit extern/icu/source/config/mh-darwin to set the right 64bit flags (-arch x86_64) for LD_FLAGS
for CFLAGS, CXXFLAGS
4. export CFLAGS='-arch x86_64'
5. export CXXFLAGS='-arch x86_64'

Then check and make sure that
MACOSX_DEPLOYMENT_TARGET=10.5
and export that for good measure.

Build should be good to go. Welcome to native 64bit Firebird on MacOS

No comments: