]> git.lizzy.rs Git - zlib.git/blobdiff - make_vms.com
CMake build fixes
[zlib.git] / make_vms.com
index 271815bbdd99fd0a70050c13083b6ce064f05c2f..65e9d0cbc8e1ddfc828ddc26ecb74c7b507faf20 100644 (file)
@@ -14,13 +14,16 @@ $! 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 
+$! 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
-$ set proc/parse=ext
 $!
 $ true  = 1
 $ false = 0
@@ -36,12 +39,12 @@ $ s_case   = False
 $!
 $! Setup variables holding "config" information
 $!
-$ Make    = ""
+$ Make    = "''p1'"
 $ name     = "Zlib"
 $ version  = "?.?.?"
 $ v_string = "ZLIB_VERSION"
 $ v_file   = "zlib.h"
-$ ccopt   = ""
+$ ccopt   = "/include = []"
 $ lopts   = ""
 $ dnsrl   = ""
 $ aconf_in_file = "zconf.h.in#zconf.h_in#zconf_h.in"
@@ -54,16 +57,25 @@ $ 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
 $!
-$ whoami = f$parse(f$enviornment("Procedure"),,,,"NO_CONCEAL")
+$! 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 F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
-$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
-$!
+$ 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
 $!
@@ -91,6 +103,10 @@ $       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)"
@@ -135,15 +151,20 @@ $   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 "# 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
@@ -152,8 +173,9 @@ $! Build the thing plain or with mms
 $!
 $ write sys$output "Compiling Zlib sources ..."
 $ if make.eqs.""
-$  then
-$   dele example.obj;*,minigzip.obj;*
+$ 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" -
@@ -187,33 +209,27 @@ $   CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
 $   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'/include=[] [.test]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
-$   if f$search("x11vms:xvmsutils.olb") .nes. ""
-$   then
-$     write sys$output "Building minigzip..."
-$     CALL MAKE minigzip.OBJ "CC ''CCOPT'/include=[] [.test]minigzip" -
-                [.test]minigzip.c zlib.h zconf.h
-$     call make minigzip.exe -
-                "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
-                minigzip.obj libz.olb
-$   endif
-$  else
+$   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
+$ endif
 $!
-$! Alpha gets a shareable image
+$! Create shareable image
 $!
-$ If axp .or. ia64
-$ Then
-$   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
-$ endif
+$ 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
@@ -228,7 +244,6 @@ $ERR_EXIT:
 $ set message/facil/ident/sever/text
 $ close/nolog optf
 $ close/nolog topt
-$ close/nolog conf_hin
 $ close/nolog aconf_in
 $ close/nolog aconf
 $ close/nolog out
@@ -419,10 +434,9 @@ OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\
 $ eod
 $ write out "CFLAGS=", ccopt
 $ write out "LOPTS=", lopts
+$ write out "all : example.exe minigzip.exe libz.olb"
 $ copy sys$input: out
 $ deck
-
-all : example.exe minigzip.exe libz.olb
         @ write sys$output " Example applications available"
 
 libz.olb : libz.olb($(OBJS))
@@ -432,7 +446,7 @@ example.exe : example.obj libz.olb
               link $(LOPTS) example,libz.olb/lib
 
 minigzip.exe : minigzip.obj libz.olb
-              link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
+              link $(LOPTS) minigzip,libz.olb/lib
 
 clean :
        delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
@@ -444,7 +458,6 @@ compress.obj : compress.c zlib.h zconf.h
 crc32.obj    : crc32.c zutil.h zlib.h zconf.h
 deflate.obj  : deflate.c deflate.h zutil.h zlib.h zconf.h
 example.obj  : [.test]example.c zlib.h zconf.h
-              cc $(CFLAGS)/include=[] [.test]example.c
 gzclose.obj  : gzclose.c zutil.h zlib.h zconf.h
 gzlib.obj    : gzlib.c zutil.h zlib.h zconf.h
 gzread.obj   : gzread.c zutil.h zlib.h zconf.h
@@ -453,7 +466,6 @@ inffast.obj  : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h
 inflate.obj  : inflate.c zutil.h zlib.h zconf.h
 inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h
 minigzip.obj : [.test]minigzip.c zlib.h zconf.h
-              cc $(CFLAGS)/include=[] [.test]minigzip.c
 trees.obj    : trees.c deflate.h zutil.h zlib.h zconf.h
 uncompr.obj  : uncompr.c zlib.h zconf.h
 zutil.obj    : zutil.c zutil.h zlib.h zconf.h
@@ -709,6 +721,7 @@ $! image from it
 $!
 $! Version history
 $! 0.01 20120128 First version
+$! 0.02 20120226 Add pre-load logic
 $!
 $ MAP_2_SHOPT: Subroutine
 $!
@@ -725,13 +738,35 @@ $    SAY "MAP_2_SHOPT:  Error, no output file provided"
 $    goto exit_m2s
 $ ENDIF
 $!
+$ module1 = "deflate#deflateEnd#deflateInit_#deflateParams#deflateSetDictionary"
+$ module2 = "gzclose#gzerror#gzgetc#gzgets#gzopen#gzprintf#gzputc#gzputs#gzread"
+$ module3 = "gzseek#gztell#inflate#inflateEnd#inflateInit_#inflateSetDictionary"
+$ module4 = "inflateSync#uncompress#zlibVersion#compress"
 $ open/read map 'p1
 $ if axp .or. ia64
-$ then 
+$ then
 $     open/write aopt a.opt
 $     open/write bopt b.opt
 $     write aopt " CASE_SENSITIVE=YES"
 $     write bopt "SYMBOL_VECTOR= (-"
+$     mod_sym_num = 1
+$ MOD_SYM_LOOP:
+$     if f$type(module'mod_sym_num') .nes. ""
+$     then
+$         mod_in = 0
+$ MOD_SYM_IN:
+$         shared_proc = f$element(mod_in, "#", module'mod_sym_num')
+$         if shared_proc .nes. "#"
+$         then
+$             write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",-
+                              f$edit(shared_proc,"upcase"),shared_proc)
+$             write bopt f$fao("!AS=PROCEDURE,-",shared_proc)
+$             mod_in = mod_in + 1
+$             goto mod_sym_in
+$         endif
+$         mod_sym_num = mod_sym_num + 1
+$         goto mod_sym_loop
+$     endif
 $MAP_LOOP:
 $     read/end=map_end map line
 $     if (f$locate("{",line).lt. f$length(line)) .or. -
@@ -756,9 +791,9 @@ $     goto map_loop
 $MAP_END:
 $     close/nolog aopt
 $     close/nolog bopt
-$     open/append libopt 'p2' 
-$     open/read aopt a.opt 
-$     open/read bopt b.opt 
+$     open/append libopt 'p2'
+$     open/read aopt a.opt
+$     open/read bopt b.opt
 $ALOOP:
 $     read/end=aloop_end aopt line
 $     write libopt line
@@ -779,13 +814,31 @@ $     write libopt f$extract(0,f$length(sv)-2,sv), "-"
 $     write libopt ")"
 $     close/nolog bopt
 $     delete/nolog/noconf a.opt;*,b.opt;*
-$ else 
+$ else
 $     if vax
 $     then
+$     open/append libopt 'p2'
+$     mod_sym_num = 1
+$ VMOD_SYM_LOOP:
+$     if f$type(module'mod_sym_num') .nes. ""
+$     then
+$         mod_in = 0
+$ VMOD_SYM_IN:
+$         shared_proc = f$element(mod_in, "#", module'mod_sym_num')
+$         if shared_proc .nes. "#"
+$         then
+$            write libopt f$fao("UNIVERSAL=!AS",-
+                                    f$edit(shared_proc,"upcase"))
+$             mod_in = mod_in + 1
+$             goto vmod_sym_in
+$         endif
+$         mod_sym_num = mod_sym_num + 1
+$         goto vmod_sym_loop
+$     endif
 $VMAP_LOOP:
 $        read/end=vmap_end map line
 $        if (f$locate("{",line).lt. f$length(line)) .or. -
-$            (f$locate("global:", line) .lt. f$length(line))
+             (f$locate("global:", line) .lt. f$length(line))
 $        then
 $            proc = true
 $            goto vmap_loop
@@ -811,5 +864,4 @@ $ endif
 $ EXIT_M2S:
 $ close/nolog map
 $ close/nolog libopt
-$ endsubroutine 
-$!------------------------------------------------------------------------------
+$ endsubroutine