aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Scripts/build-libpq.sh
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/PostgresKit/Scripts/build-libpq.sh')
-rwxr-xr-xFrameworks/PostgresKit/Scripts/build-libpq.sh24
1 files changed, 18 insertions, 6 deletions
diff --git a/Frameworks/PostgresKit/Scripts/build-libpq.sh b/Frameworks/PostgresKit/Scripts/build-libpq.sh
index e94308e9..43e8a48e 100755
--- a/Frameworks/PostgresKit/Scripts/build-libpq.sh
+++ b/Frameworks/PostgresKit/Scripts/build-libpq.sh
@@ -42,15 +42,13 @@
QUIET='NO'
CLEAN='NO'
+# Configuration
MIN_OS_X_VERSION='10.5'
-
-# C/C++ compiler flags
-export CFLAGS="-isysroot /Developer3/SDKs/MacOSX${MIN_OS_X_VERSION}.sdk -arch ppc -arch i386 -arch x86_64 -O3 -fno-omit-frame-pointer -fno-exceptions -mmacosx-version-min=${MIN_OS_X_VERSION}"
-export CXXFLAGS="-isysroot /Developer3/SDKs/MacOSX${MIN_OS_X_VERSION}.sdk -arch ppc -arch i386 -arch x86_64 -O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mmacosx-version-min=${MIN_OS_X_VERSION}"
-
-ESC=$(printf '\033')
+ARCHITECTURES='-arch ppc -arch i386 -arch x86_64'
CONFIGURE_OPTIONS='--enable-thread-safety --with-openssl'
+COMMON_COMPILE_OPTIONS="-fno-omit-frame-pointer -fno-exceptions -mmacosx-version-min=${MIN_OS_X_VERSION}"
+ESC=$(printf '\033')
set -A INCLUDE_HEADERS 'src/interfaces/libpq/libpq-fe.h' 'src/include/postgres_ext.h'
usage()
@@ -104,6 +102,20 @@ else
OUTPUT_PATH="$POSTGRESQL_SOURCE_DIR"
fi
+# Find the SDK path
+SDK_PATH=$(xcodebuild -version -sdk 2>/dev/null | grep "^Path: [a-zA-Z0-9\/\.]*$" | awk -F' ' '{ print $2 }' | grep "$MIN_OS_X_VERSION")
+
+if [ "x${SDK_PATH}" == 'x' ]
+then
+ echo "$ESC[1;31mNo SDK found matching OS X version ${MIN_OS_X_VERSION}.$ESC[0m"
+ echo "$ESC[1;31mExiting...$ESC[0m"
+ exit 1
+fi
+
+# C/C++ compiler flags
+export CFLAGS="-O3 -isysroot ${SDK_PATH} ${ARCHITECTURES} ${COMMON_COMPILE_OPTIONS}"
+export CXXFLAGS="-O3 -isysroot ${SDK_PATH} ${ARCHITECTURES} ${COMMON_COMPILE_OPTIONS} -felide-constructors -fno-rtti"
+
OUTPUT_PATH="${OUTPUT_PATH}/SPPostgreSQLFiles.build"
cd "$POSTGRESQL_SOURCE_DIR"