Bug 1900505 - Work around cmake issue with exporting symbols on Windows. r=firefox-build-system-reviewers,ahochheiden

Differential Revision: https://phabricator.services.mozilla.com/D212766
This commit is contained in:
Mike Hommey 2024-06-06 19:44:59 +00:00
Родитель abad680367
Коммит 634cbd03f1
4 изменённых файлов: 88 добавлений и 7 удалений

Просмотреть файл

@ -421,12 +421,12 @@ ninja:
add-prefix: ninja/bin/
cmake:
description: cmake 3.25.1
description: cmake 3.25.1 source code
fetch:
type: static-url
url: https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-windows-x86_64.zip
sha256: d93958d87cc9b91983489f0b37a268b03a3c891894d11f5437fa2a5ce94aab24
size: 41460154
url: https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz
sha256: 1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8
size: 10561054
artifact-name: cmake.tar.zst
strip-components: 1
add-prefix: cmake/

Просмотреть файл

@ -432,11 +432,11 @@ win64-clang-17-raw:
fetches:
fetch:
- clang-17
- cmake
- ninja
toolchain:
- win64-clang-17-stage1
- win64-compiler-rt-17
- win64-cmake
- vs-toolchain
- win64-libxml2
@ -824,10 +824,10 @@ win64-clang-18-raw:
fetches:
fetch:
- clang-18
- cmake
- ninja
toolchain:
- win64-clang-18-stage1
- win64-cmake
- win64-compiler-rt-18
- vs-toolchain
- win64-libxml2
@ -1238,10 +1238,10 @@ win64-clang-trunk-raw:
fetches:
fetch:
- clang-trunk
- cmake
- ninja
toolchain:
- win64-clang-trunk-stage1
- win64-cmake
- win64-compiler-rt-trunk
- vs-toolchain
- win64-libxml2

Просмотреть файл

@ -589,6 +589,20 @@ windows-rs:
extract: false
dest: ../artifacts
win64-cmake:
description: "cmake toolchain build"
treeherder:
symbol: TW64(cmake)
run:
script: build-cmake.sh
toolchain-artifact: public/build/cmake.tar.zst
fetches:
fetch:
- cmake
toolchain:
- linux64-clang-toolchain
- vs-toolchain
win64-libxml2:
description: "libxml2 toolchain build"
treeherder:

Просмотреть файл

@ -0,0 +1,67 @@
#!/bin/bash
set -e -v -x
artifact=$(basename "$TOOLCHAIN_ARTIFACT")
project=${artifact%.tar.*}
workspace=$HOME/workspace
cd $MOZ_FETCHES_DIR/cmake
# Work around https://gitlab.kitware.com/cmake/cmake/-/issues/26031
patch -p1 <<'EOF'
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 52e200c24f..07ccf3965c 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -398,7 +398,7 @@ static bool DumpFile(std::string const& nmPath, const char* filename,
std::set<std::string>& symbols,
std::set<std::string>& dataSymbols)
{
-#ifndef _WIN32
+#if 1
return DumpFileWithLlvmNm(nmPath, filename, symbols, dataSymbols);
#else
HANDLE hFile;
EOF
# Work around https://github.com/llvm/llvm-project/issues/94563
# The resulting cmake works well enough for our use.
patch -p1 <<'EOF'
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index c268a92111..d18f8cf221 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -863,7 +863,6 @@ if(WIN32)
# Add a manifest file to executables on Windows to allow for
# GetVersion to work properly on Windows 8 and above.
- target_sources(ManifestLib INTERFACE cmake.version.manifest)
endif()
endif()
EOF
export PATH="$MOZ_FETCHES_DIR/clang/bin:$PATH"
cmake \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang-cl \
-DCMAKE_CXX_COMPILER=clang-cl \
-DCMAKE_LINKER=lld-link \
-DCMAKE_MT=llvm-mt \
-DCMAKE_C_FLAGS="-Xclang -ivfsoverlay -Xclang $MOZ_FETCHES_DIR/vs/overlay.yaml -winsysroot $MOZ_FETCHES_DIR/vs" \
-DCMAKE_CXX_FLAGS="-GR -EHsc -Xclang -ivfsoverlay -Xclang $MOZ_FETCHES_DIR/vs/overlay.yaml -winsysroot $MOZ_FETCHES_DIR/vs" \
-DCMAKE_EXE_LINKER_FLAGS="-winsysroot:$MOZ_FETCHES_DIR/vs" \
-DCMAKE_MODULE_LINKER_FLAGS="-winsysroot:$MOZ_FETCHES_DIR/vs" \
-DCMAKE_SHARED_LINKER_FLAGS="-winsysroot:$MOZ_FETCHES_DIR/vs" \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded \
-DCMAKE_INSTALL_PREFIX=$workspace/$project \
-B $workspace/build
ninja -C $workspace/build -v install
tar -C $workspace -acvf $artifact $project
mkdir -p $UPLOAD_DIR
mv $artifact $UPLOAD_DIR