annotate src/zlib-1.2.8/make_vms.com @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 5ea0608b923f
children
rev   line source
Chris@43 1 $! make libz under VMS written by
Chris@43 2 $! Martin P.J. Zinser
Chris@43 3 $!
Chris@43 4 $! In case of problems with the install you might contact me at
Chris@43 5 $! zinser@zinser.no-ip.info(preferred) or
Chris@43 6 $! martin.zinser@eurexchange.com (work)
Chris@43 7 $!
Chris@43 8 $! Make procedure history for Zlib
Chris@43 9 $!
Chris@43 10 $!------------------------------------------------------------------------------
Chris@43 11 $! Version history
Chris@43 12 $! 0.01 20060120 First version to receive a number
Chris@43 13 $! 0.02 20061008 Adapt to new Makefile.in
Chris@43 14 $! 0.03 20091224 Add support for large file check
Chris@43 15 $! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite
Chris@43 16 $! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in
Chris@43 17 $! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new exmples
Chris@43 18 $! subdir path, update module search in makefile.in
Chris@43 19 $! 0.07 20120115 Triggered by work done by Alexey Chupahin completly redesigned
Chris@43 20 $! shared image creation
Chris@43 21 $! 0.08 20120219 Make it work on VAX again, pre-load missing symbols to shared
Chris@43 22 $! image
Chris@43 23 $! 0.09 20120305 SMS. P1 sets builder ("MMK", "MMS", " " (built-in)).
Chris@43 24 $! "" -> automatic, preference: MMK, MMS, built-in.
Chris@43 25 $!
Chris@43 26 $ on error then goto err_exit
Chris@43 27 $!
Chris@43 28 $ true = 1
Chris@43 29 $ false = 0
Chris@43 30 $ tmpnam = "temp_" + f$getjpi("","pid")
Chris@43 31 $ tt = tmpnam + ".txt"
Chris@43 32 $ tc = tmpnam + ".c"
Chris@43 33 $ th = tmpnam + ".h"
Chris@43 34 $ define/nolog tconfig 'th'
Chris@43 35 $ its_decc = false
Chris@43 36 $ its_vaxc = false
Chris@43 37 $ its_gnuc = false
Chris@43 38 $ s_case = False
Chris@43 39 $!
Chris@43 40 $! Setup variables holding "config" information
Chris@43 41 $!
Chris@43 42 $ Make = "''p1'"
Chris@43 43 $ name = "Zlib"
Chris@43 44 $ version = "?.?.?"
Chris@43 45 $ v_string = "ZLIB_VERSION"
Chris@43 46 $ v_file = "zlib.h"
Chris@43 47 $ ccopt = "/include = []"
Chris@43 48 $ lopts = ""
Chris@43 49 $ dnsrl = ""
Chris@43 50 $ aconf_in_file = "zconf.h.in#zconf.h_in#zconf_h.in"
Chris@43 51 $ conf_check_string = ""
Chris@43 52 $ linkonly = false
Chris@43 53 $ optfile = name + ".opt"
Chris@43 54 $ mapfile = name + ".map"
Chris@43 55 $ libdefs = ""
Chris@43 56 $ vax = f$getsyi("HW_MODEL").lt.1024
Chris@43 57 $ axp = f$getsyi("HW_MODEL").ge.1024 .and. f$getsyi("HW_MODEL").lt.4096
Chris@43 58 $ ia64 = f$getsyi("HW_MODEL").ge.4096
Chris@43 59 $!
Chris@43 60 $! 2012-03-05 SMS.
Chris@43 61 $! Why is this needed? And if it is needed, why not simply ".not. vax"?
Chris@43 62 $!
Chris@43 63 $!!! if axp .or. ia64 then set proc/parse=extended
Chris@43 64 $!
Chris@43 65 $ whoami = f$parse(f$environment("Procedure"),,,,"NO_CONCEAL")
Chris@43 66 $ mydef = F$parse(whoami,,,"DEVICE")
Chris@43 67 $ mydir = f$parse(whoami,,,"DIRECTORY") - "]["
Chris@43 68 $ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type")
Chris@43 69 $!
Chris@43 70 $! Check for MMK/MMS
Chris@43 71 $!
Chris@43 72 $ if (Make .eqs. "")
Chris@43 73 $ then
Chris@43 74 $ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
Chris@43 75 $ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
Chris@43 76 $ else
Chris@43 77 $ Make = f$edit( Make, "trim")
Chris@43 78 $ endif
Chris@43 79 $!
Chris@43 80 $ gosub find_version
Chris@43 81 $!
Chris@43 82 $ open/write topt tmp.opt
Chris@43 83 $ open/write optf 'optfile'
Chris@43 84 $!
Chris@43 85 $ gosub check_opts
Chris@43 86 $!
Chris@43 87 $! Look for the compiler used
Chris@43 88 $!
Chris@43 89 $ gosub check_compiler
Chris@43 90 $ close topt
Chris@43 91 $ close optf
Chris@43 92 $!
Chris@43 93 $ if its_decc
Chris@43 94 $ then
Chris@43 95 $ ccopt = "/prefix=all" + ccopt
Chris@43 96 $ if f$trnlnm("SYS") .eqs. ""
Chris@43 97 $ then
Chris@43 98 $ if axp
Chris@43 99 $ then
Chris@43 100 $ define sys sys$library:
Chris@43 101 $ else
Chris@43 102 $ ccopt = "/decc" + ccopt
Chris@43 103 $ define sys decc$library_include:
Chris@43 104 $ endif
Chris@43 105 $ endif
Chris@43 106 $!
Chris@43 107 $! 2012-03-05 SMS.
Chris@43 108 $! Why /NAMES = AS_IS? Why not simply ".not. vax"? And why not on VAX?
Chris@43 109 $!
Chris@43 110 $ if axp .or. ia64
Chris@43 111 $ then
Chris@43 112 $ ccopt = ccopt + "/name=as_is/opt=(inline=speed)"
Chris@43 113 $ s_case = true
Chris@43 114 $ endif
Chris@43 115 $ endif
Chris@43 116 $ if its_vaxc .or. its_gnuc
Chris@43 117 $ then
Chris@43 118 $ if f$trnlnm("SYS").eqs."" then define sys sys$library:
Chris@43 119 $ endif
Chris@43 120 $!
Chris@43 121 $! Build a fake configure input header
Chris@43 122 $!
Chris@43 123 $ open/write conf_hin config.hin
Chris@43 124 $ write conf_hin "#undef _LARGEFILE64_SOURCE"
Chris@43 125 $ close conf_hin
Chris@43 126 $!
Chris@43 127 $!
Chris@43 128 $ i = 0
Chris@43 129 $FIND_ACONF:
Chris@43 130 $ fname = f$element(i,"#",aconf_in_file)
Chris@43 131 $ if fname .eqs. "#" then goto AMISS_ERR
Chris@43 132 $ if f$search(fname) .eqs. ""
Chris@43 133 $ then
Chris@43 134 $ i = i + 1
Chris@43 135 $ goto find_aconf
Chris@43 136 $ endif
Chris@43 137 $ open/read/err=aconf_err aconf_in 'fname'
Chris@43 138 $ open/write aconf zconf.h
Chris@43 139 $ACONF_LOOP:
Chris@43 140 $ read/end_of_file=aconf_exit aconf_in line
Chris@43 141 $ work = f$edit(line, "compress,trim")
Chris@43 142 $ if f$extract(0,6,work) .nes. "#undef"
Chris@43 143 $ then
Chris@43 144 $ if f$extract(0,12,work) .nes. "#cmakedefine"
Chris@43 145 $ then
Chris@43 146 $ write aconf line
Chris@43 147 $ endif
Chris@43 148 $ else
Chris@43 149 $ cdef = f$element(1," ",work)
Chris@43 150 $ gosub check_config
Chris@43 151 $ endif
Chris@43 152 $ goto aconf_loop
Chris@43 153 $ACONF_EXIT:
Chris@43 154 $ write aconf ""
Chris@43 155 $ write aconf "/* VMS specifics added by make_vms.com: */"
Chris@43 156 $ write aconf "#define VMS 1"
Chris@43 157 $ write aconf "#include <unistd.h>"
Chris@43 158 $ write aconf "#include <unixio.h>"
Chris@43 159 $ write aconf "#ifdef _LARGEFILE"
Chris@43 160 $ write aconf "# define off64_t __off64_t"
Chris@43 161 $ write aconf "# define fopen64 fopen"
Chris@43 162 $ write aconf "# define fseeko64 fseeko"
Chris@43 163 $ write aconf "# define lseek64 lseek"
Chris@43 164 $ write aconf "# define ftello64 ftell"
Chris@43 165 $ write aconf "#endif"
Chris@43 166 $ write aconf "#if !defined( __VAX) && (__CRTL_VER >= 70312000)"
Chris@43 167 $ write aconf "# define HAVE_VSNPRINTF"
Chris@43 168 $ write aconf "#endif"
Chris@43 169 $ close aconf_in
Chris@43 170 $ close aconf
Chris@43 171 $ if f$search("''th'") .nes. "" then delete 'th';*
Chris@43 172 $! Build the thing plain or with mms
Chris@43 173 $!
Chris@43 174 $ write sys$output "Compiling Zlib sources ..."
Chris@43 175 $ if make.eqs.""
Chris@43 176 $ then
Chris@43 177 $ if (f$search( "example.obj;*") .nes. "") then delete example.obj;*
Chris@43 178 $ if (f$search( "minigzip.obj;*") .nes. "") then delete minigzip.obj;*
Chris@43 179 $ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
Chris@43 180 adler32.c zlib.h zconf.h
Chris@43 181 $ CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
Chris@43 182 compress.c zlib.h zconf.h
Chris@43 183 $ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
Chris@43 184 crc32.c zlib.h zconf.h
Chris@43 185 $ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
Chris@43 186 deflate.c deflate.h zutil.h zlib.h zconf.h
Chris@43 187 $ CALL MAKE gzclose.OBJ "CC ''CCOPT' gzclose" -
Chris@43 188 gzclose.c zutil.h zlib.h zconf.h
Chris@43 189 $ CALL MAKE gzlib.OBJ "CC ''CCOPT' gzlib" -
Chris@43 190 gzlib.c zutil.h zlib.h zconf.h
Chris@43 191 $ CALL MAKE gzread.OBJ "CC ''CCOPT' gzread" -
Chris@43 192 gzread.c zutil.h zlib.h zconf.h
Chris@43 193 $ CALL MAKE gzwrite.OBJ "CC ''CCOPT' gzwrite" -
Chris@43 194 gzwrite.c zutil.h zlib.h zconf.h
Chris@43 195 $ CALL MAKE infback.OBJ "CC ''CCOPT' infback" -
Chris@43 196 infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
Chris@43 197 $ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
Chris@43 198 inffast.c zutil.h zlib.h zconf.h inffast.h
Chris@43 199 $ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
Chris@43 200 inflate.c zutil.h zlib.h zconf.h infblock.h
Chris@43 201 $ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
Chris@43 202 inftrees.c zutil.h zlib.h zconf.h inftrees.h
Chris@43 203 $ CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
Chris@43 204 trees.c deflate.h zutil.h zlib.h zconf.h
Chris@43 205 $ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
Chris@43 206 uncompr.c zlib.h zconf.h
Chris@43 207 $ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
Chris@43 208 zutil.c zutil.h zlib.h zconf.h
Chris@43 209 $ write sys$output "Building Zlib ..."
Chris@43 210 $ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
Chris@43 211 $ write sys$output "Building example..."
Chris@43 212 $ CALL MAKE example.OBJ "CC ''CCOPT' [.test]example" -
Chris@43 213 [.test]example.c zlib.h zconf.h
Chris@43 214 $ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
Chris@43 215 $ write sys$output "Building minigzip..."
Chris@43 216 $ CALL MAKE minigzip.OBJ "CC ''CCOPT' [.test]minigzip" -
Chris@43 217 [.test]minigzip.c zlib.h zconf.h
Chris@43 218 $ call make minigzip.exe -
Chris@43 219 "LINK minigzip,libz.olb/lib" -
Chris@43 220 minigzip.obj libz.olb
Chris@43 221 $ else
Chris@43 222 $ gosub crea_mms
Chris@43 223 $ write sys$output "Make ''name' ''version' with ''Make' "
Chris@43 224 $ 'make'
Chris@43 225 $ endif
Chris@43 226 $!
Chris@43 227 $! Create shareable image
Chris@43 228 $!
Chris@43 229 $ gosub crea_olist
Chris@43 230 $ write sys$output "Creating libzshr.exe"
Chris@43 231 $ call map_2_shopt 'mapfile' 'optfile'
Chris@43 232 $ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,'optfile'/opt
Chris@43 233 $ write sys$output "Zlib build completed"
Chris@43 234 $ delete/nolog tmp.opt;*
Chris@43 235 $ exit
Chris@43 236 $AMISS_ERR:
Chris@43 237 $ write sys$output "No source for config.hin found."
Chris@43 238 $ write sys$output "Tried any of ''aconf_in_file'"
Chris@43 239 $ goto err_exit
Chris@43 240 $CC_ERR:
Chris@43 241 $ write sys$output "C compiler required to build ''name'"
Chris@43 242 $ goto err_exit
Chris@43 243 $ERR_EXIT:
Chris@43 244 $ set message/facil/ident/sever/text
Chris@43 245 $ close/nolog optf
Chris@43 246 $ close/nolog topt
Chris@43 247 $ close/nolog aconf_in
Chris@43 248 $ close/nolog aconf
Chris@43 249 $ close/nolog out
Chris@43 250 $ close/nolog min
Chris@43 251 $ close/nolog mod
Chris@43 252 $ close/nolog h_in
Chris@43 253 $ write sys$output "Exiting..."
Chris@43 254 $ exit 2
Chris@43 255 $!
Chris@43 256 $!
Chris@43 257 $MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
Chris@43 258 $ V = 'F$Verify(0)
Chris@43 259 $! P1 = What we are trying to make
Chris@43 260 $! P2 = Command to make it
Chris@43 261 $! P3 - P8 What it depends on
Chris@43 262 $
Chris@43 263 $ If F$Search(P1) .Eqs. "" Then Goto Makeit
Chris@43 264 $ Time = F$CvTime(F$File(P1,"RDT"))
Chris@43 265 $arg=3
Chris@43 266 $Loop:
Chris@43 267 $ Argument = P'arg
Chris@43 268 $ If Argument .Eqs. "" Then Goto Exit
Chris@43 269 $ El=0
Chris@43 270 $Loop2:
Chris@43 271 $ File = F$Element(El," ",Argument)
Chris@43 272 $ If File .Eqs. " " Then Goto Endl
Chris@43 273 $ AFile = ""
Chris@43 274 $Loop3:
Chris@43 275 $ OFile = AFile
Chris@43 276 $ AFile = F$Search(File)
Chris@43 277 $ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
Chris@43 278 $ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
Chris@43 279 $ Goto Loop3
Chris@43 280 $NextEL:
Chris@43 281 $ El = El + 1
Chris@43 282 $ Goto Loop2
Chris@43 283 $EndL:
Chris@43 284 $ arg=arg+1
Chris@43 285 $ If arg .Le. 8 Then Goto Loop
Chris@43 286 $ Goto Exit
Chris@43 287 $
Chris@43 288 $Makeit:
Chris@43 289 $ VV=F$VERIFY(0)
Chris@43 290 $ write sys$output P2
Chris@43 291 $ 'P2
Chris@43 292 $ VV='F$Verify(VV)
Chris@43 293 $Exit:
Chris@43 294 $ If V Then Set Verify
Chris@43 295 $ENDSUBROUTINE
Chris@43 296 $!------------------------------------------------------------------------------
Chris@43 297 $!
Chris@43 298 $! Check command line options and set symbols accordingly
Chris@43 299 $!
Chris@43 300 $!------------------------------------------------------------------------------
Chris@43 301 $! Version history
Chris@43 302 $! 0.01 20041206 First version to receive a number
Chris@43 303 $! 0.02 20060126 Add new "HELP" target
Chris@43 304 $ CHECK_OPTS:
Chris@43 305 $ i = 1
Chris@43 306 $ OPT_LOOP:
Chris@43 307 $ if i .lt. 9
Chris@43 308 $ then
Chris@43 309 $ cparm = f$edit(p'i',"upcase")
Chris@43 310 $!
Chris@43 311 $! Check if parameter actually contains something
Chris@43 312 $!
Chris@43 313 $ if f$edit(cparm,"trim") .nes. ""
Chris@43 314 $ then
Chris@43 315 $ if cparm .eqs. "DEBUG"
Chris@43 316 $ then
Chris@43 317 $ ccopt = ccopt + "/noopt/deb"
Chris@43 318 $ lopts = lopts + "/deb"
Chris@43 319 $ endif
Chris@43 320 $ if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
Chris@43 321 $ then
Chris@43 322 $ start = f$locate("=",cparm) + 1
Chris@43 323 $ len = f$length(cparm) - start
Chris@43 324 $ ccopt = ccopt + f$extract(start,len,cparm)
Chris@43 325 $ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
Chris@43 326 then s_case = true
Chris@43 327 $ endif
Chris@43 328 $ if cparm .eqs. "LINK" then linkonly = true
Chris@43 329 $ if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
Chris@43 330 $ then
Chris@43 331 $ start = f$locate("=",cparm) + 1
Chris@43 332 $ len = f$length(cparm) - start
Chris@43 333 $ lopts = lopts + f$extract(start,len,cparm)
Chris@43 334 $ endif
Chris@43 335 $ if f$locate("CC=",cparm) .lt. f$length(cparm)
Chris@43 336 $ then
Chris@43 337 $ start = f$locate("=",cparm) + 1
Chris@43 338 $ len = f$length(cparm) - start
Chris@43 339 $ cc_com = f$extract(start,len,cparm)
Chris@43 340 if (cc_com .nes. "DECC") .and. -
Chris@43 341 (cc_com .nes. "VAXC") .and. -
Chris@43 342 (cc_com .nes. "GNUC")
Chris@43 343 $ then
Chris@43 344 $ write sys$output "Unsupported compiler choice ''cc_com' ignored"
Chris@43 345 $ write sys$output "Use DECC, VAXC, or GNUC instead"
Chris@43 346 $ else
Chris@43 347 $ if cc_com .eqs. "DECC" then its_decc = true
Chris@43 348 $ if cc_com .eqs. "VAXC" then its_vaxc = true
Chris@43 349 $ if cc_com .eqs. "GNUC" then its_gnuc = true
Chris@43 350 $ endif
Chris@43 351 $ endif
Chris@43 352 $ if f$locate("MAKE=",cparm) .lt. f$length(cparm)
Chris@43 353 $ then
Chris@43 354 $ start = f$locate("=",cparm) + 1
Chris@43 355 $ len = f$length(cparm) - start
Chris@43 356 $ mmks = f$extract(start,len,cparm)
Chris@43 357 $ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
Chris@43 358 $ then
Chris@43 359 $ make = mmks
Chris@43 360 $ else
Chris@43 361 $ write sys$output "Unsupported make choice ''mmks' ignored"
Chris@43 362 $ write sys$output "Use MMK or MMS instead"
Chris@43 363 $ endif
Chris@43 364 $ endif
Chris@43 365 $ if cparm .eqs. "HELP" then gosub bhelp
Chris@43 366 $ endif
Chris@43 367 $ i = i + 1
Chris@43 368 $ goto opt_loop
Chris@43 369 $ endif
Chris@43 370 $ return
Chris@43 371 $!------------------------------------------------------------------------------
Chris@43 372 $!
Chris@43 373 $! Look for the compiler used
Chris@43 374 $!
Chris@43 375 $! Version history
Chris@43 376 $! 0.01 20040223 First version to receive a number
Chris@43 377 $! 0.02 20040229 Save/set value of decc$no_rooted_search_lists
Chris@43 378 $! 0.03 20060202 Extend handling of GNU C
Chris@43 379 $! 0.04 20090402 Compaq -> hp
Chris@43 380 $CHECK_COMPILER:
Chris@43 381 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
Chris@43 382 $ then
Chris@43 383 $ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
Chris@43 384 $ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
Chris@43 385 $ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
Chris@43 386 $ endif
Chris@43 387 $!
Chris@43 388 $! Exit if no compiler available
Chris@43 389 $!
Chris@43 390 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
Chris@43 391 $ then goto CC_ERR
Chris@43 392 $ else
Chris@43 393 $ if its_decc
Chris@43 394 $ then
Chris@43 395 $ write sys$output "CC compiler check ... hp C"
Chris@43 396 $ if f$trnlnm("decc$no_rooted_search_lists") .nes. ""
Chris@43 397 $ then
Chris@43 398 $ dnrsl = f$trnlnm("decc$no_rooted_search_lists")
Chris@43 399 $ endif
Chris@43 400 $ define/nolog decc$no_rooted_search_lists 1
Chris@43 401 $ else
Chris@43 402 $ if its_vaxc then write sys$output "CC compiler check ... VAX C"
Chris@43 403 $ if its_gnuc
Chris@43 404 $ then
Chris@43 405 $ write sys$output "CC compiler check ... GNU C"
Chris@43 406 $ if f$trnlnm(topt) then write topt "gnu_cc:[000000]gcclib.olb/lib"
Chris@43 407 $ if f$trnlnm(optf) then write optf "gnu_cc:[000000]gcclib.olb/lib"
Chris@43 408 $ cc = "gcc"
Chris@43 409 $ endif
Chris@43 410 $ if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"
Chris@43 411 $ if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"
Chris@43 412 $ endif
Chris@43 413 $ endif
Chris@43 414 $ return
Chris@43 415 $!------------------------------------------------------------------------------
Chris@43 416 $!
Chris@43 417 $! If MMS/MMK are available dump out the descrip.mms if required
Chris@43 418 $!
Chris@43 419 $CREA_MMS:
Chris@43 420 $ write sys$output "Creating descrip.mms..."
Chris@43 421 $ create descrip.mms
Chris@43 422 $ open/append out descrip.mms
Chris@43 423 $ copy sys$input: out
Chris@43 424 $ deck
Chris@43 425 # descrip.mms: MMS description file for building zlib on VMS
Chris@43 426 # written by Martin P.J. Zinser
Chris@43 427 # <zinser@zinser.no-ip.info or martin.zinser@eurexchange.com>
Chris@43 428
Chris@43 429 OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\
Chris@43 430 gzread.obj, gzwrite.obj, uncompr.obj, infback.obj\
Chris@43 431 deflate.obj, trees.obj, zutil.obj, inflate.obj, \
Chris@43 432 inftrees.obj, inffast.obj
Chris@43 433
Chris@43 434 $ eod
Chris@43 435 $ write out "CFLAGS=", ccopt
Chris@43 436 $ write out "LOPTS=", lopts
Chris@43 437 $ write out "all : example.exe minigzip.exe libz.olb"
Chris@43 438 $ copy sys$input: out
Chris@43 439 $ deck
Chris@43 440 @ write sys$output " Example applications available"
Chris@43 441
Chris@43 442 libz.olb : libz.olb($(OBJS))
Chris@43 443 @ write sys$output " libz available"
Chris@43 444
Chris@43 445 example.exe : example.obj libz.olb
Chris@43 446 link $(LOPTS) example,libz.olb/lib
Chris@43 447
Chris@43 448 minigzip.exe : minigzip.obj libz.olb
Chris@43 449 link $(LOPTS) minigzip,libz.olb/lib
Chris@43 450
Chris@43 451 clean :
Chris@43 452 delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
Chris@43 453
Chris@43 454
Chris@43 455 # Other dependencies.
Chris@43 456 adler32.obj : adler32.c zutil.h zlib.h zconf.h
Chris@43 457 compress.obj : compress.c zlib.h zconf.h
Chris@43 458 crc32.obj : crc32.c zutil.h zlib.h zconf.h
Chris@43 459 deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h
Chris@43 460 example.obj : [.test]example.c zlib.h zconf.h
Chris@43 461 gzclose.obj : gzclose.c zutil.h zlib.h zconf.h
Chris@43 462 gzlib.obj : gzlib.c zutil.h zlib.h zconf.h
Chris@43 463 gzread.obj : gzread.c zutil.h zlib.h zconf.h
Chris@43 464 gzwrite.obj : gzwrite.c zutil.h zlib.h zconf.h
Chris@43 465 inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h
Chris@43 466 inflate.obj : inflate.c zutil.h zlib.h zconf.h
Chris@43 467 inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h
Chris@43 468 minigzip.obj : [.test]minigzip.c zlib.h zconf.h
Chris@43 469 trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h
Chris@43 470 uncompr.obj : uncompr.c zlib.h zconf.h
Chris@43 471 zutil.obj : zutil.c zutil.h zlib.h zconf.h
Chris@43 472 infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
Chris@43 473 $ eod
Chris@43 474 $ close out
Chris@43 475 $ return
Chris@43 476 $!------------------------------------------------------------------------------
Chris@43 477 $!
Chris@43 478 $! Read list of core library sources from makefile.in and create options
Chris@43 479 $! needed to build shareable image
Chris@43 480 $!
Chris@43 481 $CREA_OLIST:
Chris@43 482 $ open/read min makefile.in
Chris@43 483 $ open/write mod modules.opt
Chris@43 484 $ src_check_list = "OBJZ =#OBJG ="
Chris@43 485 $MRLOOP:
Chris@43 486 $ read/end=mrdone min rec
Chris@43 487 $ i = 0
Chris@43 488 $SRC_CHECK_LOOP:
Chris@43 489 $ src_check = f$element(i, "#", src_check_list)
Chris@43 490 $ i = i+1
Chris@43 491 $ if src_check .eqs. "#" then goto mrloop
Chris@43 492 $ if (f$extract(0,6,rec) .nes. src_check) then goto src_check_loop
Chris@43 493 $ rec = rec - src_check
Chris@43 494 $ gosub extra_filnam
Chris@43 495 $ if (f$element(1,"\",rec) .eqs. "\") then goto mrloop
Chris@43 496 $MRSLOOP:
Chris@43 497 $ read/end=mrdone min rec
Chris@43 498 $ gosub extra_filnam
Chris@43 499 $ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop
Chris@43 500 $MRDONE:
Chris@43 501 $ close min
Chris@43 502 $ close mod
Chris@43 503 $ return
Chris@43 504 $!------------------------------------------------------------------------------
Chris@43 505 $!
Chris@43 506 $! Take record extracted in crea_olist and split it into single filenames
Chris@43 507 $!
Chris@43 508 $EXTRA_FILNAM:
Chris@43 509 $ myrec = f$edit(rec - "\", "trim,compress")
Chris@43 510 $ i = 0
Chris@43 511 $FELOOP:
Chris@43 512 $ srcfil = f$element(i," ", myrec)
Chris@43 513 $ if (srcfil .nes. " ")
Chris@43 514 $ then
Chris@43 515 $ write mod f$parse(srcfil,,,"NAME"), ".obj"
Chris@43 516 $ i = i + 1
Chris@43 517 $ goto feloop
Chris@43 518 $ endif
Chris@43 519 $ return
Chris@43 520 $!------------------------------------------------------------------------------
Chris@43 521 $!
Chris@43 522 $! Find current Zlib version number
Chris@43 523 $!
Chris@43 524 $FIND_VERSION:
Chris@43 525 $ open/read h_in 'v_file'
Chris@43 526 $hloop:
Chris@43 527 $ read/end=hdone h_in rec
Chris@43 528 $ rec = f$edit(rec,"TRIM")
Chris@43 529 $ if (f$extract(0,1,rec) .nes. "#") then goto hloop
Chris@43 530 $ rec = f$edit(rec - "#", "TRIM")
Chris@43 531 $ if f$element(0," ",rec) .nes. "define" then goto hloop
Chris@43 532 $ if f$element(1," ",rec) .eqs. v_string
Chris@43 533 $ then
Chris@43 534 $ version = 'f$element(2," ",rec)'
Chris@43 535 $ goto hdone
Chris@43 536 $ endif
Chris@43 537 $ goto hloop
Chris@43 538 $hdone:
Chris@43 539 $ close h_in
Chris@43 540 $ return
Chris@43 541 $!------------------------------------------------------------------------------
Chris@43 542 $!
Chris@43 543 $CHECK_CONFIG:
Chris@43 544 $!
Chris@43 545 $ in_ldef = f$locate(cdef,libdefs)
Chris@43 546 $ if (in_ldef .lt. f$length(libdefs))
Chris@43 547 $ then
Chris@43 548 $ write aconf "#define ''cdef' 1"
Chris@43 549 $ libdefs = f$extract(0,in_ldef,libdefs) + -
Chris@43 550 f$extract(in_ldef + f$length(cdef) + 1, -
Chris@43 551 f$length(libdefs) - in_ldef - f$length(cdef) - 1, -
Chris@43 552 libdefs)
Chris@43 553 $ else
Chris@43 554 $ if (f$type('cdef') .eqs. "INTEGER")
Chris@43 555 $ then
Chris@43 556 $ write aconf "#define ''cdef' ", 'cdef'
Chris@43 557 $ else
Chris@43 558 $ if (f$type('cdef') .eqs. "STRING")
Chris@43 559 $ then
Chris@43 560 $ write aconf "#define ''cdef' ", """", '''cdef'', """"
Chris@43 561 $ else
Chris@43 562 $ gosub check_cc_def
Chris@43 563 $ endif
Chris@43 564 $ endif
Chris@43 565 $ endif
Chris@43 566 $ return
Chris@43 567 $!------------------------------------------------------------------------------
Chris@43 568 $!
Chris@43 569 $! Check if this is a define relating to the properties of the C/C++
Chris@43 570 $! compiler
Chris@43 571 $!
Chris@43 572 $ CHECK_CC_DEF:
Chris@43 573 $ if (cdef .eqs. "_LARGEFILE64_SOURCE")
Chris@43 574 $ then
Chris@43 575 $ copy sys$input: 'tc'
Chris@43 576 $ deck
Chris@43 577 #include "tconfig"
Chris@43 578 #define _LARGEFILE
Chris@43 579 #include <stdio.h>
Chris@43 580
Chris@43 581 int main(){
Chris@43 582 FILE *fp;
Chris@43 583 fp = fopen("temp.txt","r");
Chris@43 584 fseeko(fp,1,SEEK_SET);
Chris@43 585 fclose(fp);
Chris@43 586 }
Chris@43 587
Chris@43 588 $ eod
Chris@43 589 $ test_inv = false
Chris@43 590 $ comm_h = false
Chris@43 591 $ gosub cc_prop_check
Chris@43 592 $ return
Chris@43 593 $ endif
Chris@43 594 $ write aconf "/* ", line, " */"
Chris@43 595 $ return
Chris@43 596 $!------------------------------------------------------------------------------
Chris@43 597 $!
Chris@43 598 $! Check for properties of C/C++ compiler
Chris@43 599 $!
Chris@43 600 $! Version history
Chris@43 601 $! 0.01 20031020 First version to receive a number
Chris@43 602 $! 0.02 20031022 Added logic for defines with value
Chris@43 603 $! 0.03 20040309 Make sure local config file gets not deleted
Chris@43 604 $! 0.04 20041230 Also write include for configure run
Chris@43 605 $! 0.05 20050103 Add processing of "comment defines"
Chris@43 606 $CC_PROP_CHECK:
Chris@43 607 $ cc_prop = true
Chris@43 608 $ is_need = false
Chris@43 609 $ is_need = (f$extract(0,4,cdef) .eqs. "NEED") .or. (test_inv .eq. true)
Chris@43 610 $ if f$search(th) .eqs. "" then create 'th'
Chris@43 611 $ set message/nofac/noident/nosever/notext
Chris@43 612 $ on error then continue
Chris@43 613 $ cc 'tmpnam'
Chris@43 614 $ if .not. ($status) then cc_prop = false
Chris@43 615 $ on error then continue
Chris@43 616 $! The headers might lie about the capabilities of the RTL
Chris@43 617 $ link 'tmpnam',tmp.opt/opt
Chris@43 618 $ if .not. ($status) then cc_prop = false
Chris@43 619 $ set message/fac/ident/sever/text
Chris@43 620 $ on error then goto err_exit
Chris@43 621 $ delete/nolog 'tmpnam'.*;*/exclude='th'
Chris@43 622 $ if (cc_prop .and. .not. is_need) .or. -
Chris@43 623 (.not. cc_prop .and. is_need)
Chris@43 624 $ then
Chris@43 625 $ write sys$output "Checking for ''cdef'... yes"
Chris@43 626 $ if f$type('cdef_val'_yes) .nes. ""
Chris@43 627 $ then
Chris@43 628 $ if f$type('cdef_val'_yes) .eqs. "INTEGER" -
Chris@43 629 then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_yes)
Chris@43 630 $ if f$type('cdef_val'_yes) .eqs. "STRING" -
Chris@43 631 then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_yes)
Chris@43 632 $ else
Chris@43 633 $ call write_config f$fao("#define !AS 1",cdef)
Chris@43 634 $ endif
Chris@43 635 $ if (cdef .eqs. "HAVE_FSEEKO") .or. (cdef .eqs. "_LARGE_FILES") .or. -
Chris@43 636 (cdef .eqs. "_LARGEFILE64_SOURCE") then -
Chris@43 637 call write_config f$string("#define _LARGEFILE 1")
Chris@43 638 $ else
Chris@43 639 $ write sys$output "Checking for ''cdef'... no"
Chris@43 640 $ if (comm_h)
Chris@43 641 $ then
Chris@43 642 call write_config f$fao("/* !AS */",line)
Chris@43 643 $ else
Chris@43 644 $ if f$type('cdef_val'_no) .nes. ""
Chris@43 645 $ then
Chris@43 646 $ if f$type('cdef_val'_no) .eqs. "INTEGER" -
Chris@43 647 then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_no)
Chris@43 648 $ if f$type('cdef_val'_no) .eqs. "STRING" -
Chris@43 649 then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_no)
Chris@43 650 $ else
Chris@43 651 $ call write_config f$fao("#undef !AS",cdef)
Chris@43 652 $ endif
Chris@43 653 $ endif
Chris@43 654 $ endif
Chris@43 655 $ return
Chris@43 656 $!------------------------------------------------------------------------------
Chris@43 657 $!
Chris@43 658 $! Check for properties of C/C++ compiler with multiple result values
Chris@43 659 $!
Chris@43 660 $! Version history
Chris@43 661 $! 0.01 20040127 First version
Chris@43 662 $! 0.02 20050103 Reconcile changes from cc_prop up to version 0.05
Chris@43 663 $CC_MPROP_CHECK:
Chris@43 664 $ cc_prop = true
Chris@43 665 $ i = 1
Chris@43 666 $ idel = 1
Chris@43 667 $ MT_LOOP:
Chris@43 668 $ if f$type(result_'i') .eqs. "STRING"
Chris@43 669 $ then
Chris@43 670 $ set message/nofac/noident/nosever/notext
Chris@43 671 $ on error then continue
Chris@43 672 $ cc 'tmpnam'_'i'
Chris@43 673 $ if .not. ($status) then cc_prop = false
Chris@43 674 $ on error then continue
Chris@43 675 $! The headers might lie about the capabilities of the RTL
Chris@43 676 $ link 'tmpnam'_'i',tmp.opt/opt
Chris@43 677 $ if .not. ($status) then cc_prop = false
Chris@43 678 $ set message/fac/ident/sever/text
Chris@43 679 $ on error then goto err_exit
Chris@43 680 $ delete/nolog 'tmpnam'_'i'.*;*
Chris@43 681 $ if (cc_prop)
Chris@43 682 $ then
Chris@43 683 $ write sys$output "Checking for ''cdef'... ", mdef_'i'
Chris@43 684 $ if f$type(mdef_'i') .eqs. "INTEGER" -
Chris@43 685 then call write_config f$fao("#define !AS !UL",cdef,mdef_'i')
Chris@43 686 $ if f$type('cdef_val'_yes) .eqs. "STRING" -
Chris@43 687 then call write_config f$fao("#define !AS !AS",cdef,mdef_'i')
Chris@43 688 $ goto msym_clean
Chris@43 689 $ else
Chris@43 690 $ i = i + 1
Chris@43 691 $ goto mt_loop
Chris@43 692 $ endif
Chris@43 693 $ endif
Chris@43 694 $ write sys$output "Checking for ''cdef'... no"
Chris@43 695 $ call write_config f$fao("#undef !AS",cdef)
Chris@43 696 $ MSYM_CLEAN:
Chris@43 697 $ if (idel .le. msym_max)
Chris@43 698 $ then
Chris@43 699 $ delete/sym mdef_'idel'
Chris@43 700 $ idel = idel + 1
Chris@43 701 $ goto msym_clean
Chris@43 702 $ endif
Chris@43 703 $ return
Chris@43 704 $!------------------------------------------------------------------------------
Chris@43 705 $!
Chris@43 706 $! Write configuration to both permanent and temporary config file
Chris@43 707 $!
Chris@43 708 $! Version history
Chris@43 709 $! 0.01 20031029 First version to receive a number
Chris@43 710 $!
Chris@43 711 $WRITE_CONFIG: SUBROUTINE
Chris@43 712 $ write aconf 'p1'
Chris@43 713 $ open/append confh 'th'
Chris@43 714 $ write confh 'p1'
Chris@43 715 $ close confh
Chris@43 716 $ENDSUBROUTINE
Chris@43 717 $!------------------------------------------------------------------------------
Chris@43 718 $!
Chris@43 719 $! Analyze the project map file and create the symbol vector for a shareable
Chris@43 720 $! image from it
Chris@43 721 $!
Chris@43 722 $! Version history
Chris@43 723 $! 0.01 20120128 First version
Chris@43 724 $! 0.02 20120226 Add pre-load logic
Chris@43 725 $!
Chris@43 726 $ MAP_2_SHOPT: Subroutine
Chris@43 727 $!
Chris@43 728 $ SAY := "WRITE_ SYS$OUTPUT"
Chris@43 729 $!
Chris@43 730 $ IF F$SEARCH("''P1'") .EQS. ""
Chris@43 731 $ THEN
Chris@43 732 $ SAY "MAP_2_SHOPT-E-NOSUCHFILE: Error, inputfile ''p1' not available"
Chris@43 733 $ goto exit_m2s
Chris@43 734 $ ENDIF
Chris@43 735 $ IF "''P2'" .EQS. ""
Chris@43 736 $ THEN
Chris@43 737 $ SAY "MAP_2_SHOPT: Error, no output file provided"
Chris@43 738 $ goto exit_m2s
Chris@43 739 $ ENDIF
Chris@43 740 $!
Chris@43 741 $ module1 = "deflate#deflateEnd#deflateInit_#deflateParams#deflateSetDictionary"
Chris@43 742 $ module2 = "gzclose#gzerror#gzgetc#gzgets#gzopen#gzprintf#gzputc#gzputs#gzread"
Chris@43 743 $ module3 = "gzseek#gztell#inflate#inflateEnd#inflateInit_#inflateSetDictionary"
Chris@43 744 $ module4 = "inflateSync#uncompress#zlibVersion#compress"
Chris@43 745 $ open/read map 'p1
Chris@43 746 $ if axp .or. ia64
Chris@43 747 $ then
Chris@43 748 $ open/write aopt a.opt
Chris@43 749 $ open/write bopt b.opt
Chris@43 750 $ write aopt " CASE_SENSITIVE=YES"
Chris@43 751 $ write bopt "SYMBOL_VECTOR= (-"
Chris@43 752 $ mod_sym_num = 1
Chris@43 753 $ MOD_SYM_LOOP:
Chris@43 754 $ if f$type(module'mod_sym_num') .nes. ""
Chris@43 755 $ then
Chris@43 756 $ mod_in = 0
Chris@43 757 $ MOD_SYM_IN:
Chris@43 758 $ shared_proc = f$element(mod_in, "#", module'mod_sym_num')
Chris@43 759 $ if shared_proc .nes. "#"
Chris@43 760 $ then
Chris@43 761 $ write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",-
Chris@43 762 f$edit(shared_proc,"upcase"),shared_proc)
Chris@43 763 $ write bopt f$fao("!AS=PROCEDURE,-",shared_proc)
Chris@43 764 $ mod_in = mod_in + 1
Chris@43 765 $ goto mod_sym_in
Chris@43 766 $ endif
Chris@43 767 $ mod_sym_num = mod_sym_num + 1
Chris@43 768 $ goto mod_sym_loop
Chris@43 769 $ endif
Chris@43 770 $MAP_LOOP:
Chris@43 771 $ read/end=map_end map line
Chris@43 772 $ if (f$locate("{",line).lt. f$length(line)) .or. -
Chris@43 773 (f$locate("global:", line) .lt. f$length(line))
Chris@43 774 $ then
Chris@43 775 $ proc = true
Chris@43 776 $ goto map_loop
Chris@43 777 $ endif
Chris@43 778 $ if f$locate("}",line).lt. f$length(line) then proc = false
Chris@43 779 $ if f$locate("local:", line) .lt. f$length(line) then proc = false
Chris@43 780 $ if proc
Chris@43 781 $ then
Chris@43 782 $ shared_proc = f$edit(line,"collapse")
Chris@43 783 $ chop_semi = f$locate(";", shared_proc)
Chris@43 784 $ if chop_semi .lt. f$length(shared_proc) then -
Chris@43 785 shared_proc = f$extract(0, chop_semi, shared_proc)
Chris@43 786 $ write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",-
Chris@43 787 f$edit(shared_proc,"upcase"),shared_proc)
Chris@43 788 $ write bopt f$fao("!AS=PROCEDURE,-",shared_proc)
Chris@43 789 $ endif
Chris@43 790 $ goto map_loop
Chris@43 791 $MAP_END:
Chris@43 792 $ close/nolog aopt
Chris@43 793 $ close/nolog bopt
Chris@43 794 $ open/append libopt 'p2'
Chris@43 795 $ open/read aopt a.opt
Chris@43 796 $ open/read bopt b.opt
Chris@43 797 $ALOOP:
Chris@43 798 $ read/end=aloop_end aopt line
Chris@43 799 $ write libopt line
Chris@43 800 $ goto aloop
Chris@43 801 $ALOOP_END:
Chris@43 802 $ close/nolog aopt
Chris@43 803 $ sv = ""
Chris@43 804 $BLOOP:
Chris@43 805 $ read/end=bloop_end bopt svn
Chris@43 806 $ if (svn.nes."")
Chris@43 807 $ then
Chris@43 808 $ if (sv.nes."") then write libopt sv
Chris@43 809 $ sv = svn
Chris@43 810 $ endif
Chris@43 811 $ goto bloop
Chris@43 812 $BLOOP_END:
Chris@43 813 $ write libopt f$extract(0,f$length(sv)-2,sv), "-"
Chris@43 814 $ write libopt ")"
Chris@43 815 $ close/nolog bopt
Chris@43 816 $ delete/nolog/noconf a.opt;*,b.opt;*
Chris@43 817 $ else
Chris@43 818 $ if vax
Chris@43 819 $ then
Chris@43 820 $ open/append libopt 'p2'
Chris@43 821 $ mod_sym_num = 1
Chris@43 822 $ VMOD_SYM_LOOP:
Chris@43 823 $ if f$type(module'mod_sym_num') .nes. ""
Chris@43 824 $ then
Chris@43 825 $ mod_in = 0
Chris@43 826 $ VMOD_SYM_IN:
Chris@43 827 $ shared_proc = f$element(mod_in, "#", module'mod_sym_num')
Chris@43 828 $ if shared_proc .nes. "#"
Chris@43 829 $ then
Chris@43 830 $ write libopt f$fao("UNIVERSAL=!AS",-
Chris@43 831 f$edit(shared_proc,"upcase"))
Chris@43 832 $ mod_in = mod_in + 1
Chris@43 833 $ goto vmod_sym_in
Chris@43 834 $ endif
Chris@43 835 $ mod_sym_num = mod_sym_num + 1
Chris@43 836 $ goto vmod_sym_loop
Chris@43 837 $ endif
Chris@43 838 $VMAP_LOOP:
Chris@43 839 $ read/end=vmap_end map line
Chris@43 840 $ if (f$locate("{",line).lt. f$length(line)) .or. -
Chris@43 841 (f$locate("global:", line) .lt. f$length(line))
Chris@43 842 $ then
Chris@43 843 $ proc = true
Chris@43 844 $ goto vmap_loop
Chris@43 845 $ endif
Chris@43 846 $ if f$locate("}",line).lt. f$length(line) then proc = false
Chris@43 847 $ if f$locate("local:", line) .lt. f$length(line) then proc = false
Chris@43 848 $ if proc
Chris@43 849 $ then
Chris@43 850 $ shared_proc = f$edit(line,"collapse")
Chris@43 851 $ chop_semi = f$locate(";", shared_proc)
Chris@43 852 $ if chop_semi .lt. f$length(shared_proc) then -
Chris@43 853 shared_proc = f$extract(0, chop_semi, shared_proc)
Chris@43 854 $ write libopt f$fao("UNIVERSAL=!AS",-
Chris@43 855 f$edit(shared_proc,"upcase"))
Chris@43 856 $ endif
Chris@43 857 $ goto vmap_loop
Chris@43 858 $VMAP_END:
Chris@43 859 $ else
Chris@43 860 $ write sys$output "Unknown Architecture (Not VAX, AXP, or IA64)"
Chris@43 861 $ write sys$output "No options file created"
Chris@43 862 $ endif
Chris@43 863 $ endif
Chris@43 864 $ EXIT_M2S:
Chris@43 865 $ close/nolog map
Chris@43 866 $ close/nolog libopt
Chris@43 867 $ endsubroutine