tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

build-linux.sh (3377B)


      1 #! /bin/bash -vex
      2 
      3 set -x -e
      4 
      5 echo "running as" $(id)
      6 
      7 ####
      8 # Taskcluster friendly wrapper for performing fx desktop builds via mozharness.
      9 ####
     10 
     11 # Inputs, with defaults
     12 
     13 : MOZHARNESS_SCRIPT             ${MOZHARNESS_SCRIPT}
     14 : MOZHARNESS_CONFIG             ${MOZHARNESS_CONFIG}
     15 : MOZHARNESS_CONFIG_PATHS       ${MOZHARNESS_CONFIG_PATHS}
     16 : MOZHARNESS_ACTIONS            ${MOZHARNESS_ACTIONS}
     17 : MOZHARNESS_OPTIONS            ${MOZHARNESS_OPTIONS}
     18 
     19 : TOOLTOOL_CACHE                ${TOOLTOOL_CACHE:=/builds/worker/tooltool-cache}
     20 
     21 : MOZ_SCM_LEVEL                 ${MOZ_SCM_LEVEL:=1}
     22 
     23 : NEED_XVFB                     ${NEED_XVFB:=false}
     24 
     25 : MH_CUSTOM_BUILD_VARIANT_CFG   ${MH_CUSTOM_BUILD_VARIANT_CFG}
     26 : MH_BRANCH                     ${MH_BRANCH:=mozilla-central}
     27 
     28 : WORKSPACE                     ${WORKSPACE:=/builds/worker/workspace}
     29 : MOZ_OBJDIR                    ${MOZ_OBJDIR:=$WORKSPACE/obj-build}
     30 
     31 set -v
     32 
     33 fail() {
     34    echo # make sure error message is on a new line
     35    echo "[build-linux.sh:error]" "${@}"
     36    exit 1
     37 }
     38 
     39 export MOZ_CRASHREPORTER_NO_REPORT=1
     40 export TINDERBOX_OUTPUT=1
     41 
     42 # use "simple" package names so that they can be hard-coded in the task's
     43 # extras.locations
     44 export MOZ_SIMPLE_PACKAGE_NAME=target
     45 
     46 # test required parameters are supplied
     47 if [[ -z ${MOZHARNESS_SCRIPT} ]]; then fail "MOZHARNESS_SCRIPT is not set"; fi
     48 if [[ -z "${MOZHARNESS_CONFIG}" && -z "${EXTRA_MOZHARNESS_CONFIG}" ]]; then fail "MOZHARNESS_CONFIG or EXTRA_MOZHARNESS_CONFIG is not set"; fi
     49 
     50 # run XVfb in the background, if necessary
     51 if $NEED_XVFB; then
     52    . /builds/worker/scripts/xvfb.sh
     53 
     54    cleanup() {
     55        local rv=$?
     56        cleanup_xvfb
     57        exit $rv
     58    }
     59    trap cleanup EXIT INT
     60 
     61    start_xvfb '1024x768x24' 2
     62 fi
     63 
     64 # set up mozharness configuration, via command line, env, etc.
     65 
     66 debug_flag=""
     67 if [ 0$DEBUG -ne 0 ]; then
     68  debug_flag='--debug'
     69 fi
     70 
     71 custom_build_variant_cfg_flag=""
     72 if [ -n "${MH_CUSTOM_BUILD_VARIANT_CFG}" ]; then
     73    custom_build_variant_cfg_flag="--custom-build-variant-cfg=${MH_CUSTOM_BUILD_VARIANT_CFG}"
     74 fi
     75 
     76 # $TOOLTOOL_CACHE bypasses mozharness completely and is read by tooltool_wrapper.sh to set the
     77 # cache.  However, only some mozharness scripts use tooltool_wrapper.sh, so this may not be
     78 # entirely effective.
     79 export TOOLTOOL_CACHE
     80 
     81 export MOZ_OBJDIR
     82 
     83 config_path_cmds=""
     84 for path in ${MOZHARNESS_CONFIG_PATHS}; do
     85    config_path_cmds="${config_path_cmds} --extra-config-path ${GECKO_PATH}/${path}"
     86 done
     87 
     88 # support multiple, space delimited, config files
     89 config_cmds=""
     90 for cfg in $MOZHARNESS_CONFIG; do
     91  config_cmds="${config_cmds} --config ${cfg}"
     92 done
     93 
     94 # if MOZHARNESS_ACTIONS is given, only run those actions (completely overriding default_actions
     95 # in the mozharness configuration)
     96 if [ -n "$MOZHARNESS_ACTIONS" ]; then
     97    actions=""
     98    for action in $MOZHARNESS_ACTIONS; do
     99        actions="$actions --$action"
    100    done
    101 fi
    102 
    103 # if MOZHARNESS_OPTIONS is given, append them to mozharness command line run
    104 if [ -n "$MOZHARNESS_OPTIONS" ]; then
    105    options=""
    106    for option in $MOZHARNESS_OPTIONS; do
    107        options="$options --$option"
    108    done
    109 fi
    110 
    111 cd /builds/worker
    112 
    113 $GECKO_PATH/mach python -- \
    114  $GECKO_PATH/testing/${MOZHARNESS_SCRIPT} \
    115  ${config_path_cmds} \
    116  ${config_cmds} \
    117  $debug_flag \
    118  $custom_build_variant_cfg_flag \
    119  $actions \
    120  $options \
    121  --log-level=debug \
    122  --work-dir=$WORKSPACE \
    123  --branch=${MH_BRANCH}