summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/build-winchecksec.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /taskcluster/scripts/misc/build-winchecksec.sh
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/scripts/misc/build-winchecksec.sh')
-rwxr-xr-xtaskcluster/scripts/misc/build-winchecksec.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/taskcluster/scripts/misc/build-winchecksec.sh b/taskcluster/scripts/misc/build-winchecksec.sh
new file mode 100755
index 0000000000..f13ef5b77b
--- /dev/null
+++ b/taskcluster/scripts/misc/build-winchecksec.sh
@@ -0,0 +1,54 @@
+#!/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/