annotate src/zlib-1.2.7/make_vms.com @ 4:e13257ea84a4

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