#!/bin/sh
#usage: ./build-autotools 0.38-0 or 0.38-0test4

if test x$1 == x
then
   echo usage: ./build-autotools 0.38-0 or 0.38-0test4
   exit 1
fi

if test -f pd-$1.src.tar.gz
then
   /bin/echo -n
else
   echo cant find file pd-$1.src.tar.gz
   exit 1
fi

rm -rf pd-$1 Pd-$1-macosx7.app

tar xzf pd-$1.src.tar.gz
cd pd-$1
./autogen.sh
./configure --enable-jack

if make
then
    echo -n
else
   echo build failed
   exit 1
fi

rm -rf po
cp -pr ../po/ po/

cd mac
./osx-app.sh  --wish \
  /Users/msp/work/build/tcltk/pd-wish-8.6.10/mac/Wish-8.6.10.app $1-macosx7
mv Pd-$1-macosx7.app ../../
cd ../..
tar czf pd-$1-macosx7.mac.tar.gz Pd-$1-macosx7.app
