wrench-macos-build.sh (2180B)
1 #!/bin/bash 2 set -x -e -v 3 4 source ${GECKO_PATH}/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh 5 6 # The osmesa-src build which we do as part of the headless build below 7 # doesn't seem to always use CFLAGS/CXXFLAGS where expected. Instead we 8 # just squash those flags into CC/CXX and everything works out. 9 # Export HOST_CC and HOST_CXX without the squashed flags, so that host 10 # builds use them and don't see the target flags. 11 export HOST_CC="${CC}" 12 export HOST_CXX="${CXX}" 13 CFLAGS_VAR="CFLAGS_${TARGET_TRIPLE//-/_}" 14 CXXFLAGS_VAR="CXXFLAGS_${TARGET_TRIPLE//-/_}" 15 export CC="${CC} ${!CFLAGS_VAR}" 16 export ${CFLAGS_VAR}= 17 export CXX="${CXX} ${!CXXFLAGS_VAR}" 18 export ${CXXFLAGS_VAR}= 19 20 export MESON_CROSSFILE=${GECKO_PATH}/gfx/wr/ci-scripts/etc/wr-darwin.meson 21 export UPLOAD_DIR="${HOME}/artifacts" 22 mkdir -p "${UPLOAD_DIR}" 23 24 # Do a cross-build without the `headless` feature 25 pushd "${GECKO_PATH}/gfx/wr/wrench" 26 python3 -m pip install -r ../ci-scripts/requirements.txt 27 cargo build --release -vv --frozen --target=${TARGET_TRIPLE} 28 # Package up the resulting wrench binary 29 cd "../target/${TARGET_TRIPLE}" 30 mkdir -p wrench-macos/bin 31 mv release/wrench wrench-macos/bin/ 32 tar cjf wrench-macos.tar.bz2 wrench-macos 33 mv wrench-macos.tar.bz2 "${UPLOAD_DIR}" 34 # Clean the build 35 cd "${GECKO_PATH}/gfx/wr" 36 rm -rf target 37 popd 38 39 # Do a cross-build with the `headless` feature 40 pushd "${GECKO_PATH}/gfx/wr/wrench" 41 cargo build --release -vv --frozen --target=${TARGET_TRIPLE} --features headless 42 # Package up the wrench binary and some libraries that we will need 43 cd "../target/${TARGET_TRIPLE}" 44 45 # Copy the native macOS libLLVM as dynamic dependency 46 cp "${MOZ_FETCHES_DIR}/clang-mac/clang/lib/libLLVM.dylib" release/build/osmesa-src*/out/mesa/src/gallium/targets/osmesa/ 47 48 mkdir wrench-macos-headless 49 mv release wrench-macos-headless/ 50 tar cjf wrench-macos-headless.tar.bz2 \ 51 wrench-macos-headless/release/wrench \ 52 wrench-macos-headless/release/build/osmesa-src*/out/mesa/src/gallium/targets/osmesa \ 53 wrench-macos-headless/release/build/osmesa-src*/out/mesa/src/mapi/shared-glapi 54 mv wrench-macos-headless.tar.bz2 "${UPLOAD_DIR}" 55 56 # Clean the build 57 cd "${GECKO_PATH}/gfx/wr" 58 rm -rf target 59 popd