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