curl: include build infra

This commit is contained in:
Tom Dewey 2024-07-22 11:32:32 +01:00 committed by Tom Dewey
parent 37ec20f0f5
commit d300c9dceb
11 changed files with 3654 additions and 0 deletions

View file

@ -0,0 +1,8 @@
#!/bin/sh
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# SPDX-License-Identifier: curl
echo "*** Do not use buildconf. Instead, just use: autoreconf -fi" >&2
exec ${AUTORECONF:-autoreconf} -fi "${@}"

View file

@ -0,0 +1,265 @@
@echo off
rem ***************************************************************************
rem * _ _ ____ _
rem * Project ___| | | | _ \| |
rem * / __| | | | |_) | |
rem * | (__| |_| | _ <| |___
rem * \___|\___/|_| \_\_____|
rem *
rem * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
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
rem * are also available at https://curl.se/docs/copyright.html.
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
rem *
rem ***************************************************************************
rem NOTES
rem
rem This batch file must be used to set up a git tree to build on systems where
rem there is no autotools support (i.e. DOS and Windows).
rem
:begin
rem Set our variables
if "%OS%" == "Windows_NT" setlocal
set MODE=GENERATE
rem Switch to this batch file's directory
cd /d "%~0\.." 1>NUL 2>&1
rem Check we are running from a curl git repository
if not exist GIT-INFO.md goto norepo
:parseArgs
if "%~1" == "" goto start
if /i "%~1" == "-clean" (
set MODE=CLEAN
) else if /i "%~1" == "-?" (
goto syntax
) else if /i "%~1" == "-h" (
goto syntax
) else if /i "%~1" == "-help" (
goto syntax
) else (
goto unknown
)
shift & goto parseArgs
:start
if "%MODE%" == "GENERATE" (
echo.
echo Generating prerequisite files
call :generate
if errorlevel 3 goto nogenhugehelp
if errorlevel 2 goto nogenmakefile
if errorlevel 1 goto warning
) else (
echo.
echo Removing prerequisite files
call :clean
if errorlevel 2 goto nocleanhugehelp
if errorlevel 1 goto nocleanmakefile
)
goto success
rem Main generate function.
rem
rem Returns:
rem
rem 0 - success
rem 1 - success with simplified tool_hugehelp.c
rem 2 - failed to generate Makefile
rem 3 - failed to generate tool_hugehelp.c
rem
:generate
if "%OS%" == "Windows_NT" setlocal
set BASIC_HUGEHELP=0
rem Create Makefile
echo * %CD%\Makefile
if exist Makefile.dist (
copy /Y Makefile.dist Makefile 1>NUL 2>&1
if errorlevel 1 (
if "%OS%" == "Windows_NT" endlocal
exit /B 2
)
)
rem Create tool_hugehelp.c
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
)
cmd /c exit 0
if "%BASIC_HUGEHELP%" == "1" (
if "%OS%" == "Windows_NT" endlocal
exit /B 1
)
if "%OS%" == "Windows_NT" endlocal
exit /B 0
rem Main clean function.
rem
rem Returns:
rem
rem 0 - success
rem 1 - failed to clean Makefile
rem 2 - failed to clean tool_hugehelp.c
rem
:clean
rem Remove Makefile
echo * %CD%\Makefile
if exist Makefile (
del Makefile 2>NUL
if exist Makefile (
exit /B 1
)
)
rem Remove tool_hugehelp.c
echo * %CD%\src\tool_hugehelp.c
if exist src\tool_hugehelp.c (
del src\tool_hugehelp.c 2>NUL
if exist src\tool_hugehelp.c (
exit /B 2
)
)
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
if exist src\tool_hugehelp.c.cvs (
copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1
) else (
echo #include "tool_setup.h"> src\tool_hugehelp.c
echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
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
)
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
exit /B 0
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=
set BASIC_HUGEHELP=
set LC_ALL
set BASIC=
exit /B
:syntax
rem Display the help
echo.
echo Usage: buildconf [-clean]
echo.
echo -clean - Removes the files
goto error
:unknown
echo.
echo Error: Unknown argument '%1'
goto error
:norepo
echo.
echo Error: This batch file should only be used with a curl git repository
goto error
: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
:warning
echo.
echo Warning: The curl manual could not be integrated in the source. This means when
echo you build curl the manual will not be available (curl --manual^). Integration of
echo the manual is not required and a summary of the options will still be available
echo (curl --help^). To integrate the manual build with configure or cmake.
goto success
:error
if "%OS%" == "Windows_NT" (
endlocal
) else (
call :dosCleanup
)
exit /B 1
:success
if "%OS%" == "Windows_NT" (
endlocal
) else (
call :dosCleanup
)
exit /B 0

View file

@ -0,0 +1,153 @@
$! build_curl-config_script.com
$!
$! This generates the curl-config. script from the curl-config.in file.
$!
$! Copyright (C) John Malmberg
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$! SPDX-License-Identifier: ISC
$!
$!===========================================================================
$!
$! Skip this if the curl-config. already exists.
$ if f$search("[--]curl-config.") .nes. "" then goto all_exit
$!
$ if (f$getsyi("HW_MODEL") .lt. 1024)
$ then
$ arch_name = "VAX"
$ else
$ arch_name = ""
$ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
$ if (arch_name .eqs. "") then arch_name = "UNK"
$ endif
$!
$ x_prefix = "/usr"
$ x_exec_prefix = "/usr"
$ x_includedir = "${prefix}/include"
$ x_cppflag_curl_staticlib = "-DCURL_STATICLIB"
$ x_enabled_shared = "no"
$ x_curl_ca_bundle = ""
$ x_cc = "cc"
$ x_support_features = "SSL IPv6 libz NTLM"
$ x_support_protocols1 = "DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP"
$ x_support_protocols2 = " LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP"
$ x_support_protocols = x_support_protocols1 + x_support_protocols2
$ x_curlversion = "0.0.0.0"
$ x_versionnum = ""
$ x_libdir = "${prefix}/lib"
$ x_require_lib_deps = ""
$ x_enable_static = ""
$ x_ldflags = ""
$ part1 = "-L/usr/lib -L/SSL_LIB -lssl -lcrypto -lz"
$ if arch_name .eqs. "VAX"
$ then
$ x_libcurl_libs = part1
$ else
$ x_libcurl_libs = part1 + " -lgssapi"
$ endif
$ x_libext = "a"
$!
$! Get the version number
$!-----------------------
$ i = 0
$ open/read/error=version_loop_end vhf [--.include.curl]curlver.h
$ version_loop:
$ read/end=version_loop_end vhf line_in
$ if line_in .eqs. "" then goto version_loop
$ if f$locate("#define LIBCURL_VERSION ", line_in) .eq. 0
$ then
$ x_curlversion = f$element(2," ", line_in) - """" - """"
$ i = i + 1
$ endif
$ if f$locate("#define LIBCURL_VERSION_NUM ", line_in) .eq. 0
$ then
$ x_versionnum = f$element(2," ", line_in) - """" - """"
$ i = i + 1
$ endif
$ if i .lt 2 then goto version_loop
$ version_loop_end:
$ close vhf
$!
$ kit_type = "V"
$ if f$locate("-", x_curlversion) .lt. f$length(x_curlversion)
$ then
$ kit_type = "D"
$ x_prefix = "/beta"
$ x_exec_prefix = "/beta"
$ endif
$!
$ if kit_type .nes. "D"
$ then
$ part1 = " echo "" '--prefix=/usr' '--exec-prefix=/usr' "
$ else
$ part1 = " echo "" '--prefix=/beta' '--exec_prefix=/beta' "
$ endif
$ if arch_name .eqs. "VAX"
$ then
$ part3 = ""
$ else
$ part3 = "'--with-gssapi' "
$ endif
$ part2 = "'--disable-dependency-tracking' '--disable-libtool-lock' "
$ part4 = "'--disable-ntlm-wb' '--with-ca-path=gnv$curl_ca_path'"""
$!
$ x_configure_options = part1 + part2 + part3 + part4
$!
$!
$ open/read/error=read_loop_end c_c_in sys$disk:[--]curl-config.in
$ create sys$disk:[--]curl-config.
$ open/append c_c_out sys$disk:[--]curl-config.
$read_loop:
$ read/end=read_loop_end c_c_in line_in
$ line_in_len = f$length(line_in)
$ if f$locate("@", line_in) .ge. line_in_len
$ then
$ write c_c_out line_in
$ goto read_loop
$ endif
$ i = 0
$ line_out = ""
$sub_loop:
$ ! Replace between pairs of @ by alternating the elements.
$ ! If mis-matched pairs, do not substitute anything.
$ section1 = f$element(i, "@", line_in)
$ if section1 .eqs. "@"
$ then
$ goto sub_loop_end
$ endif
$ i = i + 1
$ section2 = f$element(i, "@", line_in)
$ if section2 .eqs. "@"
$ then
$ goto sub_loop_end
$ endif
$ i = i + 1
$ section3 = f$element(i, "@", line_in)
$ if section3 .eqs. "@"
$ then
$ if line_out .eqs. "" then line_out = line_in
$ goto sub_loop_end
$ endif
$ line_out = line_out + section1
$ if f$type(x_'section2') .eqs. "STRING"
$ then
$ line_out = line_out + x_'section2'
$ endif
$ goto sub_loop
$sub_loop_end:
$ write c_c_out line_out
$ goto read_loop
$read_loop_end:
$ close c_c_in
$ close c_c_out

View file

@ -0,0 +1,36 @@
$! File: build_gnv_curl.com
$!
$! All in one build procedure
$!
$! Copyright (C) John Malmberg
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$! SPDX-License-Identifier: ISC
$!
$!-----------------------------------------------------------------------
$!
$ @setup_gnv_curl_build.com
$!
$ bash gnv_curl_configure.sh
$!
$ @clean_gnv_curl.com
$!
$ bash make_gnv_curl_install.sh
$!
$ @gnv_link_curl.com
$!
$ purge new_gnu:[*...]/log
$!
$!
$exit

View file

@ -0,0 +1,489 @@
$! File: Build_GNV_CURL_PCSI_DESC.COM
$!
$! Build the *.pcsi$text file in the following sections:
$! Required software dependencies.
$! install/upgrade/postinstall steps.
$! 1. Duplicate filenames need an alias procedure. (N/A for curl)
$! 2. ODS-5 filenames need an alias procedure. (N/A for curl)
$! 3. Special alias links for executables (curl. -> curl.exe)
$! if a lot, then an alias procedure is needed.
$! 4. Rename the files to lowercase.
$! Move Release Notes to destination
$! Source kit option
$! Create directory lines
$! Add file lines for curl.
$! Add Link alias procedure file (N/A for curl)
$! Add [.SYS$STARTUP]curl_startup file
$! Add Release notes file.
$!
$! The file PCSI_GNV_CURL_FILE_LIST.TXT is read in to get the files other
$! than the release notes file and the source backup file.
$!
$! The PCSI system can really only handle ODS-2 format filenames and
$! assumes that there is only one source directory. It also assumes that
$! all destination files with the same name come from the same source file.
$! Fortunately CURL does not trip most of these issues, so those steps
$! above are marked N/A.
$!
$! A rename action section is needed to make sure that the files are
$! created in the GNV$GNU: in the correct case, and to create the alias
$! link [usr.bin]curl. for [usr.bin]curl.exe.
$!
$! Copyright (C) John Malmberg
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$! SPDX-License-Identifier: ISC
$!
$!===========================================================================
$!
$ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
$ if kit_name .eqs. ""
$ then
$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$ goto all_exit
$ endif
$ producer = f$trnlnm("GNV_PCSI_PRODUCER")
$ if producer .eqs. ""
$ then
$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$ goto all_exit
$ endif
$ filename_base = f$trnlnm("GNV_PCSI_FILENAME_BASE")
$ if filename_base .eqs. ""
$ then
$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$ goto all_exit
$ endif
$!
$!
$! Parse the kit name into components.
$!---------------------------------------
$ producer = f$element(0, "-", kit_name)
$ base = f$element(1, "-", kit_name)
$ product = f$element(2, "-", kit_name)
$ mmversion = f$element(3, "-", kit_name)
$ majorver = f$extract(0, 3, mmversion)
$ minorver = f$extract(3, 2, mmversion)
$ updatepatch = f$element(4, "-", kit_name)
$ if updatepatch .eqs. "-" then updatepatch = ""
$!
$! kit type of "D" means a daily build
$ kit_type = f$edit(f$extract(0, 1, majorver), "upcase")
$!
$!
$ product_line = "product ''producer' ''base' ''product'"
$ if updatepatch .eqs. ""
$ then
$ product_name = " ''majorver'.''minorver'"
$ else
$ product_name = " ''majorver'.''minorver'-''updatepatch'"
$ endif
$ product_line = product_line + " ''product_name' full;"
$!write sys$output product_line
$!
$!
$!
$! Create the file as a VMS text file.
$!----------------------------------------
$ base_file = kit_name
$ create 'base_file'.pcsi$desc
$!
$!
$! Start building file.
$!----------------------
$ open/append pdsc 'base_file'.pcsi$desc
$!
$ write pdsc product_line
$!
$! Required product dependencies.
$!----------------------------------
$ vmsprd = "DEC"
$ if base .eqs. "I64VMS" then vmsprd = "HP"
$ vsiprd = "VSI"
$!
$ write pdsc " software ''vmsprd' ''base' VMS ;"
$ arch_type = f$getsyi("ARCH_NAME")
$ node_swvers = f$getsyi("node_swvers")
$ vernum = f$extract(1, f$length(node_swvers), node_swvers)
$ majver = f$element(0, ".", vernum)
$ minverdash = f$element(1, ".", vernum)
$ minver = f$element(0, "-", minverdash)
$ dashver = f$element(1, "-", minverdash)
$ if dashver .eqs. "-" then dashver = ""
$ vmstag = majver + minver + dashver
$ code = f$extract(0, 1, arch_type)
$ arch_code = f$extract(0, 1, arch_type)
$ line_out = -
" if ((not <software ''vsiprd' ''base' VMS version minimum" + -
" ''node_swvers'>) and" + -
" (not <software ''vmsprd' ''base' VMS version minimum ''node_swvers'>));"
$ write pdsc line_out
$ write pdsc " error NEED_VMS''vmstag';"
$ write pdsc " end if;"
$!
$write pdsc " software VMSPORTS ''base' ZLIB ;"
$write pdsc -
" if (not <software VMSPORTS ''base' ZLIB version minimum V1.2-8>) ;"
$write pdsc " error NEED_ZLIB;"
$write pdsc " end if;"
$!
$!
$!
$! install/upgrade/postinstall steps.
$!-----------------------------------
$! 1. Duplicate filenames need an alias procedure. (N/A for curl)
$! 2. ODS-5 filenames need an alias procedure. (N/A for curl)
$! 3. Special alias links for executables (curl. -> curl.exe)
$! if a lot, then an alias procedure is needed.
$! 4. Rename the files to lowercase.
$!
$!
$! Alias links needed.
$!-------------------------
$ add_alias_lines = ""
$ rem_alias_lines = ""
$ line_out = ""
$!
$! Read through the file list to set up aliases and rename commands.
$!---------------------------------------------------------------------
$ open/read flst pcsi_gnv_curl_file_list.txt
$!
$inst_alias_loop:
$ read/end=inst_alias_loop_end flst line_in
$ line_in = f$edit(line_in,"compress,trim,uncomment")
$ if line_in .eqs. "" then goto inst_alias_loop
$ pathname = f$element(0, " ", line_in)
$ linkflag = f$element(1, " ", line_in)
$ if linkflag .nes. "->" then goto inst_alias_write
$!
$ linktarget = f$element(2, " ", line_in)
$ if kit_type .eqs. "D"
$ then
$ old_start = f$locate("[gnv.usr", pathname)
$ if old_start .lt. f$length(pathname)
$ then
$ pathname = "[gnv.beta" + pathname - "[gnv.usr"
$ linktarget = "[gnv.beta" + linktarget - "[gnv.usr"
$ endif
$ endif
$ nlink = "pcsi$destination:" + pathname
$ ntarg = "pcsi$destination:" + linktarget
$ new_add_alias_line = -
"""if f$search(""""''nlink'"""") .eqs. """""""" then" + -
" set file/enter=''nlink' ''ntarg'"""
$ if add_alias_lines .nes. ""
$ then
$ add_alias_lines = add_alias_lines + "," + new_add_alias_line
$ else
$ add_alias_lines = new_add_alias_line
$ endif
$!
$ new_rem_alias_line = -
"""if f$search(""""''nlink'"""") .nes. """""""" then" + -
" set file/remove ''nlink';"""
$ if rem_alias_lines .nes. ""
$ then
$ rem_alias_lines = rem_alias_lines + "," + new_rem_alias_line
$ else
$ rem_alias_lines = new_rem_alias_line
$ endif
$!
$ goto inst_alias_loop
$!
$inst_alias_write:
$!
$! execute install / remove
$ write pdsc " execute install ("
$! add aliases
$ i = 0
$ex_ins_loop:
$ line = f$element(i, ",", add_alias_lines)
$ i = i + 1
$ if line .eqs. "" then goto ex_ins_loop
$ if line .eqs. "," then goto ex_ins_loop_end
$ if line_out .nes. "" then write pdsc line_out,","
$ line_out = line
$ goto ex_ins_loop
$ex_ins_loop_end:
$ write pdsc line_out
$ line_out = ""
$ write pdsc " )"
$ write pdsc " remove ("
$! remove aliases
$ i = 0
$ex_rem_loop:
$ line = f$element(i, ",", rem_alias_lines)
$ i = i + 1
$ if line .eqs. "" then goto ex_rem_loop
$ if line .eqs. "," then goto ex_rem_loop_end
$ if line_out .nes. "" then write pdsc line_out,","
$ line_out = line
$ goto ex_rem_loop
$ex_rem_loop_end:
$ write pdsc line_out
$ line_out = ""
$ write pdsc " ) ;"
$!
$! execute upgrade
$ write pdsc " execute upgrade ("
$ i = 0
$ex_upg_loop:
$ line = f$element(i, ",", rem_alias_lines)
$ i = i + 1
$ if line .eqs. "" then goto ex_upg_loop
$ if line .eqs. "," then goto ex_upg_loop_end
$ if line_out .nes. "" then write pdsc line_out,","
$ line_out = line
$ goto ex_upg_loop
$ex_upg_loop_end:
$ write pdsc line_out
$ line_out = ""
$! remove aliases
$ write pdsc " ) ;"
$!
$! execute postinstall
$ write pdsc " execute postinstall ("
$ if arch_code .nes. "V"
$ then
$ line_out = " ""set process/parse=extended"""
$ endif
$ i = 0
$ex_pins_loop:
$ line = f$element(i, ",", add_alias_lines)
$ i = i + 1
$ if line .eqs. "" then goto ex_pins_loop
$ if line .eqs. "," then goto ex_pins_loop_end
$ if line_out .nes. "" then write pdsc line_out,","
$ line_out = line
$ goto ex_pins_loop
$ex_pins_loop_end:
$ if line_out .eqs. "" then line_out = " ""continue"""
$! write pdsc line_out
$! line_out = ""
$! add aliases and follow with renames.
$!
$goto inst_dir
$!
$inst_dir_loop:
$ read/end=inst_alias_loop_end flst line_in
$ line_in = f$edit(line_in,"compress,trim,uncomment")
$ if line_in .eqs. "" then goto inst_dir_loop
$inst_dir:
$ pathname = f$element(0, " ", line_in)
$ if kit_type .eqs. "D"
$ then
$ if pathname .eqs. "[gnv]usr.dir"
$ then
$ pathname = "[gnv]beta.dir"
$ else
$ old_start = f$locate("[gnv.usr", pathname)
$ if old_start .lt. f$length(pathname)
$ then
$ pathname = "[gnv.beta" + pathname - "[gnv.usr"
$ endif
$ endif
$ endif
$!
$! Ignore the directory entries for now.
$!-----------------------------------------
$ filedir = f$parse(pathname,,,"DIRECTORY")
$ if pathname .eqs. filedir then goto inst_dir_loop
$!
$! process .dir extensions for rename
$! If this is not a directory then start processing files.
$!-------------------------
$ filetype = f$parse(pathname,,,"TYPE")
$ filetype_u = f$edit(filetype, "upcase")
$ filename = f$parse(pathname,,,"NAME")
$ if filetype_u .nes. ".DIR" then goto inst_file
$!
$! process directory lines for rename.
$!--------------------------------------
$ if line_out .nes. ""
$ then
$ write pdsc line_out,","
$ line_out = ""
$ endif
$ if arch_code .nes. "V"
$ then
$ if line_out .nes. "" then write pdsc line_out,","
$ line_out = " ""rename pcsi$destination:''pathname' ''filename'.DIR"""
$ else
$ if line_out .nes. "" then write pdsc line_out
$ line_out = ""
$ endif
$ goto inst_dir_loop
$!
$!
$! process file lines for rename
$!---------------------------------
$inst_file_loop:
$ read/end=inst_alias_loop_end flst line_in
$ line_in = f$edit(line_in,"compress,trim,uncomment")
$ if line_in .eqs. "" then goto inst_dir_loop
$ pathname = f$element(0, " ", line_in)
$ if kit_type .eqs. "D"
$ then
$ if pathname .eqs. "[gnv]usr.dir"
$ then
$ pathname = "[gnv]beta.dir"
$ else
$ old_start = f$locate("[gnv.usr", pathname)
$ if old_start .lt. f$length(pathname)
$ then
$ pathname = "[gnv.beta" + pathname - "[gnv.usr"
$ endif
$ endif
$ endif
$!
$! Filenames with $ in them are VMS special and do not need to be lowercase.
$! --------------------------------------------------------------------------
$ if f$locate("$", pathname) .lt. f$length(pathname) then goto inst_file_loop
$!
$ filetype = f$parse(pathname,,,"TYPE")
$ filename = f$parse(pathname,,,"NAME") + filetype
$inst_file:
$ if arch_code .nes. "V"
$ then
$ if line_out .nes. "" then write pdsc line_out,","
$ filetype = f$parse(pathname,,,"TYPE")
$ filename = f$parse(pathname,,,"NAME") + filetype
$ line_out = " ""rename pcsi$destination:''pathname' ''filename'"""
$ else
$ if line_out .nes. "" then write pdsc line_out
$ line_out = ""
$ endif
$ goto inst_file_loop
$!
$inst_alias_loop_end:
$!
$write pdsc line_out
$write pdsc " ) ;"
$close flst
$!
$! Move Release Notes to destination
$!-------------------------------------
$write pdsc " information RELEASE_NOTES phase after ;"
$!
$! Source kit option
$!---------------------
$write pdsc " option SOURCE default 0;"
$write pdsc " directory ""[gnv.common_src]"" PROTECTION PUBLIC ;"
$write pdsc -
" file ""[gnv.common_src]''filename_base'_original_src.bck"""
$write pdsc -
" source [common_src]''filename_base'_original_src.bck ;"
$if f$search("gnv$gnu:[vms_src]''filename_base'_vms_src.bck") .nes. ""
$then
$ write pdsc " directory ""[gnv.vms_src]"" PROTECTION PUBLIC ;"
$ write pdsc " file ""[gnv.vms_src]''filename_base'_vms_src.bck"""
$ write pdsc " source [vms_src]''filename_base'_vms_src.bck ;"
$endif
$write pdsc " end option;"
$!
$!
$! Read through the file list again.
$!----------------------------------
$open/read flst pcsi_gnv_curl_file_list.txt
$!
$!
$! Create directory lines
$!-------------------------
$flst_dir_loop:
$ read/end=flst_loop_end flst line_in
$ line_in = f$edit(line_in,"compress,trim,uncomment")
$ if line_in .eqs. "" then goto flst_dir_loop
$!
$ filename = f$element(0, " ", line_in)
$ linkflag = f$element(1, " ", line_in)
$ if linkflag .eqs. "->" then goto flst_dir_loop
$!
$! Ignore .dir extensions
$!-------------------------
$ filetype = f$edit(f$parse(filename,,,"TYPE"), "upcase")
$ if filetype .eqs. ".DIR" then goto flst_dir_loop
$!
$ destname = filename
$ if kit_type .eqs. "D"
$ then
$ old_start = f$locate("[gnv.usr", destname)
$ if old_start .lt. f$length(destname)
$ then
$ destname = "[gnv.beta" + destname - "[gnv.usr"
$ endif
$ endif
$!
$! It should be just a directory then.
$!-------------------------------------
$ filedir = f$edit(f$parse(filename,,,"DIRECTORY"), "lowercase")
$! If this is not a directory then start processing files.
$!---------------------------------------------------------
$ if filename .nes. filedir then goto flst_file
$!
$ write pdsc " directory ""''destname'"" PROTECTION PUBLIC ;"
$ goto flst_dir_loop
$!
$!
$! Add file lines for curl.
$!---------------------------
$flst_file_loop:
$ read/end=flst_loop_end flst line_in
$ line_in = f$edit(line_in,"compress,trim,uncomment")
$ if line_in .eqs. "" then goto inst_file_loop
$ filename = f$element(0, " ", line_in)
$ destname = filename
$ if kit_type .eqs. "D"
$ then
$ old_start = f$locate("[gnv.usr", destname)
$ if old_start .lt. f$length(destname)
$ then
$ destname = "[gnv.beta" + destname - "[gnv.usr"
$ endif
$ endif
$flst_file:
$ srcfile = filename - "gnv."
$ write pdsc " file ""''destname'"" "
$ write pdsc " source ""''srcfile'"" ;"
$ goto flst_file_loop
$!
$flst_loop_end:
$ close flst
$!
$! Add Link alias procedure file (N/A for curl)
$!------------------------------------------------
$!
$! Add [.SYS$STARTUP]curl_startup file
$!---------------------------------------
$ if kit_type .eqs. "D"
$ then
$ write pdsc " file ""[sys$startup]curl_daily_startup.com"""
$ else
$ write pdsc " file ""[sys$startup]curl_startup.com"""
$ endif
$ write pdsc " source [usr.lib]curl_startup.com ;"
$!
$! Add Release notes file.
$!------------------------------
$ write pdsc -
" file ""[SYSHLP]''filename_base'.release_notes"" release notes ;"
$!
$! Close the product file
$!------------------------
$ write pdsc "end product;"
$!
$close pdsc
$!
$all_exit:
$ exit

View file

@ -0,0 +1,195 @@
$! File: Build_GNV_curl_pcsi_text.com
$!
$! Build the *.pcsi$text file from the four components:
$! 1. Generated =product header section
$! 2. [--]readme. file from the Curl distribution, modified to fit
$! a pcsi$text file format.
$! 3. [--]copying file from the Curl distribution, modified to fit
$! a pcsi$text file format.
$! 4. Generated Producer section.
$!
$! Set the name of the release notes from the GNV_PCSI_FILENAME_BASE
$!
$! Copyright (C) John Malmberg
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$! SPDX-License-Identifier: ISC
$!
$!===========================================================================
$!
$ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
$ if kit_name .eqs. ""
$ then
$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$ goto all_exit
$ endif
$ producer = f$trnlnm("GNV_PCSI_PRODUCER")
$ if producer .eqs. ""
$ then
$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$ goto all_exit
$ endif
$ producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME")
$ if producer_full_name .eqs. ""
$ then
$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$ goto all_exit
$ endif
$!
$!
$! Parse the kit name into components.
$!---------------------------------------
$ producer = f$element(0, "-", kit_name)
$ base = f$element(1, "-", kit_name)
$ product = f$element(2, "-", kit_name)
$ mmversion = f$element(3, "-", kit_name)
$ majorver = f$extract(0, 3, mmversion)
$ minorver = f$extract(3, 2, mmversion)
$ updatepatch = f$element(4, "-", kit_name)
$ if updatepatch .eqs. "-" then updatepatch = ""
$!
$!
$ product_line = "=product ''producer' ''base' ''product'"
$ if updatepatch .eqs. ""
$ then
$ product_name = " ''majorver'.''minorver'"
$ else
$ product_name = " ''majorver'.''minorver'-''updatepatch'"
$ endif
$ product_line = product_line + " ''product_name' full"
$!
$!
$! If this is VAX and the file is on NFS, the names may be mangled.
$!-----------------------------------------------------------------
$ readme_file = ""
$ if f$search("[--]readme.") .nes. ""
$ then
$ readme_file = "[--]readme."
$ else
$ if f$search("[--]$README.") .nes. ""
$ then
$ readme_file = "[--]$README."
$ else
$ write sys$output "Can not find readme file."
$ goto all_exit
$ endif
$ endif
$ copying_file = ""
$ if f$search("[--]copying.") .nes. ""
$ then
$ copying_file = "[--]copying."
$ else
$ if f$search("[--]$COPYING.") .nes. ""
$ then
$ copying_file = "[--]$COPYING."
$ else
$ write sys$output "Can not find copying file."
$ goto all_exit
$ endif
$ endif
$!
$! Create the file as a VMS text file.
$!----------------------------------------
$ base_file = kit_name
$ create 'base_file'.pcsi$text
$!
$!
$! Start building file.
$!----------------------
$ open/append ptxt 'base_file'.pcsi$text
$ write ptxt product_line
$!
$!
$! First insert the Readme file.
$!
$ open/read rf 'readme_file'
$!
$ write ptxt "1 'PRODUCT"
$ write ptxt "=prompt ''producter' ''product' for OpenVMS"
$!
$rf_loop:
$ read/end=rf_loop_end rf line_in
$ if line_in .nes. ""
$ then
$! PCSI files use the first character in for their purposes.
$!--------------------------------------------------------------
$ first_char = f$extract(0, 1, line_in)
$ if first_char .nes. " " then line_in = " " + line_in
$ endif
$ write ptxt line_in
$ goto rf_loop
$rf_loop_end:
$ close rf
$!
$!
$! Now add in the copying file
$!--------------------------------
$ write ptxt ""
$ write ptxt "1 'NOTICE"
$ write ptxt ""
$!
$ open/read cf 'copying_file'
$!
$cf_loop:
$ read/end=cf_loop_end cf line_in
$ if line_in .nes. ""
$ then
$! PCSI files use the first character in for their purposes.
$!--------------------------------------------------------------
$ first_char = f$extract(0, 1, line_in)
$ if first_char .nes. " " then line_in = " " + line_in
$ endif
$ write ptxt line_in
$ goto cf_loop
$cf_loop_end:
$ close cf
$!
$! Now we need the rest of the boiler plate.
$!--------------------------------------------
$ write ptxt ""
$ write ptxt "1 'PRODUCER"
$ write ptxt "=prompt ''producer_full_name'"
$ write ptxt -
"This software product is provided by ''producer_full_name' with no warranty."
$!
$ arch_type = f$getsyi("ARCH_NAME")
$ node_swvers = f$getsyi("node_swvers")
$ vernum = f$extract(1, f$length(node_swvers), node_swvers)
$ majver = f$element(0, ".", vernum)
$ minverdash = f$element(1, ".", vernum)
$ minver = f$element(0, "-", minverdash)
$ dashver = f$element(1, "-", minverdash)
$ if dashver .eqs. "-" then dashver = ""
$ vmstag = majver + minver + dashver
$ code = f$extract(0, 1, arch_type)
$!
$ write ptxt "1 NEED_VMS''vmstag'"
$ write ptxt -
"=prompt OpenVMS ''vernum' or later is not installed on your system."
$ write ptxt "This product requires OpenVMS ''vernum' or later to function."
$ write ptxt "1 NEED_ZLIB"
$ write ptxt "=prompt ZLIB 1.2-8 or later is not installed on your system."
$ write ptxt "This product requires ZLIB 1.2-8 or later to function."
$ write ptxt "1 SOURCE"
$ write ptxt "=prompt Source modules for ''product'"
$ write ptxt "The Source modules for ''product' will be installed."
$ write ptxt "1 RELEASE_NOTES"
$ write ptxt "=prompt Release notes are available in the [SYSHLP] directory."
$!
$ close ptxt
$!
$!
$!
$all_exit:
$ exit

View file

@ -0,0 +1,100 @@
$! File: Build_GNV_curl_release_notes.com
$!
$! Build the release note file from the four components:
$! 1. The curl_release_note_start.txt
$! 2. The hp_ssl_release_info.txt
$! 3. [--]readme. file from the Curl distribution.
$! 4. The Curl_gnv-build_steps.txt.
$!
$! Set the name of the release notes from the GNV_PCSI_FILENAME_BASE
$! logical name.
$!
$! Copyright (C) John Malmberg
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$! SPDX-License-Identifier: ISC
$!
$!===========================================================================
$!
$ base_file = f$trnlnm("GNV_PCSI_FILENAME_BASE")
$ if base_file .eqs. ""
$ then
$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$ goto all_exit
$ endif
$!
$!
$ curl_readme = f$search("sys$disk:[--]readme.")
$ if curl_readme .eqs. ""
$ then
$ curl_readme = f$search("sys$disk:[--]$README.")
$ endif
$ if curl_readme .eqs. ""
$ then
$ write sys$output "Can not find Curl readme file."
$ goto all_exit
$ endif
$!
$ curl_copying = f$search("sys$disk:[--]copying.")
$ if curl_copying .eqs. ""
$ then
$ curl_copying = f$search("sys$disk:[--]$COPYING.")
$ endif
$ if curl_copying .eqs. ""
$ then
$ write sys$output "Can not find Curl copying file."
$ goto all_exit
$ endif
$!
$ vms_readme = f$search("sys$disk:[]readme.")
$ if vms_readme .eqs. ""
$ then
$ vms_readme = f$search("sys$disk:[]$README.")
$ endif
$ if vms_readme .eqs. ""
$ then
$ write sys$output "Can not find VMS specific Curl readme file."
$ goto all_exit
$ endif
$!
$ curl_release_notes = f$search("sys$disk:[--]release-notes.")
$ if curl_release_notes .eqs. ""
$ then
$ curl_release_notes = f$search("sys$disk:[--]$RELEASE-NOTES.")
$ endif
$ if curl_release_notes .eqs. ""
$ then
$ write sys$output "Can not find Curl release-notes file."
$ goto all_exit
$ endif
$!
$ if f$search("sys$disk:[]hp_ssl_release_info.txt") .eqs. ""
$ then
$ write sys$output "GNV_LINK_CURL.COM has not been run!"
$ goto all_exit
$ endif
$!
$ type/noheader 'curl_readme', 'vms_readme', -
'curl_release_notes', -
sys$disk:[]curl_release_note_start.txt, -
sys$disk:[]hp_ssl_release_info.txt, -
'curl_copying', -
sys$disk:[]curl_gnv_build_steps.txt -
/out='base_file'.release_notes
$!
$ purge 'base_file'.release_notes
$ rename 'base_file.release_notes ;1
$!
$all_exit:
$ exit

View file

@ -0,0 +1,202 @@
$! File: build_libcurl_pc.com
$!
$! Build the libcurl.pc file from the libcurl.pc.in file
$!
$! Copyright (C) John Malmberg
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$! SPDX-License-Identifier: ISC
$!
$!===========================================================================
$!
$! Skip this if the libcurl.pc already exists.
$ if f$search("[--]libcurl.pc") .nes. "" then goto all_exit
$!
$! Need to know the kit type.
$ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
$ if kit_name .eqs. ""
$ then
$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$ goto all_exit
$ endif
$!
$!
$! Parse the kit name into components.
$!---------------------------------------
$ producer = f$element(0, "-", kit_name)
$ base = f$element(1, "-", kit_name)
$ product = f$element(2, "-", kit_name)
$ mmversion = f$element(3, "-", kit_name)
$ majorver = f$extract(0, 3, mmversion)
$ minorver = f$extract(3, 2, mmversion)
$ updatepatch = f$element(4, "-", kit_name)
$ if updatepatch .eqs. "-" then updatepatch = ""
$!
$! kit type of "D" means a daily build
$ kit_type = f$edit(f$extract(0, 1, majorver), "upcase")
$!
$ pc_file_in = "[--]libcurl^.pc.in"
$!
$ if f$search(pc_file_in) .eqs. ""
$ then
$ pc_file_in = "[--]libcurl.pc$5nin"
$ if f$search(pc_file_in) .eqs. ""
$ then
$ pc_file_in = "[--]libcurl.pc_in"
$ if f$search(pc_file_in) .eqs. ""
$ then
$ write sys$output "Can not find libcurl.pc.in."
$ goto all_exit
$ endif
$ endif
$ endif
$!
$ if (f$getsyi("HW_MODEL") .lt. 1024)
$ then
$ arch_name = "VAX"
$ else
$ arch_name = ""
$ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
$ if (arch_name .eqs. "") then arch_name = "UNK"
$ endif
$!
$!
$ curl_version = "0.0.0"
$ open/read vf [--.src]tool_version.h
$version_loop:
$ read vf/end=version_loop_end line_in
$ if line_in .eqs. "" then goto version_loop
$ key = f$element(0, " ", line_in)
$ if key .nes. "#define" then goto version_loop
$ name = f$element(1, " ", line_in)
$ if name .eqs. "VERSION"
$ then
$ curl_version = f$element(2, " ", line_in) - """" - """"
$ else
$ goto version_loop
$ endif
$version_loop_end:
$ close vf
$!
$!
$ create [--]libcurl.pc
$ open/append pco [--]libcurl.pc
$ open/read pci 'pc_file_in'
$pc_file_loop:
$ read pci/end=pc_file_loop_end line_in
$!
$! blank lines
$ if line_in .eqs. ""
$ then
$ write pco ""
$ goto pc_file_loop
$ endif
$!
$! comment lines
$ key = f$extract(0, 1, line_in)
$ if key .eqs. "#"
$ then
$ write pco line_in
$ goto pc_file_loop
$ endif
$!
$! Special handling for libs.
$ if f$locate("Libs:", line_in) .eq. 0
$ then
$ write pco "#",line_in
$ goto pc_file_loop
$ endif
$! No substitution line
$ line_in_len = f$length(line_in)
$ if f$locate("@", line_in) .ge. line_in_len
$ then
$ write pco line_in
$ goto pc_file_loop
$ endif
$!
$ if f$locate("@prefix@", line_in) .lt line_in_len
$ then
$ if kit_type .nes. "D"
$ then
$ write pco "prefix=/usr"
$ else
$ write pco "prefix=/beta"
$ endif
$ goto pc_file_loop
$ endif
$ if f$locate("@exec_prefix@", line_in) .lt line_in_len
$ then
$ if kit_type .nes. "D"
$ then
$ write pco "exec_prefix=/usr"
$ else
$ write pco "exec_prefix=/beta"
$ endif
$ goto pc_file_loop
$ endif
$ if f$locate("@libdir@", line_in) .lt line_in_len
$ then
$ write pco "libdir=$(exec_prefix}/lib"
$ goto pc_file_loop
$ endif
$ if f$locate("@includedir@", line_in) .lt line_in_len
$ then
$ write pco "includedir=$(prefix}/include"
$ goto pc_file_loop
$ endif
$ if f$locate("@SUPPORT_PROTOCOLS@", line_in) .lt line_in_len
$ then
$ proto1 = "DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS"
$ proto2 = " LDAP LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP"
$ proto = proto1 + proto2
$ write pco "supported_protocols=""" + proto + """"
$ goto pc_file_loop
$ endif
$ if f$locate("@SUPPORT_FEATURES@", line_in) .lt line_in_len
$ then
$ if arch_name .eqs. "VAX"
$ then
$ write pco "supported_features=""SSL libz NTLM"""
$ else
$ write pco "supported_features=""SSL IPv6 libz NTLM"""
$ endif
$ goto pc_file_loop
$ endif
$ if f$locate("@CURLVERSION@", line_in) .lt line_in_len
$ then
$ write pco "Version: ''curl_version'"
$ goto pc_file_loop
$ endif
$ if f$locate("@LIBCURL_LIBS@", line_in) .lt line_in_len
$ then
$ if arch_name .eqs. "VAX"
$ then
$ write pco "Libs.private: -lssl -lcrypto -lz"
$ else
$ write pco "Libs.private: -lssl -lcrypto -lgssapi -lz"
$ endif
$ goto pc_file_loop
$ endif
$ if f$locate("@CPPFLAG_CURL_STATICLIB@", line_in) .lt line_in_len
$ then
$ write pco "Cflags: -I${includedir} -DCURL_STATICLIB"
$ goto pc_file_loop
$ endif
$!
$pc_file_loop_end:
$ close pco
$ close pci
$!
$all_exit:
$ exit

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,739 @@
@echo off
rem ***************************************************************************
rem * _ _ ____ _
rem * Project ___| | | | _ \| |
rem * / __| | | | |_) | |
rem * | (__| |_| | _ <| |___
rem * \___|\___/|_| \_\_____|
rem *
rem * Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
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
rem * are also available at https://curl.se/docs/copyright.html.
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
rem *
rem ***************************************************************************
:begin
rem Check we are running on a Windows NT derived OS
if not "%OS%" == "Windows_NT" goto nodos
rem Set our variables
setlocal ENABLEDELAYEDEXPANSION
set BUILD_CONFIG=
set BUILD_PLATFORM=
set SAVED_PATH=
set SOURCE_PATH=
set TMP_BUILD_PATH=
set TMP_INSTALL_PATH=
set VC_VER=
rem Ensure we have the required arguments
if /i "%~1" == "" goto syntax
rem Calculate the program files directory
if defined PROGRAMFILES (
set "PF=%PROGRAMFILES%"
set OS_PLATFORM=x86
)
if defined PROGRAMFILES(x86) (
rem Visual Studio was x86-only prior to 14.3
if /i "%~1" == "vc14.3" (
set "PF=%PROGRAMFILES%"
) else (
set "PF=%PROGRAMFILES(x86)%"
)
set OS_PLATFORM=x64
)
:parseArgs
if not "%~1" == "" (
if /i "%~1" == "vc10" (
set VC_VER=10.0
set VC_DESC=VC10
set "VC_PATH=Microsoft Visual Studio 10.0\VC"
) else if /i "%~1" == "vc11" (
set VC_VER=11.0
set VC_DESC=VC11
set "VC_PATH=Microsoft Visual Studio 11.0\VC"
) else if /i "%~1" == "vc12" (
set VC_VER=12.0
set VC_DESC=VC12
set "VC_PATH=Microsoft Visual Studio 12.0\VC"
) else if /i "%~1" == "vc14" (
set VC_VER=14.0
set VC_DESC=VC14
set "VC_PATH=Microsoft Visual Studio 14.0\VC"
) else if /i "%~1" == "vc14.1" (
set VC_VER=14.1
set VC_DESC=VC14.10
rem Determine the VC14.1 path based on the installed edition in descending
rem order (Enterprise, then Professional and finally Community)
if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
) else (
set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
)
) else if /i "%~1" == "vc14.2" (
set VC_VER=14.2
set VC_DESC=VC14.20
rem Determine the VC14.2 path based on the installed edition in descending
rem order (Enterprise, then Professional and finally Community)
if exist "%PF%\Microsoft Visual Studio\2019\Enterprise\VC" (
set "VC_PATH=Microsoft Visual Studio\2019\Enterprise\VC"
) else if exist "%PF%\Microsoft Visual Studio\2019\Professional\VC" (
set "VC_PATH=Microsoft Visual Studio\2019\Professional\VC"
) else (
set "VC_PATH=Microsoft Visual Studio\2019\Community\VC"
)
) else if /i "%~1" == "vc14.3" (
set VC_VER=14.3
set VC_DESC=VC14.30
rem Determine the VC14.3 path based on the installed edition in descending
rem order (Enterprise, then Professional and finally Community)
if exist "%PF%\Microsoft Visual Studio\2022\Enterprise\VC" (
set "VC_PATH=Microsoft Visual Studio\2022\Enterprise\VC"
) else if exist "%PF%\Microsoft Visual Studio\2022\Professional\VC" (
set "VC_PATH=Microsoft Visual Studio\2022\Professional\VC"
) else (
set "VC_PATH=Microsoft Visual Studio\2022\Community\VC"
)
) else if /i "%~1%" == "x86" (
set BUILD_PLATFORM=x86
) else if /i "%~1%" == "x64" (
set BUILD_PLATFORM=x64
) else if /i "%~1%" == "debug" (
set BUILD_CONFIG=debug
) else if /i "%~1%" == "release" (
set BUILD_CONFIG=release
) else if /i "%~1" == "-?" (
goto syntax
) else if /i "%~1" == "-h" (
goto syntax
) else if /i "%~1" == "-help" (
goto syntax
) else if /i "%~1" == "-VSpath" (
if "%~2" == "" (
echo.
echo Error. Please provide VS Path.
goto error
) else (
set "ABS_VC_PATH=%~2\VC"
shift
)
) else if /i "%~1" == "-perlpath" (
if "%~2" == "" (
echo.
echo Error. Please provide Perl root Path.
goto error
) else (
set "PERL_PATH=%~2"
shift
)
) else (
if not defined START_DIR (
set "START_DIR=%~1%"
) else (
goto unknown
)
)
shift & goto parseArgs
)
:prerequisites
rem Compiler is a required parameter
if not defined VC_VER goto syntax
rem Default the start directory if one isn't specified
if not defined START_DIR set START_DIR=..\..\openssl
if not defined ABS_VC_PATH (
rem Check we have a program files directory
if not defined PF goto nopf
set "ABS_VC_PATH=%PF%\%VC_PATH%"
)
rem Check we have Visual Studio installed
if not exist "%ABS_VC_PATH%" goto novc
if not defined PERL_PATH (
rem Check we have Perl in our path
perl --version <NUL 1>NUL 2>&1
if errorlevel 1 (
rem It isn't so check we have it installed and set the path if it is
if exist "%SystemDrive%\Perl" (
set "PATH=%SystemDrive%\Perl\bin;%PATH%"
) else (
if exist "%SystemDrive%\Perl64" (
set "PATH=%SystemDrive%\Perl64\bin;%PATH%"
) else (
goto noperl
)
)
)
) else (
set "PATH=%PERL_PATH%\Perl\bin;%PATH%"
)
rem Check the start directory exists
if not exist "%START_DIR%" goto noopenssl
:setup
if "%BUILD_PLATFORM%" == "" (
if "%VC_VER%" == "6.0" (
set BUILD_PLATFORM=x86
) else if "%VC_VER%" == "7.0" (
set BUILD_PLATFORM=x86
) else if "%VC_VER%" == "7.1" (
set BUILD_PLATFORM=x86
) else (
set BUILD_PLATFORM=%OS_PLATFORM%
)
)
if "%BUILD_PLATFORM%" == "x86" (
set VCVARS_PLATFORM=x86
) else if "%BUILD_PLATFORM%" == "x64" (
if "%VC_VER%" == "10.0" set VCVARS_PLATFORM=%BUILD_PLATFORM%
if "%VC_VER%" == "11.0" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "12.0" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "14.0" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "14.1" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "14.2" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "14.3" set VCVARS_PLATFORM=amd64
)
if exist "%START_DIR%\ms\do_ms.bat" (
set LEGACY_BUILD=TRUE
) else (
set LEGACY_BUILD=FALSE
)
:start
echo.
set "SAVED_PATH=%CD%"
if "%VC_VER%" == "14.1" (
call "%ABS_VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
) else if "%VC_VER%" == "14.2" (
call "%ABS_VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
) else if "%VC_VER%" == "14.3" (
call "%ABS_VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
) else (
call "%ABS_VC_PATH%\vcvarsall" %VCVARS_PLATFORM%
)
echo.
cd /d "%START_DIR%" || (echo Error: Failed cd start & exit /B 1)
rem Save the full path of the openssl source dir
set "SOURCE_PATH=%CD%"
rem Set temporary paths for building and installing OpenSSL. If a temporary
rem path is not the same as the source path then it is *removed* after the
rem installation is completed.
rem
rem For legacy OpenSSL the temporary build path must be the source path.
rem
rem For OpenSSL 1.1.x the temporary paths must be separate not a descendant
rem of the other, otherwise pdb files will be lost between builds.
rem https://github.com/openssl/openssl/issues/10005
rem
if "%LEGACY_BUILD%" == "TRUE" (
set "TMP_BUILD_PATH=%SOURCE_PATH%"
set "TMP_INSTALL_PATH=%SOURCE_PATH%"
) else (
set "TMP_BUILD_PATH=%SOURCE_PATH%\build\tmp_build"
set "TMP_INSTALL_PATH=%SOURCE_PATH%\build\tmp_install"
)
goto %BUILD_PLATFORM%
:x64
rem Calculate our output directory
set OUTDIR=build\Win64\%VC_DESC%
if not exist %OUTDIR% md %OUTDIR%
if not "%BUILD_CONFIG%" == "release" (
rem Configuring 64-bit Static Library Debug Build
call :configure x64 debug static %LEGACY_BUILD%
rem Perform the build
call :build x64 static %LEGACY_BUILD%
rem Perform the install
call :install debug static %LEGACY_BUILD%
rem Configuring 64-bit Shared Library Debug Build
call :configure x64 debug shared %LEGACY_BUILD%
rem Perform the build
call :build x64 shared %LEGACY_BUILD%
rem Perform the install
call :install debug shared %LEGACY_BUILD%
)
if not "%BUILD_CONFIG%" == "debug" (
rem Configuring 64-bit Static Library Release Build
call :configure x64 release static %LEGACY_BUILD%
rem Perform the build
call :build x64 static %LEGACY_BUILD%
rem Perform the install
call :install release static %LEGACY_BUILD%
rem Configuring 64-bit Shared Library Release Build
call :configure x64 release shared %LEGACY_BUILD%
rem Perform the build
call :build x64 shared %LEGACY_BUILD%
rem Perform the install
call :install release shared %LEGACY_BUILD%
)
goto success
:x86
rem Calculate our output directory
set OUTDIR=build\Win32\%VC_DESC%
if not exist %OUTDIR% md %OUTDIR%
if not "%BUILD_CONFIG%" == "release" (
rem Configuring 32-bit Static Library Debug Build
call :configure x86 debug static %LEGACY_BUILD%
rem Perform the build
call :build x86 static %LEGACY_BUILD%
rem Perform the install
call :install debug static %LEGACY_BUILD%
rem Configuring 32-bit Shared Library Debug Build
call :configure x86 debug shared %LEGACY_BUILD%
rem Perform the build
call :build x86 shared %LEGACY_BUILD%
rem Perform the install
call :install debug shared %LEGACY_BUILD%
)
if not "%BUILD_CONFIG%" == "debug" (
rem Configuring 32-bit Static Library Release Build
call :configure x86 release static %LEGACY_BUILD%
rem Perform the build
call :build x86 static %LEGACY_BUILD%
rem Perform the install
call :install release static %LEGACY_BUILD%
rem Configuring 32-bit Shared Library Release Build
call :configure x86 release shared %LEGACY_BUILD%
rem Perform the build
call :build x86 shared %LEGACY_BUILD%
rem Perform the install
call :install release shared %LEGACY_BUILD%
)
goto success
rem Function to configure the build.
rem
rem %1 - Platform (x86 or x64)
rem %2 - Configuration (release or debug)
rem %3 - Build Type (static or shared)
rem %4 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE)
rem
:configure
setlocal
if "%1" == "" exit /B 1
if "%2" == "" exit /B 1
if "%3" == "" exit /B 1
if "%4" == "" exit /B 1
if not exist "%TMP_BUILD_PATH%" mkdir "%TMP_BUILD_PATH%"
cd /d "%TMP_BUILD_PATH%" || (echo Error: Failed cd build & exit /B 1)
if "%4" == "TRUE" (
rem Calculate the configure options
if "%1" == "x86" (
if "%2" == "debug" (
set options=debug-VC-WIN32
) else if "%2" == "release" (
set options=VC-WIN32
) else (
exit /B 1
)
set options=!options! no-asm
) else if "%1" == "x64" (
if "%2" == "debug" (
set options=debug-VC-WIN64A
) else if "%2" == "release" (
set options=VC-WIN64A
) else (
exit /B 1
)
) else (
exit /B 1
)
) else if "%4" == "FALSE" (
rem Has configure already been ran?
if exist makefile (
rem Clean up the previous build
nmake clean
rem Remove the old makefile
del makefile 1>nul
)
rem Calculate the configure options
if "%1" == "x86" (
set options=VC-WIN32
) else if "%1" == "x64" (
set options=VC-WIN64A
) else (
exit /B 1
)
if "%2" == "debug" (
set options=!options! --debug
) else if "%2" == "release" (
set options=!options! --release
) else (
exit /B 1
)
if "%3" == "static" (
set options=!options! no-shared
) else if not "%3" == "shared" (
exit /B 1
)
set options=!options! no-asm
) else (
exit /B 1
)
rem Run the configure
perl "%SOURCE_PATH%\Configure" %options% "--prefix=%TMP_INSTALL_PATH%"
exit /B %ERRORLEVEL%
rem Main build function.
rem
rem %1 - Platform (x86 or x64)
rem %2 - Build Type (static or shared)
rem %3 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE)
rem
:build
setlocal
if "%1" == "" exit /B 1
if "%2" == "" exit /B 1
if "%3" == "" exit /B 1
cd /d "%TMP_BUILD_PATH%" || (echo Error: Failed cd build & exit /B 1)
if "%3" == "TRUE" (
if "%1" == "x86" (
call ms\do_ms.bat
) else if "%1" == "x64" (
call ms\do_win64a.bat
) else (
exit /B 1
)
if "%2" == "static" (
nmake -f ms\nt.mak
) else if "%2" == "shared" (
nmake -f ms\ntdll.mak
) else (
exit /B 1
)
) else if "%3" == "FALSE" (
nmake
) else (
exit /B 1
)
exit /B 0
rem Main installation function.
rem
rem %1 - Configuration (release or debug)
rem %2 - Build Type (static or shared)
rem %3 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE)
rem
:install
setlocal
if "%1" == "" exit /B 1
if "%2" == "" exit /B 1
if "%3" == "" exit /B 1
rem Copy the generated files to our directory structure
if "%3" == "TRUE" (
rem There's no actual installation for legacy OpenSSL, the files are copied
rem from the build dir (for legacy this is same as source dir) to the final
rem location.
cd /d "%SOURCE_PATH%" || (echo Error: Failed cd source & exit /B 1)
if "%1" == "debug" (
if "%2" == "static" (
rem Move the output directories
if exist "%OUTDIR%\LIB Debug" (
copy /y out32.dbg\* "%OUTDIR%\LIB Debug" 1>nul
rd out32.dbg /s /q
) else (
move out32.dbg "%OUTDIR%\LIB Debug" 1>nul
)
rem Move the PDB files
move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug" 1>nul
rem Remove the intermediate directories
rd tmp32.dbg /s /q
) else if "%2" == "shared" (
if exist "%OUTDIR%\DLL Debug" (
copy /y out32dll.dbg\* "%OUTDIR%\DLL Debug" 1>nul
rd out32dll.dbg /s /q
) else (
move out32dll.dbg "%OUTDIR%\DLL Debug" 1>nul
)
rem Move the PDB files
move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug" 1>nul
rem Remove the intermediate directories
rd tmp32dll.dbg /s /q
) else (
exit /B 1
)
) else if "%1" == "release" (
if "%2" == "static" (
rem Move the output directories
if exist "%OUTDIR%\LIB Release" (
copy /y out32\* "%OUTDIR%\LIB Release" 1>nul
rd out32 /s /q
) else (
move out32 "%OUTDIR%\LIB Release" 1>nul
)
rem Move the PDB files
move tmp32\lib.pdb "%OUTDIR%\LIB Release" 1>nul
rem Remove the intermediate directories
rd tmp32 /s /q
) else if "%2" == "shared" (
if exist "%OUTDIR%\DLL Release" (
copy /y out32dll\* "%OUTDIR%\DLL Release" 1>nul
rd out32dll /s /q
) else (
move out32dll "%OUTDIR%\DLL Release" 1>nul
)
rem Move the PDB files
move tmp32dll\lib.pdb "%OUTDIR%\DLL Release" 1>nul
rem Remove the intermediate directories
rd tmp32dll /s /q
) else (
exit /B 1
)
)
) else if "%3" == "FALSE" (
cd /d "%TMP_BUILD_PATH%" || (echo Error: Failed cd build & exit /B 1)
rem Perform the installation
nmake install_sw
cd /d "%SOURCE_PATH%" || (echo Error: Failed cd source & exit /B 1)
rem Move the output directories
if "%1" == "debug" (
if "%2" == "static" (
if not exist "%OUTDIR%\LIB Debug" (
mkdir "%OUTDIR%\LIB Debug" 1>nul
)
move "%TMP_INSTALL_PATH%\lib\*.lib" "%OUTDIR%\LIB Debug" 1>nul
move "%TMP_INSTALL_PATH%\lib\*.pdb" "%OUTDIR%\LIB Debug" 1>nul
move "%TMP_INSTALL_PATH%\bin\*.exe" "%OUTDIR%\LIB Debug" 1>nul
move "%TMP_INSTALL_PATH%\bin\*.pdb" "%OUTDIR%\LIB Debug" 1>nul
xcopy /E /I /Y "%TMP_INSTALL_PATH%\include" "%OUTDIR%\LIB Debug\include" 1>nul
) else if "%2" == "shared" (
if not exist "%OUTDIR%\DLL Debug" (
mkdir "%OUTDIR%\DLL Debug" 1>nul
)
move "%TMP_INSTALL_PATH%\lib\*.lib" "%OUTDIR%\DLL Debug" 1>nul
if exist "%TMP_INSTALL_PATH%\lib\engines-3" (
move "%TMP_INSTALL_PATH%\lib\engines-3\*.dll" "%OUTDIR%\DLL Debug" 1>nul
move "%TMP_INSTALL_PATH%\lib\engines-3\*.pdb" "%OUTDIR%\DLL Debug" 1>nul
) else if exist "%TMP_INSTALL_PATH%\lib\engines-1_1" (
move "%TMP_INSTALL_PATH%\lib\engines-1_1\*.dll" "%OUTDIR%\DLL Debug" 1>nul
move "%TMP_INSTALL_PATH%\lib\engines-1_1\*.pdb" "%OUTDIR%\DLL Debug" 1>nul
)
move "%TMP_INSTALL_PATH%\bin\*.dll" "%OUTDIR%\DLL Debug" 1>nul
move "%TMP_INSTALL_PATH%\bin\*.exe" "%OUTDIR%\DLL Debug" 1>nul
move "%TMP_INSTALL_PATH%\bin\*.pdb" "%OUTDIR%\DLL Debug" 1>nul
xcopy /E /I /Y "%TMP_INSTALL_PATH%\include" "%OUTDIR%\DLL Debug\include" 1>nul
) else (
exit /B 1
)
) else if "%1" == "release" (
if "%2" == "static" (
if not exist "%OUTDIR%\LIB Release" (
mkdir "%OUTDIR%\LIB Release" 1>nul
)
move "%TMP_INSTALL_PATH%\lib\*.lib" "%OUTDIR%\LIB Release" 1>nul
move "%TMP_INSTALL_PATH%\lib\*.pdb" "%OUTDIR%\LIB Release" 1>nul
move "%TMP_INSTALL_PATH%\bin\*.exe" "%OUTDIR%\LIB Release" 1>nul
move "%TMP_INSTALL_PATH%\bin\*.pdb" "%OUTDIR%\LIB Release" 1>nul
xcopy /E /I /Y "%TMP_INSTALL_PATH%\include" "%OUTDIR%\LIB Release\include" 1>nul
) else if "%2" == "shared" (
if not exist "%OUTDIR%\DLL Release" (
mkdir "%OUTDIR%\DLL Release" 1>nul
)
move "%TMP_INSTALL_PATH%\lib\*.lib" "%OUTDIR%\DLL Release" 1>nul
if exist "%TMP_INSTALL_PATH%\lib\engines-3" (
move "%TMP_INSTALL_PATH%\lib\engines-3\*.dll" "%OUTDIR%\DLL Release" 1>nul
move "%TMP_INSTALL_PATH%\lib\engines-3\*.pdb" "%OUTDIR%\DLL Release" 1>nul
) else if exist "%TMP_INSTALL_PATH%\lib\engines-1_1" (
move "%TMP_INSTALL_PATH%\lib\engines-1_1\*.dll" "%OUTDIR%\DLL Release" 1>nul
move "%TMP_INSTALL_PATH%\lib\engines-1_1\*.pdb" "%OUTDIR%\DLL Release" 1>nul
)
move "%TMP_INSTALL_PATH%\bin\*.dll" "%OUTDIR%\DLL Release" 1>nul
move "%TMP_INSTALL_PATH%\bin\*.exe" "%OUTDIR%\DLL Release" 1>nul
move "%TMP_INSTALL_PATH%\bin\*.pdb" "%OUTDIR%\DLL Release" 1>nul
xcopy /E /I /Y "%TMP_INSTALL_PATH%\include" "%OUTDIR%\DLL Release\include" 1>nul
) else (
exit /B 1
)
) else (
exit /B 1
)
rem Remove the output directories
if not "%SOURCE_PATH%" == "%TMP_BUILD_PATH%" (
rd "%TMP_BUILD_PATH%" /s /q
)
if not "%SOURCE_PATH%" == "%TMP_INSTALL_PATH%" (
rd "%TMP_INSTALL_PATH%" /s /q
)
) else (
exit /B 1
)
exit /B 0
:syntax
rem Display the help
echo.
echo Usage: build-openssl ^<compiler^> [platform] [configuration] [directory] [-VSpath] ["VSpath"] [-perlpath] ["perlpath"]
echo.
echo Compiler:
echo.
echo vc10 - Use Visual Studio 2010
echo vc11 - Use Visual Studio 2012
echo vc12 - Use Visual Studio 2013
echo vc14 - Use Visual Studio 2015
echo vc14.1 - Use Visual Studio 2017
echo vc14.2 - Use Visual Studio 2019
echo vc14.3 - Use Visual Studio 2022
echo.
echo Platform:
echo.
echo x86 - Perform a 32-bit build
echo x64 - Perform a 64-bit build
echo.
echo Configuration:
echo.
echo debug - Perform a debug build
echo release - Perform a release build
echo.
echo Other:
echo.
echo directory - Specifies the OpenSSL source directory
echo.
echo -VSpath - Specify the custom VS path if Visual Studio is not located at
echo "C:\<ProgramFiles>\Microsoft Visual Studio <version>"
echo For e.g. -VSpath "C:\apps\MVS14"
echo.
echo -perlpath - Specify the custom perl root path if perl is not located at
echo "C:\Perl" and it is a portable copy of perl and not
echo installed on the win system.
echo For e.g. -perlpath "D:\strawberry-perl-5.24.3.1-64bit-portable"
goto error
:unknown
echo.
echo Error: Unknown argument '%1'
goto error
:nodos
echo.
echo Error: Only a Windows NT based Operating System is supported
goto error
:nopf
echo.
echo Error: Cannot obtain the directory for Program Files
goto error
:novc
echo.
echo Error: %VC_DESC% is not installed
echo Error: Please check whether Visual compiler is installed at the path "%ABS_VC_PATH%"
echo Error: Please provide proper VS Path by using -VSpath
goto error
:noperl
echo.
echo Error: Perl is not installed
echo Error: Please check whether Perl is installed or it is at location "C:\Perl"
echo Error: If Perl is portable please provide perl root path by using -perlpath
goto error
:nox64
echo.
echo Error: %VC_DESC% does not support 64-bit builds
goto error
:noopenssl
echo.
echo Error: Cannot locate OpenSSL source directory
goto error
:error
if "%OS%" == "Windows_NT" endlocal
exit /B 1
:success
cd /d "%SAVED_PATH%"
endlocal
exit /B 0

View file

@ -0,0 +1,429 @@
@echo off
rem ***************************************************************************
rem * _ _ ____ _
rem * Project ___| | | | _ \| |
rem * / __| | | | |_) | |
rem * | (__| |_| | _ <| |___
rem * \___|\___/|_| \_\_____|
rem *
rem * Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
rem * Copyright (C) Jay Satiro, <raysatiro@yahoo.com>.
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
rem * are also available at https://curl.se/docs/copyright.html.
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
rem *
rem ***************************************************************************
:begin
rem Check we are running on a Windows NT derived OS
if not "%OS%" == "Windows_NT" goto nodos
rem Set our variables
setlocal
set SUCCESSFUL_BUILDS=
set VC_VER=
set BUILD_PLATFORM=
set DEFAULT_START_DIR=..\..\wolfssl
rem Calculate the program files directory
if defined PROGRAMFILES (
set "PF=%PROGRAMFILES%"
set OS_PLATFORM=x86
)
if defined PROGRAMFILES(x86) (
rem Visual Studio was x86-only prior to 14.3
if /i "%~1" == "vc14.3" (
set "PF=%PROGRAMFILES%"
) else (
set "PF=%PROGRAMFILES(x86)%"
)
set OS_PLATFORM=x64
)
rem Ensure we have the required arguments
if /i "%~1" == "" goto syntax
:parseArgs
if "%~1" == "" goto prerequisites
if /i "%~1" == "vc10" (
set VC_VER=10.0
set VC_DESC=VC10
set VC_TOOLSET=v100
set "VC_PATH=Microsoft Visual Studio 10.0\VC"
) else if /i "%~1" == "vc11" (
set VC_VER=11.0
set VC_DESC=VC11
set VC_TOOLSET=v110
set "VC_PATH=Microsoft Visual Studio 11.0\VC"
) else if /i "%~1" == "vc12" (
set VC_VER=12.0
set VC_DESC=VC12
set VC_TOOLSET=v120
set "VC_PATH=Microsoft Visual Studio 12.0\VC"
) else if /i "%~1" == "vc14" (
set VC_VER=14.0
set VC_DESC=VC14
set VC_TOOLSET=v140
set "VC_PATH=Microsoft Visual Studio 14.0\VC"
) else if /i "%~1" == "vc14.1" (
set VC_VER=14.1
set VC_DESC=VC14.10
set VC_TOOLSET=v141
rem Determine the VC14.1 path based on the installed edition in descending
rem order (Enterprise, then Professional and finally Community)
if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
) else (
set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
)
) else if /i "%~1" == "vc14.2" (
set VC_VER=14.2
set VC_DESC=VC14.20
set VC_TOOLSET=v142
rem Determine the VC14.2 path based on the installed edition in descending
rem order (Enterprise, then Professional and finally Community)
if exist "%PF%\Microsoft Visual Studio\2019\Enterprise\VC" (
set "VC_PATH=Microsoft Visual Studio\2019\Enterprise\VC"
) else if exist "%PF%\Microsoft Visual Studio\2019\Professional\VC" (
set "VC_PATH=Microsoft Visual Studio\2019\Professional\VC"
) else (
set "VC_PATH=Microsoft Visual Studio\2019\Community\VC"
)
) else if /i "%~1" == "vc14.3" (
set VC_VER=14.3
set VC_DESC=VC14.30
set VC_TOOLSET=v143
rem Determine the VC14.3 path based on the installed edition in descending
rem order (Enterprise, then Professional and finally Community)
if exist "%PF%\Microsoft Visual Studio\2022\Enterprise\VC" (
set "VC_PATH=Microsoft Visual Studio\2022\Enterprise\VC"
) else if exist "%PF%\Microsoft Visual Studio\2022\Professional\VC" (
set "VC_PATH=Microsoft Visual Studio\2022\Professional\VC"
) else (
set "VC_PATH=Microsoft Visual Studio\2022\Community\VC"
)
) else if /i "%~1" == "x86" (
set BUILD_PLATFORM=x86
) else if /i "%~1" == "x64" (
set BUILD_PLATFORM=x64
) else if /i "%~1" == "debug" (
set BUILD_CONFIG=debug
) else if /i "%~1" == "release" (
set BUILD_CONFIG=release
) else if /i "%~1" == "-?" (
goto syntax
) else if /i "%~1" == "-h" (
goto syntax
) else if /i "%~1" == "-help" (
goto syntax
) else (
if not defined START_DIR (
set START_DIR=%~1
) else (
goto unknown
)
)
shift & goto parseArgs
:prerequisites
rem Compiler is a required parameter
if not defined VC_VER goto syntax
rem Default the start directory if one isn't specified
if not defined START_DIR set "START_DIR=%DEFAULT_START_DIR%"
rem Check we have a program files directory
if not defined PF goto nopf
rem Check we have Visual Studio installed
if not exist "%PF%\%VC_PATH%" goto novc
rem Check the start directory exists
if not exist "%START_DIR%" goto nowolfssl
:configure
if "%BUILD_PLATFORM%" == "" set BUILD_PLATFORM=%OS_PLATFORM%
if "%BUILD_PLATFORM%" == "x86" (
set VCVARS_PLATFORM=x86
) else if "%BUILD_PLATFORM%" == "x64" (
if "%VC_VER%" == "10.0" set VCVARS_PLATFORM=%BUILD_PLATFORM%
if "%VC_VER%" == "11.0" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "12.0" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "14.0" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "14.1" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "14.2" set VCVARS_PLATFORM=amd64
if "%VC_VER%" == "14.3" set VCVARS_PLATFORM=amd64
)
:start
echo.
set SAVED_PATH=%CD%
if "%VC_VER%" == "14.1" (
call "%PF%\%VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
) else if "%VC_VER%" == "14.2" (
call "%PF%\%VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
) else if "%VC_VER%" == "14.3" (
call "%PF%\%VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
) else (
call "%PF%\%VC_PATH%\vcvarsall" %VCVARS_PLATFORM%
)
echo.
cd /d %SAVED_PATH%
if defined START_DIR cd /d %START_DIR%
goto %BUILD_PLATFORM%
:x64
rem Calculate our output directory
set OUTDIR=build\Win64\%VC_DESC%
if not exist %OUTDIR% md %OUTDIR%
if "%BUILD_CONFIG%" == "release" goto x64release
:x64debug
rem Perform 64-bit Debug Build
call :build Debug x64
if errorlevel 1 goto error
call :build "DLL Debug" x64
if errorlevel 1 goto error
if "%BUILD_CONFIG%" == "debug" goto success
:x64release
rem Perform 64-bit Release Build
call :build Release x64
if errorlevel 1 goto error
call :build "DLL Release" x64
if errorlevel 1 goto error
goto success
:x86
rem Calculate our output directory
set OUTDIR=build\Win32\%VC_DESC%
if not exist %OUTDIR% md %OUTDIR%
if "%BUILD_CONFIG%" == "release" goto x86release
:x86debug
rem Perform 32-bit Debug Build
call :build Debug Win32
if errorlevel 1 goto error
call :build "DLL Debug" Win32
if errorlevel 1 goto error
if "%BUILD_CONFIG%" == "debug" goto success
:x86release
rem Perform 32-bit Release Build
call :build Release Win32
if errorlevel 1 goto error
call :build "DLL Release" Win32
if errorlevel 1 goto error
goto success
:build
rem This function builds wolfSSL.
rem Usage: CALL :build <configuration> <platform>
rem The current directory must be the wolfSSL directory.
rem VS Configuration: Debug, Release, DLL Debug or DLL Release.
rem VS Platform: Win32 or x64.
rem Returns: 1 on fail, 0 on success.
rem An informational message should be shown before any return.
setlocal
set MSBUILD_CONFIG=%~1
set MSBUILD_PLATFORM=%~2
if not exist wolfssl64.sln (
echo.
echo Error: build: wolfssl64.sln not found in "%CD%"
exit /b 1
)
rem OUTDIR isn't a full path, only relative. MSBUILD_OUTDIR must be full and
rem not have trailing backslashes, which are handled later.
if "%MSBUILD_CONFIG%" == "Debug" (
set "MSBUILD_OUTDIR=%CD%\%OUTDIR%\LIB Debug"
) else if "%MSBUILD_CONFIG%" == "Release" (
set "MSBUILD_OUTDIR=%CD%\%OUTDIR%\LIB Release"
) else if "%MSBUILD_CONFIG%" == "DLL Debug" (
set "MSBUILD_OUTDIR=%CD%\%OUTDIR%\DLL Debug"
) else if "%MSBUILD_CONFIG%" == "DLL Release" (
set "MSBUILD_OUTDIR=%CD%\%OUTDIR%\DLL Release"
) else (
echo.
echo Error: build: Configuration not recognized.
exit /b 1
)
if not "%MSBUILD_PLATFORM%" == "Win32" if not "%MSBUILD_PLATFORM%" == "x64" (
echo.
echo Error: build: Platform not recognized.
exit /b 1
)
copy /v /y "%~dp0\wolfssl_options.h" .\cyassl\options.h
if %ERRORLEVEL% neq 0 (
echo.
echo Error: build: Couldn't replace .\cyassl\options.h
exit /b 1
)
copy /v /y "%~dp0\wolfssl_options.h" .\wolfssl\options.h
if %ERRORLEVEL% neq 0 (
echo.
echo Error: build: Couldn't replace .\wolfssl\options.h
exit /b 1
)
rem Extra trailing \ in Dirs because otherwise it thinks a quote is escaped
msbuild wolfssl64.sln ^
-p:CustomAfterMicrosoftCommonTargets="%~dp0\wolfssl_override.props" ^
-p:Configuration="%MSBUILD_CONFIG%" ^
-p:Platform="%MSBUILD_PLATFORM%" ^
-p:PlatformToolset="%VC_TOOLSET%" ^
-p:OutDir="%MSBUILD_OUTDIR%\\" ^
-p:IntDir="%MSBUILD_OUTDIR%\obj\\"
if %ERRORLEVEL% neq 0 (
echo.
echo Error: Failed building wolfSSL %MSBUILD_CONFIG%^|%MSBUILD_PLATFORM%.
exit /b 1
)
rem For tests to run properly the wolfSSL directory must remain the current.
set "PATH=%MSBUILD_OUTDIR%;%PATH%"
"%MSBUILD_OUTDIR%\testsuite.exe"
if %ERRORLEVEL% neq 0 (
echo.
echo Error: Failed testing wolfSSL %MSBUILD_CONFIG%^|%MSBUILD_PLATFORM%.
exit /b 1
)
echo.
echo Success: Built and tested wolfSSL %MSBUILD_CONFIG%^|%MSBUILD_PLATFORM%.
echo.
echo.
rem This is necessary to export our local variables back to the caller.
endlocal & set SUCCESSFUL_BUILDS="%MSBUILD_CONFIG%|%MSBUILD_PLATFORM%" ^
%SUCCESSFUL_BUILDS%
exit /b 0
:syntax
rem Display the help
echo.
echo Usage: build-wolfssl ^<compiler^> [platform] [configuration] [directory]
echo.
echo.
echo Compiler:
echo.
echo vc10 - Use Visual Studio 2010
echo vc11 - Use Visual Studio 2012
echo vc12 - Use Visual Studio 2013
echo vc14 - Use Visual Studio 2015
echo vc14.1 - Use Visual Studio 2017
echo vc14.2 - Use Visual Studio 2019
echo vc14.3 - Use Visual Studio 2022
echo.
echo.
echo Platform:
echo.
echo x86 - Perform a 32-bit build
echo x64 - Perform a 64-bit build
echo.
echo If this parameter is unset the OS platform is used ^(%OS_PLATFORM%^).
echo.
echo.
echo Configuration:
echo.
echo debug - Perform a debug build
echo release - Perform a release build
echo.
echo If this parameter is unset both configurations are built.
echo.
echo.
echo Other:
echo.
echo directory - Specifies the wolfSSL source directory
echo.
echo If this parameter is unset the directory used is "%DEFAULT_START_DIR%".
echo.
goto error
:unknown
echo.
echo Error: Unknown argument '%1'
goto error
:nodos
echo.
echo Error: Only a Windows NT based Operating System is supported
goto error
:nopf
echo.
echo Error: Cannot obtain the directory for Program Files
goto error
:novc
echo.
echo Error: %VC_DESC% is not installed
goto error
:nox64
echo.
echo Error: %VC_DESC% does not support 64-bit builds
goto error
:nowolfssl
echo.
echo Error: Cannot locate wolfSSL source directory, expected "%START_DIR%"
goto error
:error
if "%OS%" == "Windows_NT" endlocal
exit /B 1
:success
if defined SUCCESSFUL_BUILDS (
echo.
echo.
echo Build complete.
echo.
echo The following configurations were built and tested successfully:
echo.
echo %SUCCESSFUL_BUILDS%
echo.
)
cd /d %SAVED_PATH%
endlocal
exit /B 0