~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to build/unix/run-mozilla.sh

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
#
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/.
6
 
cmdname=`basename "$0"`
7
 
MOZ_DIST_BIN=`dirname "$0"`
8
 
MOZ_DEFAULT_NAME="./${cmdname}-bin"
9
 
MOZ_APPRUNNER_NAME="./mozilla-bin"
10
 
MOZ_PROGRAM=""
11
 
 
12
 
exitcode=1
13
 
#
14
 
##
15
 
## Functions
16
 
##
17
 
##########################################################################
18
 
moz_usage()
19
 
{
20
 
echo "Usage:  ${cmdname} [options] [program]"
21
 
echo ""
22
 
echo "  options:"
23
 
echo ""
24
 
echo "    -g                   Run in debugger."
25
 
echo "    --debug"
26
 
echo ""
27
 
echo "    -d debugger          Debugger to use."
28
 
echo "    --debugger debugger"
29
 
echo ""
30
 
echo "    -a debugger_args     Arguments passed to [debugger]."
31
 
echo "    --debugger-args debugger_args"
32
 
echo ""
33
 
echo "  Examples:"
34
 
echo ""
35
 
echo "  Run the mozilla-bin binary"
36
 
echo ""
37
 
echo "    ${cmdname} mozilla-bin"
38
 
echo ""
39
 
echo "  Debug the mozilla-bin binary in gdb"
40
 
echo ""
41
 
echo "    ${cmdname} -g mozilla-bin -d gdb"
42
 
echo ""
43
 
echo "  Run mozilla-bin under valgrind with arguments"
44
 
echo ""
45
 
echo "    ${cmdname} -g -d valgrind -a '--tool=memcheck --leak-check=full' mozilla-bin"
46
 
echo ""
47
 
        return 0
48
 
}
49
 
##########################################################################
50
 
moz_bail()
51
 
{
52
 
        message=$1
53
 
        echo
54
 
        echo "$cmdname: $message"
55
 
        echo
56
 
        exit 1
57
 
}
58
 
##########################################################################
59
 
moz_test_binary()
60
 
{
61
 
        binary=$1
62
 
        if [ -f "$binary" ]
63
 
        then
64
 
                if [ -x "$binary" ]
65
 
                then
66
 
                        return 1
67
 
                fi
68
 
        fi
69
 
        return 0
70
 
}
71
 
##########################################################################
72
 
moz_get_debugger()
73
 
{
74
 
        debuggers="ddd gdb dbx bdb native-gdb"
75
 
        debugger="notfound"
76
 
        done="no"
77
 
        for d in $debuggers
78
 
        do
79
 
                moz_test_binary /bin/which
80
 
                if [ $? -eq 1 ]
81
 
                then
82
 
                        dpath=`which ${d}`      
83
 
                else    
84
 
                        dpath=`LC_MESSAGES=C type ${d} | awk '{print $3;}' | sed -e 's/\.$//'`  
85
 
                fi
86
 
                if [ -x "$dpath" ]
87
 
                then
88
 
                        debugger=$dpath
89
 
                        break
90
 
                fi
91
 
        done
92
 
        echo $debugger
93
 
        return 0
94
 
}
95
 
##########################################################################
96
 
moz_run_program()
97
 
{
98
 
        prog=$MOZ_PROGRAM
99
 
        ##
100
 
        ## Make sure the program is executable
101
 
        ##
102
 
        if [ ! -x "$prog" ]
103
 
        then
104
 
                moz_bail "Cannot execute $prog."
105
 
        fi
106
 
        ##
107
 
        ## Run the program
108
 
        ##
109
 
        exec "$prog" ${1+"$@"}
110
 
        exitcode=$?
111
 
}
112
 
##########################################################################
113
 
moz_debug_program()
114
 
{
115
 
        prog=$MOZ_PROGRAM
116
 
        ##
117
 
        ## Make sure the program is executable
118
 
        ##
119
 
        if [ ! -x "$prog" ]
120
 
        then
121
 
                moz_bail "Cannot execute $prog."
122
 
        fi
123
 
        if [ -n "$moz_debugger" ]
124
 
        then
125
 
                moz_test_binary /bin/which
126
 
                if [ $? -eq 1 ]
127
 
                then    
128
 
                        debugger=`which $moz_debugger` 
129
 
                else
130
 
                        debugger=`LC_MESSAGES=C type $moz_debugger | awk '{print $3;}' | sed -e 's/\.$//'` 
131
 
                fi      
132
 
        else
133
 
                debugger=`moz_get_debugger`
134
 
        fi
135
 
    if [ -x "$debugger" ] 
136
 
    then
137
 
# If you are not using ddd, gdb and know of a way to convey the arguments 
138
 
# over to the prog then add that here- Gagan Saksena 03/15/00
139
 
        case `basename $debugger` in
140
 
            native-gdb) echo "$debugger $moz_debugger_args --args $prog" ${1+"$@"}
141
 
                exec "$debugger" $moz_debugger_args --args "$prog" ${1+"$@"}
142
 
                exitcode=$?
143
 
                ;;
144
 
            gdb) echo "$debugger $moz_debugger_args --args $prog" ${1+"$@"}
145
 
                exec "$debugger" $moz_debugger_args --args "$prog" ${1+"$@"}
146
 
                exitcode=$?
147
 
                ;;
148
 
            ddd) echo "$debugger $moz_debugger_args --gdb -- --args $prog" ${1+"$@"}
149
 
                exec "$debugger" $moz_debugger_args --gdb -- --args "$prog" ${1+"$@"}
150
 
                exitcode=$?
151
 
                ;;
152
 
            *) echo "$debugger $moz_debugger_args $prog ${1+"$@"}"
153
 
                exec $debugger $moz_debugger_args "$prog" ${1+"$@"}
154
 
                exitcode=$?
155
 
                ;;
156
 
        esac
157
 
    else
158
 
        moz_bail "Could not find a debugger on your system."
159
 
    fi
160
 
}
161
 
##########################################################################
162
 
##
163
 
## Command line arg defaults
164
 
##
165
 
moz_debug=0
166
 
moz_debugger=""
167
 
moz_debugger_args=""
168
 
#
169
 
##
170
 
## Parse the command line
171
 
##
172
 
while [ $# -gt 0 ]
173
 
do
174
 
  case $1 in
175
 
    -g | --debug)
176
 
      moz_debug=1
177
 
      shift
178
 
      ;;
179
 
    -d | --debugger)
180
 
      moz_debugger=$2;
181
 
      if [ "${moz_debugger}" != "" ]; then
182
 
        shift 2
183
 
      else
184
 
        echo "-d requires an argument"
185
 
        exit 1
186
 
      fi
187
 
      ;;
188
 
    -a | --debugger-args)
189
 
      moz_debugger_args=$2;
190
 
      if [ "${moz_debugger_args}" != "" ]; then
191
 
        shift 2
192
 
      else
193
 
        echo "-a requires an argument"
194
 
        exit 1
195
 
      fi
196
 
      ;;
197
 
    *)
198
 
      break;
199
 
      ;;
200
 
  esac
201
 
done
202
 
#
203
 
##
204
 
## Program name given in $1
205
 
##
206
 
if [ $# -gt 0 ]
207
 
then
208
 
        MOZ_PROGRAM=$1
209
 
        shift
210
 
fi
211
 
##
212
 
## Program not given, try to guess a default
213
 
##
214
 
if [ -z "$MOZ_PROGRAM" ]
215
 
then
216
 
        ##
217
 
        ## Try this script's name with '-bin' appended
218
 
        ##
219
 
        if [ -x "$MOZ_DEFAULT_NAME" ]
220
 
        then
221
 
                MOZ_PROGRAM=$MOZ_DEFAULT_NAME
222
 
        ##
223
 
        ## Try mozilla-bin
224
 
        ## 
225
 
        elif [ -x "$MOZ_APPRUNNER_NAME" ]
226
 
        then
227
 
                MOZ_PROGRAM=$MOZ_APPRUNNER_NAME
228
 
        fi
229
 
fi
230
 
#
231
 
#
232
 
##
233
 
## Make sure the program is executable
234
 
##
235
 
if [ ! -x "$MOZ_PROGRAM" ]
236
 
then
237
 
        moz_bail "Cannot execute $MOZ_PROGRAM."
238
 
fi
239
 
#
240
 
##
241
 
## Set MOZILLA_FIVE_HOME
242
 
##
243
 
MOZILLA_FIVE_HOME=$MOZ_DIST_BIN
244
 
 
245
 
if [ -z "$MRE_HOME" ]; then
246
 
    MRE_HOME=$MOZILLA_FIVE_HOME
247
 
fi
248
 
##
249
 
## Set LD_LIBRARY_PATH
250
 
##
251
 
## On Solaris we use $ORIGIN (set in RUNPATH) instead of LD_LIBRARY_PATH 
252
 
## to locate shared libraries. 
253
 
##
254
 
## When a shared library is a symbolic link, $ORIGIN will be replaced with
255
 
## the real path (i.e., what the symbolic link points to) by the runtime
256
 
## linker.  For example, if dist/bin/libxul.so is a symbolic link to
257
 
## toolkit/library/libxul.so, $ORIGIN will be "toolkit/library" instead of "dist/bin".
258
 
## So the runtime linker will use "toolkit/library" NOT "dist/bin" to locate the
259
 
## other shared libraries that libxul.so depends on.  This only happens
260
 
## when a user (developer) tries to start firefox, thunderbird, or seamonkey
261
 
## under dist/bin. To solve the problem, we should rely on LD_LIBRARY_PATH
262
 
## to locate shared libraries.
263
 
##
264
 
## Note: 
265
 
##  We test $MOZ_DIST_BIN/*.so. If any of them is a symbolic link,
266
 
##  we need to set LD_LIBRARY_PATH.
267
 
##########################################################################
268
 
moz_should_set_ld_library_path()
269
 
{
270
 
        [ `uname -s` != "SunOS" ] && return 0
271
 
        for sharedlib in $MOZ_DIST_BIN/*.so
272
 
        do
273
 
                [ -h $sharedlib ] && return 0
274
 
        done
275
 
        return 1
276
 
}
277
 
if moz_should_set_ld_library_path
278
 
then
279
 
        LD_LIBRARY_PATH=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}
280
 
fi 
281
 
 
282
 
if [ -n "$LD_LIBRARYN32_PATH" ]
283
 
then
284
 
        LD_LIBRARYN32_PATH=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARYN32_PATH:+":$LD_LIBRARYN32_PATH"}
285
 
fi
286
 
if [ -n "$LD_LIBRARYN64_PATH" ]
287
 
then
288
 
        LD_LIBRARYN64_PATH=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARYN64_PATH:+":$LD_LIBRARYN64_PATH"}
289
 
fi
290
 
if [ -n "$LD_LIBRARY_PATH_64" ]; then
291
 
        LD_LIBRARY_PATH_64=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARY_PATH_64:+":$LD_LIBRARY_PATH_64"}
292
 
fi
293
 
#
294
 
#
295
 
## Set SHLIB_PATH for HPUX
296
 
SHLIB_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${SHLIB_PATH:+":$SHLIB_PATH"}
297
 
#
298
 
## Set LIBPATH for AIX
299
 
LIBPATH=${MOZ_DIST_BIN}:${MRE_HOME}${LIBPATH:+":$LIBPATH"}
300
 
#
301
 
## Set DYLD_LIBRARY_PATH for Mac OS X (Darwin)
302
 
DYLD_LIBRARY_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${DYLD_LIBRARY_PATH:+":$DYLD_LIBRARY_PATH"}
303
 
#
304
 
## Solaris Xserver(Xsun) tuning - use shared memory transport if available
305
 
if [ "$XSUNTRANSPORT" = "" ]
306
 
then 
307
 
        XSUNTRANSPORT="shmem" 
308
 
        XSUNSMESIZE="512"
309
 
        export XSUNTRANSPORT XSUNSMESIZE
310
 
fi
311
 
 
312
 
# Disable Gnome crash dialog
313
 
GNOME_DISABLE_CRASH_DIALOG=1
314
 
export GNOME_DISABLE_CRASH_DIALOG
315
 
 
316
 
if [ "$moz_debug" -eq 1 ]
317
 
then
318
 
  echo "MOZILLA_FIVE_HOME=$MOZILLA_FIVE_HOME"
319
 
  echo "  LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
320
 
  if [ -n "$LD_LIBRARYN32_PATH" ]
321
 
  then
322
 
        echo "LD_LIBRARYN32_PATH=$LD_LIBRARYN32_PATH"
323
 
  fi
324
 
  if [ -n "$LD_LIBRARYN64_PATH" ]
325
 
  then
326
 
        echo "LD_LIBRARYN64_PATH=$LD_LIBRARYN64_PATH"
327
 
  fi
328
 
  if [ -n "$LD_LIBRARY_PATH_64" ]; then
329
 
        echo "LD_LIBRARY_PATH_64=$LD_LIBRARY_PATH_64"
330
 
  fi
331
 
  if [ -n "$DISPLAY" ]; then
332
 
       echo "DISPLAY=$DISPLAY"
333
 
  fi
334
 
  if [ -n "$FONTCONFIG_PATH" ]; then
335
 
        echo "FONTCONFIG_PATH=$FONTCONFIG_PATH"
336
 
  fi
337
 
  if [ -n "$MOZILLA_POSTSCRIPT_PRINTER_LIST" ]; then
338
 
       echo "MOZILLA_POSTSCRIPT_PRINTER_LIST=$MOZILLA_POSTSCRIPT_PRINTER_LIST"
339
 
  fi
340
 
  echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH"
341
 
  echo "     LIBRARY_PATH=$LIBRARY_PATH"
342
 
  echo "       SHLIB_PATH=$SHLIB_PATH"
343
 
  echo "          LIBPATH=$LIBPATH"
344
 
  echo "       ADDON_PATH=$ADDON_PATH"
345
 
  echo "      MOZ_PROGRAM=$MOZ_PROGRAM"
346
 
  echo "      MOZ_TOOLKIT=$MOZ_TOOLKIT"
347
 
  echo "        moz_debug=$moz_debug"
348
 
  echo "     moz_debugger=$moz_debugger"
349
 
  echo "moz_debugger_args=$moz_debugger_args"
350
 
fi
351
 
#
352
 
export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
353
 
export SHLIB_PATH LIBPATH LIBRARY_PATH ADDON_PATH DYLD_LIBRARY_PATH
354
 
 
355
 
if [ $moz_debug -eq 1 ]
356
 
then
357
 
        moz_debug_program ${1+"$@"}
358
 
else
359
 
        moz_run_program ${1+"$@"}
360
 
fi
361
 
 
362
 
exit $exitcode