Kyng Chaos
“The beast is actively interested only in now, and, as it is always now and always shall be, there is an eternity of time for the accomplishment of objects.”
- the wisdom of Tarzan

PostgreSQL Build

version: 8.3.3
source: postgresql.org
installer: PostgreSQL

FIXME check if arch flags can be used directly instead of ccub.
FIXME add contrib compilation instructions.

Postgres can't be compiled universal out of the box. This is because ld is used directly to assemble intermediate object files, and ld doesn't do multiple architectures. It's simple to fix - use gcc -Wl,-r -nostdlib to assemble those object files. Here's what to do:

Edit src/makefile.global.in, change the LDREL line to:

LDREL = -Wl,-r

Don't worry about LD, that will be change from configure.

Leopard

In the postgresql source folder:

Configure

export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --with-openssl --with-pam --with-krb5 --with-ldap --enable-thread-safety \
--with-bonjour --with-python --without-perl --enable-nls \
CC=ccub_3264 CFLAGS="-Os -D_FILE_OFFSET_BITS=64" LD="ccub_3264 -nostdlib"

I left out perl support because perl is like python, only partially 64bits, and I haven't tried adding it (I'm not really interested in perl).

When configure is done, a couple files must be patched for endianess and 64bits:

src/include/pg_config.h

replace in each:

64bit stuff

– the ALIGNOF_DOUBLE line with:

#ifdef __LP64__
#define ALIGNOF_DOUBLE 8
#else
#define ALIGNOF_DOUBLE 4
#endif

– the ALIGNOF_LONG line with:

#ifdef __LP64__
#define ALIGNOF_LONG 8
#else
#define ALIGNOF_LONG 4
#endif

– the ALIGNOF_LONG_LONG_INT line with:

#ifndef __LP64__
#define ALIGNOF_LONG_LONG_INT 4
#endif

– the HAVE_LL_CONSTANTS line with:

#ifndef __LP64__
#define HAVE_LL_CONSTANTS 1
#endif

– the HAVE_LONG_INT_64 and HAVE_LONG_LONG_INT_64 lines with:

#ifdef __LP64__
#define HAVE_LONG_INT_64 
#else
#define HAVE_LONG_LONG_INT_64 
#endif

– the INT64_FORMAT line with:

#ifdef __LP64__
#define INT64_FORMAT "%ld"
#else
#define INT64_FORMAT "%lld"
#endif

– the MAXIMUM_ALIGNOF line with:

#ifdef __LP64__
#define MAXIMUM_ALIGNOF 8
#else
#define MAXIMUM_ALIGNOF 4
#endif

– the SIZEOF_SIZE_T line with:

#ifdef __LP64__
#define SIZEOF_SIZE_T 8
#else
#define SIZEOF_SIZE_T 4
#endif

– the SIZEOF_UNSIGNED_LONG line with:

#ifdef __LP64__
#define SIZEOF_UNSIGNED_LONG 8
#else
#define SIZEOF_UNSIGNED_LONG 4
#endif

– the UINT64_FORMAT line with:

#ifdef __LP64__
#define UINT64_FORMAT "%lu"
#else
#define UINT64_FORMAT "%llu"
#endif

endian stuff

– the WORDS_BIGENDIAN line with:

#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#undef WORDS_BIGENDIAN
#endif

src/interfaces/ecpg/include/ecpg_config.h

64bit stuff

– the HAVE_LONG_INT_64 and HAVE_LONG_LONG_INT_64 lines with:

#ifdef __LP64__
#define HAVE_LONG_INT_64 
#else
#define HAVE_LONG_LONG_INT_64 
#endif

make & install

make
sudo make install

Tiger

In the postgresql source folder:

Configure

export MACOSX_DEPLOYMENT_TARGET=10.4
./configure --with-openssl --with-pam --with-krb5 --with-ldap --enable-thread-safety \
--with-bonjour --with-python --without-perl --enable-nls \
CC=ccub_3264 CFLAGS="-Os -D_FILE_OFFSET_BITS=64" LD="ccub_3264 -nostdlib"

When adding Python support, an up-to-date package from python.org is recommended.

When configure is done, a couple files must be patched for endianess and 64bits:

src/include/pg_config.h

Apply just the endian edits from the Leopard notes.

make & install

make
sudo make install

Panther

In the postgresql source folder:

export MACOSX_DEPLOYMENT_TARGET=10.3
./configure --with-openssl --with-pam --with-krb5 --with-ldap --enable-thread-safety \
--with-bonjour --with-python --without-perl --enable-nls \
CFLAGS="-Os -D_FILE_OFFSET_BITS=64" LD="gcc -nostdlib"
make
sudo make install

When adding Python support, an up-to-date package from python.org is recommended.

Setup

For now, see the Postgres documentation and the Installation section of the README.postgis document.

macosx/build/postgresql.txt (2523 views) · Last modified: 2008/08/14 08:22 by kyngchaos
Copyright © 2004-2009 William Kyngesburye Driven by DokuWiki Recent changes RSS feed