aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/build-mysql-client.sh
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-07-21 16:47:11 +0000
committerstuconnolly <stuart02@gmail.com>2009-07-21 16:47:11 +0000
commit8b8f3e6cea540b17262aadf6d97a8ad28fe41c03 (patch)
treead6bb7f53b03924aa24d0cf5822a27b3bd453592 /Scripts/build-mysql-client.sh
parent383863f98dfc488db0181e01d39da1bb025d421b (diff)
downloadsequelpro-8b8f3e6cea540b17262aadf6d97a8ad28fe41c03.tar.gz
sequelpro-8b8f3e6cea540b17262aadf6d97a8ad28fe41c03.tar.bz2
sequelpro-8b8f3e6cea540b17262aadf6d97a8ad28fe41c03.zip
Merge framework integration branch back to trunk. Summary of changes:
- Includes all custom code from subclasses CMMCPConnection and CMMCPResult, meaning they have subsequently been removed from the project. - All previous Sequel Pro specific code in the above subclasses has been removed in favour of the delegate (currently set to TableDocumet) informing the framework of such information. - All references to CMMCPConnection and CMMCPResult have subsequently been changed to MCPConnection and MCPResult. - Framework includes MySQL 5.1.36 client libraries and source headers. - Framework is now built as a 4-way (32/64 bit, i386/PPC arch) binary. - All import references to <MCPKit_bundled/MCPKit_bundled.h> have been changed to <MCPKit/MCPKit.h>. - New script 'build-mysql-client.sh' can be used to build the MySQL client libraries from the MySQL source. See the script's header for a list of available options or run it with no arguments to display it's usage. Note that there are still a few changes to be made to the framework with regard to removing Sequel Pro specific calls to the delegate. These however can be made later on as they have no effect on functionality and are merely design changes. Also, note that any future development done on the framework should be made to be as 'generic' as possible, with no Sequel Pro specific references. This should allow the framework to be integrated into another project without the need for SP specific code.
Diffstat (limited to 'Scripts/build-mysql-client.sh')
-rwxr-xr-xScripts/build-mysql-client.sh151
1 files changed, 151 insertions, 0 deletions
diff --git a/Scripts/build-mysql-client.sh b/Scripts/build-mysql-client.sh
new file mode 100755
index 00000000..09e373f2
--- /dev/null
+++ b/Scripts/build-mysql-client.sh
@@ -0,0 +1,151 @@
+#! /bin/ksh
+
+## $Id: build-mysql-client.sh 1044 2009-07-17 14:30:58Z stuart02 $
+##
+## Author: Stuart Connolly (stuconnolly.com)
+## Copyright (c) 2009 Stuart Connolly. All rights reserved.
+##
+## 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.
+##
+## Description: Builds the MySQL client libraries for distrubution in Sequel Pro's MCPKit MySQL framework.
+
+QUIET='NO'
+DEBUG='NO'
+CLEAN='NO'
+
+# C/C++ compiler flags
+export CFLAGS='-arch ppc -arch i386 -arch ppc64 -arch x86_64 -O3 -fno-omit-frame-pointer'
+export CXXFLAGS='-arch ppc -arch i386 -arch ppc64 -arch x86_64 -O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti'
+
+CONFIGURE_OPTIONS='--without-server --enable-thread-safe-client --disable-dependency-tracking'
+BINARY_DISTRIBUTION_SCRIPT='scripts/make_binary_distribution'
+
+usage()
+{
+ cat <<!EOF
+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
+ -d -- Debug. Output all the build commands
+!EOF
+}
+
+if [ $# -eq 0 ]
+then
+ echo "Invalid number of arguments. I need the path to the MySQL source directory."
+ echo ''
+ usage
+ exit 1
+fi
+
+echo ''
+echo "This script builds the MySQL client libraries for distrubution in Sequel Pro's MCPKit MySQL framework."
+echo 'The are all built as 4-way (32/64 bit, i386/PPC arch) binaries.'
+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
+ case "$OPTION" in
+ s) MYSQL_SOURCE_DIR="$OPTARG";;
+ q) QUIET='YES';;
+ c) CLEAN='YES';;
+ d) DEBUG='YES';;
+ *) echo 'Unrecognised option'; 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...'
+ exit 1
+fi
+
+# Change to source directory
+cd "$MYSQL_SOURCE_DIR"
+
+echo 'Configuring MySQL source...'
+
+if [ "x${DEBUG}" == 'xYES' ]
+then
+ echo "${MYSQL_SOURCE_DIR}/configure" "$CONFIGURE_OPTIONS"
+fi
+
+if [ "x${QUIET}" == 'xYES' ]
+then
+ ./configure $CONFIGURE_OPTIONS > /dev/null
+else
+ ./configure $CONFIGURE_OPTIONS
+fi
+
+if [ $? -eq 0 ]
+then
+ echo 'Configure successfully completed'
+else
+ echo 'Configure failed. Exiting...'
+ exit 1
+fi
+
+echo 'Building client libraries...'
+
+if [ "x${QUIET}" == 'xYES' ]
+then
+ make > /dev/null
+else
+ make
+fi
+
+if [ $? -eq 0 ]
+then
+ echo 'Bulding libraries successfully completed'
+else
+ echo 'Bulding libraries failed. Exiting...'
+ exit 1
+fi
+
+echo 'Building binary distribution...'
+
+if [ "x${QUIET}" == 'xYES' ]
+then
+ $BINARY_DISTRIBUTION_SCRIPT > /dev/null
+else
+ $BINARY_DISTRIBUTION_SCRIPT
+fi
+
+if [ $? -eq 0 ]
+then
+ echo 'Bulding binary distribution successfully completed'
+else
+ echo 'Bulding binary distribution failed. Exiting...'
+ exit 1
+fi
+
+if [ "x${CLEAN}" == 'xYES' ]
+then
+ echo 'Cleaning build...'
+
+ if [ "x${QUIET}" == 'xYES' ]
+ then
+ make clean > /dev/null
+ else
+ make clean
+ fi
+fi
+
+echo 'Building MySQL client libraries successfully completed.'
+
+exit 0