summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdist.sh47
1 files changed, 35 insertions, 12 deletions
diff --git a/dist.sh b/dist.sh
index 445efbb..df1b78f 100755
--- a/dist.sh
+++ b/dist.sh
@@ -17,12 +17,27 @@ 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
+}
+
wd=`pwd`
out_root=/tmp
src_root=$HOME/work/odb
ver=`sed -e 's/^\(.*\)\.\(.*\)\..*$/\1.\2/' $src_root/odb/version`
-
test=n
rebuild=n
complete=n
@@ -128,7 +143,8 @@ fi
# Build ODB compiler
#
if [ $complete = y ]; then
- make -C $src_root/odb dist dist_prefix=$out_root/odb
+ make -C `find_out_dir $src_root/odb` -f $src_root/odb/makefile \
+dist dist_prefix=$out_root/odb
cd $out_root/odb
@@ -149,7 +165,8 @@ fi
# Build libodb
#
-make -C $src_root/libodb dist dist_prefix=$out_root/libodb
+make -C `find_out_dir $src_root/libodb` -f $src_root/libodb/makefile \
+dist dist_prefix=$out_root/libodb
cd $out_root/libodb
@@ -169,7 +186,8 @@ cp $out_root/libodb/libodb-$ver.*.tar.bz2 $out_root/pack/
# Build libodb-pgsql
#
-make -C $src_root/libodb-pgsql dist dist_prefix=$out_root/libodb-pgsql
+make -C `find_out_dir $src_root/libodb-pgsql` \
+-f $src_root/libodb-pgsql/makefile dist dist_prefix=$out_root/libodb-pgsql
cd $out_root/libodb-pgsql
@@ -189,7 +207,8 @@ cp $out_root/libodb-pgsql/libodb-pgsql-$ver.*.tar.bz2 $out_root/pack/
# Build libodb-sqlite
#
-make -C $src_root/libodb-sqlite dist dist_prefix=$out_root/libodb-sqlite
+make -C `find_out_dir $src_root/libodb-sqlite` \
+ -f $src_root/libodb-sqlite/makefile dist dist_prefix=$out_root/libodb-sqlite
cd $out_root/libodb-sqlite
@@ -209,7 +228,8 @@ cp $out_root/libodb-sqlite/libodb-sqlite-$ver.*.tar.bz2 $out_root/pack/
# Build libodb-mysql
#
-make -C $src_root/libodb-mysql dist dist_prefix=$out_root/libodb-mysql
+make -C `find_out_dir $src_root/libodb-mysql` \
+-f $src_root/libodb-mysql/makefile dist dist_prefix=$out_root/libodb-mysql
cd $out_root/libodb-mysql
@@ -229,7 +249,8 @@ cp $out_root/libodb-mysql/libodb-mysql-$ver.*.tar.bz2 $out_root/pack/
# Build libodb-tracer
#
-make -C $src_root/libodb-tracer dist dist_prefix=$out_root/libodb-tracer
+make -C `find_out_dir $src_root/libodb-tracer` \
+-f $src_root/libodb-tracer/makefile dist dist_prefix=$out_root/libodb-tracer
cd $out_root/libodb-tracer
@@ -249,7 +270,8 @@ cp $out_root/libodb-tracer/libodb-tracer-$ver.*.tar.bz2 $out_root/pack/
# Build libodb-boost
#
-make -C $src_root/libodb-boost dist dist_prefix=$out_root/libodb-boost
+make -C `find_out_dir $src_root/libodb-boost` \
+-f $src_root/libodb-boost/makefile dist dist_prefix=$out_root/libodb-boost
cd $out_root/libodb-boost
@@ -269,7 +291,8 @@ cp $out_root/libodb-boost/libodb-boost-$ver.*.tar.bz2 $out_root/pack/
# Build libodb-qt
#
-make -C $src_root/libodb-qt dist dist_prefix=$out_root/libodb-qt
+make -C `find_out_dir $src_root/libodb-qt` \
+-f $src_root/libodb-qt/makefile dist dist_prefix=$out_root/libodb-qt
cd $out_root/libodb-qt
@@ -289,7 +312,7 @@ cp $out_root/libodb-qt/libodb-qt-$ver.*.tar.bz2 $out_root/pack/
# Build odb-tests
#
-make -C $src_root/tests-mysql -f $src_root/tests/makefile dist \
+make -C `find_out_dir $src_root/tests-mysql` -f $src_root/tests/makefile dist \
dist_prefix=$out_root/odb-tests
cd $out_root/odb-tests
@@ -338,8 +361,8 @@ cp $out_root/odb-tests-$dist_tests/odb-tests-$ver.*.tar.bz2 $out_root/pack/
# Build odb-examples
#
-make -C $src_root/examples-mysql -f $src_root/examples/makefile dist \
-dist_prefix=$out_root/odb-examples
+make -C `find_out_dir $src_root/examples-mysql` \
+-f $src_root/examples/makefile dist dist_prefix=$out_root/odb-examples
cd $out_root/odb-examples