-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbuild-clangtron-windows.bat
More file actions
90 lines (79 loc) · 2.58 KB
/
build-clangtron-windows.bat
File metadata and controls
90 lines (79 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@echo off
REM SPDX-FileCopyrightText: 2026 citron Emulator Project
REM SPDX-License-Identifier: GPL-3.0-or-later
REM
REM build-clangtron-windows.bat
REM Opens an MSYS2 CLANG64 shell in the repository directory, prints the
REM build-clangtron-windows.sh help text, and leaves the prompt open for you
REM to run build stages manually.
REM
REM This is NOT a one-click build. See docs/BUILDING-CLANG-MINGW.md for
REM the full pipeline.
setlocal enabledelayedexpansion
REM ---------- locate MSYS2 ----------
set "MSYS2_PATH="
for %%P in (
"C:\msys64"
"C:\msys2"
"%USERPROFILE%\msys64"
"%USERPROFILE%\msys2"
"D:\msys64"
"D:\msys2"
) do (
if exist "%%~P\usr\bin\bash.exe" (
set "MSYS2_PATH=%%~P"
goto :found_msys2
)
)
REM Try to locate via PATH
where bash.exe >nul 2>&1
if %ERRORLEVEL% equ 0 (
for /f "delims=" %%I in ('where bash.exe') do (
set "BASH_LOC=%%~dpI"
if exist "!BASH_LOC!..\..\..\usr\bin\bash.exe" (
for %%J in ("!BASH_LOC!..\..\..") do set "MSYS2_PATH=%%~fJ"
goto :found_msys2
)
)
)
echo.
echo ERROR: Could not find an MSYS2 installation.
echo.
echo Install MSYS2 from https://www.msys2.org/ then run setup:
echo.
echo build-clangtron-windows.bat
echo bash build-clangtron-windows.sh setup
echo.
echo Or set MSYS2_PATH before running:
echo set MSYS2_PATH=C:\msys64
echo build-clangtron-windows.bat
echo.
pause
exit /b 1
:found_msys2
echo Found MSYS2 at: %MSYS2_PATH%
REM ---------- resolve script directory ----------
REM Strip trailing backslash left by %%~dp0
set "SCRIPT_DIR=%~dp0"
if "%SCRIPT_DIR:~-1%"=="\" set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
REM Use cygpath (always present in MSYS2) to convert the Windows path to a
REM POSIX path. The manual letter-by-letter loop it replaces was inserting
REM extra slashes into every path component (e.g. /citron -> /c/itron).
for /f "delims=" %%P in ('^""%MSYS2_PATH%\usr\bin\cygpath.exe" "%SCRIPT_DIR%"^"') do set "MSYS_SOURCE=%%P"
if "%MSYS_SOURCE%"=="" (
echo.
echo ERROR: cygpath failed to convert path: %SCRIPT_DIR%
echo Ensure MSYS2 is installed correctly.
echo.
pause
exit /b 1
)
REM ---------- open CLANG64 shell, print help, leave prompt open ----------
echo.
echo Opening MSYS2 CLANG64 shell.
echo The build script help will be printed above the prompt.
echo Run stages manually -- see docs/BUILDING-CLANG-MINGW.md for guidance.
echo.
"%MSYS2_PATH%\usr\bin\env.exe" MSYSTEM=CLANG64 ^
"%MSYS2_PATH%\usr\bin\bash.exe" --login -c ^
"cd '%MSYS_SOURCE%' && bash build-clangtron-windows.sh --help; exec bash"