2014-09-13 06:24:07 -04:00
|
|
|
@echo off
|
|
|
|
rem ***************************************************************************
|
|
|
|
rem * _ _ ____ _
|
|
|
|
rem * Project ___| | | | _ \| |
|
|
|
|
rem * / __| | | | |_) | |
|
|
|
|
rem * | (__| |_| | _ <| |___
|
|
|
|
rem * \___|\___/|_| \_\_____|
|
|
|
|
rem *
|
2016-03-05 16:03:40 -05:00
|
|
|
rem * Copyright (C) 2014 - 2016, Steve Holme, <steve_holme@hotmail.com>.
|
2014-09-13 06:24:07 -04:00
|
|
|
rem *
|
|
|
|
rem * This software is licensed as described in the file COPYING, which
|
|
|
|
rem * you should have received as part of this distribution. The terms
|
2016-02-02 18:19:02 -05:00
|
|
|
rem * are also available at https://curl.haxx.se/docs/copyright.html.
|
2014-09-13 06:24:07 -04:00
|
|
|
rem *
|
|
|
|
rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
rem * copies of the Software, and permit persons to whom the Software is
|
|
|
|
rem * furnished to do so, under the terms of the COPYING file.
|
|
|
|
rem *
|
|
|
|
rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
rem * KIND, either express or implied.
|
|
|
|
rem *
|
|
|
|
rem ***************************************************************************
|
|
|
|
|
|
|
|
:begin
|
|
|
|
rem Check we are running on a Windows NT derived OS
|
|
|
|
if not "%OS%" == "Windows_NT" goto nodos
|
2015-08-08 06:11:46 -04:00
|
|
|
|
|
|
|
rem Set our variables
|
2014-09-13 06:24:07 -04:00
|
|
|
setlocal
|
2016-03-12 20:01:33 -05:00
|
|
|
set CHECK_LIB=TRUE
|
|
|
|
set CHECK_SRC=TRUE
|
2016-04-03 16:57:04 -04:00
|
|
|
set CHECK_TESTS=TRUE
|
2016-04-03 17:09:07 -04:00
|
|
|
set CHECK_EXAMPLES=TRUE
|
2014-09-13 06:24:07 -04:00
|
|
|
|
2015-08-08 06:04:55 -04:00
|
|
|
:parseArgs
|
2015-08-08 06:21:49 -04:00
|
|
|
if "%~1" == "" goto prerequisites
|
|
|
|
|
2015-08-08 06:04:55 -04:00
|
|
|
if /i "%~1" == "-?" (
|
|
|
|
goto syntax
|
|
|
|
) else if /i "%~1" == "-h" (
|
|
|
|
goto syntax
|
|
|
|
) else if /i "%~1" == "-help" (
|
|
|
|
goto syntax
|
2016-03-12 20:01:33 -05:00
|
|
|
) else if /i "%~1" == "lib" (
|
|
|
|
set CHECK_LIB=TRUE
|
|
|
|
set CHECK_SRC=FALSE
|
2016-04-03 15:52:38 -04:00
|
|
|
set CHECK_TESTS=FALSE
|
2016-04-03 17:09:07 -04:00
|
|
|
set CHECK_EXAMPLES=FALSE
|
2016-03-12 20:01:33 -05:00
|
|
|
) else if /i "%~1" == "src" (
|
|
|
|
set CHECK_LIB=FALSE
|
|
|
|
set CHECK_SRC=TRUE
|
2016-04-03 15:52:38 -04:00
|
|
|
set CHECK_TESTS=FALSE
|
2016-04-03 17:09:07 -04:00
|
|
|
set CHECK_EXAMPLES=FALSE
|
2016-04-03 15:52:38 -04:00
|
|
|
) else if /i "%~1" == "tests" (
|
|
|
|
set CHECK_LIB=FALSE
|
|
|
|
set CHECK_SRC=FALSE
|
|
|
|
set CHECK_TESTS=TRUE
|
2016-04-03 17:09:07 -04:00
|
|
|
set CHECK_EXAMPLES=FALSE
|
|
|
|
) else if /i "%~1" == "examples" (
|
|
|
|
set CHECK_LIB=FALSE
|
|
|
|
set CHECK_SRC=FALSE
|
|
|
|
set CHECK_TESTS=FALSE
|
|
|
|
set CHECK_EXAMPLES=TRUE
|
2015-08-08 06:21:49 -04:00
|
|
|
) else (
|
|
|
|
if not defined SRC_DIR (
|
|
|
|
set SRC_DIR=%~1%
|
|
|
|
) else (
|
|
|
|
goto unknown
|
|
|
|
)
|
2015-08-08 06:04:55 -04:00
|
|
|
)
|
2014-09-13 06:24:07 -04:00
|
|
|
|
2015-08-08 06:21:49 -04:00
|
|
|
shift & goto parseArgs
|
|
|
|
|
2014-09-13 06:24:07 -04:00
|
|
|
:prerequisites
|
2016-03-05 16:03:40 -05:00
|
|
|
rem Check we have Perl in our path
|
2015-01-16 15:44:32 -05:00
|
|
|
echo %PATH% | findstr /I /C:"\Perl" 1>nul
|
|
|
|
if errorlevel 1 (
|
2016-03-05 16:03:40 -05:00
|
|
|
rem It isn't so check we have it installed and set the path if it is
|
|
|
|
if exist "%SystemDrive%\Perl" (
|
2016-03-06 15:02:58 -05:00
|
|
|
set "PATH=%SystemDrive%\Perl\bin;%PATH%"
|
2016-03-05 16:03:40 -05:00
|
|
|
) else (
|
|
|
|
if exist "%SystemDrive%\Perl64" (
|
|
|
|
set "PATH=%SystemDrive%\Perl64\bin;%PATH%"
|
|
|
|
) else (
|
|
|
|
goto noperl
|
|
|
|
)
|
2015-01-16 15:44:32 -05:00
|
|
|
)
|
2014-09-13 06:24:07 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
:configure
|
2015-08-08 06:21:49 -04:00
|
|
|
if "%SRC_DIR%" == "" set SRC_DIR=..
|
2014-09-13 06:24:07 -04:00
|
|
|
if not exist "%SRC_DIR%" goto nosrc
|
|
|
|
|
|
|
|
:start
|
2016-03-12 20:01:33 -05:00
|
|
|
if "%CHECK_SRC%" == "TRUE" (
|
|
|
|
rem Check the src directory
|
|
|
|
if exist %SRC_DIR%\src (
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\src\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\src" -Wtool_hugehelp.c "%%i"
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\src\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\src" "%%i"
|
|
|
|
)
|
2015-08-08 06:35:59 -04:00
|
|
|
)
|
2015-08-08 06:11:46 -04:00
|
|
|
|
2016-03-12 20:01:33 -05:00
|
|
|
if "%CHECK_LIB%" == "TRUE" (
|
|
|
|
rem Check the lib directory
|
|
|
|
if exist %SRC_DIR%\lib (
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib" "%%i"
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib" -Wcurl_config.h.cmake "%%i"
|
|
|
|
)
|
2015-08-08 06:11:46 -04:00
|
|
|
|
2015-09-12 06:19:24 -04:00
|
|
|
rem Check the lib\vauth directory
|
|
|
|
if exist %SRC_DIR%\lib\vauth (
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vauth\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vauth" "%%i"
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vauth\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vauth" "%%i"
|
|
|
|
)
|
|
|
|
|
2016-03-12 20:01:33 -05:00
|
|
|
rem Check the lib\vtls directory
|
|
|
|
if exist %SRC_DIR%\lib\vtls (
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vtls\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vtls" "%%i"
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\lib\vtls\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\lib\vtls" "%%i"
|
|
|
|
)
|
2015-08-08 06:35:59 -04:00
|
|
|
)
|
2015-08-08 06:11:46 -04:00
|
|
|
|
2016-04-03 15:52:38 -04:00
|
|
|
if "%CHECK_TESTS%" == "TRUE" (
|
|
|
|
rem Check the tests\libtest directory
|
|
|
|
if exist %SRC_DIR%\tests\libtest (
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\libtest\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\libtest" "%%i"
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\libtest\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\libtest" "%%i"
|
|
|
|
)
|
|
|
|
|
|
|
|
rem Check the tests\unit directory
|
|
|
|
if exist %SRC_DIR%\tests\unit (
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\unit\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\unit" "%%i"
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\unit\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\unit" "%%i"
|
|
|
|
)
|
2016-04-03 16:53:32 -04:00
|
|
|
|
|
|
|
rem Check the tests\server directory
|
|
|
|
if exist %SRC_DIR%\tests\server (
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\server\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\server" "%%i"
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\tests\server\*.h.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\tests\server" "%%i"
|
|
|
|
)
|
2016-04-03 15:52:38 -04:00
|
|
|
)
|
|
|
|
|
2016-04-03 17:09:07 -04:00
|
|
|
if "%CHECK_EXAMPLES%" == "TRUE" (
|
|
|
|
rem Check the docs\examples directory
|
|
|
|
if exist %SRC_DIR%\docs\examples (
|
|
|
|
for /f "delims=" %%i in ('dir "%SRC_DIR%\docs\examples\*.c.*" /b 2^>NUL') do @perl "%SRC_DIR%\lib\checksrc.pl" "-D%SRC_DIR%\docs\examples" "%%i"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2014-09-13 06:24:07 -04:00
|
|
|
goto success
|
|
|
|
|
|
|
|
:syntax
|
|
|
|
rem Display the help
|
|
|
|
echo.
|
2016-03-23 02:50:03 -04:00
|
|
|
echo Usage: checksrc [what] [directory]
|
2016-03-12 20:01:33 -05:00
|
|
|
echo.
|
2016-03-23 02:50:03 -04:00
|
|
|
echo What to scan:
|
2016-03-12 20:01:33 -05:00
|
|
|
echo.
|
|
|
|
echo lib - Scan the libcurl source
|
|
|
|
echo src - Scan the command-line tool source
|
2016-04-03 15:52:38 -04:00
|
|
|
echo tests - Scan the library tests and unit tests
|
2016-04-03 17:09:07 -04:00
|
|
|
echo examples - Scan the examples
|
2014-09-13 06:24:07 -04:00
|
|
|
echo.
|
|
|
|
echo directory - Specifies the curl source directory
|
|
|
|
goto success
|
|
|
|
|
2015-08-08 06:21:49 -04:00
|
|
|
:unknown
|
|
|
|
echo.
|
|
|
|
echo Error: Unknown argument '%1'
|
|
|
|
goto error
|
|
|
|
|
2014-09-13 06:24:07 -04:00
|
|
|
:nodos
|
|
|
|
echo.
|
|
|
|
echo Error: Only a Windows NT based Operating System is supported
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:noperl
|
|
|
|
echo.
|
|
|
|
echo Error: Perl is not installed
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:nosrc
|
|
|
|
echo.
|
|
|
|
echo Error: "%SRC_DIR%" does not exist
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:error
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
|
|
|
exit /B 1
|
|
|
|
|
|
|
|
:success
|
|
|
|
endlocal
|
|
|
|
exit /B 0
|