6 # Get the absolute path of a file.
7 # Args 1: Relative path to file
10 if [[ "$?" != "0" ]]; then
11 echo "Error: Could not get absolute path to \"$1\"." 1>&2
16 SCRIPT_NAME
=`basename "$0"`
17 SCRIPT_DIR
=`get_absolute_path "$PWD"`
18 SCRIPT_TMP_DIR
="$SCRIPT_DIR/tmp"
19 SCRIPT_PARENT_DIR
=`get_absolute_path "$SCRIPT_DIR/.."`
20 SCRIPT_PATH
="$SCRIPT_DIR/$SCRIPT_NAME"
21 BACKEND_DIR
=`get_absolute_path ../backend`
22 IRRECO_DIR
=`get_absolute_path ../irreco`
23 IRRECO_DATA
="$IRRECO_DIR/data"
24 IRRECO_SRC
="$IRRECO_DIR/src"
25 INSTALL_DIR
=`get_absolute_path ".."`"/install"
26 MAKE_LOG_FILE
="$SCRIPT_TMP_DIR/make_log"
27 RUN_LOG_FILE
="$SCRIPT_TMP_DIR/run_log"
28 DEB_LOG_FILE
="$SCRIPT_TMP_DIR/deb_log"
30 EXIT_CODE_FILE
="$SCRIPT_TMP_DIR/exit_code"
31 ALL_BACKENDS_FILTER
="(mythtv|irtrans)"
33 mkdir
-p "$SCRIPT_TMP_DIR"
37 #THEME_DIR='../../../../themes'
38 #if [ ! -d "$THEME_DIR" ]; then
39 # THEME_DIR='../../../themes'
40 # if [ ! -d "$THEME_DIR" ]; then
41 # THEME_DIR='../../themes'
42 # if [ ! -d "$THEME_DIR" ]; then
43 # echo "Cant find theme dir"
50 if [ ! -d "$THEME_DIR" ]; then
51 echo "Cant find theme dir"
55 THEME_DIR
=`get_absolute_path "$THEME_DIR"`
60 #IRTRANS_DIR='../../../../irtrans/'
61 #if [ ! -d "$IRTRANS_DIR" ]; then
62 # IRTRANS_DIR='../../../irtrans/'
63 # if [ ! -d "$IRTRANS_DIR" ]; then
64 # IRTRANS_DIR='../../irtrans/'
65 # if [ ! -d "$IRTRANS_DIR" ]; then
66 # echo "Cant find theme dir"
72 IRTRANS_DIR
='../irtrans/'
73 if [ ! -d "$IRTRANS_DIR" ]; then
74 echo "Cant find theme dir"
78 IRTRANS_DIR
=`get_absolute_path "$IRTRANS_DIR"`
79 IRTRANS_SHLIB_DIR
="$IRTRANS_DIR/shlib"
80 IRTRANS_IRSERVER_DIR
="$IRTRANS_DIR/irserver"
90 if [ ! -e "$INSTALL_DIR" ]; then
98 if [[ "$_SBOX_DIR" == "" ||
99 "$_SBOX_RESTART_FILE" == "" ||
100 "$_SBOX_SHELL_PID" == "" ||
101 "$_SBOX_USER_GROUPNAME" == "" ]]; then
102 echo "Error: Need scratchbox."
106 #which sb-conf &> /dev/null
107 #if [[ "$?" != "0" ]]; then
108 # echo "Error: Need scratchbox."
115 if [[ "$_SBOX_DIR" != "" ||
116 "$_SBOX_RESTART_FILE" != "" ||
117 "$_SBOX_SHELL_PID" != "" ||
118 "$_SBOX_USER_GROUPNAME" != "" ]]; then
119 echo "Error: Cant run this command inside scratchbox."
123 #which sb-conf &> /dev/null
124 #if [[ "$?" == "0" ]]; then
125 # echo "Error: Cant run this command inside scratchbox."
137 for ((LEN
+= 6; LEN
<= 80; LEN
++)); do
144 # Check log for error & warnings
149 REGEX_IGNORE
='(^if gcc |^[[:space:]]*gcc |^/bin/sh |^if /bin/sh|^/usr/share/aclocal/audiofile\.m4)'
151 REGEX
="(warning|error|cannot find"
152 REGEX
="$REGEX|^[0-9a-zA-Z\/._-]+\.[cho]:"
153 REGEX
="$REGEX|^[0-9a-zA-Z\/._-]+:[0-9]+"
154 REGEX
="$REGEX|^[0-9a-zA-Z\/._-]+:[0-9]+:[0-9]+"
155 REGEX
="$REGEX|^:[0-9a-zA-Z\/._-]+"
158 cat "$1" |
egrep -v "$REGEX_IGNORE" \
159 |
egrep -i -A $ERROR_CONTEXT -B $ERROR_CONTEXT --color=yes "$REGEX"
161 if [[ "$2" == "1" ]]; then
162 if [[ "$EXIT_CODE" != "0" ]]; then
173 echo "$?" > "$EXIT_CODE_FILE"
178 EXIT_CODE
=`cat "$EXIT_CODE_FILE"`
184 # Stop script if exit code is not 0
186 # Usage: check_exit_code "$?"
189 if [[ "$1" != "0" ]]; then
190 if [[ "$2" != "" ]]; then
191 echo "Error:" "$2" "$3" "$4" "$5"
204 for ((; LEN
> 0; LEN--
)); do
214 # Generic build functions
223 save_exit_code
make "${MAKE_ARGS[@]:1}" 2>&1 |
tee "$MAKE_LOG_FILE"
226 check_log
"$MAKE_LOG_FILE" "1"
237 if [ -e "Makefile" ]; then
243 if [ -e "autoclean.sh" ]; then
250 # Save current sb_target to file,
251 # and return 0 if it is the same as current target.
256 CURRENT_TARGET
=`sb-conf current`
258 if [ -f "$SB_TARGET_FILE" ]; then
259 PREVIOUS_TARGET
=`cat "$SB_TARGET_FILE"`
264 #echo "SB_TARGET_FILE = $SB_TARGET_FILE"
265 #echo "CURRENT_TARGET = $CURRENT_TARGET"
266 #echo "PREVIOUS_TARGET = $PREVIOUS_TARGET"
268 if [[ "$CURRENT_TARGET" != "$PREVIOUS_TARGET" ]]; then
269 echo "Saving \"$CURRENT_TARGET\" to \"$SB_TARGET_FILE\""
270 echo "$CURRENT_TARGET" > "$SB_TARGET_FILE"