From 23d05a8c3a942b0af65022006ccfe624a0db1742 Mon Sep 17 00:00:00 2001 From: Levon Gevorgyan Date: Fri, 12 Dec 2025 14:19:40 -0600 Subject: [PATCH] more windows fixes --- lib/build.sh | 16 ++++++++++++++++ lib/install_deps.sh | 43 ++++++++++++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/lib/build.sh b/lib/build.sh index 5bb7acf..a6b22c4 100644 --- a/lib/build.sh +++ b/lib/build.sh @@ -4,6 +4,8 @@ set_compile_opts() { test "$FB_COMPILE_OPTS_SET" == 1 && return 0 EXPORTED_ENV_NAMES=( + CC + CXX LDFLAGS C_FLAGS CXX_FLAGS @@ -170,6 +172,19 @@ set_compile_opts() { arch_flags+=("-march=${ARCH}") fi + # use CLANG/LLVM on windows + if is_windows; then + CC=clang + CXX=clang++ + CMAKE_FLAGS+=( + "-DCMAKE_C_COMPILER=${CC}" + "-DCMAKE_CXX_COMPILER=${CXX}" + "-DCMAKE_LINKER_TYPE=LLD" + ) + else + unset CC CXX + fi + # can fail static builds with -fpic # warning: too many GOT entries for -fpic, please recompile with -fPIC C_FLAGS+=("${arch_flags[@]}" "-fPIC") @@ -352,6 +367,7 @@ download_release() { localHEAD="$(git rev-parse HEAD)" remoteHEAD="$(get_remote_head "$(git config --get remote.origin.url)")" if [[ ${localHEAD} != "${remoteHEAD}" ]]; then + git stash git pull --ff-only git submodule update --init --recursive fi diff --git a/lib/install_deps.sh b/lib/install_deps.sh index 2df0bab..4affe9e 100644 --- a/lib/install_deps.sh +++ b/lib/install_deps.sh @@ -4,7 +4,11 @@ determine_pkg_mgr() { # sudo used externally # shellcheck disable=SC2034 - test "$(id -u)" -eq 0 && SUDO='' || SUDO='sudo ' + if is_windows || test "$(id -u)" -eq 0; then + SUDO='' + else + SUDO='sudo ' + fi # pkg-mgr update-cmd upgrade-cmd install-cmd check-cmd # shellcheck disable=SC2016 @@ -14,7 +18,6 @@ brew:brew update:brew upgrade:brew install:brew list --formula ${pkg} apt-get:${SUDO}apt-get update:${SUDO}apt-get upgrade -y:${SUDO}apt-get install -y:dpkg -l ${pkg} pacman:${SUDO}pacman -Syy:${SUDO}pacman -Syu --noconfirm:${SUDO}pacman -S --noconfirm --needed:pacman -Qi ${pkg} dnf:${SUDO}dnf check-update || true:${SUDO}dnf upgrade --refresh -y:${SUDO}dnf install -y:dnf list -q --installed ${pkg} -winget:winget update:true:${SUDO}winget install:winget list ${pkg} ' local supported_pkg_mgr=() unset pkg_mgr pkg_mgr_update pkg_mgr_upgrade pkg_install pkg_check @@ -92,21 +95,31 @@ print_req_pkgs() { binutils ninja ndk-multilib-native-static ) # shellcheck disable=SC2034 - local winget_pkgs=( - Git.Git gerardog.gsudo - StrawberryPerl.StrawberryPerl - bloodrock.pkg-config-lite - Kitware.CMake mesonbuild.meson - Microsoft.VisualStudio.2019.BuildTools - Microsoft.VisualStudio.2022.BuildTools - GnuWin32.DiffUtils GnuWin32.Bison - GnuWin32.Gperf GnuWin32.File - GnuWin32.Tar GnuWin32.UnZip - GnuWin32.Zip GnuWin32.Which - Rustlang.Rustup Python.Python.3.12 - Ccache.Ccache LLVM.LLVM + local msys_ucrt_pkgs=( + mingw-w64-ucrt-x86_64-toolchain + mingw-w64-ucrt-x86_64-autotools + mingw-w64-ucrt-x86_64-clang + mingw-w64-ucrt-x86_64-clang-libs + mingw-w64-ucrt-x86_64-cmake + mingw-w64-ucrt-x86_64-compiler-rt + mingw-w64-ucrt-x86_64-doxygen + mingw-w64-ucrt-x86_64-gcc-libs + mingw-w64-ucrt-x86_64-gperf + mingw-w64-ucrt-x86_64-itstool + mingw-w64-ucrt-x86_64-meson + mingw-w64-ucrt-x86_64-bc + mingw-w64-ucrt-x86_64-nasm + mingw-w64-ucrt-x86_64-yasm + mingw-w64-ucrt-x86_64-ccache + mingw-w64-ucrt-x86_64-rustup + mingw-w64-ucrt-x86_64-cargo-c + mingw-w64-ucrt-x86_64-perl + mingw-w64-ucrt-x86_64-perl-modules ) + if is_windows; then + local pkg_mgr='msys_ucrt' + fi local req_pkgs_env_name="${pkg_mgr/-/_}_pkgs" declare -n req_pkgs="${req_pkgs_env_name}" local sorted_req_pkgs=($(printf '%s\n' "${req_pkgs[@]}" | sort -u))