diff --git a/_build.bat b/_build.bat new file mode 100644 index 0000000..73bd9b0 --- /dev/null +++ b/_build.bat @@ -0,0 +1,73 @@ +REM :: Marius Negrutiu (marius.negrutiu@protonmail.com) + +@echo off +setlocal enabledelayedexpansion +echo. + +cd /d "%~dp0" +set original_path=%PATH% + +REM | build.bat [mingw|msvc] [debug|release] [win32|amd64|x86|x64] [unicode|ansi] + +set compiler=mingw +set configuration=Release +set platform=x64 +set charset=unicode + +:arg + if "%~1" equ "" goto :arg_end + if /i "%~1" equ "mingw" set compiler=mingw + if /i "%~1" equ "msvc" set compiler=msvc + if /i "%~1" equ "debug" set configuration=Debug + if /i "%~1" equ "release" set configuration=Release + if /i "%~1" equ "win32" set platform=x86 + if /i "%~1" equ "x86" set platform=x86 + if /i "%~1" equ "amd64" set platform=x64 + if /i "%~1" equ "x64" set platform=x64 + if /i "%~1" equ "unicode" set charset=unicode + if /i "%~1" equ "ansi" set charset=ansi + shift /1 + goto :arg +:arg_end + +if "%platform%" neq "x86" set charset=unicode + +title %configuration%-%compiler%-%platform%-%charset% +echo --- compiler = %compiler% +echo --- configuration = %configuration% +echo --- platform = %platform% +echo --- charset = %charset% + +if "%compiler%" equ "mingw" goto :mingw +if "%compiler%" equ "msvc" goto :msvc + +:: ------------------------------------------------------------------------------- + +:mingw +if "%platform%" equ "x86" if not exist "%mingw%\bin\gcc.exe" set MINGW=%SystemDrive%\msys2\mingw32 +if "%platform%" equ "x86" if not exist "%mingw%\bin\gcc.exe" set MINGW=%SystemDrive%\msys64\mingw32 +if "%platform%" equ "x64" if not exist "%mingw%\bin\gcc.exe" set MINGW=%SystemDrive%\msys2\mingw64 +if "%platform%" equ "x64" if not exist "%mingw%\bin\gcc.exe" set MINGW=%SystemDrive%\msys64\mingw64 +echo --- mingw = %mingw% +if not exist "%mingw%\bin\gcc.exe" echo ERROR: Missing "%mingw%\bin\gcc.exe" && exit /b 2 +set PATH=%mingw%\bin;%PATH% + +echo. +gcc --version + +set platform_nsis=%platform% +if "%platform_nsis%" equ "x64" set platform_nsis=amd64 + +echo ^> mingw32-make.exe ARCH=%platform% CHAR=%charset% OUTDIR="%~dp0%configuration%-%compiler%-%platform_nsis%-%charset%" CONFIG=%configuration% clean all +mingw32-make.exe ARCH=%platform% CHAR=%charset% OUTDIR="%~dp0%configuration%-%compiler%-%platform_nsis%-%charset%" CONFIG=%configuration% clean all || exit /b !errorlevel! +goto :end + +:: ------------------------------------------------------------------------------- + +:msvc +echo TODO +goto :end + +:end +echo all done. errorlevel %errorlevel% +REM pause \ No newline at end of file diff --git a/_build_mingw_Release.bat b/_build_mingw_Release.bat index 39dc3ff..6ee818d 100644 --- a/_build_mingw_Release.bat +++ b/_build_mingw_Release.bat @@ -2,61 +2,7 @@ REM :: Marius Negrutiu (marius.negrutiu@protonmail.com) @echo off setlocal enabledelayedexpansion -echo. -if not exist "%MINGW32%\bin\gcc.exe" set MINGW32=%MINGW32_INSTDIR% -if not exist "%MINGW32%\bin\gcc.exe" set MINGW32=%SystemDrive%\msys2\mingw32 -if not exist "%MINGW32%\bin\gcc.exe" set MINGW32=%SystemDrive%\msys64\mingw32 - -if not exist "%MINGW64%\bin\gcc.exe" set MINGW64=%MINGW64_INSTDIR% -if not exist "%MINGW64%\bin\gcc.exe" set MINGW64=%SystemDrive%\msys2\mingw64 -if not exist "%MINGW64%\bin\gcc.exe" set MINGW64=%SystemDrive%\msys64\mingw64 - -set ORIGINAL_PATH=%PATH% - -cd /d "%~dp0" - -:x86 -if not exist "%MINGW32%\bin\gcc.exe" echo ERROR: Missing "%MINGW32%" && pause && exit /B 2 -set PATH=%MINGW32%\bin;%ORIGINAL_PATH% - -echo. -echo ------------------------------------------------------------------- -set OUTDIR=%~dp0Release-mingw-x86-ansi -echo %OUTDIR% -title %OUTDIR% -echo ------------------------------------------------------------------- -pushd "%~dp0src\nscurl" -mingw32-make.exe ARCH=x86 CHAR=ANSI OUTDIR=%OUTDIR% clean all -popd -if %errorlevel% neq 0 pause && exit /B %errorlevel% - -echo. -echo ------------------------------------------------------------------- -set OUTDIR=%~dp0Release-mingw-x86-unicode -echo %OUTDIR% -title %OUTDIR% -echo ------------------------------------------------------------------- -pushd "%~dp0src\nscurl" -mingw32-make.exe ARCH=x86 CHAR=Unicode OUTDIR=%OUTDIR% clean all -popd -if %errorlevel% neq 0 pause && exit /B %errorlevel% - - -:amd64 -if not exist "%MINGW64%\bin\gcc.exe" echo ERROR: Missing "%MINGW64%" && pause && exit /B 2 -set PATH=%MINGW64%\bin;%ORIGINAL_PATH% - -echo. -echo ------------------------------------------------------------------- -set OUTDIR=%~dp0Release-mingw-amd64-unicode -echo %OUTDIR% -title %OUTDIR% -echo ------------------------------------------------------------------- -pushd "%~dp0src\nscurl" -mingw32-make.exe ARCH=x64 CHAR=Unicode OUTDIR=%OUTDIR% clean all -popd -if %errorlevel% neq 0 pause && exit /B %errorlevel% - -echo. -REM pause +call "%~dp0_build.bat" mingw release x86 unicode || exit /b !errorlevel! +call "%~dp0_build.bat" mingw release x86 ansi || exit /b !errorlevel! +call "%~dp0_build.bat" mingw release x64 unicode || exit /b !errorlevel!