So we start with:
$ wget http://www.sqlite.org/sqlite-2.8.17.tar.gz
$ tar -zxf sqlite-2.8.17.tar.gz
The next big problem comes with CFLAGS. The package we are about to install comes with a pre-made configure script that doesn't respects the CFLAGS environment variable when creating the dynamic library. It took me a while but I have the patch for you, too.
--- configure.old 2008-12-21 18:50:24.000000000 -0200
+++ configure 2008-12-21 18:57:11.000000000 -0200
@@ -8253,7 +8253,7 @@
;;
esac
output_verbose_link_cmd='echo'
- archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
+ archive_cmds='$CC '$CFLAGS' -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
# Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
After applying the patch to the configure file we can proceed as usual:
$ ./configure --prefix=/usr/local LDFLAGS="-arch i686 -arch x86_64" CFLAGS="-arch i686 -arch x86_64"
$ make
I like to take full advantage of my system so I like to have things working at 64 bits. Just for the case I ever need a tool that won't go 64, I keep a fat binary with both archs 32 and 64. At this point we should check our work:
$ file .libs/libsqlite.0.8.6.dylib
.libs/libsqlite.0.8.6.dylib: Mach-O universal binary with 2 architectures
.libs/libsqlite.0.8.6.dylib (for architecture i386): Mach-O dynamically linked shared library i386
.libs/libsqlite.0.8.6.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
Everything seems fine. So we finally install it:
$ sudo make install