From 15a02ad7b83689833e0297c6dad2f51dcbe6a377 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Wed, 18 Jan 2012 13:56:04 +0200
Subject: Add support for situation where src_root != out_root

---
 binary/mingw/build-dist | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

(limited to 'binary')

diff --git a/binary/mingw/build-dist b/binary/mingw/build-dist
index e01679d..59ed868 100755
--- a/binary/mingw/build-dist
+++ b/binary/mingw/build-dist
@@ -12,6 +12,22 @@ function error ()
   echo "$*" 1>&2
 }
 
+# Find output directory for a project. It is either $1-default or if
+# that doesn't exist, it is $1.
+#
+function find_out_dir ()
+{
+  # Get the actual directory in case -default is a symlink.
+  #
+  tmp=`realpath $1-default 2>/dev/null`
+
+  if [ -n "$tmp" -a -d "$tmp" ]; then
+    echo "$tmp"
+  else
+    echo "$1"
+  fi
+}
+
 rebuild=n
 pack=n
 
@@ -88,7 +104,8 @@ fi
 # Build libodb
 #
 if [ $pack = n ]; then
-  make -C $src_root/odb/libodb dist dist_prefix=$out_root/libodb
+  make -C `find_out_dir $src_root/odb/libodb` -f $src_root/odb/libodb/makefile \
+    dist dist_prefix=$out_root/libodb
 
   if [ $rebuild = y ]; then
     cd libodb
@@ -114,7 +131,8 @@ cd ../..
 # Build libodb-boost
 #
 if [ $pack = n ]; then
-  make -C $src_root/odb/libodb-boost dist dist_prefix=$out_root/libodb-boost
+  make -C `find_out_dir $src_root/odb/libodb-boost` -f $src_root/odb/libodb-boost/makefile \
+    dist dist_prefix=$out_root/libodb-boost
 
   if [ $rebuild = y ]; then
     cd libodb-boost
@@ -139,7 +157,8 @@ cd ..
 # Build libodb-qt
 #
 if [ $pack = n ]; then
-  make -C $src_root/odb/libodb-qt dist dist_prefix=$out_root/libodb-qt
+  make -C `find_out_dir $src_root/odb/libodb-qt` -f $src_root/odb/libodb-qt/makefile \
+    dist dist_prefix=$out_root/libodb-qt
 
   if [ $rebuild = y ]; then
     cd libodb-qt
-- 
cgit v1.1