867 lines · 25.8 KB · Text
RawDownload
$! make libz under VMS written by$! Martin P.J. Zinser$!$! In case of problems with the install you might contact me at$! zinser@zinser.no-ip.info(preferred) or$! martin.zinser@eurexchange.com (work)$!$! Make procedure history for Zlib$!$!------------------------------------------------------------------------------$! Version history$! 0.01 20060120 First version to receive a number$! 0.02 20061008 Adapt to new Makefile.in$! 0.03 20091224 Add support for large file check$! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite$! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in$! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new exmples$!               subdir path, update module search in makefile.in$! 0.07 20120115 Triggered by work done by Alexey Chupahin completly redesigned$!               shared image creation$! 0.08 20120219 Make it work on VAX again, pre-load missing symbols to shared$!               image$! 0.09 20120305 SMS.  P1 sets builder ("MMK", "MMS", " " (built-in)).$!               "" -> automatic, preference: MMK, MMS, built-in.$!$ on error then goto err_exit$!$ true  = 1$ false = 0$ tmpnam = "temp_" + f$getjpi("","pid")$ tt = tmpnam + ".txt"$ tc = tmpnam + ".c"$ th = tmpnam + ".h"$ define/nolog tconfig 'th'$ its_decc = false$ its_vaxc = false$ its_gnuc = false$ s_case   = False$!$! Setup variables holding "config" information$!$ Make    = "''p1'"$ name     = "Zlib"$ version  = "?.?.?"$ v_string = "ZLIB_VERSION"$ v_file   = "zlib.h"$ ccopt   = "/include = []"$ lopts   = ""$ dnsrl   = ""$ aconf_in_file = "zconf.h.in#zconf.h_in#zconf_h.in"$ conf_check_string = ""$ linkonly = false$ optfile  = name + ".opt"$ mapfile  = name + ".map"$ libdefs  = ""$ vax      = f$getsyi("HW_MODEL").lt.1024$ axp      = f$getsyi("HW_MODEL").ge.1024 .and. f$getsyi("HW_MODEL").lt.4096$ ia64     = f$getsyi("HW_MODEL").ge.4096$!$! 2012-03-05 SMS.$! Why is this needed?  And if it is needed, why not simply ".not. vax"?$!$!!! if axp .or. ia64 then  set proc/parse=extended$!$ whoami = f$parse(f$environment("Procedure"),,,,"NO_CONCEAL")$ mydef  = F$parse(whoami,,,"DEVICE")$ mydir  = f$parse(whoami,,,"DIRECTORY") - "]["$ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type")$!$! Check for MMK/MMS$!$ if (Make .eqs. "")$ then$   If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"$   If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"$ else$   Make = f$edit( Make, "trim")$ endif$!$ gosub find_version$!$  open/write topt tmp.opt$  open/write optf 'optfile'$!$ gosub check_opts$!$! Look for the compiler used$!$ gosub check_compiler$ close topt$ close optf$!$ if its_decc$ then$   ccopt = "/prefix=all" + ccopt$   if f$trnlnm("SYS") .eqs. ""$   then$     if axp$     then$       define sys sys$library:$     else$       ccopt = "/decc" + ccopt$       define sys decc$library_include:$     endif$   endif$!$! 2012-03-05 SMS.$! Why /NAMES = AS_IS?  Why not simply ".not. vax"?  And why not on VAX?$!$   if axp .or. ia64$   then$       ccopt = ccopt + "/name=as_is/opt=(inline=speed)"$       s_case = true$   endif$ endif$ if its_vaxc .or. its_gnuc$ then$    if f$trnlnm("SYS").eqs."" then define sys sys$library:$ endif$!$! Build a fake configure input header$!$ open/write conf_hin config.hin$ write conf_hin "#undef _LARGEFILE64_SOURCE"$ close conf_hin$!$!$ i = 0$FIND_ACONF:$ fname = f$element(i,"#",aconf_in_file)$ if fname .eqs. "#" then goto AMISS_ERR$ if f$search(fname) .eqs. ""$ then$   i = i + 1$   goto find_aconf$ endif$ open/read/err=aconf_err aconf_in 'fname'$ open/write aconf zconf.h$ACONF_LOOP:$ read/end_of_file=aconf_exit aconf_in line$ work = f$edit(line, "compress,trim")$ if f$extract(0,6,work) .nes. "#undef"$ then$   if f$extract(0,12,work) .nes. "#cmakedefine"$   then$       write aconf line$   endif$ else$   cdef = f$element(1," ",work)$   gosub check_config$ endif$ goto aconf_loop$ACONF_EXIT:$ write aconf ""$ write aconf "/* VMS specifics added by make_vms.com: */"$ write aconf "#define VMS 1"$ write aconf "#include <unistd.h>"$ write aconf "#include <unixio.h>"$ write aconf "#ifdef _LARGEFILE"$ write aconf "# define off64_t __off64_t"$ write aconf "# define fopen64 fopen"$ write aconf "# define fseeko64 fseeko"$ write aconf "# define lseek64 lseek"$ write aconf "# define ftello64 ftell"$ write aconf "#endif"$ write aconf "#if !defined( __VAX) && (__CRTL_VER >= 70312000)"$ write aconf "# define HAVE_VSNPRINTF"$ write aconf "#endif"$ close aconf_in$ close aconf$ if f$search("''th'") .nes. "" then delete 'th';*$! Build the thing plain or with mms$!$ write sys$output "Compiling Zlib sources ..."$ if make.eqs.""$ then$   if (f$search( "example.obj;*") .nes. "") then delete example.obj;*$   if (f$search( "minigzip.obj;*") .nes. "") then delete minigzip.obj;*$   CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -                adler32.c zlib.h zconf.h$   CALL MAKE compress.OBJ "CC ''CCOPT' compress" -                compress.c zlib.h zconf.h$   CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -                crc32.c zlib.h zconf.h$   CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -                deflate.c deflate.h zutil.h zlib.h zconf.h$   CALL MAKE gzclose.OBJ "CC ''CCOPT' gzclose" -                gzclose.c zutil.h zlib.h zconf.h$   CALL MAKE gzlib.OBJ "CC ''CCOPT' gzlib" -                gzlib.c zutil.h zlib.h zconf.h$   CALL MAKE gzread.OBJ "CC ''CCOPT' gzread" -                gzread.c zutil.h zlib.h zconf.h$   CALL MAKE gzwrite.OBJ "CC ''CCOPT' gzwrite" -                gzwrite.c zutil.h zlib.h zconf.h$   CALL MAKE infback.OBJ "CC ''CCOPT' infback" -                infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h$   CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -                inffast.c zutil.h zlib.h zconf.h inffast.h$   CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -                inflate.c zutil.h zlib.h zconf.h infblock.h$   CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -                inftrees.c zutil.h zlib.h zconf.h inftrees.h$   CALL MAKE trees.OBJ "CC ''CCOPT' trees" -                trees.c deflate.h zutil.h zlib.h zconf.h$   CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -                uncompr.c zlib.h zconf.h$   CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -                zutil.c zutil.h zlib.h zconf.h$   write sys$output "Building Zlib ..."$   CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ$   write sys$output "Building example..."$   CALL MAKE example.OBJ "CC ''CCOPT' [.test]example" -                [.test]example.c zlib.h zconf.h$   call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb$   write sys$output "Building minigzip..."$   CALL MAKE minigzip.OBJ "CC ''CCOPT' [.test]minigzip" -              [.test]minigzip.c zlib.h zconf.h$   call make minigzip.exe -              "LINK minigzip,libz.olb/lib" -              minigzip.obj libz.olb$ else$   gosub crea_mms$   write sys$output "Make ''name' ''version' with ''Make' "$   'make'$ endif$!$! Create shareable image$!$ gosub crea_olist$ write sys$output "Creating libzshr.exe"$ call map_2_shopt 'mapfile' 'optfile'$ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,'optfile'/opt$ write sys$output "Zlib build completed"$ delete/nolog tmp.opt;*$ exit$AMISS_ERR:$ write sys$output "No source for config.hin found."$ write sys$output "Tried any of ''aconf_in_file'"$ goto err_exit$CC_ERR:$ write sys$output "C compiler required to build ''name'"$ goto err_exit$ERR_EXIT:$ set message/facil/ident/sever/text$ close/nolog optf$ close/nolog topt$ close/nolog aconf_in$ close/nolog aconf$ close/nolog out$ close/nolog min$ close/nolog mod$ close/nolog h_in$ write sys$output "Exiting..."$ exit 2$!$!$MAKE: SUBROUTINE   !SUBROUTINE TO CHECK DEPENDENCIES$ V = 'F$Verify(0)$! P1 = What we are trying to make$! P2 = Command to make it$! P3 - P8  What it depends on$$ If F$Search(P1) .Eqs. "" Then Goto Makeit$ Time = F$CvTime(F$File(P1,"RDT"))$arg=3$Loop:$       Argument = P'arg$       If Argument .Eqs. "" Then Goto Exit$       El=0$Loop2:$       File = F$Element(El," ",Argument)$       If File .Eqs. " " Then Goto Endl$       AFile = ""$Loop3:$       OFile = AFile$       AFile = F$Search(File)$       If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl$       If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit$       Goto Loop3$NextEL:$       El = El + 1$       Goto Loop2$EndL:$ arg=arg+1$ If arg .Le. 8 Then Goto Loop$ Goto Exit$$Makeit:$ VV=F$VERIFY(0)$ write sys$output P2$ 'P2$ VV='F$Verify(VV)$Exit:$ If V Then Set Verify$ENDSUBROUTINE$!------------------------------------------------------------------------------$!$! Check command line options and set symbols accordingly$!$!------------------------------------------------------------------------------$! Version history$! 0.01 20041206 First version to receive a number$! 0.02 20060126 Add new "HELP" target$ CHECK_OPTS:$ i = 1$ OPT_LOOP:$ if i .lt. 9$ then$   cparm = f$edit(p'i',"upcase")$!$! Check if parameter actually contains something$!$   if f$edit(cparm,"trim") .nes. ""$   then$     if cparm .eqs. "DEBUG"$     then$       ccopt = ccopt + "/noopt/deb"$       lopts = lopts + "/deb"$     endif$     if f$locate("CCOPT=",cparm) .lt. f$length(cparm)$     then$       start = f$locate("=",cparm) + 1$       len   = f$length(cparm) - start$       ccopt = ccopt + f$extract(start,len,cparm)$       if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -          then s_case = true$     endif$     if cparm .eqs. "LINK" then linkonly = true$     if f$locate("LOPTS=",cparm) .lt. f$length(cparm)$     then$       start = f$locate("=",cparm) + 1$       len   = f$length(cparm) - start$       lopts = lopts + f$extract(start,len,cparm)$     endif$     if f$locate("CC=",cparm) .lt. f$length(cparm)$     then$       start  = f$locate("=",cparm) + 1$       len    = f$length(cparm) - start$       cc_com = f$extract(start,len,cparm)        if (cc_com .nes. "DECC") .and. -           (cc_com .nes. "VAXC") .and. -           (cc_com .nes. "GNUC")$       then$         write sys$output "Unsupported compiler choice ''cc_com' ignored"$         write sys$output "Use DECC, VAXC, or GNUC instead"$       else$         if cc_com .eqs. "DECC" then its_decc = true$         if cc_com .eqs. "VAXC" then its_vaxc = true$         if cc_com .eqs. "GNUC" then its_gnuc = true$       endif$     endif$     if f$locate("MAKE=",cparm) .lt. f$length(cparm)$     then$       start  = f$locate("=",cparm) + 1$       len    = f$length(cparm) - start$       mmks = f$extract(start,len,cparm)$       if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")$       then$         make = mmks$       else$         write sys$output "Unsupported make choice ''mmks' ignored"$         write sys$output "Use MMK or MMS instead"$       endif$     endif$     if cparm .eqs. "HELP" then gosub bhelp$   endif$   i = i + 1$   goto opt_loop$ endif$ return$!------------------------------------------------------------------------------$!$! Look for the compiler used$!$! Version history$! 0.01 20040223 First version to receive a number$! 0.02 20040229 Save/set value of decc$no_rooted_search_lists$! 0.03 20060202 Extend handling of GNU C$! 0.04 20090402 Compaq -> hp$CHECK_COMPILER:$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))$ then$   its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")$   its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")$   its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")$ endif$!$! Exit if no compiler available$!$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))$ then goto CC_ERR$ else$   if its_decc$   then$     write sys$output "CC compiler check ... hp C"$     if f$trnlnm("decc$no_rooted_search_lists") .nes. ""$     then$       dnrsl = f$trnlnm("decc$no_rooted_search_lists")$     endif$     define/nolog decc$no_rooted_search_lists 1$   else$     if its_vaxc then write sys$output "CC compiler check ... VAX C"$     if its_gnuc$     then$         write sys$output "CC compiler check ... GNU C"$         if f$trnlnm(topt) then write topt "gnu_cc:[000000]gcclib.olb/lib"$         if f$trnlnm(optf) then write optf "gnu_cc:[000000]gcclib.olb/lib"$         cc = "gcc"$     endif$     if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"$     if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"$   endif$ endif$ return$!------------------------------------------------------------------------------$!$! If MMS/MMK are available dump out the descrip.mms if required$!$CREA_MMS:$ write sys$output "Creating descrip.mms..."$ create descrip.mms$ open/append out descrip.mms$ copy sys$input: out$ deck# descrip.mms: MMS description file for building zlib on VMS# written by Martin P.J. Zinser# <zinser@zinser.no-ip.info or martin.zinser@eurexchange.com> OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\       gzread.obj, gzwrite.obj, uncompr.obj, infback.obj\       deflate.obj, trees.obj, zutil.obj, inflate.obj, \       inftrees.obj, inffast.obj $ eod$ write out "CFLAGS=", ccopt$ write out "LOPTS=", lopts$ write out "all : example.exe minigzip.exe libz.olb"$ copy sys$input: out$ deck        @ write sys$output " Example applications available" libz.olb : libz.olb($(OBJS))	@ write sys$output " libz available" example.exe : example.obj libz.olb              link $(LOPTS) example,libz.olb/lib minigzip.exe : minigzip.obj libz.olb              link $(LOPTS) minigzip,libz.olb/lib clean :	delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*  # Other dependencies.adler32.obj  : adler32.c zutil.h zlib.h zconf.hcompress.obj : compress.c zlib.h zconf.hcrc32.obj    : crc32.c zutil.h zlib.h zconf.hdeflate.obj  : deflate.c deflate.h zutil.h zlib.h zconf.hexample.obj  : [.test]example.c zlib.h zconf.hgzclose.obj  : gzclose.c zutil.h zlib.h zconf.hgzlib.obj    : gzlib.c zutil.h zlib.h zconf.hgzread.obj   : gzread.c zutil.h zlib.h zconf.hgzwrite.obj  : gzwrite.c zutil.h zlib.h zconf.hinffast.obj  : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.hinflate.obj  : inflate.c zutil.h zlib.h zconf.hinftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.hminigzip.obj : [.test]minigzip.c zlib.h zconf.htrees.obj    : trees.c deflate.h zutil.h zlib.h zconf.huncompr.obj  : uncompr.c zlib.h zconf.hzutil.obj    : zutil.c zutil.h zlib.h zconf.hinfback.obj  : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h$ eod$ close out$ return$!------------------------------------------------------------------------------$!$! Read list of core library sources from makefile.in and create options$! needed to build shareable image$!$CREA_OLIST:$ open/read min makefile.in$ open/write mod modules.opt$ src_check_list = "OBJZ =#OBJG ="$MRLOOP:$ read/end=mrdone min rec$ i = 0$SRC_CHECK_LOOP:$ src_check = f$element(i, "#", src_check_list)$ i = i+1$ if src_check .eqs. "#" then goto mrloop$ if (f$extract(0,6,rec) .nes. src_check) then goto src_check_loop$ rec = rec - src_check$ gosub extra_filnam$ if (f$element(1,"\",rec) .eqs. "\") then goto mrloop$MRSLOOP:$ read/end=mrdone min rec$ gosub extra_filnam$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop$MRDONE:

Lines 1–500 of 867.