1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-15 22:15:13 -05:00

build_vms.com: use existing curlbuild.h and parsing fix

This patch removes building curlbuild.h from the build_vms.com procedure
and uses the one in the daily or release tarball instead.

packages/vms/build_curlbuild_h.com is obsolete with this change.

Accessing the library module name "tool_main" needs different handling
when the optional extended parsing is enabled.

Tested on IA64/VMS 8.4 and VAX/VMS 7.3
This commit is contained in:
John E. Malmberg 2013-03-20 20:36:20 +01:00 committed by Yang Tse
parent 6f1f7e5de8
commit 1c44f83e54
3 changed files with 37 additions and 341 deletions

View File

@ -1,5 +1,4 @@
EXTRA_DIST = \ EXTRA_DIST = \
build_curlbuild_h.com \
build_vms.com \ build_vms.com \
config_h.com \ config_h.com \
curlmsg.h \ curlmsg.h \

View File

@ -1,327 +0,0 @@
$! File: config_h.com
$!
$! $Id: config_h.com,v 1.1.1.1 2012/12/02 19:25:21 wb8tyw Exp $
$!
$! This procedure attempts to figure out how to build a config.h file
$! for the current project.
$!
$! P1 specifies the config.h.in file or equivalent. If it is not specified
$! then this procedure will search for several common names of the file.
$!
$! The CONFIGURE shell script will be examined for hints and a few symbols
$! but most of the tests will not produce valid results on OpenVMS. Some
$! will produce false positives and some will produce false negatives.
$!
$! It is easier to just read the config.h_in file and make up tests based
$! on what is in it!
$!
$! This file will create an empty config_vms.h file if one does not exist.
$! The config_vms.h is intended for manual edits to handle things that
$! this procedure can not.
$!
$! The config_vms.h will be invoked by the resulting config.h file.
$!
$! This procedure knows about the DEC C RTL on the system it is on.
$! Future versions may be handle the GNV, the OpenVMS porting library,
$! and others.
$!
$! This procedure may not guess the options correctly for all architectures,
$! and is a work in progress.
$!
$! Copyright 2011, 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.
$!
$! 15-Jan-2001 J. Malmberg Original
$! 29-Apr-2001 J. Malmberg Also look for config.*in* in a [.include]
$! subdirectory
$! 30-Apr-2001 J. Malmberg Update for SAMBA checks
$! 09-Apr-2005 J. Malmberg Update for RSYNC and large file.
$! 29-Sep-2011 J. Malmberg Update for Bash 4.2
$! 01-Mar-2012 J. Malmberg Warn about getcwd(0,0)
$! 21-Dec-2012 J. Malmberg Update for gawk
$! 29-Dec-2012 J. Malmberg Update for curl
$!============================================================================
$!
$ss_normal = 1
$ss_abort = 44
$ss_control_y = 1556
$status = ss_normal
$on control_y then goto control_y
$on warning then goto general_error
$!
$! Some information for writing timestamps to created files
$!----------------------------------------------------------
$my_proc = f$environment("PROCEDURE")
$my_proc_file = f$parse(my_proc,,,"NAME") + f$parse(my_proc,,,"TYPE")
$tab[0,8] = 9
$datetime = f$element(0,".",f$cvtime(,"ABSOLUTE","DATETIME"))
$username = f$edit(f$getjpi("","USERNAME"),"TRIM")
$!
$pid = f$getjpi("","PID")
$tfile1 = "SYS$SCRATCH:config_h_temp1_''pid'.TEMP"
$dchfile = "SYS$SCRATCH:config_h_decc_''pid'.TEMP"
$configure_script = "SYS$SCRATCH:configure_script_''pid'.TEMP"
$!
$! Get the system type
$!----------------------
$arch_type = f$getsyi("arch_type")
$!
$!
$! Write out the header
$!----------------------
$gosub write_curlbuild_h_header
$!
$!
$! config.h.in could have at least five different names depending
$! on how it was transferred to OpenVMS
$!------------------------------------------------------------------
$base_curlbuild = "sys$disk:[.include.curl]"
$if p1 .nes. ""
$then
$ cfile = p1
$else
$ cfile = f$search("''base_curlbuild'curlbuild.h.in")
$ if cfile .eqs. ""
$ then
$ cfile = f$search("''base_curlbuild'curlbuild.h_in")
$ if cfile .eqs. ""
$ then
$ cfile = f$search("''base_curlbuild'curlbuildh.in")
$ if cfile .eqs. ""
$ then
$ cfile = f$search("''base_curlbuild'curlbuild__2eh.in")
$ if cfile .eqs. ""
$ then
$ cfile = f$search("''base_curlbuild'curlbuild.h__2ein")
$ if cfile .eqs. ""
$ then
$ cfile = f$search("''base_curlbuild'curlbuild.h$5nin")
$ endif
$ endif
$ endif
$ endif
$ endif
$endif
$!
$if cfile .eqs. ""
$then
$ write sys$output "Can not find ''base_curlbuild'curlbuild.h.in"
$ line_out = "Looked for curlbuild.h.in, curlbuild.h_in, curlbuild.in, "
$ line_out = line_out + "curlbuild__2eh.in, curlbuild.h__2ein, "
$ line_out = line_out + "curlbuild.h$5nin"
$ write/symbol sys$output line_out
$ goto general_error
$endif
$!
$open/read inf 'cfile'
$do_comment = 0
$if_block = 0
$cfgh_in_loop1:
$!set nover
$ read/end=cfgh_in_loop1_end inf line_in
$ xline = f$edit(line_in,"TRIM,COMPRESS")
$!
$! Blank line handling
$!---------------------
$ if xline .eqs. ""
$ then
$ write tf ""
$ goto cfgh_in_loop1
$ endif
$ xlen = f$length(xline)
$ key = f$extract(0,2,xline)
$!
$! deal with comments by copying exactly
$!-----------------------------------------
$ if (do_comment .eq. 1) .or. (key .eqs. "/*")
$ then
$ do_comment = 1
$ write tf line_in
$ key = f$extract(xlen - 2, 2, xline)
$ if key .eqs. "*/" then do_comment = 0
$ goto cfgh_in_loop1
$ endif
$!
$! Some quick parsing
$!----------------------
$ keyif = f$extract(0,3,xline)
$ key1 = f$element(0," ",xline)
$ key2 = f$element(1," ",xline)
$ key2a = f$element(0,"_",key2)
$ key2b = f$element(1,"_",key2)
$ key2_len = f$length(key2)
$ key2_h = f$extract(key2_len - 2, 2, key2)
$ key2_t = f$extract(key2_len - 5, 5, key2)
$ if key2_t .eqs. "_TYPE" then key2_h = "_T"
$ key64 = 0
$ if f$locate("64", xline) .lt. xlen then key64 = 1
$!
$!write sys$output "xline = ''xline'"
$!
$ if key1 .nes. "#undef"
$ then
$ write tf line_in
$ goto cfgh_in_loop1
$ endif
$!
$! All versions of VMS have sys/types.h
$!----------------------------------------
$ if (key2 .eqs. "CURL_PULL_SYS_TYPES_H")
$ then
$ write tf "#define ''key2' 1"
$ goto cfgh_in_loop1
$ endif
$!
$! Most have sys/socket.h
$!-------------------------
$ if (key2 .eqs. "CURL_PULL_SYS_SOCKET_H")
$ then
$ write tf "#ifdef HAVE_SYS_SOCKET_H"
$ write tf "#define ''key2' 1"
$ write tf "#else"
$ write tf "#undef ''key2'"
$ write tf "#endif"
$ goto cfgh_in_loop1
$ endif
$!
$! VAX/VMS 7.3 does not have sys/poll.h
$!----------------------------------------
$ if (key2 .eqs. "CURL_PULL_SYS_POLL_H")
$ then
$ write tf "#ifdef HAVE_POLL_H"
$ write tf "#define ''key2' 1"
$ write tf "#else"
$ write tf "#undef ''key2'"
$ write tf "#endif"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_SIZEOF_LONG")
$ then
$ write tf "#define ''key2' SIZEOF_INT"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_SIZEOF_CURL_SOCKLEN_T")
$ then
$ write tf "#define ''key2' SIZEOF_INT"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_TYPEOF_CURL_SOCKLEN_T")
$ then
$ write tf "#define ''key2' size_t"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_TYPEOF_CURL_OFF_T")
$ then
$ write tf "#define ''key2' off_t"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_FORMAT_CURL_OFF_T")
$ then
$ write tf "#if (SIZEOF_OFF_T == 8)"
$ write tf "#define ''key2' ""lld"""
$ write tf "#else"
$ write tf "#define ''key2' ""ld"""
$ write tf "#endif"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_FORMAT_CURL_OFF_TU")
$ then
$ write tf "#if (SIZEOF_OFF_T == 8)"
$ write tf "#define ''key2' ""llu"""
$ write tf "#else"
$ write tf "#define ''key2' ""lu"""
$ write tf "#endif"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_FORMAT_OFF_T")
$ then
$ write tf "#if (SIZEOF_OFF_T == 8)"
$ write tf "#define ''key2' ""%lld"""
$ write tf "#else"
$ write tf "#define ''key2' ""%ld"""
$ write tf "#endif"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_SIZEOF_CURL_OFF_T")
$ then
$ write tf "#define ''key2' SIZEOF_OFF_T"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_SUFFIX_CURL_OFF_T")
$ then
$ write tf "#if (SIZEOF_OFF_T == 8)"
$ write tf "#define ''key2' LL"
$ write tf "#else"
$ write tf "#define ''key2' L"
$ write tf "#endif"
$ goto cfgh_in_loop1
$ endif
$!
$ if (key2 .eqs. "CURL_SUFFIX_CURL_OFF_TU")
$ then
$ write tf "#if (SIZEOF_OFF_T == 8)"
$ write tf "#define ''key2' ULL"
$ write tf "#else"
$ write tf "#define ''key2' UL"
$ write tf "#endif"
$ goto cfgh_in_loop1
$ endif
$!
$!
$!
$! If it falls through everything else, comment it out
$!-----------------------------------------------------
$ write tf "/* ", xline, " */"
$ goto cfgh_in_loop1
$cfgh_in_loop1_end:
$close inf
$close tf
$!
$! Exit and clean up
$!--------------------
$general_error:
$status = '$status'
$all_exit:
$set noon
$if f$trnlnm("tf","lnm$process",,"SUPERVISOR") .nes. "" then close tf
$if f$trnlnm("inf","lnm$process",,"SUPERVISOR") .nes. "" then close inf
$exit 'status'
$!
$!
$control_y:
$ status = ss_control_y
$ goto all_exit
$!
$!
$! gosub to write out a documentation header for config.h
$!----------------------------------------------------------------
$write_curlbuild_h_header:
$outfile = "sys$disk:[.include.curl]curlbuild.h"
$create 'outfile'
$open/append tf 'outfile'
$write tf -
"/* [.include.curl]curlbuild.h. Generated from curlbuild.h.in by */"
$write tf -
"/* ", my_proc_file, tab, datetime, tab, username, tab, " */"
$write tf ""
$return

View File

@ -128,6 +128,11 @@ $! Added missing slash in cc_full_list.
$! Removed unwanted extra quotes inside symbol tool_main $! Removed unwanted extra quotes inside symbol tool_main
$! for non-VAX architectures that triggered link failure. $! for non-VAX architectures that triggered link failure.
$! Replaced curl_sys_inc with sys_inc. $! Replaced curl_sys_inc with sys_inc.
$! 19-Mar-2013, John Malmberg
$! symbol tool_main needs to be quoted when parse style is
$! set to exended in versions of VMS greater than 7.3-1.
$! Remove curlbuild.h generation as it should be pre-built
$! in the curl release or daily tarball.
$! $!
$!=========================================================================== $!===========================================================================
$! $!
@ -198,6 +203,7 @@ $!
$! Define the architecture-specific product file destination directory $! Define the architecture-specific product file destination directory
$! name(s). $! name(s).
$! $!
$ parse_style = "TRADITIONAL"
$ if (f$getsyi("HW_MODEL") .lt. 1024) $ if (f$getsyi("HW_MODEL") .lt. 1024)
$ then $ then
$ arch_name = "VAX" $ arch_name = "VAX"
@ -205,6 +211,31 @@ $ else
$ arch_name = "" $ arch_name = ""
$ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE") $ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
$ if (arch_name .eqs. "") then arch_name = "UNK" $ if (arch_name .eqs. "") then arch_name = "UNK"
$!
$! Extended parsing option starts with VMS 7.3-1.
$! There is no 7.4, so that simplifies the parse a bit.
$!
$ node_swvers = f$getsyi("node_swvers")
$ version_patch = f$extract(1, f$length(node_swvers), node_swvers)
$ maj_ver = f$element(0, ".", version_patch)
$ min_ver_patch = f$element(1, ".", version_patch)
$ min_ver = f$element(0, "-", min_ver_patch)
$ patch = f$element(1, "-", min_ver_patch)
$ if patch .eqs. "-" then patch = ""
$ parse_x = 0
$ if maj_ver .ges. "8"
$ then
$ parse_x = 1
$ else
$ if maj_ver .eqs. "7" .and. min_ver .ges. "3" .and. patch .nes. ""
$ then
$ parse_x = 1
$ endif
$ endif
$ if parse_x
$ then
$ parse_style = f$getjpi("", "parse_style_perm")
$ endif
$ endif $ endif
$! $!
$ exedir = proc_dev_dir - delim + ".''arch_name'" + delim $ exedir = proc_dev_dir - delim + ".''arch_name'" + delim
@ -275,8 +306,6 @@ $ if (f$search(prods) .nes. "") then set prot=o:rwed 'prods'
$ if (f$search(prods) .nes. "") then delete /log 'prods' $ if (f$search(prods) .nes. "") then delete /log 'prods'
$ file = "[]config_vms.h" $ file = "[]config_vms.h"
$ if f$search(file) .nes. "" then delete/log 'file';* $ if f$search(file) .nes. "" then delete/log 'file';*
$ file = "[.include.curl]curlbuild.h"
$ if f$search(file) .nes. "" then delete/log 'file';*
$ file = "[.lib]config_vms.h" $ file = "[.lib]config_vms.h"
$ if f$search(file) .nes. "" then delete/log 'file';* $ if f$search(file) .nes. "" then delete/log 'file';*
$ goto Common_Exit $ goto Common_Exit
@ -654,15 +683,6 @@ $! set nover
$endif $endif
$! $!
$! $!
$write sys$output "Creating the new curlbuild.h"
$new_conf = f$search("[.include.curl]curlbuild.h")
$if new_conf .eqs. ""
$then
$! set ver
$ @'proc_dev_dir'build_curlbuild_h.com
$! set nover
$endif
$!
$! $!
$ on control_y then goto Common_Exit $ on control_y then goto Common_Exit
$! $!
@ -727,13 +747,17 @@ $!
$! If we are not on VAX, then we want the debug symbol table in $! If we are not on VAX, then we want the debug symbol table in
$! a separate file. $! a separate file.
$! VAX needs the tool_main unquoted in uppercase, $! VAX needs the tool_main unquoted in uppercase,
$! Alpha and IA64 need tool_main quoted in exact case. $! Alpha and IA64 need tool_main quoted in exact case when parse style is
$! extended.
$ link_dsf1 = "" $ link_dsf1 = ""
$ link_dsf2 = "" $ link_dsf2 = ""
$ tool_main = "tool_main" $ tool_main = "tool_main"
$ if arch_name .nes. "VAX" $ if arch_name .nes. "VAX"
$ then $ then
$ tool_main = "tool_main" $ if parse_style .eqs. "EXTENDED"
$ then
$ tool_main = """tool_main"""
$ endif
$ link_dsf1 = "/dsf=" + exedir + "CURL.DSF" $ link_dsf1 = "/dsf=" + exedir + "CURL.DSF"
$ link_dsf2 = "/dsf=" + exedir + "CURL_DEBUG.DSF" $ link_dsf2 = "/dsf=" + exedir + "CURL_DEBUG.DSF"
$ endif $ endif