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

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

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

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

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

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

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

cd mac
./osx-app.sh  --wish /Users/msp/b32/Wish-8.5.19.app $1-i386
mv Pd-$1-i386.app ../../
cd ../..
tar czf pd-$1-i386.mac.tar.gz Pd-$1-i386.app
