diff options
Diffstat (limited to 'Frameworks/SPMySQLFramework/build-mysql-client.sh')
-rwxr-xr-x | Frameworks/SPMySQLFramework/build-mysql-client.sh | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/Frameworks/SPMySQLFramework/build-mysql-client.sh b/Frameworks/SPMySQLFramework/build-mysql-client.sh index bd3fa0db..6e7be914 100755 --- a/Frameworks/SPMySQLFramework/build-mysql-client.sh +++ b/Frameworks/SPMySQLFramework/build-mysql-client.sh @@ -43,15 +43,15 @@ QUIET='NO' DEBUG='NO' CLEAN='NO' -# C/C++ compiler flags -export CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -arch x86_64 -O3 -fno-omit-frame-pointer -fno-exceptions -mmacosx-version-min=10.5' -export CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -arch x86_64 -O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mmacosx-version-min=10.5' +# Configuration +MIN_OS_X_VERSION='10.5' +ARCHITECTURES='-arch ppc -arch i386 -arch x86_64' CONFIGURE_OPTIONS='-DBUILD_CONFIG=mysql_release -DENABLED_LOCAL_INFILE=1 -DWITH_SSL=bundled -DWITH_MYSQLD_LDFLAGS="-all-static --disable-shared"' OUTPUT_DIR='SPMySQLFiles.build' -set -A INCLUDE_HEADERS 'my_alloc.h' 'my_list.h' 'mysql_com.h' 'mysql_time.h' 'mysql_version.h' 'mysql.h' 'typelib.h' ESC=`printf '\033'` +set -A INCLUDE_HEADERS 'my_alloc.h' 'my_list.h' 'mysql_com.h' 'mysql_time.h' 'mysql_version.h' 'mysql.h' 'typelib.h' usage() { @@ -67,6 +67,7 @@ Where: -s -- Path to the MySQL source directory # Test for cmake cmake --version > /dev/null 2>&1 + if [ ! $? -eq 0 ] then echo "$ESC[1;31mIn addition to the standard OS X build tools, '$ESC[0;1mcmake$ESC[1;31m' is required to compile the MySQL source. $ESC[0;1mcmake$ESC[1;31m is found at $ESC[0mcmake.org$ESC[1;31m, and a binary distribution is available from $ESC[0mhttp://www.cmake.org/cmake/resources/software.mhtml$ESC[1;31m ." @@ -82,7 +83,6 @@ then exit 1 fi - while getopts ':s:qcd' OPTION do case "$OPTION" in @@ -106,6 +106,7 @@ if [ "x${DEBUG}" == 'xYES' ] then echo "cd ${MYSQL_SOURCE_DIR}" fi + cd "$MYSQL_SOURCE_DIR" # Perform a clean if requested @@ -116,10 +117,12 @@ then if [ "x${QUIET}" == 'xYES' ] then make clean > /dev/null + if [ -f 'CMakeCache.txt' ]; then rm 'CMakeCache.txt' > /dev/null; fi if [ -d "$OUTPUT_DIR" ]; then rm -rf "$OUTPUT_DIR" > /dev/null; fi else make clean + if [ -f 'CMakeCache.txt' ]; then rm 'CMakeCache.txt'; fi if [ -d "$OUTPUT_DIR" ]; then rm -rf "$OUTPUT_DIR" > /dev/null; fi fi @@ -143,6 +146,19 @@ then exit 0 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="-isysroot ${SDK_PATH} ${ARCHITECTURES} -O3 -fno-omit-frame-pointer -fno-exceptions -mmacosx-version-min=${MIN_OS_X_VERSION}" +export CXXFLAGS="-isysroot ${SDK_PATH} ${ARCHITECTURES} -O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mmacosx-version-min=${MIN_OS_X_VERSION}" echo "$ESC[1mConfiguring MySQL source...$ESC[0m" @@ -200,6 +216,7 @@ then exit 1 fi fi + if [ ! -d "${OUTPUT_DIR}/lib" ] then mkdir "${OUTPUT_DIR}/lib" @@ -209,6 +226,7 @@ then exit 1 fi fi + if [ ! -d "${OUTPUT_DIR}/include" ] then mkdir "${OUTPUT_DIR}/include" @@ -221,6 +239,7 @@ fi # Copy the library cp 'libmysql/libmysqlclient.a' "${OUTPUT_DIR}/lib/" + if [ ! $? -eq 0 ] then echo "$ESC[1;31mCould not copy libmysqlclient.a to output directory! (${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/lib)$ESC[0m" @@ -236,8 +255,7 @@ do echo "$ESC[1;31mCould not copy ${eachheader} to output directory! (${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/include)$ESC[0m" exit 1 fi -done - +done echo "$ESC[1mBuilding MySQL client libraries successfully completed.$ESC[0m" echo "$ESC[1mSee ${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/ for the product.$ESC[0m" |