From 192599bf63b6ae5aa08e4536a90d5d0a17f969f7 Mon Sep 17 00:00:00 2001 From: "Felipe \\\\\\\"Zimmerle\\\\\\\" Costa" Date: Wed, 6 Nov 2013 08:49:25 -0600 Subject: [PATCH] iss: Better err handling in build scripts. Now checking for errors in every step of the build phase --- iis/build_modsecurity.bat | 10 +++++++++- iis/dependencies/build_curl.bat | 7 ++++++- iis/dependencies/build_libxml2.bat | 6 ++++++ iis/dependencies/build_lua.bat | 7 +++++++ iis/dependencies/build_pcre.bat | 6 ++++++ iis/dependencies/build_zlib.bat | 5 +++++ 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/iis/build_modsecurity.bat b/iis/build_modsecurity.bat index 339e1a87..a9cf6dd0 100644 --- a/iis/build_modsecurity.bat +++ b/iis/build_modsecurity.bat @@ -12,14 +12,17 @@ set CURRENT_DIR=%cd% cd ..\apache2 del *.obj *.dll *.lib NMAKE -f Makefile.win APACHE=..\iis\%DEPENDENCIES_DIR%\Apache24 PCRE=..\iis\%DEPENDENCIES_DIR%\pcre LIBXML2=..\iis\%DEPENDENCIES_DIR%\libxml2 LUA=..\iis\%DEPENDENCIES_DIR%\lua\src VERSION=VERSION_IIS +@if NOT (%ERRORLEVEL%) == (0) goto build_failed cd ..\mlogc nmake -f Makefile.win clean nmake -f Makefile.win APACHE=..\iis\%DEPENDENCIES_DIR%\Apache24 PCRE=..\iis\%DEPENDENCIES_DIR%\pcre CURL=..\iis\%DEPENDENCIES_DIR%\curl VERSION=VERSION_IIS +@if NOT (%ERRORLEVEL%) == (0) goto build_failed cd ..\iis nmake -f Makefile.win clean NMAKE -f Makefile.win APACHE=..\iis\%DEPENDENCIES_DIR%\Apache24 PCRE=..\iis\%DEPENDENCIES_DIR%\pcre LIBXML2=..\iis\%DEPENDENCIES_DIR%\libxml2 LUA=..\iis\%DEPENDENCIES_DIR%\lua\src VERSION=VERSION_IIS +@if NOT (%ERRORLEVEL%) == (0) goto build_failed cd %CURRENT_DIR% @@ -33,6 +36,11 @@ exit /B 0 @echo Please specify a valid vcargs @goto failed +:build_failed +@echo Problems during the building phase +@goto failed + :failed @cd %CURRENT_DIR% -@exit /B +@exit /B 1 + diff --git a/iis/dependencies/build_curl.bat b/iis/dependencies/build_curl.bat index ed4911d1..746b7f5d 100644 --- a/iis/dependencies/build_curl.bat +++ b/iis/dependencies/build_curl.bat @@ -11,9 +11,10 @@ mklink /D "curl" "%CURL_DIR%" copy /y CMakeLists.txt "%CURL_DIR%" CD "%CURL_DIR%" CMAKE -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=True -DCURL_ZLIB=True +@if NOT (%ERRORLEVEL%) == (0) goto build_failed "%WORK_DIR%\fart.exe" -r -C "%WORK_DIR%\%CURL_DIR%\include\curl\curlbuild.h" LLU ULL NMAKE - +@if NOT (%ERRORLEVEL%) == (0) goto build_failed cd "%WORK_DIR%" copy /y "%WORK_DIR%\%CURL_DIR%\lib\libcurl.dll" "%OUTPUT_DIR%" @@ -26,6 +27,10 @@ exit /B 0 @echo File not found: "%SOURCE_DIR%\%CURL%" @goto failed +:build_failed +@echo Problems during the building phase +@goto failed + :failed @exit /B 1 diff --git a/iis/dependencies/build_libxml2.bat b/iis/dependencies/build_libxml2.bat index 33d37e34..c5adc5c9 100644 --- a/iis/dependencies/build_libxml2.bat +++ b/iis/dependencies/build_libxml2.bat @@ -11,7 +11,9 @@ mklink /D "libxml2" "%LIBXML2_DIR%" fart.exe -r -i -C "%WORK_DIR%\%LIBXML2_DIR%\win32\*.*" \x2Fopt:nowin98 " " cd "%LIBXML2_DIR%\win32" CSCRIPT configure.js iconv=no vcmanifest=yes zlib=yes +@if NOT (%ERRORLEVEL%) == (0) goto build_failed NMAKE -f Makefile.msvc +@if NOT (%ERRORLEVEL%) == (0) goto build_failed cd "%WORK%" @@ -24,6 +26,10 @@ copy /y "%WORK_DIR%\%LIBXML2_DIR%\win32\bin.msvc\libxml2.lib" "%OUTPUT_DIR%" @echo File not found: "%SOURCE_DIR%\%LIBXML2%" @goto failed +:build_failed +@echo Problems during the building phase +@goto failed + :failed @exit /B 1 diff --git a/iis/dependencies/build_lua.bat b/iis/dependencies/build_lua.bat index 29872acc..79b05b6f 100644 --- a/iis/dependencies/build_lua.bat +++ b/iis/dependencies/build_lua.bat @@ -11,9 +11,12 @@ mklink /D "lua" "%LUA_DIR%" cd "%LUA_DIR%\src" CL /Ox /arch:SSE2 /GF /GL /Gy /FD /EHsc /MD /Zi /TC /wd4005 /D "_MBCS" /D "LUA_CORE" /D "LUA_BUILD_AS_DLL" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_WIN32" /D "_WINDLL" /c *.c +@if NOT (%ERRORLEVEL%) == (0) goto build_failed DEL lua.obj luac.obj LINK /DLL /LTCG /DEBUG /OUT:lua5.1.dll *.obj +@if NOT (%ERRORLEVEL%) == (0) goto build_failed IF EXIST lua5.1.dll.manifest MT -manifest lua5.1.dll.manifest -outputresource:lua5.1.dll;2 +@if NOT (%ERRORLEVEL%) == (0) goto build_failed cd "%WORK_DIR%" @@ -27,6 +30,10 @@ copy /y "%WORK_DIR%\%LUA_DIR%\src\lua5.1.lib" "%OUTPUT_DIR%" @echo File not found: "%SOURCE_DIR%\%LUA%" @goto failed +:build_failed +@echo Problems during the building phase +@goto failed + :failed @exit /B 1 diff --git a/iis/dependencies/build_pcre.bat b/iis/dependencies/build_pcre.bat index bfaaad0e..55ef3832 100644 --- a/iis/dependencies/build_pcre.bat +++ b/iis/dependencies/build_pcre.bat @@ -9,7 +9,9 @@ mklink /D "pcre" "%PCRE_DIR%" cd "%PCRE_DIR%" CMAKE -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=True +@if NOT (%ERRORLEVEL%) == (0) goto build_failed NMAKE +@if NOT (%ERRORLEVEL%) == (0) goto build_failed cd "%WORK%" copy /y "%WORK_DIR%\%PCRE_DIR%\pcre.dll" "%OUTPUT_DIR%" @@ -22,5 +24,9 @@ echo "a" @echo File not found: "%SOURCE_DIR%\%PCRE%" @goto failed +:build_failed +@echo Problems during the building phase +@goto failed + :failed @exit /B 1 diff --git a/iis/dependencies/build_zlib.bat b/iis/dependencies/build_zlib.bat index d57b4e41..22a8aa0a 100644 --- a/iis/dependencies/build_zlib.bat +++ b/iis/dependencies/build_zlib.bat @@ -11,6 +11,7 @@ mklink /D "zlib" "%ZLIB_DIR%" cd "%ZLIB_DIR%" nmake -f win32\Makefile.msc +@if NOT (%ERRORLEVEL%) == (0) goto build_failed SET INCLUDE=%INCLUDE%;%WORK_DIR%\%ZLIB_DIR% SET LIB=%LIB%;%WORK_DIR%\%ZLIB_DIR% cd "%WORK_DIR%" @@ -25,5 +26,9 @@ copy /y "%WORK_DIR%\%ZLIB_DIR%\zdll.lib" "%OUTPUT_DIR%" @echo File not found: "%SOURCE_DIR%\%ZLIB%" @goto failed +:build_failed +@echo Problems during the building phase +@goto failed + :failed @exit /B 1