File: build-dxc.sh

package info (click to toggle)
firefox 147.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,683,324 kB
  • sloc: cpp: 7,607,156; javascript: 6,532,492; ansic: 3,775,158; python: 1,415,368; xml: 634,556; asm: 438,949; java: 186,241; sh: 62,751; makefile: 18,079; objc: 13,092; perl: 12,808; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10; exp: 6
file content (82 lines) | stat: -rwxr-xr-x 2,728 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
set -x -e -v

# This script is for building the DirectX Shader Compiler (DXC).
# It takes the target CPU architecture as parameter ("x86_64" or "aarch64").

export MOZ_DXC_TARGET_ARCH=$1

export VSINSTALLDIR="$MOZ_FETCHES_DIR/vs"

# Detect a windows SDK version by looking at the directory names in
# "Windows Kits/10/Include/". At the time of writing this comment, there
# is one, but we pick the first result in alphabetical order in to reduce
# the risk of breakage if the vs-toolchain job changes.
export MOZ_DXC_WIN10_SDK_VERSION=`ls "$VSINSTALLDIR/Windows Kits/10/Include/" | sort | head -n 1`

artifact=$(basename "$TOOLCHAIN_ARTIFACT")
dxc_folder=${artifact%.tar.*}


dxc_src_dir="$MOZ_FETCHES_DIR/DirectXShaderCompiler"
cd "$dxc_src_dir"

# Configure and build.
dxc_build_dir="$dxc_src_dir/build"
mkdir "$dxc_build_dir"
cd "$dxc_build_dir"

# Note: it is important that LLVM_ENABLE_ASSERTIONS remains enabled.

cmake .. \
  -C ../cmake/caches/PredefinedParams.cmake \
  -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/WinMsvc.cmake \
  -DHOST_ARCH="$MOZ_DXC_TARGET_ARCH" \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_DISABLE_ASSEMBLY_FILES=ON \
  -DLLVM_NATIVE_TOOLCHAIN="$MOZ_FETCHES_DIR/clang" \
  -DLLVM_WINSYSROOT="$VSINSTALLDIR" \
  -DDIASDK_INCLUDE_DIR="$VSINSTALLDIR/DIA SDK/include" \
  -DWIN10_SDK_PATH="$VSINSTALLDIR/Windows Kits/10" -DWIN10_SDK_VERSION="$MOZ_DXC_WIN10_SDK_VERSION" \
  -DCMAKE_RC_COMPILER="$MOZ_FETCHES_DIR/clang/bin/llvm-rc" \
  -DHLSL_INCLUDE_TESTS=OFF -DCLANG_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TESTS=OFF \
  -DHLSL_BUILD_DXILCONV=OFF -DSPIRV_WERROR=OFF \
  -DENABLE_SPIRV_CODEGEN=OFF \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DLLVM_ASSERTIONS_NO_STRINGS=ON \
  -DLLVM_ASSERTIONS_TRAP=ON \
  -DDXC_CODEGEN_EXCEPTIONS_TRAP=ON \
  -DDXC_DISABLE_ALLOCATOR_OVERRIDES=ON \
  -G Ninja


# Only build the required target.
# NOTE: This builds `dxcompiler.pdb`, too.
ninja dxcompiler.dll

# Pack the result and upload.
mkdir "$dxc_folder"
cp bin/dxcompiler.dll bin/dxcompiler.pdb "$dxc_folder"

mkdir -p "$UPLOAD_DIR"
tar cavf "$UPLOAD_DIR/$artifact" "$dxc_folder"

cd "$GECKO_PATH"

# Create a directory for `*.sym` files of the form `…/<bin>/<hash>/<bin>.sym`.
symbols_dir="$dxc_build_dir/sym"
bin_dir="$dxc_build_dir/bin"
./mach python toolkit/crashreporter/tools/symbolstore.py \
  "$MOZ_FETCHES_DIR/dump_syms/dump_syms" \
  --platform "WINNT" \
  --no-rust \
  --no-moz-extra-info \
  "$symbols_dir" \
  "$bin_dir/dxcompiler.dll"
  # NOTE: `dll` is not a typo. `symbolstore.py` will find the `pdb` based on this name.

# Upload a symbols tarball to this job's artifacts.
symbols_archive="$UPLOAD_DIR/target.crashreporter-symbols-dxc.tar.zst"
cd "$symbols_dir"
tar cavf "$symbols_archive" *
cd -