summaryrefslogtreecommitdiff
path: root/binary/mingw/build-dist
diff options
context:
space:
mode:
Diffstat (limited to 'binary/mingw/build-dist')
-rwxr-xr-xbinary/mingw/build-dist252
1 files changed, 252 insertions, 0 deletions
diff --git a/binary/mingw/build-dist b/binary/mingw/build-dist
new file mode 100755
index 0000000..c5d9968
--- /dev/null
+++ b/binary/mingw/build-dist
@@ -0,0 +1,252 @@
+#! /usr/bin/env bash
+
+# Create ODB compiler Windows distribution.
+#
+# -rebuild
+# -pack get the source distributions from /tmp/pack/
+#
+trap 'exit 1' ERR
+
+function error ()
+{
+ echo "$*" 1>&2
+}
+
+rebuild=n
+pack=n
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ -rebuild)
+ rebuild=y
+ shift
+ ;;
+ -pack)
+ pack=y
+ rebuild=y
+ shift
+ ;;
+ *)
+ error "unknown option: $1"
+ exit 1
+ ;;
+ esac
+done
+
+
+out_root=`pwd`
+version=`cat $HOME/work/odb/odb/version`
+install_root="/tmp/odb-$version-i686-windows"
+
+if [ $pack = n ]; then
+ src_root=$HOME/work
+else
+ src_root=/tmp
+fi
+
+export PATH=$out_root/cross/mingw/bin:$PATH
+
+# Clean everything up if we are rebuilding.
+#
+if [ $rebuild = y ]; then
+ rm -rf /mingw/*
+ rm -rf libplugin-stub
+ rm -rf gcc-build/*
+ rm -rf libcutl
+ rm -rf libodb
+ rm -rf libodb-boost
+ rm -rf odb
+ rm -rf odb-build/*
+ rm -rf $install_root
+
+ cp -r mingw-rt/* /mingw/
+ # make -C binutils-build install
+ cp -r mingw-binutils/* /mingw/
+fi
+
+if [ $pack = n ]; then
+ rm -f /tmp/odb-$version-i686-windows.zip
+else
+ rm -f /tmp/pack/odb-$version-i686-windows.zip
+fi
+
+# Build libplugin-stub
+#
+if [ $rebuild = y ]; then
+ mkdir -p libplugin-stub
+ cd libplugin-stub
+ i686-mingw32-gcc -O2 -c ../plugin-stub.c
+ i686-mingw32-ar cr libplugin-stub.a plugin-stub.o
+ i686-mingw32-ranlib libplugin-stub.a
+ cd ..
+
+ mkdir -p gcc-build/gcc
+ cp libplugin-stub/libplugin-stub.a gcc-build/gcc/
+fi
+
+# Build libodb
+#
+if [ $pack = n ]; then
+ make -C $src_root/odb/libodb dist dist_prefix=$out_root/libodb
+
+ if [ $rebuild = y ]; then
+ cd libodb
+ ./bootstrap
+ cd ..
+ fi
+else
+ tar xfz $src_root/pack/libodb-$version.tar.gz
+ mv libodb-$version libodb
+fi
+
+cd libodb
+
+if [ $rebuild = y ]; then
+ ../libodb-configure
+fi
+
+make
+cd odb
+make install-data
+cd ../..
+
+# Build libodb-boost
+#
+if [ $pack = n ]; then
+ make -C $src_root/odb/libodb-boost dist dist_prefix=$out_root/libodb-boost
+
+ if [ $rebuild = y ]; then
+ cd libodb-boost
+ ./bootstrap
+ cd ..
+ fi
+else
+ tar xfz $src_root/pack/libodb-boost-$version.tar.gz
+ mv libodb-boost-$version libodb-boost
+fi
+
+cd libodb-boost
+
+if [ $rebuild = y ]; then
+ ../libodb-boost-configure
+fi
+
+make
+make install-data
+cd ..
+
+# Build libcutl
+#
+if [ $pack = n ]; then
+ make -C $src_root/cutl/libcutl dist dist_prefix=$out_root/libcutl
+
+ if [ $rebuild = y ]; then
+ cd libcutl
+ ./bootstrap
+ cd ..
+ fi
+else
+ cutl_version=`cat $HOME/work/cutl/libcutl/version`
+ tar xfz $src_root/libcutl-$cutl_version.tar.gz
+ mv libcutl-$cutl_version libcutl
+fi
+
+cd libcutl
+
+if [ $rebuild = y ]; then
+ ../libcutl-configure
+fi
+
+make
+cd ..
+
+# Build odb
+#
+if [ $pack = n ]; then
+ make -C $src_root/odb/odb dist dist_prefix=$out_root/odb
+
+ if [ $rebuild = y ]; then
+ cd odb
+ ./bootstrap
+ cd ..
+ fi
+else
+ tar xfz $src_root/pack/odb-$version.tar.gz
+ mv odb-$version odb
+fi
+
+mkdir -p odb-build
+cd odb-build
+
+if [ $rebuild = y ]; then
+ ../odb-configure $version
+fi
+
+make
+make install-strip
+rm -f $install_root/bin/odb.a
+cd ..
+
+# Build gcc
+#
+mkdir -p gcc-build
+cd gcc-build
+
+if [ $rebuild = y ]; then
+ ../gcc-configure
+else
+ rm -f gcc/cc1plus.exe gcc/cc1plus-dummy.exe
+fi
+
+make STATIC_PLUGIN_LIBS="$out_root/odb-build/odb/.libs/odb.a $out_root/libcutl/cutl/.libs/libcutl.a -lstdc++ -static-libgcc"
+make install
+make -C i686-mingw32/libstdc++-v3 install-strip
+cd ..
+
+# Copy /mingw over to installation
+#
+cp -r /mingw $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 $install_root/mingw/lib/libbfd.*
+rm -f $install_root/mingw/include/bfd*.h
+rm -f $install_root/mingw/lib/libopcodes.*
+rm -f $install_root/mingw/lib/libiberty.a
+rm -f `find $install_root -name '*.la'`
+
+# Copy msys over to installation.
+#
+cp -r msys/* $install_root/mingw/
+
+# Copy the default options file.
+#
+mkdir -p $install_root/etc/odb
+cp -L default.options $install_root/etc/odb/
+todos $install_root/etc/odb/default.options
+
+# Copy manifest.
+#
+cp -L manifest.txt $install_root/mingw/
+todos $install_root/mingw/manifest.txt
+
+# Copy README.
+#
+cp -L README $install_root/README
+todos $install_root/README
+
+# Zip it up.
+#
+cd /tmp
+zip -r odb-$version-i686-windows.zip odb-$version-i686-windows
+if [ $pack = y ]; then
+ mv odb-$version-i686-windows.zip pack/
+fi
+cd $out_root