Files
eepp/projects/mingw32/make.sh
T
Martín Lucas Golini 28cc1e528f fix(a11y): restore compatibility with older macOS and MinGW SDKs
- Use the native AX navigation-order attribute name on older AppKit SDKs
- Supply missing UIA declarations with compatible COM signatures and UUID
- Generate missing x86/x64 UIAutomationCore import libraries for older MinGW
- Keep fallback library paths consistent across Premake 4 and 5
- Add native navigation-order and UIA event-advice ABI regression coverage
2026-10-12 20:00:57 -03:00

115 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
cd "$(dirname "$0")" || exit
ARCH=32
BACKEND=sdl2
MAKE_ARGS=()
for i in "$@"; do
case $i in
config=*)
CONFIG="${i#*=}"
MAKE_ARGS+=("$i")
;;
--backend=*)
BACKEND="${i#*=}"
;;
*)
MAKE_ARGS+=("$i")
;;
esac
done
set -- "${MAKE_ARGS[@]}"
PREMAKE5_ARCH=
if [[ "$CONFIG" == *"x86_64"* ]]; then
ARCH=64
elif [[ "$CONFIG" == *"arm64"* && "$(uname -m)" == "x86_64" ]]; then
export CC="aarch64-w64-mingw32-gcc"
export CXX="aarch64-w64-mingw32-g++"
export AR="aarch64-w64-mingw32-ar"
PREMAKE5_ARCH="--arch=arm64"
if ! command -v aarch64-w64-mingw32-gcc &> /dev/null \
|| ! command -v aarch64-w64-mingw32-g++ &> /dev/null \
|| ! command -v aarch64-w64-mingw32-ar &> /dev/null
then
LLVM_MINGW_V="20241015"
URL="https://github.com/mstorsjo/llvm-mingw/releases/download/$LLVM_MINGW_V/llvm-mingw-$LLVM_MINGW_V-ucrt-ubuntu-20.04-x86_64.tar.xz"
FILE_NAME="llvm-mingw-$LLVM_MINGW_V-ucrt-ubuntu-20.04-x86_64"
TAR_FILE_NAME="$FILE_NAME.tar.xz"
RENAMED_FOLDER="llvm-mingw"
BIN_PATH="$(pwd)/$RENAMED_FOLDER/bin"
if [[ ! -f "$TAR_FILE_NAME" ]]; then
echo "Downloading $TAR_FILE_NAME..."
curl -LO "$URL" || { echo "Download failed!"; exit 1; }
else
echo "$TAR_FILE_NAME already exists. Skipping download."
fi
if [[ ! -d "$RENAMED_FOLDER" ]]; then
echo "Extracting $TAR_FILE_NAME..."
tar -xf "$TAR_FILE_NAME" || { echo "Extraction failed!"; exit 1; }
mv "$FILE_NAME" "$RENAMED_FOLDER"
else
echo "$RENAMED_FOLDER directory already exists. Skipping extraction."
fi
export PATH="$PATH:$BIN_PATH"
echo "Added $BIN_PATH to PATH."
fi
fi
detect_backend_arg()
{
if [[ "${BACKEND,,}" == "sdl3" ]]; then
echo "SDL3"
else
echo "SDL2"
fi
}
detect_backend_name()
{
if [[ "${BACKEND,,}" == "sdl3" ]]; then
echo "sdl3"
else
echo "sdl2"
fi
}
PREMAKE5_ARGS="--file=../../premake5.lua --os=windows --cc=gcc --windows-mingw-build --with-backend=$(detect_backend_arg) $PREMAKE5_ARCH gmake"
if command -v premake5 &> /dev/null
then
premake5 $PREMAKE5_ARGS
elif [ -f ../../premake5 ]; then
../../premake5 $PREMAKE5_ARGS
else
echo "premake5 is not available. Please install one."
exit 1
fi
if [[ "$CONFIG" == *"arm64"* ]]; then
bash ./build_$(detect_backend_name).sh --arch=arm64 || exit 1
else
if command -v x86_64-w64-mingw32-gcc-posix &> /dev/null; then
export CC=x86_64-w64-mingw32-gcc-posix
export CXX=x86_64-w64-mingw32-g++-posix
else
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
fi
bash ./build_uiautomation.sh "$ARCH" "$CC" || exit 1
fi
cd ../../make/windows/ || exit
if command -v mingw"$ARCH"-make &> /dev/null
then
mingw"$ARCH"-make "$@"
else
# Use x86_64 or arm64 toolchain based on CONFIG
make "$@"
fi