Skip to content

Commit d0528ae

Browse files
committed
Fix: setup-stdlib script for gcc 11.2.0
Fixes issue where mod files were installed in the wrong location since GCC was updated to v11.2.0. Adds checks to the setup-stdlib script to check the installation.
1 parent 6523615 commit d0528ae

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

utils/setup-stdlib.bat

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
@echo off
22
REM Helper script to install latest stdlib in the local MinGW installation
33

4+
setlocal
5+
46
set ORIG=%cd%
57
set ROOT=%~dp0..
68

9+
set GCCVER=11.2.0
10+
set PREFIX=%ROOT%\mingw64
11+
set INCLUDE_PATH=lib\gcc\x86_64-w64-mingw32\%GCCVER%\finclude\
12+
713
echo Installation root is %ROOT%
814

915
cd %ROOT%
1016

1117
if NOT EXIST %ROOT%\mingw64 echo mingw64 installation not found && exit /b 1
1218

1319
if NOT EXIST %ROOT%\stdlib git clone https://github.com/fortran-lang/stdlib.git
20+
if %errorlevel% neq 0 exit /b %errorlevel%
1421

1522
cd stdlib
1623
git reset --hard
@@ -20,8 +27,31 @@ git pull
2027
echo [install] >> fpm.toml
2128
echo library = true >> fpm.toml
2229

23-
fpm install --profile release --prefix %cd%\..\mingw64 --includedir lib\gcc\x86_64-w64-mingw32\10.3.0\finclude --verbose --flag "-DWITH_QP=1"
30+
REM Check output directory exists
31+
if not exist "%PREFIX%\%INCLUDE_PATH%" (
32+
echo setup-stdlib error: Cannot find module include directory "%PREFIX%\%INCLUDE_PATH%"
33+
exit /B 3
34+
)
35+
36+
fpm install --profile release --prefix %PREFIX% --includedir %INCLUDE_PATH% --verbose --flag "-DWITH_QP=1"
37+
if %errorlevel% neq 0 exit /b %errorlevel%
38+
39+
del /Q %PREFIX%\%INCLUDE_PATH%\test*.mod
40+
41+
REM Check installation
42+
set LIB_OUT="%PREFIX%\lib\libstdlib.a"
43+
if not exist %LIB_OUT% (
44+
echo Installation failed: cannot find %LIB_OUT%
45+
exit /B 2
46+
)
47+
set INC_OUT="%PREFIX%\%INCLUDE_PATH%\stdlib_version.mod"
48+
if not exist %INC_OUT% (
49+
echo Installation failed: cannot find %INC_OUT%
50+
exit /B 2
51+
)
52+
53+
echo stdlib built and installed successfully
2454

25-
del /Q %ROOT%\mingw64\lib\gcc\x86_64-w64-mingw32\10.3.0\finclude\test*.mod
55+
cd %ORIG%
2656

27-
cd %ORIG%
57+
endlocal

0 commit comments

Comments
 (0)