summaryrefslogtreecommitdiff
path: root/binary/darwin
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-02-15 08:44:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-02-15 08:44:41 +0200
commitd845f920ec1f5cd6ef5a95366383e74725912441 (patch)
tree2969ea00c3dbb1553cde248fc918cfb241f361f6 /binary/darwin
parenta4a5194f4ffc82aa817f4b8e2d4f6d29dac1a0b9 (diff)
Add Mac OS X ODB binary build scripts
Diffstat (limited to 'binary/darwin')
-rw-r--r--binary/darwin/NOTES8
-rwxr-xr-xbinary/darwin/build-dist192
-rwxr-xr-xbinary/darwin/build-gcc65
-rw-r--r--binary/darwin/gcc-4.5.1-plugin-support.patch46
-rwxr-xr-xbinary/darwin/gcc-configure24
-rwxr-xr-xbinary/darwin/libcutl-configure12
-rwxr-xr-xbinary/darwin/libodb-boost-configure8
-rwxr-xr-xbinary/darwin/libodb-configure6
-rwxr-xr-xbinary/darwin/libodb-qt-configure7
-rwxr-xr-xbinary/darwin/odb-configure23
-rw-r--r--binary/darwin/test/gcc40
-rw-r--r--binary/darwin/test/gcc-qt33
12 files changed, 464 insertions, 0 deletions
diff --git a/binary/darwin/NOTES b/binary/darwin/NOTES
new file mode 100644
index 0000000..bc3fd87
--- /dev/null
+++ b/binary/darwin/NOTES
@@ -0,0 +1,8 @@
+* Newer versions of GCC (e.g., 4.7.3) support plugins on OS X out of the
+ box, so no patch is necessary.
+
+* Have to use previous GCC build (4.5.1) for libcutl/ODB compilation because
+ of some problems 4.7.3 has with older as. See build-dist PATH settings.
+
+ Because of that, we have to manually add 4.7.3 plugin headers to CPPFLAGS
+ (see odb-configure).
diff --git a/binary/darwin/build-dist b/binary/darwin/build-dist
new file mode 100755
index 0000000..ccbe0a7
--- /dev/null
+++ b/binary/darwin/build-dist
@@ -0,0 +1,192 @@
+#! /usr/bin/env bash
+
+# Create ODB compiler Darwin distribution.
+#
+# -rebuild
+# -arch
+#
+trap 'exit 1' ERR
+
+function error ()
+{
+ echo "$*" 1>&2
+}
+
+rebuild=n
+
+arch=i686-apple-darwin8
+rebuild=n
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ -rebuild)
+ rebuild=y
+ shift
+ ;;
+ -arch)
+ shift
+ arch=$1
+ shift
+ ;;
+ *)
+ error "unknown option: $1"
+ exit 1
+ ;;
+ esac
+done
+
+wd=`pwd`
+cpu=`echo $arch | sed -e 's/^\([^-]*\)-.*$/\1/'`
+
+cver=`echo libcutl-?.*.tar.gz | sed -e "s%libcutl-\(.*\).tar.gz%\1%"`
+over=`echo odb-?.*.tar.gz | sed -e "s%odb-\(.*\).tar.gz%\1%"`
+mver=`echo $over | sed -e 's%\([0-9]*\.[0-9]*\).*%\1%'`
+
+install_root="/tmp/odb-$over-$cpu-macosx"
+
+# Using older version of GCC (newer one have trouble with old as).
+#
+export PATH=/$arch-4.5.1/bin:$PATH
+
+# Clean everything up if we are rebuilding.
+#
+if [ $rebuild = y ]; then
+ rm -rf libcutl
+ rm -rf odb odb-build-d odb-build-p
+ rm -rf $install_root
+ rm -rf libodb
+ rm -rf libodb-boost
+ rm -rf libodb-qt
+
+ if [ ! -d ../boost-binary ]; then
+ error "no boost distribution in ../boost-binary"
+ exit 1
+ fi
+
+ tar xfz libcutl-$cver.tar.gz
+ mv libcutl-$cver libcutl
+
+ tar xfz odb-$over.tar.gz
+ mv odb-$over odb
+
+ libodb=`echo libodb-$mver.*.tar.gz | sed -e 's%\(.*\)\.tar\.gz%\1%'`
+ tar xfz $libodb.tar.gz
+ mv $libodb libodb
+
+ libodb_boost=`echo libodb-boost-$mver.*.tar.gz | sed -e 's%\(.*\)\.tar\.gz%\1%'`
+ tar xfz $libodb_boost.tar.gz
+ mv $libodb_boost libodb-boost
+
+ libodb_qt=`echo libodb-qt-$mver.*.tar.gz | sed -e 's%\(.*\)\.tar\.gz%\1%'`
+ tar xfz $libodb_qt.tar.gz
+ mv $libodb_qt libodb-qt
+fi
+
+rm -f /tmp/odb-$over-$cpu-macosx.tar.bz2
+
+mkdir -p odb-build-d
+mkdir -p odb-build-p
+
+# Build libcutl
+#
+cd libcutl
+
+if [ $rebuild = y ]; then
+ ../libcutl-configure
+fi
+
+make
+cd ..
+
+# Build odb plugin
+#
+cd odb-build-p
+
+if [ $rebuild = y ]; then
+ ../odb-configure p $arch $install_root
+fi
+
+make
+make install-strip
+cd ..
+
+# Build odb driver
+#
+cd odb-build-d
+
+if [ $rebuild = y ]; then
+ ../odb-configure d $arch $install_root
+fi
+
+make -C odb odb
+cp odb/odb $install_root/bin/
+cd ..
+
+# Build libodb
+#
+cd libodb
+
+if [ $rebuild = y ]; then
+ ../libodb-configure $install_root/lib/odb/$arch
+fi
+
+make
+cd odb
+make install-data
+cd ../..
+
+# Build libodb-boost
+#
+cd libodb-boost
+
+if [ $rebuild = y ]; then
+ ../libodb-boost-configure $install_root/lib/odb/$arch
+fi
+
+make
+make install-data
+cd ..
+
+# Build libodb-qt
+#
+cd libodb-qt
+
+if [ $rebuild = y ]; then
+ ../libodb-qt-configure $install_root/lib/odb/$arch
+fi
+
+make
+make install-data
+cd ..
+
+# Copy /$arch over to installation
+#
+cp -r /$arch $install_root/lib/odb/
+
+# Copy the default options file.
+#
+mkdir -p $install_root/etc/odb
+cp ./default.options $install_root/etc/odb/
+
+# Copy manifest and README.
+#
+cp manifest $install_root/lib/odb/$arch/
+cp README $install_root/
+
+
+# Move doc and man out of share/
+#
+rm -rf $install_root/doc $install_root/man
+mv $install_root/share/man $install_root/
+mv $install_root/share/doc/odb $install_root/doc
+rm -r $install_root/share
+
+# Clean some things up.
+#
+rm -f `find $install_root -name '*.la'`
+
+# Pack it up.
+#
+cd /tmp
+tar cfj $wd/test/odb-$over-$cpu-macosx.tar.bz2 odb-$over-$cpu-macosx
+cd $wd
diff --git a/binary/darwin/build-gcc b/binary/darwin/build-gcc
new file mode 100755
index 0000000..93ffb41
--- /dev/null
+++ b/binary/darwin/build-gcc
@@ -0,0 +1,65 @@
+#! /usr/bin/env bash
+
+# Create GCC compiler Darwin distribution.
+#
+# -rebuild
+# -arch
+#
+trap 'exit 1' ERR
+
+function error ()
+{
+ echo "$*" 1>&2
+}
+
+arch=i686-apple-darwin8
+rebuild=n
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ -rebuild)
+ rebuild=y
+ shift
+ ;;
+ -arch)
+ shift
+ arch=$1
+ shift
+ ;;
+ *)
+ error "unknown option: $1"
+ exit 1
+ ;;
+ esac
+done
+
+out_root=`pwd`
+
+mkdir -p gcc-build
+
+# Need gcc-4.2.
+#
+export PATH=/usr/local/bin:$PATH
+
+# Clean everything up if we are rebuilding.
+#
+if [ $rebuild = y ]; then
+ rm -rf gcc-build/*
+ rm -rf /$arch/*
+fi
+
+# Build gcc
+#
+cd gcc-build
+
+if [ $rebuild = y ]; then
+ ../gcc-configure $arch
+fi
+
+make -j 2
+make install
+make -C $arch/libstdc++-v3 install-strip
+
+cd ..
+
+#cp ../gcc/gcc/config/darwin-sections.def /$arch/lib/gcc/$arch/4.5.1/plugin/include/
diff --git a/binary/darwin/gcc-4.5.1-plugin-support.patch b/binary/darwin/gcc-4.5.1-plugin-support.patch
new file mode 100644
index 0000000..9bd7c9f
--- /dev/null
+++ b/binary/darwin/gcc-4.5.1-plugin-support.patch
@@ -0,0 +1,46 @@
+Index: gcc/configure.ac
+===================================================================
+--- gcc/configure.ac (revision 161355)
++++ gcc/configure.ac (working copy)
+@@ -4544,15 +4544,23 @@
+ pluginlibs=
+ if test x"$enable_plugin" = x"yes"; then
+
++ case "${host}" in
++ *-*-darwin*)
++ export_sym_check="$gcc_cv_nm -g"
++ ;;
++ *)
++ export_sym_check="$gcc_cv_objdump -T"
++ ;;
++ esac
+ AC_MSG_CHECKING([for exported symbols])
+ echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c
+ ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest > /dev/null 2>&1
+- if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
++ if $export_sym_check conftest | grep foobar > /dev/null; then
+ : # No need to use a flag
+ else
+ AC_MSG_CHECKING([for -rdynamic])
+ ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest > /dev/null 2>&1
+- if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
++ if $export_sym_check conftest | grep foobar > /dev/null; then
+ plugin_rdynamic=yes
+ pluginlibs="-rdynamic"
+ else
+@@ -4572,7 +4580,14 @@
+
+ # Check that we can build shared objects with -fPIC -shared
+ saved_LDFLAGS="$LDFLAGS"
+- LDFLAGS="$LDFLAGS -fPIC -shared"
++ case "${host}" in
++ *-*-darwin*)
++ LDFLAGS="$LDFLAGS -fPIC -shared -undefined dynamic_lookup"
++ ;;
++ *)
++ LDFLAGS="$LDFLAGS -fPIC -shared"
++ ;;
++ esac
+ AC_MSG_CHECKING([for -fPIC -shared])
+ AC_TRY_LINK(
+ [extern int X;],[return X == 0;],
diff --git a/binary/darwin/gcc-configure b/binary/darwin/gcc-configure
new file mode 100755
index 0000000..fe758e3
--- /dev/null
+++ b/binary/darwin/gcc-configure
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+../../gcc/configure \
+--disable-bootstrap \
+--enable-languages=c,c++ \
+--disable-multiarch \
+--enable-shared \
+--disable-libssp \
+--disable-libgomp \
+--disable-nls \
+--disable-multilib \
+--disable-libstdcxx-pch \
+--prefix=/$1 \
+--enable-plugin \
+--build=$1 \
+--host=$1 \
+--target=$1 \
+--enable-cxx-flags=-fPIC \
+CFLAGS=-O2 CXXFLAGS=-O2 \
+CFLAGS_FOR_TARGET="-O2 -fno-common" CXXFLAGS_FOR_TARGET="-O2 -fno-common" \
+CC=gcc-4.2 CXX=g++-4.2
+
+
+# LDFLAGS="-s" -s interferes with plugin test
diff --git a/binary/darwin/libcutl-configure b/binary/darwin/libcutl-configure
new file mode 100755
index 0000000..daab3ad
--- /dev/null
+++ b/binary/darwin/libcutl-configure
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+libcxx=`g++ --print-file-name libstdc++.a`
+libgcc=`g++ --print-file-name libgcc.a`
+libgcc_eh=`g++ --print-file-name libgcc_eh.a`
+
+./configure \
+--disable-shared \
+--with-pic \
+CXX="g++ -nodefaultlibs" \
+CXXFLAGS=-O2 \
+LIBS="$libcxx $libgcc $libgcc_eh -lSystem"
diff --git a/binary/darwin/libodb-boost-configure b/binary/darwin/libodb-boost-configure
new file mode 100755
index 0000000..e35281a
--- /dev/null
+++ b/binary/darwin/libodb-boost-configure
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+./configure \
+--disable-shared \
+--enable-static \
+--with-libodb=../libodb \
+--with-boost=../../boost-binary \
+--prefix=$1
diff --git a/binary/darwin/libodb-configure b/binary/darwin/libodb-configure
new file mode 100755
index 0000000..83107c7
--- /dev/null
+++ b/binary/darwin/libodb-configure
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+./configure \
+--disable-shared \
+--enable-static \
+--prefix=$1
diff --git a/binary/darwin/libodb-qt-configure b/binary/darwin/libodb-qt-configure
new file mode 100755
index 0000000..12ff867
--- /dev/null
+++ b/binary/darwin/libodb-qt-configure
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+./configure \
+--disable-shared \
+--enable-static \
+--with-libodb=../libodb \
+--prefix=$1
diff --git a/binary/darwin/odb-configure b/binary/darwin/odb-configure
new file mode 100755
index 0000000..b199f2f
--- /dev/null
+++ b/binary/darwin/odb-configure
@@ -0,0 +1,23 @@
+#! /bin/sh
+
+if test "$1" = "d"; then
+ libcxx=`g++ --print-file-name libstdc++.a`
+ libgcc=`g++ --print-file-name libgcc.a`
+ libgcc_eh=`g++ --print-file-name libgcc_eh.a`
+
+ cxx="g++ -nodefaultlibs"
+ libs="$libcxx $libgcc $libgcc_eh -lSystem"
+else
+ cxx="g++"
+ libs=
+fi
+
+../odb/configure \
+--with-libcutl=../libcutl \
+--disable-rpath \
+--with-gxx-name=../lib/odb/$2/bin/g++ \
+--with-options-file=../etc/odb/default.options \
+--prefix=$3 \
+--libexecdir=$3/lib \
+CXX="$cxx" CXXFLAGS=-O2 LIBS="$libs" \
+CPPFLAGS="-I`/$2/bin/g++ --print-file-name plugin`/include"
diff --git a/binary/darwin/test/gcc b/binary/darwin/test/gcc
new file mode 100644
index 0000000..7ac3eb5
--- /dev/null
+++ b/binary/darwin/test/gcc
@@ -0,0 +1,40 @@
+SQLITE=$HOME/sqlite
+MYSQL=$HOME/odb/mysqlclient-5.1.51-osx10.4-i686
+PGSQL=$HOME/pgsql-8.4.8
+ORACLE=$HOME/oracle
+BOOST=$HOME/boost
+
+sqlite_build_options=
+sqlite_use_options=
+
+mysql_build_options=
+mysql_use_options="--with-mysql-host=192.168.0.5 --with-mysql-client=$MYSQL/bin/mysql"
+
+pgsql_build_options=
+pgsql_use_options="--with-pgsql-host=192.168.0.5 --with-pgsql-client=$PGSQL/bin/psql"
+
+oracle_build_options="--with-oci=$ORACLE"
+oracle_use_options="--with-oracle-host=192.168.0.5 --with-oracle-service=xe --with-oracle-client=$ORACLE/sqlplus"
+
+# @@ While we have Qt installed (as a framework), we don't have a g++ build
+# that is both recent enough (so it can handle friend access) and that supports
+# the -framework option. The target g++ (in /i686-apple-darwin8) does not work
+# because of the different libgcc_s used by Qt and other code (exception handling
+# does not work).
+#
+#
+with_qt=n
+with_boost=y
+
+CC=gcc-4.2
+CXX=g++-4.2
+CPPFLAGS="-I$BOOST -I$SQLITE -I$MYSQL/include -I$PGSQL/include"
+CXXFLAGS="-O3 -W -Wall -Wno-unknown-pragmas"
+LDFLAGS="-L$BOOST/stage/lib -L$SQLITE -L$MYSQL/lib -L$PGSQL/lib"
+
+export DYLD_LIBRARY_PATH=$SQLITE:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH=$MYSQL/lib:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH=$PGSQL/lib:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH=$ORACLE:$DYLD_LIBRARY_PATH
+
+export DYLD_LIBRARY_PATH=$BOOST/stage/lib:$DYLD_LIBRARY_PATH
diff --git a/binary/darwin/test/gcc-qt b/binary/darwin/test/gcc-qt
new file mode 100644
index 0000000..c17bdd0
--- /dev/null
+++ b/binary/darwin/test/gcc-qt
@@ -0,0 +1,33 @@
+SQLITE=$HOME/sqlite
+MYSQL=$HOME/mysqlclient-5.1.51-osx10.4-i686
+PGSQL=$HOME/pgsql-8.4.8
+ORACLE=$HOME/oracle
+BOOST=$HOME/boost
+
+sqlite_build_options=
+sqlite_use_options=
+
+mysql_build_options=
+mysql_use_options="--with-mysql-host=192.168.0.5 --with-mysql-client=$MYSQL/bin/mysql"
+
+pgsql_build_options=
+pgsql_use_options="--with-pgsql-host=192.168.0.5 --with-pgsql-client=$PGSQL/bin/psql"
+
+oracle_build_options="--with-oci=$ORACLE"
+oracle_use_options="--with-oracle-host=192.168.0.5 --with-oracle-service=xe --with-oracle-client=$ORACLE/sqlplus"
+
+with_qt=y
+with_boost=y
+
+CC=gcc
+CXX=g++
+CPPFLAGS="-I$BOOST -I$SQLITE -I$MYSQL/include -I$PGSQL/include"
+CXXFLAGS="-m32 -O3 -W -Wall -Wno-unknown-pragmas"
+LDFLAGS="-m32 -L$BOOST/stage/lib -L$SQLITE -L$MYSQL/lib -L$PGSQL/lib"
+
+export DYLD_LIBRARY_PATH=$SQLITE:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH=$MYSQL/lib:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH=$PGSQL/lib:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH=$ORACLE:$DYLD_LIBRARY_PATH
+
+export DYLD_LIBRARY_PATH=$BOOST/stage/lib:$DYLD_LIBRARY_PATH