gecko-dev/taskcluster/scripts/misc/build-winchecksec.sh
Mike Hommey 007a7a25e5 Bug 1807780 - Use -ivfsoverlay instead of liblowercase. r=firefox-build-system-reviewers,ahochheiden
Because this involves affecting the MSVC + Windows SDK packs, we need to
do this for toolchain tasks as well as Firefox builds in a single pass.

The MSVC + Windows SDK packs are altered to keep the original case
instead of lowercasing everything (except .lib files), and contain
an overlay file that we now automatically use from the WINSYSROOT.

This requires adjusting some paths to match what the original case
is, as well as removing everything related to the use of liblowercase,
which conflicts with the use of the overlay file. People using
liblowercase locally will still have a working setup as long as they
don't set WINSYSROOT (it's new, so they won't have it), and don't have
an overlay file in there (which they only would  if they ran the new
pack_vs.py).

Differential Revision: https://phabricator.services.mozilla.com/D165596
2022-12-29 00:05:49 +00:00

54 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
set -e -v -x
mkdir -p $UPLOAD_DIR
cd $MOZ_FETCHES_DIR/winchecksec
SUFFIX=
case "$1" in
x86_64-pc-windows-msvc)
SUFFIX=.exe
export PATH="$MOZ_FETCHES_DIR/clang/bin:$PATH"
. $GECKO_PATH/taskcluster/scripts/misc/vs-setup.sh
# Patch pe-parse because clang-cl doesn't support /analyze.
patch -p1 <<'EOF'
--- a/pe-parse/cmake/compilation_flags.cmake
+++ b/pe-parse/cmake/compilation_flags.cmake
@@ -1,5 +1,5 @@
if (MSVC)
- list(APPEND DEFAULT_CXX_FLAGS /W4 /analyze)
+ list(APPEND DEFAULT_CXX_FLAGS /W4)
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
list(APPEND DEFAULT_CXX_FLAGS /Zi)
EOF
CMAKE_FLAGS='
-DCMAKE_CXX_COMPILER=clang-cl
-DCMAKE_C_COMPILER=clang-cl
-DCMAKE_LINKER=lld-link
-DCMAKE_C_FLAGS="-fuse-ld=lld -Xclang -ivfsoverlay -Xclang $MOZ_FETCHES_DIR/vs/overlay.yaml"
-DCMAKE_CXX_FLAGS="-fuse-ld=lld -EHsc -Xclang -ivfsoverlay -Xclang $MOZ_FETCHES_DIR/vs/overlay.yaml"
-DCMAKE_RC_COMPILER=llvm-rc
-DCMAKE_MT=llvm-mt
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
'
;;
esac
eval cmake \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=Off \
$CMAKE_FLAGS
ninja -v
cd ..
tar -caf winchecksec.tar.zst winchecksec/winchecksec${SUFFIX}
cp winchecksec.tar.zst $UPLOAD_DIR/