/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. ## Usage:
  40. ##
  41. ## $ mozilla [args]
  42. ##
  43. ## This script is meant to run the application binary from mozilla/dist/bin.
  44. ##
  45. ## The script will setup all the environment voodoo needed to make
  46. ## the application binary to work.
  47. ##
  48. #uncomment for debugging
  49. #set -x
  50. moz_libdir=%MOZAPPDIR%
  51. # Use run-mozilla.sh in the current dir if it exists
  52. # If not, then start resolving symlinks until we find run-mozilla.sh
  53. found=0
  54. progname="$0"
  55. curdir=`dirname "$progname"`
  56. progbase=`basename "$progname"`
  57. run_moz="$curdir/run-mozilla.sh"
  58. if test -x "$run_moz"; then
  59. dist_bin="$curdir"
  60. found=1
  61. else
  62. here=`/bin/pwd`
  63. while [ -h "$progname" ]; do
  64. bn=`basename "$progname"`
  65. cd `dirname "$progname"`
  66. # Resolve symlink of dirname
  67. cd `/bin/pwd`
  68. progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
  69. progbase=`basename "$progname"`
  70. if [ ! -x "$progname" ]; then
  71. break
  72. fi
  73. curdir=`dirname "$progname"`
  74. run_moz="$curdir/run-mozilla.sh"
  75. if [ -x "$run_moz" ]; then
  76. cd "$curdir"
  77. dist_bin=`/bin/pwd`
  78. run_moz="$dist_bin/run-mozilla.sh"
  79. found=1
  80. break
  81. fi
  82. done
  83. cd "$here"
  84. fi
  85. if [ $found = 0 ]; then
  86. # Check default compile-time libdir
  87. if [ -x "$moz_libdir/run-mozilla.sh" ]; then
  88. dist_bin="$moz_libdir"
  89. run_moz="$moz_libdir/run-mozilla.sh"
  90. else
  91. echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting."
  92. exit 1
  93. fi
  94. fi
  95. script_args=""
  96. debugging=0
  97. MOZILLA_BIN="${progbase}-bin"
  98. if [ "$OSTYPE" = "beos" ]; then
  99. mimeset -F "$MOZILLA_BIN"
  100. fi
  101. pass_arg_count=0
  102. while [ $# -gt $pass_arg_count ]
  103. do
  104. case "$1" in
  105. -p | --pure | -pure)
  106. MOZILLA_BIN="${MOZILLA_BIN}.pure"
  107. shift
  108. ;;
  109. -g | --debug)
  110. script_args="$script_args -g"
  111. debugging=1
  112. shift
  113. ;;
  114. -d | --debugger)
  115. script_args="$script_args -d $2"
  116. shift 2
  117. ;;
  118. *)
  119. # Move the unrecognized argument to the end of the list.
  120. arg="$1"
  121. shift
  122. set -- "$@" "$arg"
  123. pass_arg_count=`expr $pass_arg_count + 1`
  124. ;;
  125. esac
  126. done
  127. if [ $debugging = 1 ]
  128. then
  129. echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
  130. fi
  131. exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
  132. # EOF.