Bumping manifests a=b2g-bump
[gecko.git] / build / unix / mozilla.in
blobd2251eae067c29b20ef2d47e767c0e7fe7c578d5
1 #!/bin/sh
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 ##
8 ## Usage:
9 ##
10 ## $ mozilla [args]
12 ## This script is meant to run the application binary from mozilla/dist/bin.
14 ## The script will setup all the environment voodoo needed to make
15 ## the application binary to work.
18 #uncomment for debugging
19 #set -x
21 moz_libdir=%MOZAPPDIR%
23 # Use run-mozilla.sh in the current dir if it exists
24 # If not, then start resolving symlinks until we find run-mozilla.sh
25 found=0
26 progname="$0"
27 curdir=`dirname "$progname"`
28 progbase=`basename "$progname"`
29 run_moz="$curdir/run-mozilla.sh"
30 if test -x "$run_moz"; then
31 dist_bin="$curdir"
32 found=1
33 else
34 here=`/bin/pwd`
35 while [ -h "$progname" ]; do
36 bn=`basename "$progname"`
37 cd `dirname "$progname"`
38 # Resolve symlink of dirname
39 cd `/bin/pwd`
40 progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
41 progbase=`basename "$progname"`
42 if [ ! -x "$progname" ]; then
43 break
45 curdir=`dirname "$progname"`
46 run_moz="$curdir/run-mozilla.sh"
47 if [ -x "$run_moz" ]; then
48 cd "$curdir"
49 dist_bin=`/bin/pwd`
50 run_moz="$dist_bin/run-mozilla.sh"
51 found=1
52 break
54 done
55 cd "$here"
57 if [ $found = 0 ]; then
58 # Check default compile-time libdir
59 if [ -x "$moz_libdir/run-mozilla.sh" ]; then
60 dist_bin="$moz_libdir"
61 run_moz="$moz_libdir/run-mozilla.sh"
62 else
63 echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting."
64 exit 1
68 script_args=""
69 debugging=0
70 MOZILLA_BIN="${progbase}-bin"
72 if [ "$OSTYPE" = "beos" ]; then
73 mimeset -F "$MOZILLA_BIN"
76 pass_arg_count=0
77 while [ $# -gt $pass_arg_count ]
79 case "$1" in
80 -p | --pure | -pure)
81 MOZILLA_BIN="${MOZILLA_BIN}.pure"
82 shift
84 -g | --debug)
85 script_args="$script_args -g"
86 debugging=1
87 shift
89 -d | --debugger)
90 script_args="$script_args -d $2"
91 shift 2
94 # Move the unrecognized argument to the end of the list.
95 arg="$1"
96 shift
97 set -- "$@" "$arg"
98 pass_arg_count=`expr $pass_arg_count + 1`
100 esac
101 done
103 if [ $debugging = 1 ]
104 then
105 echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
107 exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
108 # EOF.