2 rem ***************************************************************************
\r
4 rem * Project ___| | | | _ \| |
\r
5 rem * / __| | | | |_) | |
\r
6 rem * | (__| |_| | _ <| |___
\r
7 rem * \___|\___/|_| \_\_____|
\r
9 rem * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
\r
11 rem * This software is licensed as described in the file COPYING, which
\r
12 rem * you should have received as part of this distribution. The terms
\r
13 rem * are also available at https://curl.se/docs/copyright.html.
\r
15 rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
\r
16 rem * copies of the Software, and permit persons to whom the Software is
\r
17 rem * furnished to do so, under the terms of the COPYING file.
\r
19 rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
\r
20 rem * KIND, either express or implied.
\r
22 rem * SPDX-License-Identifier: curl
\r
24 rem ***************************************************************************
\r
28 rem This batch file must be used to set up a git tree to build on systems where
\r
29 rem there is no autotools support (i.e. DOS and Windows).
\r
33 rem Set our variables
\r
34 if "%OS%" == "Windows_NT" setlocal
\r
37 rem Switch to this batch file's directory
\r
38 cd /d "%~0\.." 1>NUL 2>&1
\r
40 rem Check we are running from a curl git repository
\r
41 if not exist GIT-INFO goto norepo
\r
43 rem Detect programs. HAVE_<PROGNAME>
\r
44 rem When not found the variable is set undefined. The undefined pattern
\r
45 rem allows for statements like "if not defined HAVE_PERL (command)"
\r
46 groff --version <NUL 1>NUL 2>&1
\r
47 if errorlevel 1 (set HAVE_GROFF=) else (set HAVE_GROFF=Y)
\r
48 nroff --version <NUL 1>NUL 2>&1
\r
49 if errorlevel 1 (set HAVE_NROFF=) else (set HAVE_NROFF=Y)
\r
50 perl --version <NUL 1>NUL 2>&1
\r
51 if errorlevel 1 (set HAVE_PERL=) else (set HAVE_PERL=Y)
\r
52 gzip --version <NUL 1>NUL 2>&1
\r
53 if errorlevel 1 (set HAVE_GZIP=) else (set HAVE_GZIP=Y)
\r
56 if "%~1" == "" goto start
\r
58 if /i "%~1" == "-clean" (
\r
60 ) else if /i "%~1" == "-?" (
\r
62 ) else if /i "%~1" == "-h" (
\r
64 ) else if /i "%~1" == "-help" (
\r
70 shift & goto parseArgs
\r
73 if "%MODE%" == "GENERATE" (
\r
75 echo Generating prerequisite files
\r
78 if errorlevel 3 goto nogenhugehelp
\r
79 if errorlevel 2 goto nogenmakefile
\r
80 if errorlevel 1 goto warning
\r
84 echo Removing prerequisite files
\r
87 if errorlevel 2 goto nocleanhugehelp
\r
88 if errorlevel 1 goto nocleanmakefile
\r
93 rem Main generate function.
\r
98 rem 1 - success with simplified tool_hugehelp.c
\r
99 rem 2 - failed to generate Makefile
\r
100 rem 3 - failed to generate tool_hugehelp.c
\r
103 if "%OS%" == "Windows_NT" setlocal
\r
104 set BASIC_HUGEHELP=0
\r
106 rem Create Makefile
\r
107 echo * %CD%\Makefile
\r
108 if exist Makefile.dist (
\r
109 copy /Y Makefile.dist Makefile 1>NUL 2>&1
\r
111 if "%OS%" == "Windows_NT" endlocal
\r
116 rem Create tool_hugehelp.c
\r
117 echo * %CD%\src\tool_hugehelp.c
\r
120 if "%OS%" == "Windows_NT" endlocal
\r
124 set BASIC_HUGEHELP=1
\r
128 rem Setup c-ares git tree
\r
129 if exist ares\buildconf.bat (
\r
131 echo Configuring c-ares build environment
\r
137 if "%BASIC_HUGEHELP%" == "1" (
\r
138 if "%OS%" == "Windows_NT" endlocal
\r
142 if "%OS%" == "Windows_NT" endlocal
\r
145 rem Main clean function.
\r
150 rem 1 - failed to clean Makefile
\r
151 rem 2 - failed to clean tool_hugehelp.c
\r
154 rem Remove Makefile
\r
155 echo * %CD%\Makefile
\r
156 if exist Makefile (
\r
158 if exist Makefile (
\r
163 rem Remove tool_hugehelp.c
\r
164 echo * %CD%\src\tool_hugehelp.c
\r
165 if exist src\tool_hugehelp.c (
\r
166 del src\tool_hugehelp.c 2>NUL
\r
167 if exist src\tool_hugehelp.c (
\r
174 rem Function to generate src\tool_hugehelp.c
\r
178 rem 0 - full tool_hugehelp.c generated
\r
179 rem 1 - simplified tool_hugehelp.c
\r
183 if "%OS%" == "Windows_NT" setlocal
\r
188 if defined HAVE_PERL (
\r
189 if defined HAVE_GROFF (
\r
190 set ROFFCMD=groff -mtty-char -Tascii -P-c -man
\r
191 ) else if defined HAVE_NROFF (
\r
192 set ROFFCMD=nroff -c -Tascii -man
\r
196 if defined ROFFCMD (
\r
197 echo #include "tool_setup.h"> src\tool_hugehelp.c
\r
198 echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
\r
200 if defined HAVE_GZIP (
\r
201 echo #ifndef HAVE_LIBZ>> src\tool_hugehelp.c
\r
204 %ROFFCMD% docs\curl.1 2>NUL | perl src\mkhelp.pl docs\MANUAL >> src\tool_hugehelp.c
\r
205 if defined HAVE_GZIP (
\r
206 echo #else>> src\tool_hugehelp.c
\r
207 %ROFFCMD% docs\curl.1 2>NUL | perl src\mkhelp.pl -c docs\MANUAL >> src\tool_hugehelp.c
\r
208 echo #endif /^* HAVE_LIBZ ^*/>> src\tool_hugehelp.c
\r
213 if exist src\tool_hugehelp.c.cvs (
\r
214 copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1
\r
216 echo #include "tool_setup.h"> src\tool_hugehelp.c
\r
217 echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
\r
218 echo.>> src\tool_hugehelp.c
\r
219 echo void hugehelp(void^)>> src\tool_hugehelp.c
\r
220 echo {>> src\tool_hugehelp.c
\r
221 echo #ifdef USE_MANUAL>> src\tool_hugehelp.c
\r
222 echo fputs("Built-in manual not included\n", stdout^);>> src\tool_hugehelp.c
\r
223 echo #endif>> src\tool_hugehelp.c
\r
224 echo }>> src\tool_hugehelp.c
\r
228 findstr "/C:void hugehelp(void)" src\tool_hugehelp.c 1>NUL 2>&1
\r
230 if "%OS%" == "Windows_NT" endlocal
\r
234 if "%BASIC%" == "1" (
\r
235 if "%OS%" == "Windows_NT" endlocal
\r
239 if "%OS%" == "Windows_NT" endlocal
\r
242 rem Function to clean-up local variables under DOS, Windows 3.x and
\r
243 rem Windows 9x as setlocal isn't available until Windows NT
\r
251 set BASIC_HUGEHELP=
\r
259 rem Display the help
\r
261 echo Usage: buildconf [-clean]
\r
263 echo -clean - Removes the files
\r
268 echo Error: Unknown argument '%1'
\r
273 echo Error: This batch file should only be used with a curl git repository
\r
278 echo Error: Unable to generate Makefile
\r
283 echo Error: Unable to generate src\tool_hugehelp.c
\r
288 echo Error: Unable to clean Makefile
\r
293 echo Error: Unable to clean src\tool_hugehelp.c
\r
298 echo Warning: The curl manual could not be integrated in the source. This means when
\r
299 echo you build curl the manual will not be available (curl --man^). Integration of
\r
300 echo the manual is not required and a summary of the options will still be available
\r
301 echo (curl --help^). To integrate the manual your PATH is required to have
\r
302 echo groff/nroff, perl and optionally gzip for compression.
\r
306 if "%OS%" == "Windows_NT" (
\r
314 if "%OS%" == "Windows_NT" (
\r