Annotation of embedaddon/curl/buildconf.bat, revision 1.1
1.1 ! misho 1: @echo off
! 2: rem ***************************************************************************
! 3: rem * _ _ ____ _
! 4: rem * Project ___| | | | _ \| |
! 5: rem * / __| | | | |_) | |
! 6: rem * | (__| |_| | _ <| |___
! 7: rem * \___|\___/|_| \_\_____|
! 8: rem *
! 9: rem * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
! 10: rem *
! 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.
! 14: rem *
! 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.
! 18: rem *
! 19: rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
! 20: rem * KIND, either express or implied.
! 21: rem *
! 22: rem ***************************************************************************
! 23:
! 24: rem NOTES
! 25: 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).
! 28: rem
! 29:
! 30: :begin
! 31: rem Set our variables
! 32: if "%OS%" == "Windows_NT" setlocal
! 33: set MODE=GENERATE
! 34:
! 35: rem Switch to this batch file's directory
! 36: cd /d "%~0\.." 1>NUL 2>&1
! 37:
! 38: rem Check we are running from a curl git repository
! 39: if not exist GIT-INFO goto norepo
! 40:
! 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)
! 52:
! 53: :parseArgs
! 54: if "%~1" == "" goto start
! 55:
! 56: if /i "%~1" == "-clean" (
! 57: set MODE=CLEAN
! 58: ) else if /i "%~1" == "-?" (
! 59: goto syntax
! 60: ) else if /i "%~1" == "-h" (
! 61: goto syntax
! 62: ) else if /i "%~1" == "-help" (
! 63: goto syntax
! 64: ) else (
! 65: goto unknown
! 66: )
! 67:
! 68: shift & goto parseArgs
! 69:
! 70: :start
! 71: if "%MODE%" == "GENERATE" (
! 72: echo.
! 73: echo Generating prerequisite files
! 74:
! 75: call :generate
! 76: if errorlevel 3 goto nogenhugehelp
! 77: if errorlevel 2 goto nogenmakefile
! 78: if errorlevel 1 goto warning
! 79:
! 80: ) else (
! 81: echo.
! 82: echo Removing prerequisite files
! 83:
! 84: call :clean
! 85: if errorlevel 2 goto nocleanhugehelp
! 86: if errorlevel 1 goto nocleanmakefile
! 87: )
! 88:
! 89: goto success
! 90:
! 91: rem Main generate function.
! 92: rem
! 93: rem Returns:
! 94: rem
! 95: rem 0 - success
! 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
! 99: rem
! 100: :generate
! 101: if "%OS%" == "Windows_NT" setlocal
! 102: set BASIC_HUGEHELP=0
! 103:
! 104: rem Create Makefile
! 105: echo * %CD%\Makefile
! 106: if exist Makefile.dist (
! 107: copy /Y Makefile.dist Makefile 1>NUL 2>&1
! 108: if errorlevel 1 (
! 109: if "%OS%" == "Windows_NT" endlocal
! 110: exit /B 2
! 111: )
! 112: )
! 113:
! 114: rem Create tool_hugehelp.c
! 115: echo * %CD%\src\tool_hugehelp.c
! 116: call :genHugeHelp
! 117: if errorlevel 2 (
! 118: if "%OS%" == "Windows_NT" endlocal
! 119: exit /B 3
! 120: )
! 121: if errorlevel 1 (
! 122: set BASIC_HUGEHELP=1
! 123: )
! 124: cmd /c exit 0
! 125:
! 126: rem Setup c-ares git tree
! 127: if exist ares\buildconf.bat (
! 128: echo.
! 129: echo Configuring c-ares build environment
! 130: cd ares
! 131: call buildconf.bat
! 132: cd ..
! 133: )
! 134:
! 135: if "%BASIC_HUGEHELP%" == "1" (
! 136: if "%OS%" == "Windows_NT" endlocal
! 137: exit /B 1
! 138: )
! 139:
! 140: if "%OS%" == "Windows_NT" endlocal
! 141: exit /B 0
! 142:
! 143: rem Main clean function.
! 144: rem
! 145: rem Returns:
! 146: rem
! 147: rem 0 - success
! 148: rem 1 - failed to clean Makefile
! 149: rem 2 - failed to clean tool_hugehelp.c
! 150: rem
! 151: :clean
! 152: rem Remove Makefile
! 153: echo * %CD%\Makefile
! 154: if exist Makefile (
! 155: del Makefile 2>NUL
! 156: if exist Makefile (
! 157: exit /B 1
! 158: )
! 159: )
! 160:
! 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 (
! 166: exit /B 2
! 167: )
! 168: )
! 169:
! 170: exit /B
! 171:
! 172: rem Function to generate src\tool_hugehelp.c
! 173: rem
! 174: rem Returns:
! 175: rem
! 176: rem 0 - full tool_hugehelp.c generated
! 177: rem 1 - simplified tool_hugehelp.c
! 178: rem 2 - failure
! 179: rem
! 180: :genHugeHelp
! 181: if "%OS%" == "Windows_NT" setlocal
! 182: set LC_ALL=C
! 183: set ROFFCMD=
! 184: set BASIC=1
! 185:
! 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
! 191: )
! 192: )
! 193:
! 194: if defined ROFFCMD (
! 195: echo #include "tool_setup.h"> src\tool_hugehelp.c
! 196: echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
! 197:
! 198: if defined HAVE_GZIP (
! 199: echo #ifndef HAVE_LIBZ>> src\tool_hugehelp.c
! 200: )
! 201:
! 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
! 207: )
! 208:
! 209: set BASIC=0
! 210: ) else (
! 211: if exist src\tool_hugehelp.c.cvs (
! 212: copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1
! 213: ) else (
! 214: echo #include "tool_setup.h"> src\tool_hugehelp.c
! 215: echo #include "tool_hugehelp.h">> 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
! 223: )
! 224: )
! 225:
! 226: findstr "/C:void hugehelp(void)" src\tool_hugehelp.c 1>NUL 2>&1
! 227: if errorlevel 1 (
! 228: if "%OS%" == "Windows_NT" endlocal
! 229: exit /B 2
! 230: )
! 231:
! 232: if "%BASIC%" == "1" (
! 233: if "%OS%" == "Windows_NT" endlocal
! 234: exit /B 1
! 235: )
! 236:
! 237: if "%OS%" == "Windows_NT" endlocal
! 238: exit /B 0
! 239:
! 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
! 242: rem
! 243: :dosCleanup
! 244: set MODE=
! 245: set HAVE_GROFF=
! 246: set HAVE_NROFF=
! 247: set HAVE_PERL=
! 248: set HAVE_GZIP=
! 249: set BASIC_HUGEHELP=
! 250: set LC_ALL
! 251: set ROFFCMD=
! 252: set BASIC=
! 253:
! 254: exit /B
! 255:
! 256: :syntax
! 257: rem Display the help
! 258: echo.
! 259: echo Usage: buildconf [-clean]
! 260: echo.
! 261: echo -clean - Removes the files
! 262: goto error
! 263:
! 264: :unknown
! 265: echo.
! 266: echo Error: Unknown argument '%1'
! 267: goto error
! 268:
! 269: :norepo
! 270: echo.
! 271: echo Error: This batch file should only be used with a curl git repository
! 272: goto error
! 273:
! 274: :nogenmakefile
! 275: echo.
! 276: echo Error: Unable to generate Makefile
! 277: goto error
! 278:
! 279: :nogenhugehelp
! 280: echo.
! 281: echo Error: Unable to generate src\tool_hugehelp.c
! 282: goto error
! 283:
! 284: :nocleanmakefile
! 285: echo.
! 286: echo Error: Unable to clean Makefile
! 287: goto error
! 288:
! 289: :nocleanhugehelp
! 290: echo.
! 291: echo Error: Unable to clean src\tool_hugehelp.c
! 292: goto error
! 293:
! 294: :warning
! 295: echo.
! 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.
! 301: goto success
! 302:
! 303: :error
! 304: if "%OS%" == "Windows_NT" (
! 305: endlocal
! 306: ) else (
! 307: call :dosCleanup
! 308: )
! 309: exit /B 1
! 310:
! 311: :success
! 312: if "%OS%" == "Windows_NT" (
! 313: endlocal
! 314: ) else (
! 315: call :dosCleanup
! 316: )
! 317: exit /B 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>