PageRenderTime 24ms CodeModel.GetById 13ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/build/unix/mozilla.in

http://github.com/zpao/v8monkey
Autoconf | 140 lines | 77 code | 8 blank | 55 comment | 9 complexity | 3fd4839e33ff760141710f0318df2eb9 MD5 | raw file
  1#!/bin/sh
  2#
  3# ***** BEGIN LICENSE BLOCK *****
  4# Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5#
  6# The contents of this file are subject to the Mozilla Public License Version
  7# 1.1 (the "License"); you may not use this file except in compliance with
  8# the License. You may obtain a copy of the License at
  9# http://www.mozilla.org/MPL/
 10#
 11# Software distributed under the License is distributed on an "AS IS" basis,
 12# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 13# for the specific language governing rights and limitations under the
 14# License.
 15#
 16# The Original Code is mozilla.org code.
 17#
 18# The Initial Developer of the Original Code is
 19# Netscape Communications Corporation.
 20# Portions created by the Initial Developer are Copyright (C) 1998
 21# the Initial Developer. All Rights Reserved.
 22#
 23# Contributor(s):
 24#
 25# Alternatively, the contents of this file may be used under the terms of
 26# either the GNU General Public License Version 2 or later (the "GPL"), or
 27# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 28# in which case the provisions of the GPL or the LGPL are applicable instead
 29# of those above. If you wish to allow use of your version of this file only
 30# under the terms of either the GPL or the LGPL, and not to allow others to
 31# use your version of this file under the terms of the MPL, indicate your
 32# decision by deleting the provisions above and replace them with the notice
 33# and other provisions required by the GPL or the LGPL. If you do not delete
 34# the provisions above, a recipient may use your version of this file under
 35# the terms of any one of the MPL, the GPL or the LGPL.
 36#
 37# ***** END LICENSE BLOCK *****
 38
 39## 
 40## Usage:
 41##
 42## $ mozilla [args]
 43##
 44## This script is meant to run the application binary from mozilla/dist/bin.
 45##
 46## The script will setup all the environment voodoo needed to make
 47## the application binary to work.
 48##
 49
 50#uncomment for debugging
 51#set -x
 52
 53moz_libdir=%MOZAPPDIR%
 54
 55# Use run-mozilla.sh in the current dir if it exists
 56# If not, then start resolving symlinks until we find run-mozilla.sh
 57found=0
 58progname="$0"
 59curdir=`dirname "$progname"`
 60progbase=`basename "$progname"`
 61run_moz="$curdir/run-mozilla.sh"
 62if test -x "$run_moz"; then
 63  dist_bin="$curdir"
 64  found=1
 65else
 66  here=`/bin/pwd`
 67  while [ -h "$progname" ]; do
 68    bn=`basename "$progname"`
 69    cd `dirname "$progname"`
 70    # Resolve symlink of dirname
 71    cd `/bin/pwd`
 72    progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
 73    progbase=`basename "$progname"`
 74    if [ ! -x "$progname" ]; then
 75      break
 76    fi
 77    curdir=`dirname "$progname"`
 78    run_moz="$curdir/run-mozilla.sh"
 79    if [ -x "$run_moz" ]; then
 80      cd "$curdir"
 81      dist_bin=`/bin/pwd`
 82      run_moz="$dist_bin/run-mozilla.sh"
 83      found=1
 84      break
 85    fi
 86  done
 87  cd "$here"
 88fi
 89if [ $found = 0 ]; then
 90  # Check default compile-time libdir
 91  if [ -x "$moz_libdir/run-mozilla.sh" ]; then
 92    dist_bin="$moz_libdir"
 93    run_moz="$moz_libdir/run-mozilla.sh"
 94  else
 95    echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting."
 96    exit 1
 97  fi
 98fi
 99
100script_args=""
101debugging=0
102MOZILLA_BIN="${progbase}-bin"
103
104if [ "$OSTYPE" = "beos" ]; then
105  mimeset -F "$MOZILLA_BIN"
106fi
107
108pass_arg_count=0
109while [ $# -gt $pass_arg_count ]
110do
111  case "$1" in
112    -p | --pure | -pure)
113      MOZILLA_BIN="${MOZILLA_BIN}.pure"
114      shift
115      ;;
116    -g | --debug)
117      script_args="$script_args -g"
118      debugging=1
119      shift
120      ;;
121    -d | --debugger)
122      script_args="$script_args -d $2"
123      shift 2
124      ;;
125    *)
126      # Move the unrecognized argument to the end of the list.
127      arg="$1"
128      shift
129      set -- "$@" "$arg"
130      pass_arg_count=`expr $pass_arg_count + 1`
131      ;;
132  esac
133done
134
135if [ $debugging = 1 ]
136then
137  echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
138fi
139exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
140# EOF.