| #!/bin/sh |
| |
| "@CMAKE_COMMAND@" -E make_directory server/nodes |
| "@CMAKE_COMMAND@" -E make_directory server/utils |
| |
| # Unfortunately, server/nodes/parsenodes.h from PG < 9.0 contains identifiers |
| # that are C++ keywords. Since this file changed frequently even within |
| # major builds, we do a simple find & substitute. Essentially, we replace |
| # - "Oid typeid;" by "Oid typeOid;" |
| # - "TypeName *typename;" by "TypeName *typeName;" |
| # - "List *typename;" by "List *typeName;" |
| # (These are the names used by the PG 9 header files.) |
| |
| sed -e 's/\(Oid[[:space:]]\{1,\}\)typeid;/\1typeOid;/g' \ |
| -e 's/\(TypeName[[:space:]]\{1,\}\*[[:space:]]*\)typename/\1typeName/g' \ |
| -e 's/\(List[[:space:]]\{1,\}\*[[:space:]]*\)typename/\1typeName/g' \ |
| "@POSTGRESQL_8_4_SERVER_INCLUDE_DIR@/nodes/parsenodes.h" > \ |
| server/nodes/parsenodes.h |
| |
| # Likewise, server/nodes/primnodes.h uses the "using" keyword. We replace |
| # - "List *using;" by "List *usingClause;" |
| |
| sed -e 's/\(List[[:space:]]\{1,\}\*[[:space:]]*\)using/\1usingClause/g' \ |
| "@POSTGRESQL_8_4_SERVER_INCLUDE_DIR@/nodes/primnodes.h" > \ |
| server/nodes/primnodes.h |
| |
| # And onther C++ incompatible file, server/utils/builtins.h. Replacing |
| # - "const char *namespace," by "const char *qualifier," |
| |
| sed 's/\(const[[:space:]]\{1,\}char[[:space:]]*\*[[:space:]]*\)namespace[[:space:]]*,/\1qualifier,/g' \ |
| "@POSTGRESQL_8_4_SERVER_INCLUDE_DIR@/utils/builtins.h" > \ |
| server/utils/builtins.h |
| |
| # More fun: server/nodes/memnodes.h contains "delete". |
| |
| sed 's/[(][[:space:]]*[*][[:space:]]*delete[[:space:]]*[)]/(*delete_context)/g' \ |
| "@POSTGRESQL_8_4_SERVER_INCLUDE_DIR@/nodes/memnodes.h" > \ |
| server/nodes/memnodes.h |