2009-04-30 08:12:31 -04:00
|
|
|
@echo off
|
2015-08-05 01:26:19 -04:00
|
|
|
rem ***************************************************************************
|
|
|
|
rem * _ _ ____ _
|
|
|
|
rem * Project ___| | | | _ \| |
|
|
|
|
rem * / __| | | | |_) | |
|
|
|
|
rem * | (__| |_| | _ <| |___
|
|
|
|
rem * \___|\___/|_| \_\_____|
|
|
|
|
rem *
|
2017-05-22 03:05:10 -04:00
|
|
|
rem * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2015-08-05 01:26:19 -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.
|
2015-08-05 01:26:19 -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 ***************************************************************************
|
|
|
|
|
|
|
|
rem NOTES
|
2015-08-05 01:22:06 -04:00
|
|
|
rem
|
2015-08-05 01:26:19 -04:00
|
|
|
rem This batch file must be used to set up a git tree to build on systems where
|
2015-08-09 06:00:07 -04:00
|
|
|
rem there is no autotools support (i.e. DOS and Windows).
|
2015-08-05 01:22:06 -04:00
|
|
|
rem
|
2009-06-08 10:27:36 -04:00
|
|
|
|
2015-08-05 01:36:42 -04:00
|
|
|
:begin
|
2015-08-08 06:09:08 -04:00
|
|
|
rem Set our variables
|
2015-08-09 06:00:07 -04:00
|
|
|
if "%OS%" == "Windows_NT" setlocal
|
2015-08-08 06:09:08 -04:00
|
|
|
set MODE=GENERATE
|
|
|
|
|
2015-08-05 14:15:46 -04:00
|
|
|
rem Switch to this batch file's directory
|
|
|
|
cd /d "%~0\.." 1>NUL 2>&1
|
|
|
|
|
2015-08-06 12:39:20 -04:00
|
|
|
rem Check we are running from a curl git repository
|
|
|
|
if not exist GIT-INFO goto norepo
|
2009-04-30 08:12:31 -04:00
|
|
|
|
2015-08-09 12:09:49 -04:00
|
|
|
rem Detect programs. HAVE_<PROGNAME>
|
|
|
|
rem When not found the variable is set undefined. The undefined pattern
|
|
|
|
rem allows for statements like "if not defined HAVE_PERL (command)"
|
|
|
|
groff --version <NUL 1>NUL 2>&1
|
|
|
|
if errorlevel 1 (set HAVE_GROFF=) else (set HAVE_GROFF=Y)
|
|
|
|
nroff --version <NUL 1>NUL 2>&1
|
|
|
|
if errorlevel 1 (set HAVE_NROFF=) else (set HAVE_NROFF=Y)
|
|
|
|
perl --version <NUL 1>NUL 2>&1
|
|
|
|
if errorlevel 1 (set HAVE_PERL=) else (set HAVE_PERL=Y)
|
|
|
|
gzip --version <NUL 1>NUL 2>&1
|
|
|
|
if errorlevel 1 (set HAVE_GZIP=) else (set HAVE_GZIP=Y)
|
|
|
|
|
2015-08-05 12:59:38 -04:00
|
|
|
:parseArgs
|
|
|
|
if "%~1" == "" goto start
|
|
|
|
|
|
|
|
if /i "%~1" == "-clean" (
|
|
|
|
set MODE=CLEAN
|
2015-08-08 06:04:55 -04:00
|
|
|
) else if /i "%~1" == "-?" (
|
|
|
|
goto syntax
|
|
|
|
) else if /i "%~1" == "-h" (
|
|
|
|
goto syntax
|
|
|
|
) else if /i "%~1" == "-help" (
|
|
|
|
goto syntax
|
2015-08-05 12:59:38 -04:00
|
|
|
) else (
|
|
|
|
goto unknown
|
|
|
|
)
|
|
|
|
|
|
|
|
shift & goto parseArgs
|
|
|
|
|
2015-08-05 01:36:42 -04:00
|
|
|
:start
|
2015-08-05 12:59:38 -04:00
|
|
|
if "%MODE%" == "GENERATE" (
|
2015-08-09 06:27:33 -04:00
|
|
|
echo.
|
|
|
|
echo Generating prerequisite files
|
|
|
|
|
2015-08-05 12:59:38 -04:00
|
|
|
call :generate
|
2015-08-09 12:54:09 -04:00
|
|
|
if errorlevel 3 goto nogenhugehelp
|
|
|
|
if errorlevel 2 goto nogenmakefile
|
|
|
|
if errorlevel 1 goto warning
|
|
|
|
|
2015-08-05 12:59:38 -04:00
|
|
|
) else (
|
2015-08-09 06:27:33 -04:00
|
|
|
echo.
|
|
|
|
echo Removing prerequisite files
|
|
|
|
|
2015-08-05 12:59:38 -04:00
|
|
|
call :clean
|
2015-08-09 06:27:33 -04:00
|
|
|
if errorlevel 2 goto nocleanhugehelp
|
|
|
|
if errorlevel 1 goto nocleanmakefile
|
2015-08-05 12:59:38 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
goto success
|
|
|
|
|
|
|
|
rem Main generate function.
|
2015-08-09 12:02:27 -04:00
|
|
|
rem
|
2015-08-09 06:27:33 -04:00
|
|
|
rem Returns:
|
|
|
|
rem
|
|
|
|
rem 0 - success
|
2015-08-09 12:54:09 -04:00
|
|
|
rem 1 - success with simplified tool_hugehelp.c
|
2015-08-09 12:57:40 -04:00
|
|
|
rem 2 - failed to generate Makefile
|
|
|
|
rem 3 - failed to generate tool_hugehelp.c
|
2015-08-09 06:27:33 -04:00
|
|
|
rem
|
2015-08-05 12:59:38 -04:00
|
|
|
:generate
|
2015-08-09 12:54:09 -04:00
|
|
|
if "%OS%" == "Windows_NT" setlocal
|
|
|
|
set BASIC_HUGEHELP=0
|
|
|
|
|
2015-08-09 12:57:40 -04:00
|
|
|
rem Create Makefile
|
2015-08-14 01:54:16 -04:00
|
|
|
echo * %CD%\Makefile
|
2015-08-05 12:32:45 -04:00
|
|
|
if exist Makefile.dist (
|
2015-08-09 06:27:33 -04:00
|
|
|
copy /Y Makefile.dist Makefile 1>NUL 2>&1
|
|
|
|
if errorlevel 1 (
|
2015-08-09 12:54:09 -04:00
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
|
|
|
exit /B 2
|
2015-08-09 06:27:33 -04:00
|
|
|
)
|
2015-08-05 12:32:45 -04:00
|
|
|
)
|
2009-04-30 08:12:31 -04:00
|
|
|
|
2015-08-09 12:57:40 -04:00
|
|
|
rem Create tool_hugehelp.c
|
2015-08-09 12:54:09 -04:00
|
|
|
echo * %CD%\src\tool_hugehelp.c
|
|
|
|
call :genHugeHelp
|
|
|
|
if errorlevel 2 (
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
|
|
|
exit /B 3
|
|
|
|
)
|
|
|
|
if errorlevel 1 (
|
|
|
|
set BASIC_HUGEHELP=1
|
2015-08-09 06:04:04 -04:00
|
|
|
)
|
2015-08-09 12:54:09 -04:00
|
|
|
cmd /c exit 0
|
2015-08-09 06:04:04 -04:00
|
|
|
|
2015-08-09 12:57:40 -04:00
|
|
|
rem Setup c-ares git tree
|
2015-08-05 12:32:45 -04:00
|
|
|
if exist ares\buildconf.bat (
|
2015-08-05 12:40:28 -04:00
|
|
|
echo.
|
|
|
|
echo Configuring c-ares build environment
|
2015-08-05 12:32:45 -04:00
|
|
|
cd ares
|
|
|
|
call buildconf.bat
|
|
|
|
cd ..
|
|
|
|
)
|
|
|
|
|
2015-08-09 12:54:09 -04:00
|
|
|
if "%BASIC_HUGEHELP%" == "1" (
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
|
|
|
exit /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
2015-08-09 06:27:33 -04:00
|
|
|
exit /B 0
|
2015-08-05 12:59:38 -04:00
|
|
|
|
|
|
|
rem Main clean function.
|
|
|
|
rem
|
2015-08-09 06:27:33 -04:00
|
|
|
rem Returns:
|
|
|
|
rem
|
|
|
|
rem 0 - success
|
2015-08-09 12:57:40 -04:00
|
|
|
rem 1 - failed to clean Makefile
|
|
|
|
rem 2 - failed to clean tool_hugehelp.c
|
2015-08-09 06:27:33 -04:00
|
|
|
rem
|
2015-08-05 12:59:38 -04:00
|
|
|
:clean
|
2015-08-09 12:57:40 -04:00
|
|
|
rem Remove Makefile
|
2015-08-05 12:59:38 -04:00
|
|
|
echo * %CD%\Makefile
|
|
|
|
if exist Makefile (
|
2015-08-09 06:27:33 -04:00
|
|
|
del Makefile 2>NUL
|
|
|
|
if exist Makefile (
|
|
|
|
exit /B 1
|
|
|
|
)
|
2015-08-05 12:59:38 -04:00
|
|
|
)
|
|
|
|
|
2015-08-09 12:57:40 -04:00
|
|
|
rem Remove tool_hugehelp.c
|
2015-08-05 12:59:38 -04:00
|
|
|
echo * %CD%\src\tool_hugehelp.c
|
|
|
|
if exist src\tool_hugehelp.c (
|
2015-08-09 06:27:33 -04:00
|
|
|
del src\tool_hugehelp.c 2>NUL
|
|
|
|
if exist src\tool_hugehelp.c (
|
|
|
|
exit /B 2
|
|
|
|
)
|
2015-08-05 12:59:38 -04:00
|
|
|
)
|
|
|
|
|
2015-08-09 12:54:09 -04:00
|
|
|
exit /B
|
|
|
|
|
|
|
|
rem Function to generate src\tool_hugehelp.c
|
|
|
|
rem
|
|
|
|
rem Returns:
|
|
|
|
rem
|
|
|
|
rem 0 - full tool_hugehelp.c generated
|
|
|
|
rem 1 - simplified tool_hugehelp.c
|
|
|
|
rem 2 - failure
|
|
|
|
rem
|
|
|
|
:genHugeHelp
|
|
|
|
if "%OS%" == "Windows_NT" setlocal
|
|
|
|
set LC_ALL=C
|
|
|
|
set ROFFCMD=
|
|
|
|
set BASIC=1
|
|
|
|
|
|
|
|
if defined HAVE_PERL (
|
|
|
|
if defined HAVE_GROFF (
|
|
|
|
set ROFFCMD=groff -mtty-char -Tascii -P-c -man
|
|
|
|
) else if defined HAVE_NROFF (
|
|
|
|
set ROFFCMD=nroff -c -Tascii -man
|
2015-08-09 06:27:33 -04:00
|
|
|
)
|
2015-08-05 12:59:38 -04:00
|
|
|
)
|
|
|
|
|
2015-08-09 12:54:09 -04:00
|
|
|
if defined ROFFCMD (
|
|
|
|
echo #include "tool_setup.h"> src\tool_hugehelp.c
|
|
|
|
echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
|
|
|
|
|
|
|
|
if defined HAVE_GZIP (
|
|
|
|
echo #ifndef HAVE_LIBZ>> src\tool_hugehelp.c
|
|
|
|
)
|
|
|
|
|
|
|
|
%ROFFCMD% docs\curl.1 2>NUL | perl src\mkhelp.pl docs\MANUAL >> src\tool_hugehelp.c
|
|
|
|
if defined HAVE_GZIP (
|
|
|
|
echo #else>> src\tool_hugehelp.c
|
|
|
|
%ROFFCMD% docs\curl.1 2>NUL | perl src\mkhelp.pl -c docs\MANUAL >> src\tool_hugehelp.c
|
|
|
|
echo #endif /^* HAVE_LIBZ ^*/>> src\tool_hugehelp.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set BASIC=0
|
|
|
|
) else (
|
|
|
|
if exist src\tool_hugehelp.c.cvs (
|
|
|
|
copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1
|
|
|
|
) else (
|
|
|
|
echo #include "tool_setup.h"> src\tool_hugehelp.c
|
|
|
|
echo #include "tool_hugehelp.hd">> src\tool_hugehelp.c
|
|
|
|
echo.>> src\tool_hugehelp.c
|
|
|
|
echo void hugehelp(void^)>> src\tool_hugehelp.c
|
|
|
|
echo {>> src\tool_hugehelp.c
|
|
|
|
echo #ifdef USE_MANUAL>> src\tool_hugehelp.c
|
|
|
|
echo fputs("Built-in manual not included\n", stdout^);>> src\tool_hugehelp.c
|
|
|
|
echo #endif>> src\tool_hugehelp.c
|
|
|
|
echo }>> src\tool_hugehelp.c
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
findstr "/C:void hugehelp(void)" src\tool_hugehelp.c 1>NUL 2>&1
|
|
|
|
if errorlevel 1 (
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
|
|
|
exit /B 2
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%BASIC%" == "1" (
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
|
|
|
exit /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
2015-08-09 06:27:33 -04:00
|
|
|
exit /B 0
|
2009-04-30 08:12:31 -04:00
|
|
|
|
2015-08-09 12:02:27 -04:00
|
|
|
rem Function to clean-up local variables under DOS, Windows 3.x and
|
|
|
|
rem Windows 9x as setlocal isn't available until Windows NT
|
|
|
|
rem
|
|
|
|
:dosCleanup
|
|
|
|
set MODE=
|
2015-08-09 12:09:49 -04:00
|
|
|
set HAVE_GROFF=
|
|
|
|
set HAVE_NROFF=
|
|
|
|
set HAVE_PERL=
|
|
|
|
set HAVE_GZIP=
|
2015-08-09 12:54:09 -04:00
|
|
|
set BASIC_HUGEHELP=
|
|
|
|
set LC_ALL
|
|
|
|
set ROFFCMD=
|
|
|
|
set BASIC=
|
2015-08-09 12:02:27 -04:00
|
|
|
|
|
|
|
exit /B
|
|
|
|
|
2015-08-05 01:41:40 -04:00
|
|
|
:syntax
|
|
|
|
rem Display the help
|
|
|
|
echo.
|
2015-08-05 12:59:38 -04:00
|
|
|
echo Usage: buildconf [-clean]
|
|
|
|
echo.
|
|
|
|
echo -clean - Removes the files
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:unknown
|
|
|
|
echo.
|
|
|
|
echo Error: Unknown argument '%1'
|
2015-08-05 01:41:40 -04:00
|
|
|
goto error
|
|
|
|
|
2015-08-06 12:39:20 -04:00
|
|
|
:norepo
|
2015-08-05 01:36:42 -04:00
|
|
|
echo.
|
2015-08-06 12:39:20 -04:00
|
|
|
echo Error: This batch file should only be used with a curl git repository
|
2015-08-05 01:36:42 -04:00
|
|
|
goto error
|
2009-06-08 10:27:36 -04:00
|
|
|
|
2015-08-09 06:27:33 -04:00
|
|
|
:nogenmakefile
|
|
|
|
echo.
|
|
|
|
echo Error: Unable to generate Makefile
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:nogenhugehelp
|
|
|
|
echo.
|
|
|
|
echo Error: Unable to generate src\tool_hugehelp.c
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:nocleanmakefile
|
|
|
|
echo.
|
|
|
|
echo Error: Unable to clean Makefile
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:nocleanhugehelp
|
|
|
|
echo.
|
|
|
|
echo Error: Unable to clean src\tool_hugehelp.c
|
|
|
|
goto error
|
|
|
|
|
2015-08-09 12:54:09 -04:00
|
|
|
:warning
|
|
|
|
echo.
|
|
|
|
echo Warning: The curl manual could not be integrated in the source. This means when
|
|
|
|
echo you build curl the manual will not be available (curl --man^). Integration of
|
|
|
|
echo the manual is not required and a summary of the options will still be available
|
|
|
|
echo (curl --help^). To integrate the manual your PATH is required to have
|
|
|
|
echo groff/nroff, perl and optionally gzip for compression.
|
|
|
|
goto success
|
|
|
|
|
2015-08-05 01:36:42 -04:00
|
|
|
:error
|
2015-08-09 06:00:07 -04:00
|
|
|
if "%OS%" == "Windows_NT" (
|
|
|
|
endlocal
|
|
|
|
) else (
|
2015-08-09 12:02:27 -04:00
|
|
|
call :dosCleanup
|
2015-08-09 06:00:07 -04:00
|
|
|
)
|
2015-08-05 01:36:42 -04:00
|
|
|
exit /B 1
|
|
|
|
|
|
|
|
:success
|
2015-08-09 06:00:07 -04:00
|
|
|
if "%OS%" == "Windows_NT" (
|
|
|
|
endlocal
|
|
|
|
) else (
|
2015-08-09 12:02:27 -04:00
|
|
|
call :dosCleanup
|
2015-08-09 06:00:07 -04:00
|
|
|
)
|
2015-08-05 01:36:42 -04:00
|
|
|
exit /B 0
|