OpenVMS Source-Code Demos

mysql_demo

$!=======================================================================================
$! title    : mysql_demo.com (build script for my "mysql" demo programs)
$! author   : Neil Rieck ( http://neilrieck.net MAILTO:n.rieck@sympatico.ca )
$!	    : 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) Linking 5.5-25 is noisy on Alpha but not Itanium
$!	      4) All linking on 5.5-57 + 58 is quiet when using Mark's provided libraries
$!		 but can be noisy when using OpenVMS libraries so ignore linker warnings
$!	      5) demo programs numbered 01-09 are c-only
$!	      6) demo programs numbered 11-19 are BASIC-c hybrid programs
$! platforms: variation-1 (2014) -----------------------------------------------
$!		MariaDB-5.5-25
$!		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 SSL_LIBSSL32.OLB (provided)	-or-
$!		c)	sys$share:SSL$LIBSSL_SHR32.EXE	-or-
$!		d)	sys$share:SSL1$LIBSSL_SHR32.EXE
$! 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
$! 20171123 NSR this is now a much simpler common build script
$!================================================================================================
$	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									!
$		pgm1 = "mysql_demo"+p1						! c-program
$		hybrid = 0							! not a hybrid
$		goto got_name							!
$	endif									!
$	if (p1 .ge. "10") .and. (p1 .le. "19")					!
$	then									!
$		pgm1 = "mysql_demo"+p1						! BASIC program
$		pgm2 = "mysql_api_demo"+p1					! c-program
$		hybrid = 1							! hybrid
$		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.0)
$	then
$		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]
$	else
$		say "-i-BASIC compiling: ",pgm1,".bas"
$		wait 0:0:01
$		basic	'pgm1'.bas
$		say "-i-C compiling: ",pgm2,".c"
$		wait 0:0:01
$		cc	'pgm2'.c/float=ieee			-
			/ieee=denorm				-
			/name=(as_is,shorten)			-
			/include=mysql055_root:[include.mysql]
$	endif
$	set noon
$!
$!	now generate a build script to cobble everything thing together
$!
$	build_file = pgm1+".scratch"
$	if (build_file.nes."") then	delete/nolog 'build_file';*
$!
$	open/write  bld  'build_file'
$	write bld	"$link ",pgm1,".obj/selective -"
$	if (hybrid.eq.1)
$	then
$		write bld    " ,",pgm2,".obj/selective -"
$	endif
$	write bld	" /NOinformationals -"
$	write bld	" , sys$input/opt"
$	write bld	" ",path,"libclientlib.olb/library"
$	write bld	" ",path,"libdbug.olb/library"
$	write bld	" ",path,"libmysys.olb/library"
$	write bld	" ",path,"libsql.olb/library"
$	write bld	" ",path,"libstrings.olb/library"
$	write bld	" ",path,"libvio.olb/library"
$	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 so using variation: ",variation
$!		this version will require YASSL (yet-another-ssl)
$		write bld	" ",path,"libyassl.olb/library"
$		write bld	" sys$share:LIBZSHR.EXE/share"
$		close bld
$	else
$		variation = 2017
$		say "-i-detected: SSL_LIBSSL32.OLB so using variation: ",variation
$!		note:	using "/share" will generate smaller programs while
$!			using "/library" will generate larger programs
$		ssl_recipe = 0
$		if f$search(path +"SSL_LIBSSL32.OLB")		.nes."" then ssl_recipe = 1
$		if f$search("sys$share:SSL$LIBSSL_SHR32.EXE")	.nes."" then ssl_recipe = 2
$		if f$search("sys$share:SSL1$LIBSSL_SHR32.EXE")	.nes."" then ssl_recipe = 3
$		if (ssl_recipe.eq.1)
$		then
$			write bld	" ",path,"SSL_LIBSSL32.OLB/library"
$			write bld	" ",path,"SSL_LIBCRYPTO32.OLB/library"
$		endif
$		if (ssl_recipe.eq.2)
$		then
$			write bld	" sys$share:SSL$LIBSSL_SHR32.EXE/share
$			write bld	" sys$share:SSL$LIBCRYPTO_SHR32.EXE/share
$		endif
$		if (ssl_recipe.eq.3)
$		then
$			write bld	" sys$share:SSL1$LIBSSL_SHR32.EXE/share"
$			write bld	" sys$share:SSL1$LIBCRYPTO_SHR32.EXE/share"
$		endif
$		libz_recipe = 0
$		if f$search(path+"LIBZ.OLB").nes.""		then libz_recipe = 1
$		if f$search("sys$share:LIBZSHR.EXE").nes.""	then libz_recipe = 2
$		if libz_recipe .eq. 0
$		then
$			say "-w-oops, could not find LIBZ"
$			wait 0:0:01
$		endif
$		if libz_recipe .eq. 1 then	write bld	" ",path,"LIBZ.OLB"
$		if libz_recipe .eq. 2 then	write bld	" sys$share:LIBZSHR.EXE/share"
$		close bld
$	endif
$	say "-i-linking"
$	@'build_file'
$	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).ne.6)
$	then
$		say "-i-there were NO LINKER errors"
$		say "-i-look what I just built:"
$		say "==============================================================="
$		dir/col=1/date/width=file=50/nohead/notrail/since="-0 0:0:10" 'pgm1'*.exe;
$		say "==============================================================="
$	endif
$fini:
$	set noon
$	say "-i-exiting script"
$	exit

left hand Back to OpenVMS
left hand Back to OpenVMS Demo Index
home Back to Home
Neil Rieck
Kitchener - Waterloo - Cambridge, Ontario, Canada.