OpenVMS Source Code Demos
mysql_demo0x
$!==============================================================================
$! title : mysql_demo0x.com (build script for mysql demo programs 01-09)
$! author : Neil Rieck (https://neilrieck.net)
$! : Waterloo, Ontario, Canada.
$! platforms: variation-1 (2014) -----------------------------------------------
$! MariaDB-5.5-25 on OpenVMS-8.4
$! a) requires an up-to-date version of zlib (1.2.6 or higher)
$! http://fafner.dyndns.org/~alexey/libsdl/ZLIB-1_2_7.ZIP
$! b) links to LIBYASSL.OLB (yet-another-ssl)
$! : variation-2 (2017) -----------------------------------------------
$! MariaDB-5.5-57 and MariaDB-5.5-58
$! a) links to LIBZ.OLB (provided)
$! b) links to sys$share:SSL$LIBSSL_SHR32.EXE -or-
$! c) links to sys$share:SSL1$LIBSSL_SHR32.EXE -or-
$! d) links to SSL_LIBSSL32.OLB (provided)
$! notes : 1) MariaDB is an alternate fork of MySQL
$! 2) your OpenVMS system will have one of three TCPIP stacks
$! (MultiNet, TCPIP Services, TCPware) which place different
$! include files in sys$library. The cleanest compile comes
$! from MultiNet
$! 3) Linking 5.5-25 is noisy on Alpha but not on Itanium
$! when who what
$! 20140120 NSR a build script for my MariaDB-5.5-25 demo programs (Alpha only)
$! 20170419 NSR added additional support for Itanium
$! 20171031 NSR added support for MariaDB-5.5-57 and MariaDB-5.5-58
$! 20171103 NSR added support for SSL$LIBSSL_SHR32.EXE and SSL1$LIBSSL_SHR32.EXE
$!==============================================================================
$ say :== write sys$output !
$ ask :== inquire/nopunct !
$ on error then goto fini !
$ set on !
$ say "=========================================================="
$ say "-i-script:",f$environment("procedure")
$ say " (a build script for MySQL/MariaDB client demos on OpenVMS)"
$ if P1 .eqs. ""
$ then
$ say "-w-oops, no 'c' program specified as P1"
$ say "-i-usage: @mysql_demo0x program.c"
$ say "-i-looking for filenames of the form: mysql_demo0*.c"
$ say "=========================================================="
$ dir/col=1/width=file=52/nohead/notrail/date mysql_demo0*.c;
$ savedstatus = $STATUS
$ if ((f$integer(savedstatus).and.7).ne.1)
$ then
$ say "-w-oops, none found"
$ exit
$ endif
$ say ""
$ ask junk "build which file? "
$ if (junk .eqs. "") then goto fini
$ p1 = junk
$ endif
$!~~~ say p1
$ if (p1 .ges. "1") .and. (p1 .les. "9") !
$ then !
$ pgm1 = "mysql_demo0"+p1 !
$ goto got_name !
$ endif !
$ if (p1 .ges. "01") .and. (p1 .les. "09") !
$ then !
$ pgm1 = "mysql_demo"+p1 !
$ goto got_name !
$ endif !
$ if (p1 .ge. "10") .and. (p1 .le. "99") !
$ then !
$ say "-e-error, this script won't build demos above 9" !
$ exit !
$ endif !
$ if f$length(p1).ge.3 ! mysql_demo01.c
$ then !
$ pgm1 = f$parse(p1,,,"NAME") !
$ say pgm1 !
$ say f$locate("mysql_demo0",pgm1) !
$ if (f$locate("MYSQL_DEMO0",pgm1).ne.0) !
$ then !
$ say "-e-can't build a program with this name(a)"
$ exit !
$ endif !
$ goto got_name !
$ else !
$ say "-e-can't build a program with this name(b)"
$ exit !
$ endif !
$got_name:
$ arch = f$getsyi("ARCH_NAME") !
$ path = f$trnlnm("mysql055_root") ! eg. KAWC90$DKB1:[MYSQL055.]
$ path = path - "]" !
$ path = path + "lib."'arch'"]" ! eg. KAWC09$DKB1:[MYSQL055.lib.ia64]
$!
$! create a logical because LINK "sys$input/opt" does not support DCL symbol substitution
$!
$ def/process logical_path 'path' ! linker requires logicals (not symbols)
$!
$ say "-i-C compiling: ",pgm1,".c"
$ wait 0:0:01
$cc 'pgm1'.c/float=ieee -
/ieee=denorm -
/name=(as_is,shorten) -
/include=mysql055_root:[include.mysql]
$ set noon
$ junk = f$search(path +"SSL_LIBSSL32.OLB") ! provided with 57 + 58
$ if (junk.eqs."")
$ then
$ variation = 2014
$ say "-i-did not detect: SSL_LIBSSL32.OLB"
$ else
$ variation = 2017
$ say "-i-detected: SSL_LIBSSL32.OLB"
$ endif
$ say "-i-linking ",pgm1,".obj"," using variation ",variation
$ wait 0:0:01
$ if variation.eq.2014 ! 5.5-25
$ then
$ link 'pgm1'.obj/selective -
/NOinformationals -
, sys$input/opt
logical_path:libclientlib.olb/library
logical_path:libdbug.olb/library
logical_path:libmysys.olb/library
logical_path:libsql.olb/library
logical_path:libstrings.olb/library
logical_path:libvio.olb/library
logical_path:libyassl.olb/library
sys$share:LIBZSHR.EXE/share
$ savedstatus = $status
$ endif
$ if variation.eq.2017 ! 57 + 58
$ then
$ ask junk "linker recipe? (1-3, 0=auto) " !
$ recipe = 0 !
$ recipe = f$integer(junk) !
$ if (recipe.lt.0).or.(recipe.gt.3) then recipe = 0 !
$ if (recipe.ne.0) then goto have_recipe !
$ recipe = 1 ! default
$ if f$search("sys$share:SSL$LIBSSL_SHR32.EXE") .nes."" then recipe = 2
$ if f$search("sys$share:SSL1$LIBSSL_SHR32.EXE") .nes."" then recipe = 3
$have_recipe:
$ say "-i-linking via recipe: ",recipe
$ wait 0:0:01
$ if recipe.eq.1
$ then
$ link 'pgm1'.obj/selective -
/NOinformationals -
, sys$input/opt
logical_path:libclientlib.olb/library
logical_path:libdbug.olb/library
logical_path:libmysys.olb/library
logical_path:libsql.olb/library
logical_path:libstrings.olb/library
logical_path:libvio.olb/library
logical_path:SSL_LIBSSL32.OLB/library
logical_path:SSL_LIBCRYPTO32.OLB/library
logical_path:LIBZ.OLB/library
$ savedstatus = $status
$ endif
$ if recipe.eq.2
$ then
$ link 'pgm1'.obj/selective -
/NOinformationals -
, sys$input/opt
logical_path:libclientlib.olb/library
logical_path:libdbug.olb/library
logical_path:libmysys.olb/library
logical_path:libsql.olb/library
logical_path:libstrings.olb/library
logical_path:libvio.olb/library
sys$share:SSL1$LIBSSL_SHR32.EXE/share
sys$share:SSL1$LIBCRYPTO_SHR32.EXE/share
logical_path:LIBZ.OLB/library
$ savedstatus = $status
$ endif
$ if recipe.eq.3
$ then
$ link 'pgm1'.obj/selective -
/NOinformationals -
, sys$input/opt
logical_path:libclientlib.olb/library
logical_path:libdbug.olb/library
logical_path:libmysys.olb/library
logical_path:libsql.olb/library
logical_path:libstrings.olb/library
logical_path:libvio.olb/library
sys$share:SSL$LIBSSL_SHR32.EXE/share
sys$share:SSL$LIBCRYPTO_SHR32.EXE/share
sys$share:LIBZSHR.EXE/share
$ savedstatus = $status
$ endif
$ endif
$ say "-i-linking without MMK is sometimes noisy so here is a summary:"
$ say "-i-exit status: ",savedstatus
$ if ((savedstatus .and. 1).eq.0) then say "-i-there were LINKER warnings"
$ if ((savedstatus .and. 2).eq.2) then say "-i-there were LINKER errors"
$ if ((savedstatus .and. 4).eq.4) then say "-i-there were LINKER fatals"
$ if ((savedstatus .and. 6).ne.6)
$ then
$ say "-i-there were NO LINKER errors"
$ say "-i-look what I built:"
$ say "==============================================================="
$ dir/col=1/date/width=file=50/nohead/notrail/since="-0 0:0:59" 'pgm1'*.exe;
$ say "==============================================================="
$ endif
$fini:
$ set noon
$ yada = ""
$ yada = f$trnlnm("logical_path")
$ if (f$length(yada).gt.0) then deas/process logical_path
$ say "-i-exiting script"
$ exit
Back to
Home
Neil Rieck
Waterloo, Ontario, Canada.