summaryrefslogtreecommitdiffstats
path: root/contrib/mingw/build.sh
blob: 999ca728056cfae6e7774cbfaa667dba2f547722 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#! /bin/sh
#
# $Id$
#
# RTEMS Build script.
#
# This script builds the RPM files then the Windows executables.
# 
# Note: This file should be placed in crossrpms.
#

command_line="$0 $*"

terminate()
{
  echo "error: $*" >&2
  exit 1
  echo "after"
}

check()
{
 if [ $? -ne 0 ]; then
  terminate $*
 fi
}

debug=
hosts=
prefix=
no_run=
relocate=
source=
targets=
version=
log=build.txt

while [ $# -gt 0 ];
do
 case $1 in
  -d)
   set -x
   debug="-d"
   ;;
  -h)
   shift
   hosts="-h $1"
   ;;
  -l)
   shift
   log=$1
   ;;
  -n)
   no_run="-n"
   ;;
  -p)
   shift
   prefix="-p $1"
   ;;
  -r)
   shift
   relocation="-r $1"
   ;;
  -s)
   shift
   source="-s $1"
   ;;
  -t)
   shift
   targets="-t $1"
   ;;
  -v)
   shift
   version="-v $1"
   ;;
  --help)
   echo "$0 -dn -h <hosts> -p <prefix> -s <source> -t <targets> -v <version>"
   exit 2
   ;;
  *)
   terminate "error: invalid option (try --help): $1"
   ;;
 esac
 shift
done

echo "$command_line" > $log

scripts=$(dirname $0)

echo "$scripts/build-rpms.sh -i $debug $no_run $prefix $source $targets $hosts $version" >> $log
$scripts/build-rpms.sh -i $debug $no_run $prefix $source $targets $hosts $version 2>&1 | tee -a $log
if [ ${PIPESTATUS[0]} -ne 0 ]; then
 terminate "Making the RPM files."
fi

echo "$scripts/build-exes.sh $debug $no_run $prefix $targets $relocation" >> $log
$scripts/build-exes.sh $debug $no_run $prefix $targets $relocation 2>&1 | tee -a $log
if [ ${PIPESTATUS[0]} -ne 0 ]; then
 terminate "Making the executable files."
fi

exit 0