2009-04-30 20:12:31 +08:00
|
|
|
@echo off
|
2015-08-05 13:26:19 +08:00
|
|
|
rem ***************************************************************************
|
|
|
|
rem * _ _ ____ _
|
|
|
|
rem * Project ___| | | | _ \| |
|
|
|
|
rem * / __| | | | |_) | |
|
|
|
|
rem * | (__| |_| | _ <| |___
|
|
|
|
rem * \___|\___/|_| \_\_____|
|
|
|
|
rem *
|
2023-01-02 20:51:48 +08:00
|
|
|
rem * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2015-08-05 13:26:19 +08: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
|
2020-11-04 21:02:01 +08:00
|
|
|
rem * are also available at https://curl.se/docs/copyright.html.
|
2015-08-05 13:26:19 +08: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 * SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
rem *
|
2015-08-05 13:26:19 +08:00
|
|
|
rem ***************************************************************************
|
|
|
|
|
|
|
|
rem NOTES
|
2015-08-05 13:22:06 +08:00
|
|
|
rem
|
2015-08-05 13:26:19 +08:00
|
|
|
rem This batch file must be used to set up a git tree to build on systems where
|
2015-08-09 18:00:07 +08:00
|
|
|
rem there is no autotools support (i.e. DOS and Windows).
|
2015-08-05 13:22:06 +08:00
|
|
|
rem
|
2009-06-08 22:27:36 +08:00
|
|
|
|
2015-08-05 13:36:42 +08:00
|
|
|
:begin
|
2015-08-08 18:09:08 +08:00
|
|
|
rem Set our variables
|
2015-08-09 18:00:07 +08:00
|
|
|
if "%OS%" == "Windows_NT" setlocal
|
2015-08-08 18:09:08 +08:00
|
|
|
set MODE=GENERATE
|
|
|
|
|
2015-08-06 02:15:46 +08:00
|
|
|
rem Switch to this batch file's directory
|
|
|
|
cd /d "%~0\.." 1>NUL 2>&1
|
|
|
|
|
2015-08-07 00:39:20 +08:00
|
|
|
rem Check we are running from a curl git repository
|
2024-03-07 16:28:06 +08:00
|
|
|
if not exist GIT-INFO.md goto norepo
|
2009-04-30 20:12:31 +08:00
|
|
|
|
2015-08-06 00:59:38 +08:00
|
|
|
:parseArgs
|
|
|
|
if "%~1" == "" goto start
|
|
|
|
|
|
|
|
if /i "%~1" == "-clean" (
|
|
|
|
set MODE=CLEAN
|
2015-08-08 18:04:55 +08:00
|
|
|
) else if /i "%~1" == "-?" (
|
|
|
|
goto syntax
|
|
|
|
) else if /i "%~1" == "-h" (
|
|
|
|
goto syntax
|
|
|
|
) else if /i "%~1" == "-help" (
|
|
|
|
goto syntax
|
2015-08-06 00:59:38 +08:00
|
|
|
) else (
|
|
|
|
goto unknown
|
|
|
|
)
|
|
|
|
|
|
|
|
shift & goto parseArgs
|
|
|
|
|
2015-08-05 13:36:42 +08:00
|
|
|
:start
|
2015-08-06 00:59:38 +08:00
|
|
|
if "%MODE%" == "GENERATE" (
|
2015-08-09 18:27:33 +08:00
|
|
|
echo.
|
|
|
|
echo Generating prerequisite files
|
|
|
|
|
2015-08-06 00:59:38 +08:00
|
|
|
call :generate
|
2015-08-10 00:54:09 +08:00
|
|
|
if errorlevel 3 goto nogenhugehelp
|
|
|
|
if errorlevel 2 goto nogenmakefile
|
|
|
|
if errorlevel 1 goto warning
|
|
|
|
|
2015-08-06 00:59:38 +08:00
|
|
|
) else (
|
2015-08-09 18:27:33 +08:00
|
|
|
echo.
|
|
|
|
echo Removing prerequisite files
|
|
|
|
|
2015-08-06 00:59:38 +08:00
|
|
|
call :clean
|
2015-08-09 18:27:33 +08:00
|
|
|
if errorlevel 2 goto nocleanhugehelp
|
|
|
|
if errorlevel 1 goto nocleanmakefile
|
2015-08-06 00:59:38 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
goto success
|
|
|
|
|
|
|
|
rem Main generate function.
|
2015-08-10 00:02:27 +08:00
|
|
|
rem
|
2015-08-09 18:27:33 +08:00
|
|
|
rem Returns:
|
|
|
|
rem
|
|
|
|
rem 0 - success
|
2018-09-24 06:24:02 +08:00
|
|
|
rem 1 - success with simplified tool_hugehelp.c
|
2015-08-10 00:57:40 +08:00
|
|
|
rem 2 - failed to generate Makefile
|
|
|
|
rem 3 - failed to generate tool_hugehelp.c
|
2015-08-09 18:27:33 +08:00
|
|
|
rem
|
2015-08-06 00:59:38 +08:00
|
|
|
:generate
|
2015-08-10 00:54:09 +08:00
|
|
|
if "%OS%" == "Windows_NT" setlocal
|
|
|
|
set BASIC_HUGEHELP=0
|
|
|
|
|
2015-08-10 00:57:40 +08:00
|
|
|
rem Create Makefile
|
2015-08-14 13:54:16 +08:00
|
|
|
echo * %CD%\Makefile
|
2015-08-06 00:32:45 +08:00
|
|
|
if exist Makefile.dist (
|
2015-08-09 18:27:33 +08:00
|
|
|
copy /Y Makefile.dist Makefile 1>NUL 2>&1
|
|
|
|
if errorlevel 1 (
|
2015-08-10 00:54:09 +08:00
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
|
|
|
exit /B 2
|
2015-08-09 18:27:33 +08:00
|
|
|
)
|
2015-08-06 00:32:45 +08:00
|
|
|
)
|
2009-04-30 20:12:31 +08:00
|
|
|
|
2015-08-10 00:57:40 +08:00
|
|
|
rem Create tool_hugehelp.c
|
2015-08-10 00:54:09 +08: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 18:04:04 +08:00
|
|
|
)
|
2015-08-10 00:54:09 +08:00
|
|
|
cmd /c exit 0
|
2015-08-09 18:04:04 +08:00
|
|
|
|
2015-08-10 00:54:09 +08:00
|
|
|
if "%BASIC_HUGEHELP%" == "1" (
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
|
|
|
exit /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
2015-08-09 18:27:33 +08:00
|
|
|
exit /B 0
|
2015-08-06 00:59:38 +08:00
|
|
|
|
|
|
|
rem Main clean function.
|
|
|
|
rem
|
2015-08-09 18:27:33 +08:00
|
|
|
rem Returns:
|
|
|
|
rem
|
|
|
|
rem 0 - success
|
2015-08-10 00:57:40 +08:00
|
|
|
rem 1 - failed to clean Makefile
|
|
|
|
rem 2 - failed to clean tool_hugehelp.c
|
2015-08-09 18:27:33 +08:00
|
|
|
rem
|
2015-08-06 00:59:38 +08:00
|
|
|
:clean
|
2015-08-10 00:57:40 +08:00
|
|
|
rem Remove Makefile
|
2015-08-06 00:59:38 +08:00
|
|
|
echo * %CD%\Makefile
|
|
|
|
if exist Makefile (
|
2015-08-09 18:27:33 +08:00
|
|
|
del Makefile 2>NUL
|
|
|
|
if exist Makefile (
|
|
|
|
exit /B 1
|
|
|
|
)
|
2015-08-06 00:59:38 +08:00
|
|
|
)
|
|
|
|
|
2015-08-10 00:57:40 +08:00
|
|
|
rem Remove tool_hugehelp.c
|
2015-08-06 00:59:38 +08:00
|
|
|
echo * %CD%\src\tool_hugehelp.c
|
|
|
|
if exist src\tool_hugehelp.c (
|
2015-08-09 18:27:33 +08:00
|
|
|
del src\tool_hugehelp.c 2>NUL
|
|
|
|
if exist src\tool_hugehelp.c (
|
|
|
|
exit /B 2
|
|
|
|
)
|
2015-08-06 00:59:38 +08:00
|
|
|
)
|
|
|
|
|
2015-08-10 00:54:09 +08: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 BASIC=1
|
|
|
|
|
2024-03-07 17:33:49 +08:00
|
|
|
if exist src\tool_hugehelp.c.cvs (
|
|
|
|
copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1
|
|
|
|
) else (
|
2015-08-10 00:54:09 +08:00
|
|
|
echo #include "tool_setup.h"> src\tool_hugehelp.c
|
2018-09-24 06:24:02 +08:00
|
|
|
echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
|
2024-03-07 17:33:49 +08:00
|
|
|
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
|
2015-08-10 00:54:09 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
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 18:27:33 +08:00
|
|
|
exit /B 0
|
2009-04-30 20:12:31 +08:00
|
|
|
|
2015-08-10 00:02:27 +08: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-10 00:54:09 +08:00
|
|
|
set BASIC_HUGEHELP=
|
|
|
|
set LC_ALL
|
|
|
|
set BASIC=
|
2015-08-10 00:02:27 +08:00
|
|
|
|
|
|
|
exit /B
|
|
|
|
|
2015-08-05 13:41:40 +08:00
|
|
|
:syntax
|
|
|
|
rem Display the help
|
|
|
|
echo.
|
2015-08-06 00:59:38 +08:00
|
|
|
echo Usage: buildconf [-clean]
|
|
|
|
echo.
|
|
|
|
echo -clean - Removes the files
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:unknown
|
|
|
|
echo.
|
|
|
|
echo Error: Unknown argument '%1'
|
2015-08-05 13:41:40 +08:00
|
|
|
goto error
|
|
|
|
|
2015-08-07 00:39:20 +08:00
|
|
|
:norepo
|
2015-08-05 13:36:42 +08:00
|
|
|
echo.
|
2015-08-07 00:39:20 +08:00
|
|
|
echo Error: This batch file should only be used with a curl git repository
|
2015-08-05 13:36:42 +08:00
|
|
|
goto error
|
2009-06-08 22:27:36 +08:00
|
|
|
|
2015-08-09 18:27:33 +08: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-10 00:54:09 +08:00
|
|
|
:warning
|
|
|
|
echo.
|
|
|
|
echo Warning: The curl manual could not be integrated in the source. This means when
|
2024-03-07 17:33:49 +08:00
|
|
|
echo you build curl the manual will not be available (curl --manual^). Integration of
|
2015-08-10 00:54:09 +08:00
|
|
|
echo the manual is not required and a summary of the options will still be available
|
2024-03-07 17:33:49 +08:00
|
|
|
echo (curl --help^). To integrate the manual build with configure or cmake.
|
2015-08-10 00:54:09 +08:00
|
|
|
goto success
|
|
|
|
|
2015-08-05 13:36:42 +08:00
|
|
|
:error
|
2015-08-09 18:00:07 +08:00
|
|
|
if "%OS%" == "Windows_NT" (
|
|
|
|
endlocal
|
|
|
|
) else (
|
2015-08-10 00:02:27 +08:00
|
|
|
call :dosCleanup
|
2015-08-09 18:00:07 +08:00
|
|
|
)
|
2015-08-05 13:36:42 +08:00
|
|
|
exit /B 1
|
|
|
|
|
|
|
|
:success
|
2015-08-09 18:00:07 +08:00
|
|
|
if "%OS%" == "Windows_NT" (
|
|
|
|
endlocal
|
|
|
|
) else (
|
2015-08-10 00:02:27 +08:00
|
|
|
call :dosCleanup
|
2015-08-09 18:00:07 +08:00
|
|
|
)
|
2015-08-05 13:36:42 +08:00
|
|
|
exit /B 0
|