tor-browser

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

build-sm.sh (2433B)


      1 #!/bin/bash
      2 
      3 set -x
      4 
      5 # Default variables values.
      6 : ${SPIDERMONKEY_VARIANT:=plain}
      7 : ${WORK:=$HOME/workspace}
      8 : ${PYTHON3:=python3}
      9 
     10 # Ensure upload dir exists
     11 mkdir -p $UPLOAD_DIR
     12 
     13 # Run the script
     14 export MOZ_UPLOAD_DIR="$(cd "$UPLOAD_DIR"; pwd)"
     15 export OBJDIR=$WORK/obj-spider
     16 AUTOMATION=1 $PYTHON3 $GECKO_PATH/js/src/devtools/automation/autospider.py ${SPIDERMONKEY_PLATFORM:+--platform=$SPIDERMONKEY_PLATFORM} $SPIDERMONKEY_VARIANT
     17 BUILD_STATUS=$?
     18 
     19 # Copy artifacts for upload by TaskCluster.
     20 upload=${MOZ_JS_UPLOAD_BINARIES_DEFAULT-1}
     21 # User-provided override switch.
     22 if [ -n "$MOZ_JS_UPLOAD_BINARIES" ]; then
     23    upload=1
     24 fi
     25 if [ "$upload" = "1" ]; then
     26    (
     27        cd "$OBJDIR/dist/bin"
     28        zip "$UPLOAD_DIR/target.jsshell.zip" \
     29            js{,.exe} \
     30            jsapi-tests{,.exe} \
     31            js-gdb.py \
     32            {,lib}nspr4.{so,dll,dylib} \
     33            {,lib}plds4.{so,dll,dylib} \
     34            {,lib}plc4.{so,dll,dylib} \
     35            {,lib}mozglue.{so,dll,dylib}
     36    )
     37    cp -L "$OBJDIR/mozinfo.json" "$UPLOAD_DIR/target.mozinfo.json"
     38 
     39    # Fuzzing users want the correct version of llvm-symbolizer available in the
     40    # same directory as the built output.
     41    if [ -d "$MOZ_FETCHES_DIR/llvm-symbolizer" ]; then
     42        for f in "$MOZ_FETCHES_DIR/llvm-symbolizer/bin/llvm-symbolizer"*; do
     43            gzip -c "$f" > "$UPLOAD_DIR/llvm-symbolizer.gz" || echo "gzip $f failed" >&2
     44            break
     45        done
     46    fi
     47 else # !upload
     48 # Provide a note for users on why we don't include artifacts for these builds
     49 # by default, and how they can get the artifacts if they really need them.
     50    cat >"$UPLOAD_DIR"/README-artifacts.txt <<'EOF'
     51 Artifact upload has been disabled for this build due to infrequent usage of the
     52 generated artifacts.  If you find yourself in a position where you need the
     53 shell or similar artifacts from this build, please redo your push with the
     54 environment variable MOZ_JS_UPLOAD_BINARIES set to 1.  You can provide this as
     55 the option `--env MOZ_JS_UPLOAD_BINARIES=1` to `mach try fuzzy` or `mach try auto`.
     56 EOF
     57 fi
     58 
     59 # Fuzzing also uses a few fields in target.json file for automated downloads to
     60 # identify what was built.
     61 if [ -n "$MOZ_BUILD_DATE" ] && [ -n "$GECKO_HEAD_REV" ]; then
     62    cat >"$UPLOAD_DIR"/target.json <<EOF
     63 {
     64  "buildid": "$MOZ_BUILD_DATE",
     65  "moz_source_stamp": "$GECKO_HEAD_REV"
     66 }
     67 EOF
     68    cp "$GECKO_PATH"/mozconfig.autospider "$UPLOAD_DIR"
     69 fi
     70 
     71 exit $BUILD_STATUS