]> git.ipfire.org Git - thirdparty/freeswitch.git/blob - build/build_patch.sh
Merge pull request #2467 from signalwire/sb14
[thirdparty/freeswitch.git] / build / build_patch.sh
1 #!/bin/bash
2 set -e -o pipefail
3
4 usage () {
5 printf "usage: %s [-u <remote>] [-r <ref>] [<patch-urls> ...]\n" "$0" >&2
6 }
7
8 err () {
9 printf "error: %s\n" "$1" >&2
10 exit 1
11 }
12
13 remote=origin
14 ref=origin/master
15 dopull=true
16 while getopts "hnr:u:" o; do
17 case "$o" in
18 h) usage; exit 0 ;;
19 n) dopull=false ;;
20 r) ref="$OPTARG" ;;
21 u) remote="$OPTARG" ;;
22 esac
23 done
24 shift $(($OPTIND-1))
25
26 if ! which git >/dev/null; then
27 printf "error: please install git\n">&2
28 exit 1; fi
29 if ! which wget >/dev/null; then
30 printf "error: please install wget\n">&2
31 exit 1; fi
32
33 now=$(date -u +%Y%m%dT%H%M%SZ)
34 git clean -fdx || err "failed"
35 git reset --hard "$ref" \
36 || err "reset failed"
37 $dopull && (git pull "$remote" || err "failed to pull")
38 for patch in "$@"; do
39 wget -O - "$patch" | git am
40 done
41 printf '# Building FreeSWITCH %s\n' "$(git describe HEAD)" \
42 > ${now}-fsbuild.log
43 (./bootstrap.sh && ./configure -C && make VERBOSE=1) 2>&1 \
44 | tee -a ${now}-fsbuild.log