more windows fixes

This commit is contained in:
2025-12-12 14:19:40 -06:00
parent c399c008ba
commit 23d05a8c3a
2 changed files with 44 additions and 15 deletions

View File

@@ -4,6 +4,8 @@ set_compile_opts() {
test "$FB_COMPILE_OPTS_SET" == 1 && return 0 test "$FB_COMPILE_OPTS_SET" == 1 && return 0
EXPORTED_ENV_NAMES=( EXPORTED_ENV_NAMES=(
CC
CXX
LDFLAGS LDFLAGS
C_FLAGS C_FLAGS
CXX_FLAGS CXX_FLAGS
@@ -170,6 +172,19 @@ set_compile_opts() {
arch_flags+=("-march=${ARCH}") arch_flags+=("-march=${ARCH}")
fi 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 # can fail static builds with -fpic
# warning: too many GOT entries for -fpic, please recompile with -fPIC # warning: too many GOT entries for -fpic, please recompile with -fPIC
C_FLAGS+=("${arch_flags[@]}" "-fPIC") C_FLAGS+=("${arch_flags[@]}" "-fPIC")
@@ -352,6 +367,7 @@ download_release() {
localHEAD="$(git rev-parse HEAD)" localHEAD="$(git rev-parse HEAD)"
remoteHEAD="$(get_remote_head "$(git config --get remote.origin.url)")" remoteHEAD="$(get_remote_head "$(git config --get remote.origin.url)")"
if [[ ${localHEAD} != "${remoteHEAD}" ]]; then if [[ ${localHEAD} != "${remoteHEAD}" ]]; then
git stash
git pull --ff-only git pull --ff-only
git submodule update --init --recursive git submodule update --init --recursive
fi fi

View File

@@ -4,7 +4,11 @@
determine_pkg_mgr() { determine_pkg_mgr() {
# sudo used externally # sudo used externally
# shellcheck disable=SC2034 # 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 # pkg-mgr update-cmd upgrade-cmd install-cmd check-cmd
# shellcheck disable=SC2016 # 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} 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} 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} 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=() local supported_pkg_mgr=()
unset pkg_mgr pkg_mgr_update pkg_mgr_upgrade pkg_install pkg_check 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 binutils ninja ndk-multilib-native-static
) )
# shellcheck disable=SC2034 # shellcheck disable=SC2034
local winget_pkgs=( local msys_ucrt_pkgs=(
Git.Git gerardog.gsudo mingw-w64-ucrt-x86_64-toolchain
StrawberryPerl.StrawberryPerl mingw-w64-ucrt-x86_64-autotools
bloodrock.pkg-config-lite mingw-w64-ucrt-x86_64-clang
Kitware.CMake mesonbuild.meson mingw-w64-ucrt-x86_64-clang-libs
Microsoft.VisualStudio.2019.BuildTools mingw-w64-ucrt-x86_64-cmake
Microsoft.VisualStudio.2022.BuildTools mingw-w64-ucrt-x86_64-compiler-rt
GnuWin32.DiffUtils GnuWin32.Bison mingw-w64-ucrt-x86_64-doxygen
GnuWin32.Gperf GnuWin32.File mingw-w64-ucrt-x86_64-gcc-libs
GnuWin32.Tar GnuWin32.UnZip mingw-w64-ucrt-x86_64-gperf
GnuWin32.Zip GnuWin32.Which mingw-w64-ucrt-x86_64-itstool
Rustlang.Rustup Python.Python.3.12 mingw-w64-ucrt-x86_64-meson
Ccache.Ccache LLVM.LLVM 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" local req_pkgs_env_name="${pkg_mgr/-/_}_pkgs"
declare -n req_pkgs="${req_pkgs_env_name}" declare -n req_pkgs="${req_pkgs_env_name}"
local sorted_req_pkgs=($(printf '%s\n' "${req_pkgs[@]}" | sort -u)) local sorted_req_pkgs=($(printf '%s\n' "${req_pkgs[@]}" | sort -u))