Small. Fast. Reliable.
Choose any three.
*** 1,24 ****
! This page is about building sqlite for MacOS using CodeWarrior. The MacOS port was added as of ticket #218 (which includes the modified files, if you are reading this before the port has made it into the release).
  
  If you are building for OS X (Darwin), use Apple's tools (gcc) and treat it as Unix.
  
  Note: I use version 8 of CodeWarrior.  I haven't tried this with earlier versions.
  
! On MacOS, you will be concerned with two types of build: Classic and Carbon. I use Classic for maximum backwards compatibility and Carbon for MacOS 9.1 (9.2.2 recommended) or newer with CarbonLib 1.5 or newer. The Carbon build runs natively on OS X. If you are a seasoned Mac developer you will know all this.
  
! You can select the various build options using a prefix file (under C/C++ Language settings). This is to do the equivalent of the -D command line options for most other compilers.
  
! For Classic I build without large file support and without thread support.  So, the prefix file contains:
  
    #define SQLITE_DISABLE_LFS
  
! For Carbon I build with large file and thread support. Note that a 'thread' to Apple is not the same as a thread to everyone else. Apple uses the term 'multitasking' or (worse still) 'multiprocessing' when it refers to pre-emptively scheduled threads. So the prefix file contains:
  
    #define THREADSAFE 1
  
! The other important thing to remember when making a Carbon executable is to include _carb.r_ in your project (e.g. from _MacOS Support/PowerPlant/PowerPlant  Resources/carb.r_)
  
! The command line 'sqlite' utility builds using SIOUX.  For this you need all the files except _tclsqlite.c_. You can build the TCL library as a separate exercise, but you will need to put _tcl.h_ in your Access Paths (under User Paths). Note that, when you use this utility, any relative path names you give it are relative to the directory containing the executable, and you will need to use Mac paths (using colons), even with the Carbon build running under OS X.
  
  The libraries you will need for the Classic build are:
  
--- 1,38 ----
! This page is about building sqlite for MacOS using CodeWarrior. The MacOS port was added as of 
! ticket #218 (which includes the modified files, if you are reading this before the port has made it 
! into the release).
  
  If you are building for OS X (Darwin), use Apple's tools (gcc) and treat it as Unix.
  
  Note: I use version 8 of CodeWarrior.  I haven't tried this with earlier versions.
  
! On MacOS, you will be concerned with two types of build: Classic and Carbon. I use Classic for 
! maximum backwards compatibility and Carbon for MacOS 9.1 (9.2.2 recommended) or newer with 
! CarbonLib 1.5 or newer. The Carbon build runs natively on OS X. If you are a seasoned Mac 
! developer you will know all this.
  
! You can select the various build options using a prefix file (under C/C++ Language settings). This 
! is to do the equivalent of the -D command line options for most other compilers.
  
! For Classic I build without large file support and without thread support.  So, the prefix file 
! contains:
  
    #define SQLITE_DISABLE_LFS
  
! For Carbon I build with large file and thread support. Note that a 'thread' to Apple is not the same 
! as a thread to everyone else. Apple uses the term 'multitasking' or (worse still) 'multiprocessing' 
! when it refers to pre-emptively scheduled threads. So the prefix file contains:
  
    #define THREADSAFE 1
  
! The other important thing to remember when making a Carbon executable is to include _carb.r_ in 
! your project (e.g. from _MacOS Support/PowerPlant/PowerPlant  Resources/carb.r_)
  
! The command line 'sqlite' utility builds using SIOUX.  For this you need all the files except 
! _tclsqlite.c_. You can build the TCL library as a separate exercise, but you will need to put _tcl.h_ in 
! your Access Paths (under User Paths). Note that, when you use this utility, any relative path names 
! you give it are relative to the directory containing the executable, and you will need to use Mac 
! paths (using colons), even with the Carbon build running under OS X.
  
  The libraries you will need for the Classic build are:
  
***************
*** 34,40 ****
  *:MSL_All_Carbon.lib
  *:CarbonLib
  
! All these (except the standard .libs) are under _MacOS Support/Universal/Libraries_, and then under _PPCLibraries_ and _StubLibraries_. The standard libraries are under _MSL/MSL_C//MSL_MacOS/Lib/PPC_.
  
  If you are building a shared library, you will need a file sqlite.mcp.exp, containing the following:
  
--- 48,56 ----
  *:MSL_All_Carbon.lib
  *:CarbonLib
  
! All these (except the standard .libs) are under _MacOS Support/Universal/Libraries_, and then 
! under _PPCLibraries_ and _StubLibraries_. The standard libraries are under _MSL/MSL_C//
! MSL_MacOS/Lib/PPC_.
  
  If you are building a shared library, you will need a file sqlite.mcp.exp, containing the following:
  
***************
*** 72,80 ****
  
  A couple of other settings I do:
  
! 1:On PPC Target, Creator, I put SQLI. (I'm not sure if that's the correct thing to do, but files created by sqlite, have this as the creator and 'Document' as type')
! 2:On PPC Processor, I put Struct Alignment as PowerPC, Target Processor as Generic PowerPC and Function alignment as 4.
! 3:If you are building a shared library, on PPC linker, remove __start from Main (Entry Points). Also don't include _shell.c_ in the build.
  4:On PPC PEF I set the fragment name to sqlite, or tclsqlite if I am building for TCL.
  
  I hope this works for you.  If you find out anything else useful, add it to this page.
--- 88,125 ----
  
  A couple of other settings I do:
  
! 1:On PPC Target, Creator, I put SQLI. (I'm not sure if that's the correct thing to do, but files created 
! by sqlite, have this as the creator and 'Document' as type')
! 2:On PPC Processor, I put Struct Alignment as PowerPC, Target Processor as Generic PowerPC and 
! Function alignment as 4.
! 3:If you are building a shared library, on PPC linker, remove __start from Main (Entry Points). Also 
! don't include _shell.c_ in the build.
  4:On PPC PEF I set the fragment name to sqlite, or tclsqlite if I am building for TCL.
  
  I hope this works for you.  If you find out anything else useful, add it to this page.
+ 
+ Added on 08/25/03 by mau: these instructions are good, but there are a couple of extra steps that 
+ are needed in order to compile a Classic library that can be used on older versions of MacOS (8.1-
+ 8.6). If you simply add the libraries in CW8.3 the executable or library created will not open in 
+ these older machines if you forget the following steps:
+ 
+   In the classic target, don't forget to highlight the following libraries and set them to IMPORT 
+ WEAK (open the project inspector and select the libraries in the project window to set this)
+   InterfaceLib
+   CarbonAccessors.o
+   MathLib
+   UnicodeConverter
+   TextCommon
+ 
+   This will guarantee that your executable/library will load when used with OS8.1, since the 
+ InterfaceLib and other stubs were different (and you can not use Universal Interfaces 3.2 with CW 
+ 8). However in order to guarantee that the code will run without a type 3 error you need to make 
+ sure support for large files is disabled as well, since the LFS functions used by FileManager are 
+ only available in OS9 and later. The easy way to do this in CW is to create a file (name it 
+ classic.pfx.pch), with the following contents:
+ 
+   #define SQLITE_DISABLE_LFS 1
+ 
+   Save this file in the same directory of your project, and enter the file name in the Classic target 
+ settings window, LANGUAGE SETTINGS->C/C++ Language-> PREFIX FILE. Recompile, and you 
+ should be ok.