~mterry/+junk/u8

« back to all changes in this revision

Viewing changes to run.sh

  • Committer: Bileto Bot
  • Author(s): Michael Zanetti
  • Date: 2016-08-11 06:22:51 UTC
  • mfrom: (2542.1.6 unity8-main-build-scripts)
  • Revision ID: ci-train-bot@canonical.com-20160811062251-1qy0g9dt7v0ertu1
Clean up some build script legacy

Approved by: Albert Astals Cid

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
. /etc/environment
4
 
export QML2_IMPORT_PATH
5
 
 
6
 
QML_PHONE_SHELL_PATH=./builddir/src/unity8
7
 
GDB=false
8
 
FAKE=false
9
 
USE_MOCKS=false
10
 
MOUSE_TOUCH=true
11
 
 
12
 
usage() {
13
 
    echo "usage: "$0" [OPTIONS]\n" >&2
14
 
    echo "Script to run the shell.\n" >&2
15
 
    echo "OPTIONS:" >&2
16
 
    echo " -f, --fake Force use of fake Qml modules." >&2
17
 
    echo " -g, --gdb Run through gdb." >&2
18
 
    echo " -h, --help Show this help." >&2
19
 
    echo " -m, --nomousetouch Run without -mousetouch argument." >&2
20
 
    echo >&2
21
 
    exit 1
22
 
}
23
 
 
24
 
ARGS=`getopt -n$0 -u -a --longoptions="fake,gdb,help:,nomousetouch" -o "fghm" -- "$@"`
25
 
[ $? -ne 0 ] && usage
26
 
eval set -- "$ARGS"
27
 
 
28
 
while [ $# -gt 0 ]
29
 
do
30
 
    case "$1" in
31
 
       -f|--fake)     USE_MOCKS=true;;
32
 
       -g|--gdb)   GDB=true;;
33
 
       -h|--help)  usage;;
34
 
       -m|--nomousetouch)  MOUSE_TOUCH=false;;
35
 
       --)         shift;break;;
36
 
    esac
37
 
    shift
38
 
done
39
 
 
40
 
if $USE_MOCKS; then
41
 
  export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
42
 
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/liblightdm:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/QMenuModel
43
 
else
44
 
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/plugins/LightDM/liblightdm
45
 
fi
46
 
 
47
 
QML_PHONE_SHELL_ARGS="-windowgeometry=40gux68gu -devicename=mako"
48
 
if $MOUSE_TOUCH; then
49
 
  QML_PHONE_SHELL_ARGS="$QML_PHONE_SHELL_ARGS -mousetouch"
50
 
fi
51
 
 
52
 
control_c()
53
 
{
54
 
  /sbin/initctl stop unity8
55
 
  exit $?
56
 
}
57
 
 
58
 
trap control_c INT
59
 
 
60
 
if $GDB; then
61
 
  gdb -ex run --args $QML_PHONE_SHELL_PATH $QML_PHONE_SHELL_ARGS $@
62
 
else
63
 
  status=`/sbin/initctl status unity8`
64
 
  if [ "$status" != "unity8 stop/waiting" ]; then
65
 
    echo "Unity8 is already running, please stop it first"
66
 
    exit 1
67
 
  fi
68
 
  /sbin/initctl start unity8 BINARY="`readlink -f $QML_PHONE_SHELL_PATH` $QML_PHONE_SHELL_ARGS $@" XDG_DATA_DIRS=$XDG_DATA_DIRS QML2_IMPORT_PATH=$QML2_IMPORT_PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH
69
 
  tailf -n 0 ~/.cache/upstart/unity8.log
70
 
fi