I finally figured it out the hard way :
https://github.com/esp8266/Arduino/discussions/8616
Install Git for windows (https://git-scm.com/download/win)
Install MinGW for windows (https://sourceforge.net/projects/mingw)
In MinGW installation manager, enable:
- mingw-developer-toolkit
- mingw32-base
- mingw32-gcc-g++
- msys-base
(not sure if all are necessary but just in case)
put C:\MinGW\bin in Windows PATH (check this https://www.rapidee.com)
reboot PC
rename C:\MinGW\bin\mingw32-make.exe to C:\MinGW\bin\make.exe
open bash terminal (just type bash in run)
(from now on assume that hardware files are in \Documents\Arduino\hardware\esp8266com\esp8266)
go to \tools\sdk\lwip2
optional: change lwip options in \tools\sdk\lwip2\builder\glue-lwip\arduino\lwipopts.h
(caution : NOT \tools\sdk\lwip2\include\lwipopts.h, this will be overwritten !)
type in bash: make install to build libraries in \esp8266com\esp8266\tools\sdk\lwip2\builder
type in bash: make clean to clean \esp8266com\esp8266\tools\sdk\lwip2\builder
finally copy new libraries to \esp8266com\esp8266\tools\sdk\lib