2 rem ***************************************************************************
4 rem * Project ___| | | | _ \| |
5 rem * / __| | | | |_) | |
6 rem * | (__| |_| | _ <| |___
7 rem * \___|\___/|_| \_\_____|
9 rem * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
11 rem * This software is licensed as described in the file COPYING, which
12 rem * you should have received as part of this distribution. The terms
13 rem * are also available at https://curl.haxx.se/docs/copyright.html.
15 rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 rem * copies of the Software, and permit persons to whom the Software is
17 rem * furnished to do so, under the terms of the COPYING file.
19 rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 rem * KIND, either express or implied.
22 rem ***************************************************************************
26 rem This batch file must be used to set up a git tree to build on systems where
27 rem there is no autotools support (i.e. DOS and Windows).
32 if "%OS%" == "Windows_NT" setlocal
35 rem Switch to this batch file's directory
36 cd /d "%~0\.." 1>NUL 2>&1
38 rem Check we are running from a curl git repository
39 if not exist GIT-INFO goto norepo
41 rem Detect programs. HAVE_<PROGNAME>
42 rem When not found the variable is set undefined. The undefined pattern
43 rem allows for statements like "if not defined HAVE_PERL (command)"
44 groff --version <NUL 1>NUL 2>&1
45 if errorlevel 1 (set HAVE_GROFF=) else (set HAVE_GROFF=Y)
46 nroff --version <NUL 1>NUL 2>&1
47 if errorlevel 1 (set HAVE_NROFF=) else (set HAVE_NROFF=Y)
48 perl --version <NUL 1>NUL 2>&1
49 if errorlevel 1 (set HAVE_PERL=) else (set HAVE_PERL=Y)
50 gzip --version <NUL 1>NUL 2>&1
51 if errorlevel 1 (set HAVE_GZIP=) else (set HAVE_GZIP=Y)
54 if "%~1" == "" goto start
56 if /i "%~1" == "-clean" (
58 ) else if /i "%~1" == "-?" (
60 ) else if /i "%~1" == "-h" (
62 ) else if /i "%~1" == "-help" (
68 shift & goto parseArgs
71 if "%MODE%" == "GENERATE" (
73 echo Generating prerequisite files
76 if errorlevel 3 goto nogenhugehelp
77 if errorlevel 2 goto nogenmakefile
78 if errorlevel 1 goto warning
82 echo Removing prerequisite files
85 if errorlevel 2 goto nocleanhugehelp
86 if errorlevel 1 goto nocleanmakefile
91 rem Main generate function.
96 rem 1 - success with simplified tool_hugehelp.c
97 rem 2 - failed to generate Makefile
98 rem 3 - failed to generate tool_hugehelp.c
101 if "%OS%" == "Windows_NT" setlocal
106 if exist Makefile.dist (
107 copy /Y Makefile.dist Makefile 1>NUL 2>&1
109 if "%OS%" == "Windows_NT" endlocal
114 rem Create tool_hugehelp.c
115 echo * %CD%\src\tool_hugehelp.c
118 if "%OS%" == "Windows_NT" endlocal
126 rem Setup c-ares git tree
127 if exist ares\buildconf.bat (
129 echo Configuring c-ares build environment
135 if "%BASIC_HUGEHELP%" == "1" (
136 if "%OS%" == "Windows_NT" endlocal
140 if "%OS%" == "Windows_NT" endlocal
143 rem Main clean function.
148 rem 1 - failed to clean Makefile
149 rem 2 - failed to clean tool_hugehelp.c
161 rem Remove tool_hugehelp.c
162 echo * %CD%\src\tool_hugehelp.c
163 if exist src\tool_hugehelp.c (
164 del src\tool_hugehelp.c 2>NUL
165 if exist src\tool_hugehelp.c (
172 rem Function to generate src\tool_hugehelp.c
176 rem 0 - full tool_hugehelp.c generated
177 rem 1 - simplified tool_hugehelp.c
181 if "%OS%" == "Windows_NT" setlocal
186 if defined HAVE_PERL (
187 if defined HAVE_GROFF (
188 set ROFFCMD=groff -mtty-char -Tascii -P-c -man
189 ) else if defined HAVE_NROFF (
190 set ROFFCMD=nroff -c -Tascii -man
195 echo #include "tool_setup.h"> src\tool_hugehelp.c
196 echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
198 if defined HAVE_GZIP (
199 echo #ifndef HAVE_LIBZ>> src\tool_hugehelp.c
202 %ROFFCMD% docs\curl.1 2>NUL | perl src\mkhelp.pl docs\MANUAL >> src\tool_hugehelp.c
203 if defined HAVE_GZIP (
204 echo #else>> src\tool_hugehelp.c
205 %ROFFCMD% docs\curl.1 2>NUL | perl src\mkhelp.pl -c docs\MANUAL >> src\tool_hugehelp.c
206 echo #endif /^* HAVE_LIBZ ^*/>> src\tool_hugehelp.c
211 if exist src\tool_hugehelp.c.cvs (
212 copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1
214 echo #include "tool_setup.h"> src\tool_hugehelp.c
215 echo #include "tool_hugehelp.hd">> src\tool_hugehelp.c
216 echo.>> src\tool_hugehelp.c
217 echo void hugehelp(void^)>> src\tool_hugehelp.c
218 echo {>> src\tool_hugehelp.c
219 echo #ifdef USE_MANUAL>> src\tool_hugehelp.c
220 echo fputs("Built-in manual not included\n", stdout^);>> src\tool_hugehelp.c
221 echo #endif>> src\tool_hugehelp.c
222 echo }>> src\tool_hugehelp.c
226 findstr "/C:void hugehelp(void)" src\tool_hugehelp.c 1>NUL 2>&1
228 if "%OS%" == "Windows_NT" endlocal
232 if "%BASIC%" == "1" (
233 if "%OS%" == "Windows_NT" endlocal
237 if "%OS%" == "Windows_NT" endlocal
240 rem Function to clean-up local variables under DOS, Windows 3.x and
241 rem Windows 9x as setlocal isn't available until Windows NT
259 echo Usage: buildconf [-clean]
261 echo -clean - Removes the files
266 echo Error: Unknown argument '%1'
271 echo Error: This batch file should only be used with a curl git repository
276 echo Error: Unable to generate Makefile
281 echo Error: Unable to generate src\tool_hugehelp.c
286 echo Error: Unable to clean Makefile
291 echo Error: Unable to clean src\tool_hugehelp.c
296 echo Warning: The curl manual could not be integrated in the source. This means when
297 echo you build curl the manual will not be available (curl --man^). Integration of
298 echo the manual is not required and a summary of the options will still be available
299 echo (curl --help^). To integrate the manual your PATH is required to have
300 echo groff/nroff, perl and optionally gzip for compression.
304 if "%OS%" == "Windows_NT" (
312 if "%OS%" == "Windows_NT" (