Mac porting guidelines

Hubert Figuière <hfiguiere@teaser.fr>

Revision $Id: MacPort_Documentation.abw,v 1.1 2001/07/20 15:43:14 hub Exp $

Platform

Target platform for MacOS port is both MacOS 8.6 and higher, using CarbonLib 1.2.5, and MacOS X 10.0.x and higher, using Carbon, CoreGraphics and UNIX (target binary is Mach-O).

Note: unless mentioned, everything that applies to MacOS 9 also applies to older supported version. This is just a writing simplification.

Why CarbonLib 1.2.5 ? How about MacOS 8.0 ?

We use ATSUI for typography because ATSUI is the recommended way to go under MacOS of advanced typography, and ATSUI is available starting MacOS 8.5. We also plan to use lot of feature like CoreFoundation and Interface builder NIBs that are available as part of CarbonLib. Since MacOS 8.6 is required for CarbonLib starting 1.1 and since this upgrade from MacOS 8.5 is free of charge, we felt that the need for 8.6 was not a bug cut-off.

If someone volunteer to port to an older version, feel free to submit patches.

Why Carbon on MacOS X and not Cocoa ?

Two reasons:

It is better to share as much code as possible between MacOS 9 and MacOS X versions. Hence Carbon is the choice

Mixing Objective-C and C++ is not easy. Carbon is raw C and match better what we want to do.

Why Mach-O and not CFM ?

MacOS X port use CoreGraphics that is only available in Mach-O environment (in fact in CFM you have to tweak and manually load it). It is build using GNU tools so Mach-O is the only available target with Apple supplied cc. We want to be as UNIXish as possible on the low-end part, so using Mach-O is also the only way to go.

We don’t mind providing 2 different versions, one for MacOS 9, one for MacOS X as both versions will be different.

Building environment

First read the BUILD.TXT file if you haven’t yet.

MacOS 9

For MacOS 9, there is not yet a pre-made project that is avilable for use with CodeWarrior. Recommended version is CodeWarrior 6. MPW build, even if it is currently committed, is not really working as MrCPP compiler is broken. Switching to CodeWarrior for MPW is a possible solution.

MacOS X

MacOS X build is done using the Apple provided cc and the GNU tools. GNU automake is required to build from CVS if you plan to use the autoconf build system (recommended). Otherwise the ancient make system works too.

You’ll need around 400 MB of free disk space, including the source tree, and 192MB of RAM seems not always enough.

API and Architecture

This will explain the use of the API within AbiWord for Mac.

Graphics

This is the hardest part. Choice have been made to use CoreGraphics on MacOS X and QuickDraw (because of no other choice) for MacOS 9. Both graphics will makes use of ATSUI, hence providing a common font handling between the 2 versions.

MacOS 9 implementation is in gr_MacQDGraphics while MacOS X implementation is in gr_MacGraphics. There is no problem breaking the source file naming scheme for MacOS 9 as neither MPW nor CW uses the standard build system based on GNU tools.

Dialogs

Choice have been made to use Interface Builder for the Carbon dialogs. This makes MacOS X a requirement for this development, but this help fasten the development cycle as Interface Builder is a great tool.

NIB files are compatible with MacOS 9 using CarbonLib 1.2.5.