3 SCRIPTSDIR="`dirname $0`"
4 SRCDIR="`dirname $SCRIPTSDIR`/psycopg"
7 echo Usage: $0 '<postgresql include directory>'
11 echo -n checking for pg_type.h ...
12 if [ -f "$1/catalog/pg_type.h" ] ; then
13 PGTYPE="$1/catalog/pg_type.h"
15 if [ -f "$1/server/catalog/pg_type.h" ] ; then
16 PGTYPE="$1/server/catalog/pg_type.h"
19 echo "error: can't find pg_type.h under $1"
25 PGVERSION="`sed -n -e 's/.*PG_VERSION \"\([0-9]\.[0-9]\).*\"/\1/p' $1/pg_config.h`"
26 PGMAJOR="`echo $PGVERSION | cut -d. -f1`"
27 PGMINOR="`echo $PGVERSION | cut -d. -f2`"
29 echo checking for postgresql major: $PGMAJOR
30 echo checking for postgresql minor: $PGMINOR
32 echo -n generating pgtypes.h ...
33 awk '/#define .+OID/ {print "#define " $2 " " $3}' "$PGTYPE" \
36 echo -n generating typecast_builtins.c ...
37 awk '/#define .+OID/ {print $2 " " $3}' "$PGTYPE" | \
38 python $SCRIPTSDIR/buildtypes.py >$SRCDIR/typecast_builtins.c