OpenVMS Source Code Demos

mysql_demo_alt

$!=======================================================================================
$! title    : mysql_demo_alt.com (build script for my "mysql" demo programs)
$! author   : Neil Rieck ( https://neilrieck.net MAILTO:n.rieck@bell.net )
$!	    : Waterloo, Ontario, Canada.
$! platform : OpenVMS 8.4 for Itanium or Alpha
$! notes    : 1) MariaDB is an alternate fork of MySQL
$!	      2) your OpenVMS system will have one of three TCPIP stacks: MultiNet,
$!		 TCPIP Services, and TCPware which place different include files in
$!		 sys$library. The cleanest compile comes from MultiNet
$!	      3) Mark's object libraries require that you link against ssl and crypto
$!		 with mixed-case names (libraries from HP/HPE have upcased names)
$!	      4) always reference zlib (or libz) before the ssl and crypto libraries
$!	      5) my c-only demo programs are numbered 01-09
$!	      6) my BASIC-c hybrids      are numbered 11-19
$! 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 (will never work)
$! 20171123 NSR this script can now build all my demos
$! 20180412 NSR this script is now much smaller
$! 20180416 NSR now include a wrapper for small foot-print executables (a deleted bad idea)
$! 20180424 NSR added support for SSL_LIBSSL_SHR32.EXE (my mixed-case build of OpenSSL-1.0.2a)
$!================================================================================================
$	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 version number was detected"
$		say "-i-usage: @mysql_demo xx (where xx = version)"
$		say "-i-generating a directory listing""
$		say "=========================================================="
$		dir/col=1/width=file=52/nohead/notrail/date mysql_demo*.c;,mysql_demo*.bas;
$		savedstatus = $STATUS
$		if ((f$integer(savedstatus).and.7).ne.1)
$		then
$			say "-w-oops, none found"
$			exit
$		endif
$		say ""
$		ask junk "build which project number? (eg. 01) "
$		if (junk .eqs. "") then goto fini
$		p1 = junk
$	endif
$	if f$length(p1).eq.1 then p1 = "0"+p1					!
$	if (p1 .ges. "01") .and. (p1 .les. "09")				!
$	then									!
$		hybrid = 0							! not a hybrid
$		pgm_c = "mysql_demo"+p1						! c-program
$		app   = "mysql_demo"+p1						!
$		goto got_name							!
$	endif									!
$	if (p1 .ge. "10") .and. (p1 .le. "19")					!
$	then									!
$		hybrid = 1							! hybrid program
$		pgm_b = "mysql_demo"+p1						! BASIC program
$		app   = "mysql_demo"+p1						!
$		pgm_c = "mysql_api_demo"+p1					! c-based API
$		goto got_name							!
$	endif									!
$	say "-e-processing cannot continue with p1 = (",p1,")"			!
$	exit									!
$!
$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]
$!
$	if (hybrid.eq.1)
$	then
$		say "-i-BASIC compiling: ",pgm_b,".bas"
$		wait 0:0:01
$		basic	'pgm_b'.bas
$		wait 0:0:01
$	endif
$	say "-i-C compiling: ",pgm_c,".c"
$	wait 0:0:01
$	cc	'pgm_c'.c				-
		/pointer=32				-
		/float=ieee				-
		/ieee=denorm				-
		/name=(as_is,shorten)			-
		/prefix_library_entries=all_entries	-
		/include=mysql055_root:[include.mysql]
$	set noon
$!===============================================================
$!	now generate a build script to cobble everything together
$!===============================================================
$	build_script = app +".bld_scratch"
$	if f$search(build_script.nes."") then	delete/nolog 'build_script';*
$	open/write  my_bld  'build_script'
$	write my_bld	"$link -"
$	if (hybrid.eq.1)
$	then
$		write my_bld    pgm_b,	".obj, ",	pgm_c,".obj	-"
$	else
$		write my_bld	pgm_c,".obj	-"
$	endif
$	write my_bld	" /MAP		-"
$	write my_bld	" /NOinformationals	-"
$	write my_bld	" , sys$input/opt"
$	write my_bld	" ",path,"libclientlib.olb/library"
$!~	write my_bld	" ",path,"libdbug.olb/library"		! debug
$	write my_bld	" ",path,"libmysys.olb/library"
$!~	write my_bld	" ",path,"libsql.olb/library"		! not required
$	write my_bld	" ",path,"libstrings.olb/library"
$	write my_bld	" ",path,"libvio.olb/library"
$!
$	say "-i-ALERT: SSL will not work with SMALL"
$	ask junk "footprint: large,medium,small? (L/M/S,default=L) "
$	if ((junk.eqs."L").or.(junk.eqs.""))
$	then
$		write my_bld	" ",path,"libz.olb/library"
$!		these two files are libraries by Mark Berryman
$!		they have mixed-case names
$		write my_bld	" ",path,"ssl_libssl32.olb/library"
$		write my_bld	" ",path,"ssl_libcrypto32.olb/library"
$		goto finish_build
$	endif
$	if (junk.eqs."M")
$	then
$		write my_bld	" ",path,"libz.olb/library"
$!		these two files are custom libraries I built from OpenSSL sources
$!		they have mixed-case names
$		write my_bld	" ","sys$share:SSL_LIBSSL_SHR32.EXE/share"
$		write my_bld	" ","sys$share:SSL_LIBCRYPTO_SHR32.EXE/share"
$		goto finish_build
$	endif
$!
$!	find the zlib (shares will generate a smaller footprint)
$!
$	zlib	= ""					! init
$	junk = f$search("sys$share:libzshr.exe")	! from a third-party source
$	if (junk.nes."") then zlib = junk + "/share"
$	junk = f$search("sys$share:gnv$libzshr32.exe")	! from vmsports at sourceforge.net
$	if (junk.nes."") then zlib = junk + "/share"
$	junk = f$search(path +"libz.olb")		!  provided with mariadb-5.5-57
$	if (junk.nes."") then zlib = junk + "/library"
$	if (zlib.nes."")
$	then
$		write my_bld	" ",zlib
$	else
$		say "-e-oops. ZLIB could not be found"
$		wait 0:0:02
$	endif
$!
$!	find the ssl libraries (shares will generate a smaller footprint)
$!
$	slib = ""						! init
$!~~~	junk = f$search(path +"libyassl.olb")			! provided with mariadb-5.5-25
$!~~~	if (junk.nes."") then	slib = junk + "/library"
$	junk = f$search(path +"ssl_libssl32.olb")		! provided with mariadb-5.5-57
$	if (junk.nes."") then	slib = junk + "/library"
$ if (1.eq.0)							! permanently disabled
$ then
$	junk = f$search("sys$share:ssl$libssl_shr32.exe")	! upcase names
$	if (junk.nes."") then   slib = junk + "/share"
$	junk = f$search("sys$share:ssl1$libssl_shr32.exe")	! upcase names
$	if (junk.nes."") then   slib = junk + "/share"
$ endif
$	junk = f$search("sys$share:ssl_libssl_shr32.exe")	! mixed-case names
$	if (junk.nes."") then   slib = junk + "/share"
$	if (slib.nes."")
$	then
$		write my_bld	" ",slib
$	else
$		say "-e-oops. An SSL library could not be found"
$		wait 0:0:02
$	endif
$!
$!	find the crypro libraries (shares will generate a smaller footprint)
$!
$	clib = ""					! init
$	junk = f$search(path +"ssl_libcrypto32.olb")	! provided with mariadb-5.5-57
$	if (junk.nes."") then	clib = junk + "/library"
$ if (1.eq.0)							! permanently disabled
$ then
$	junk = f$search("sys$share:ssl$libcrypto_shr32.exe")	! upcase names
$	if (junk.nes."") then   clib = junk + "/share"
$	junk = f$search("sys$share:ssl1$libcrypto_shr32.exe")	! upcase names
$	if (junk.nes."") then   clib = junk + "/share"
$ endif
$	junk = f$search("sys$share:ssl_libcrypto_shr32.exe")	! mixed-case names
$	if (junk.nes."") then   clib = junk + "/share"
$	if (clib.nes."")
$	then
$		write my_bld	" ",clib
$	else
$		say "-e-oops. A CRYPTO library could not be found"
$		wait 0:0:02
$	endif
$!
$!	build the wrapper
$!
$ if (1.eq.0)						! a bad idea
$ then
$	wlib = ""
$	cc/names=as_is	MYSQL_SHRLIB_WRAPPER.c
$	junk = f$search("MYSQL_SHRLIB_WRAPPER.obj")
$	if (junk.nes."") then wlib = junk
$	if (wlib.nes."")
$	then
$		write my_bld    " ",wlib
$	else
$		say "-e-oops. A library wrapper could not be found"
$		wait 0:0:02
$	endif
$ endif
$finish_build:
$	close my_bld
$	say "-i-linking"
$	@'build_script'
$	savedstatus = $status
$	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).eq.0)
$	then
$		say "-i-there were NO LINKER errors"
$		say "-i-you can ignore LINKER warnings if they pertain to SSL (and you are not using SSL)"
$		say "-i-look what I just built:"
$		say "==============================================================="
$		dir/col=1/date/width=file=50/nohead/notrail/since="-0 0:0:10" 'app'*.exe;/siz
$		say "==============================================================="
$	endif
$
$fini:
$	set noon
$	say "-i-exiting script"
$	exit

home Back to Home
Neil Rieck
Waterloo, Ontario, Canada.