#!/bin/bash set -x -e -v export WORKSPACE="/builds/worker/workspace" export TOOLS_DIR="${WORKSPACE}/build/src" export TARGET_TRIPLE="x86_64-apple-darwin" mkdir -p "${TOOLS_DIR}" # The tooltool-download script assumes that the gecko checkout is in # ${WORKSPACE}/build/src and that it can run `./mach` there. This is not # true when using run-task (which is what this script runs with) so we # symlink mach to satisfy tooltool-download's assumptions. ln -s "${GECKO_PATH}/mach" "${TOOLS_DIR}" source "${GECKO_PATH}/taskcluster/scripts/misc/tooltool-download.sh" MACOS_SYSROOT="${TOOLS_DIR}/MacOSX10.11.sdk" CLANGDIR="${TOOLS_DIR}/clang" # Deploy the wrench dependencies mv ${TOOLS_DIR}/wrench-deps/{vendor,.cargo} "${GECKO_PATH}/gfx/wr/" # Building wrench with the `headless` feature also builds the osmesa-src crate, # which includes building C++ code. We have to do a bunch of shenanigans # to make this cross-compile properly. pushd "${TOOLS_DIR}/cctools/bin" # Link all the tools from x86_64-darwin11-* to x86_64-apple-darwin-* because # x86_64-apple-darwin is the Official Rust Triple (TM) and so that's the prefix # we run configure with, and the toolchain configure/make will look for. # We can't just rename the files because e.g. the ar tool invokes the ranlib # tool with the old prefix hard-coded. So we symlink instead. for TOOL in x86_64-darwin11-*; do ln -s "${TOOL}" "${TOOL/x86_64-darwin11/${TARGET_TRIPLE}}" done # Add a pkg-config cross-compile wrapper. Without this, the configure script # will use pkg-config from the host, which will find host libraries that are # not what we want. This script stolen from # https://autotools.io/pkgconfig/cross-compiling.html cat > ${TARGET_TRIPLE}-pkg-config <