Repaired Windows binary in patch and added comments to batch
[sgc2.git] / praat_module / testPraatPratch.sh
blob958dfa8224769a2feb4c27e8589514ac82dc387a
1 #!/bin/bash
3 APPLICATIONNAME=TEVA
4 CURRENTWORKINGDIR=$(pwd)
5 UNAME=$(uname -s)
6 MAKECMD=make
7 EXECPATH=./praat
8 TARGETNAME=${APPLICATIONNAME}
10 PRAATSOURCES=./praat_sources
11 if [[ ${1:-Normal} == "MinGW" ]]; then
12 PRAATSOURCES=../../praat_mingw
13 if [[ ! -d ${PRAATSOURCES} ]]; then
14 exit
16 elif [[ -d ../praat_sources ]]; then
17 PRAATSOURCES=../praat_sources
18 elif [[ -d ../../demo_praat_sources ]]; then
19 PRAATSOURCES=../../demo_praat_sources
20 elif [[ -d ../../praat_sources ]]; then
21 PRAATSOURCES=../../praat_sources
24 if [[ -e ${PRAATSOURCES}/makefile.defs && -n `grep -l mingw32 ${PRAATSOURCES}/makefile.defs` ]]; then
25 EXECPATH=./Praat.exe
26 if [[ ${1:-Normal} == "MinGW" && ${2:-Normal} == "XP" ]]; then
27 TARGETNAME=${APPLICATIONNAME}XP.exe
28 else
29 TARGETNAME=${APPLICATIONNAME}.exe
31 UNAME=MinGW
32 elif [[ ${UNAME} == "Darwin" ]]; then
33 SDK=`ls -1d /Developer/SDKs/*|tail -1`
34 MAKECMD="xcodebuild -project praat32.xcodeproj"
35 if [[ -n ${SDK} ]]; then
36 MAKECMD="xcodebuild -project praat32.xcodeproj -sdk ${SDK}"
38 EXECPATH="./build/Configuration1/Praat.app"
39 TARGETNAME=${APPLICATIONNAME}.app
42 # This is a dry run!
43 MAKECMD=echo
45 # Patch Praat
46 cd ${PRAATSOURCES}
47 if [[ -s ${CURRENTWORKINGDIR}/adaptPraat.patch ]]; then
48 patch --strip=1 < ${CURRENTWORKINGDIR}/adaptPraat.patch
49 patch --strip=1 < ${CURRENTWORKINGDIR}/sys_praat_name.patch
52 # Add demopraatapplication.h
53 cd main/
55 touch main_Praat.cpp
57 # Patch main_Praat
58 if [[ -s ${CURRENTWORKINGDIR}/main_Praat.patch ]]; then
59 patch main_Praat.cpp ${CURRENTWORKINGDIR}/main_Praat.patch
62 cd ../
63 if [[ ${UNAME} == "Darwin" ]]; then
64 ${MAKECMD} OTHER_CFLAGS='$OTHER_CFLAGS -DDEMOAPP' 2>&1
65 else
66 ${MAKECMD} 2>&1
69 # Undo patches
70 if [[ -s ${CURRENTWORKINGDIR}/adaptPraat.patch ]]; then
71 patch -R --strip=1 < ${CURRENTWORKINGDIR}/adaptPraat.patch
72 patch -R --strip=1 < ${CURRENTWORKINGDIR}/sys_praat_name.patch
75 cd main/
76 if [[ -s ${CURRENTWORKINGDIR}/main_Praat.patch ]]; then
77 patch -R main_Praat.cpp ${CURRENTWORKINGDIR}/main_Praat.patch
79 cd -