diff options
author | rowanbeentje <rowan@beent.je> | 2012-04-09 16:37:31 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-04-09 16:37:31 +0000 |
commit | 761ee77727eb18e0ed6980ea98ea723cb8b3e817 (patch) | |
tree | b3090244ce5c62b31464e7d3dc1c4f370e9f62e9 /Frameworks/SPMySQLFramework/build-mysql-client.sh | |
parent | 535ae6f2b8313ea6d5ae2e878dcd17d369807079 (diff) | |
download | sequelpro-761ee77727eb18e0ed6980ea98ea723cb8b3e817.tar.gz sequelpro-761ee77727eb18e0ed6980ea98ea723cb8b3e817.tar.bz2 sequelpro-761ee77727eb18e0ed6980ea98ea723cb8b3e817.zip |
- Upgrade to the MySQL 5.5.22 client libraries, updating to a much more up-to-date codebase.
- Update the build-mysql-client.sh MySQL build script within SPMySQL.framework to allow it to easily build 5.5 client libraries
- Fix reconnection within SPMySQL.framework after a connection is lost for MySQL servers < 5 when a query is cancelled by killing the connection
Diffstat (limited to 'Frameworks/SPMySQLFramework/build-mysql-client.sh')
-rwxr-xr-x | Frameworks/SPMySQLFramework/build-mysql-client.sh | 175 |
1 files changed, 121 insertions, 54 deletions
diff --git a/Frameworks/SPMySQLFramework/build-mysql-client.sh b/Frameworks/SPMySQLFramework/build-mysql-client.sh index 45e3c465..158d9393 100755 --- a/Frameworks/SPMySQLFramework/build-mysql-client.sh +++ b/Frameworks/SPMySQLFramework/build-mysql-client.sh @@ -27,10 +27,10 @@ # Builds the MySQL client libraries for distrubution in Sequel Pro's MySQL framework. # -# Paramters: -s -- The path to the MySQL source directory. -# -q -- Quiet. Don't output any compiler messages. -# -c -- Clean the source after build completes. -# -d -- Debug. Output the build statements. +# Parameters: -s -- The path to the MySQL source directory. +# -q -- Quiet. Don't output any compiler messages. +# -c -- Clean the source instead of building it. +# -d -- Debug. Output the build statements. QUIET='NO' DEBUG='NO' @@ -40,8 +40,11 @@ CLEAN='NO' 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' -CONFIGURE_OPTIONS='--without-server --enable-thread-safe-client --disable-dependency-tracking --enable-local-infile --with-ssl --enable-assembler --with-mysqld-ldflags=-all-static' -BINARY_DISTRIBUTION_SCRIPT='scripts/make_binary_distribution' +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'` usage() { @@ -50,32 +53,28 @@ Usage: $(basename $0): -s <mysql_source_path> [-q -c -d] Where: -s -- Path to the MySQL source directory -q -- Be quiet during the build. Suppress all compiler messages - -c -- Clean the source directory after the build completes + -c -- Clean the source directory instead of building -d -- Debug. Output all the build commands !EOF } +# 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 ." + echo "Exiting...$ESC[0m" + exit 1 +fi + if [ $# -eq 0 ] then - echo "Invalid number of arguments. I need the path to the MySQL source directory." + echo "$ESC[1;31mInvalid number of arguments. I need the path to the MySQL source directory.$ESC[0m" echo '' usage exit 1 fi -echo '' -echo "This script builds the MySQL client libraries for distribution in Sequel Pro's MySQL framework." -echo 'They are all built as 3-way binaries (32 bit PPC, 32/64 bit i386).' -echo '' -echo -n 'This may take a while, are you sure you want to continue [y | n]: ' - -read CONTINUE - -if [ "x${CONTINUE}" == 'xn' ] -then - echo 'Aborting...' - exit 0 -fi while getopts ':s:qcd' OPTION do @@ -84,88 +83,156 @@ do q) QUIET='YES';; c) CLEAN='YES';; d) DEBUG='YES';; - *) echo 'Unrecognised option'; usage; exit 1;; + *) echo "$ESC[1;31mUnrecognised option$ESC[0m"; usage; exit 1;; esac done if [ ! -d "$MYSQL_SOURCE_DIR" ] then - echo "MySQL source directory does not exist at path '${MYSQL_SOURCE_DIR}'." - echo 'Exiting...' + echo "$ESC[1;31mMySQL source directory does not exist at path '${MYSQL_SOURCE_DIR}'.$ESC[0m" + echo "$ESC[1;31mExiting...$ESC[0m" exit 1 fi # Change to source directory +if [ "x${DEBUG}" == 'xYES' ] +then + echo "cd ${MYSQL_SOURCE_DIR}" +fi cd "$MYSQL_SOURCE_DIR" -echo 'Configuring MySQL source...' +# Perform a clean if requested +if [ "x${CLEAN}" == 'xYES' ] +then + echo "$ESC[1mCleaning MySQL source and builds...$ESC[0m" + + 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 + + echo "$ESC[1mCleaning MySQL completed.$ESC[0m" + + exit 0 +fi + +echo '' +echo "This script builds the MySQL client libraries for distribution in Sequel Pro's MySQL framework." +echo 'They are all built as 3-way binaries (32 bit PPC, 32/64 bit i386).' +echo '' +echo -n "$ESC[1mThis may take a while, are you sure you want to continue [y | n]: $ESC[0m" + +read CONTINUE + +if [ "x${CONTINUE}" == 'xn' ] +then + echo "$ESC[31mAborting...$ESC[0m" + exit 0 +fi + + +echo "$ESC[1mConfiguring MySQL source...$ESC[0m" if [ "x${DEBUG}" == 'xYES' ] then - echo "${MYSQL_SOURCE_DIR}/configure" "$CONFIGURE_OPTIONS" + echo "cmake ${CONFIGURE_OPTIONS} ." fi if [ "x${QUIET}" == 'xYES' ] then - ./configure $CONFIGURE_OPTIONS > /dev/null + cmake $CONFIGURE_OPTIONS . > /dev/null else - ./configure $CONFIGURE_OPTIONS + cmake $CONFIGURE_OPTIONS . fi if [ $? -eq 0 ] then - echo 'Configure successfully completed' + echo "$ESC[1mConfigure successfully completed$ESC[0m" else - echo 'Configure failed. Exiting...' + echo "$ESC[1;31mConfigure failed. Exiting...$ESC[0m" exit 1 fi -echo 'Building client libraries...' +if [ "x${DEBUG}" == 'xYES' ] +then + echo "make mysqlclient" +fi + +echo "$ESC[1mBuilding client libraries...$ESC[0m" if [ "x${QUIET}" == 'xYES' ] then - make > /dev/null + make mysqlclient > /dev/null else - make + make mysqlclient fi if [ $? -eq 0 ] then - echo 'Building libraries successfully completed' + echo "$ESC[1mBuilding libraries successfully completed$ESC[0m" else - echo 'Building libraries failed. Exiting...' + echo "$ESC[1;31mBuilding libraries failed. Exiting...$ESC[0m" exit 1 fi -echo 'Building binary distribution...' +echo "$ESC[1mPutting together files for distribution...$ESC[0m" -if [ "x${QUIET}" == 'xYES' ] +# Create the appropriate directories +if [ ! -d "$OUTPUT_DIR" ] then - $BINARY_DISTRIBUTION_SCRIPT > /dev/null -else - $BINARY_DISTRIBUTION_SCRIPT + mkdir "$OUTPUT_DIR" + if [ ! $? -eq 0 ] + then + echo "$ESC[1;31mCould not create $OUTPUT_DIR output directory!$ESC[0m" + exit 1 + fi +fi +if [ ! -d "${OUTPUT_DIR}/lib" ] +then + mkdir "${OUTPUT_DIR}/lib" + if [ ! $? -eq 0 ] + then + echo "$ESC[1;31mCould not create ${OUTPUT_DIR}/lib output directory!$ESC[0m" + exit 1 + fi +fi +if [ ! -d "${OUTPUT_DIR}/include" ] +then + mkdir "${OUTPUT_DIR}/include" + if [ ! $? -eq 0 ] + then + echo "$ESC[1;31mCould not create ${OUTPUT_DIR}/include output directory!$ESC[0m" + exit 1 + fi fi -if [ $? -eq 0 ] +# Copy the library +cp 'libmysql/libmysqlclient.a' "${OUTPUT_DIR}/lib/" +if [ ! $? -eq 0 ] then - echo 'Building binary distribution successfully completed' -else - echo 'Building binary distribution failed. Exiting...' + echo "$ESC[1;31mCould not copy libmysqlclient.a to output directory! (${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/lib)$ESC[0m" exit 1 fi -if [ "x${CLEAN}" == 'xYES' ] -then - echo 'Cleaning build...' - - if [ "x${QUIET}" == 'xYES' ] +# Copy in the required headers +for eachheader in ${INCLUDE_HEADERS[@]} +do + cp "include/${eachheader}" "${OUTPUT_DIR}/include/" + if [ ! $? -eq 0 ] then - make clean > /dev/null - else - make clean + echo "$ESC[1;31mCould not copy ${eachheader} to output directory! (${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/include)$ESC[0m" + exit 1 fi -fi +done + -echo 'Building MySQL client libraries successfully completed.' +echo "$ESC[1mBuilding MySQL client libraries successfully completed.$ESC[0m" +echo "$ESC[1mSee ${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/ for the product.$ESC[0m" exit 0 |