home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip22.zip / vms / make_zip.com < prev    next >
Text File  |  1997-07-24  |  10KB  |  280 lines

  1. $ ! MAKE_ZIP.COM
  2. $ !
  3. $ !    "Makefile" for VMS versions of Zip, ZipCloak, ZipNote,
  4. $ !    and ZipSplit (stolen from Unzip)
  5. $ !
  6. $ !    Command args:
  7. $ !    - select compiler environment: "VAXC", "DECC", "GNUC"
  8. $ !    - select installation of CLI interface version of zip:
  9. $ !      "VMSCLI" or "CLI"
  10. $ !    - force installation of UNIX interface version of zip
  11. $ !      (override LOCAL_ZIP environment): "NOVMSCLI" or "NOCLI"
  12. $ !
  13. $ !    To define additional options, define the global symbol
  14. $ !    LOCAL_ZIP prior to executing MAKE_ZIP.COM, e.g.:
  15. $ !
  16. $ !        $ LOCAL_ZIP == "VMS_IM_EXTRA,"
  17. $ !        $ @MAKE_ZIP
  18. $ !
  19. $ !    The trailing "," may be omitted.  Valid VMS-specific options
  20. $ !    include VMS_PK_EXTRA and VMS_IM_EXTRA; see the INSTALL file
  21. $ !    for other options.
  22. $ !    NOTE: This command procedure does always generate both the
  23. $ !          "default" Zip containing the UNIX style command interface
  24. $ !          and the "VMSCLI" Zip containing the CLI compatible command
  25. $ !          interface. There is no need to add "VMSCLI" to the LOCAL_ZIP
  26. $ !          symbol. (The only effect of "VMSCLI" is now the selection of the
  27. $ !          CLI style Zip executable in the foreign command definition.)
  28. $ !
  29. $ !
  30. $ on error then goto error
  31. $ on control_y then goto error
  32. $ OLD_VERIFY = f$verify(0)
  33. $!
  34. $ edit := edit            ! override customized edit commands
  35. $ say := write sys$output
  36. $!##################### Read settings from environment ########################
  37. $!
  38. $ if f$type(LOCAL_ZIP).eqs.""
  39. $ then
  40. $    local_zip = ""
  41. $ else    ! Trim blanks and append comma if missing
  42. $    local_zip = f$edit(local_zip, "TRIM")
  43. $    if f$extract(f$length(local_zip)-1, 1, local_zip).nes."," then -
  44.         local_zip = local_zip + ","
  45. $ endif
  46. $! Check for the presence of "VMSCLI" in local_zip. If yes, we will define
  47. $! the foreign command for "zip" to use the executable containing the
  48. $! CLI interface.
  49. $ pos_cli = f$locate("VMSCLI",local_zip)
  50. $ len_local_zip = f$length(local_zip)
  51. $ if pos_cli.ne.len_local_zip
  52. $ then
  53. $   CLI_IS_DEFAULT = 1
  54. $   ! Remove "VMSCLI" macro from local_zip. The Zip executable including
  55. $   ! the CLI interface is now created unconditionally.
  56. $   local_zip = f$extract(0, pos_cli, local_zip) + -
  57. $        f$extract(pos_cli+7, len_local_zip-(pos_cli+7), local_zip)
  58. $ else
  59. $   CLI_IS_DEFAULT = 0
  60. $ endif
  61. $ delete/symbol/local pos_cli
  62. $ delete/symbol/local len_local_zip
  63. $!##################### Customizing section #############################
  64. $!
  65. $ zipx_unx = "zip"
  66. $ zipx_cli = "zip_cli"
  67. $!
  68. $ MAY_USE_DECC = 1
  69. $ MAY_USE_GNUC = 0
  70. $!
  71. $! Process command line parameters requesting optional features:
  72. $ arg_cnt = 1
  73. $ argloop:
  74. $  current_arg_name = "P''arg_cnt'"
  75. $  curr_arg = f$edit('current_arg_name',"UPCASE")
  76. $  IF curr_arg .eqs. "" THEN GOTO argloop_out
  77. $  IF curr_arg .eqs. "VAXC"
  78. $  THEN MAY_USE_DECC = 0
  79. $    MAY_USE_GNUC = 0
  80. $  ENDIF
  81. $  IF curr_arg .eqs. "DECC"
  82. $  THEN MAY_USE_DECC = 1
  83. $    MAY_USE_GNUC = 0
  84. $  ENDIF
  85. $  IF curr_arg .eqs. "GNUC"
  86. $  THEN MAY_USE_DECC = 0
  87. $    MAY_USE_GNUC = 1
  88. $  ENDIF
  89. $  IF (curr_arg .eqs. "VMSCLI") .or. (curr_arg .eqs. "CLI")
  90. $  THEN
  91. $    CLI_IS_DEFAULT = 1
  92. $  ENDIF
  93. $  IF (curr_arg .eqs. "NOVMSCLI") .or. (curr_arg .eqs. "NOCLI")
  94. $  THEN
  95. $    CLI_IS_DEFAULT = 0
  96. $  ENDIF
  97. $  arg_cnt = arg_cnt + 1
  98. $ GOTO argloop
  99. $ argloop_out:
  100. $!
  101. $ if CLI_IS_DEFAULT
  102. $ then
  103. $    ZIPEXEC = zipx_cli
  104. $ else
  105. $    ZIPEXEC = zipx_unx
  106. $ endif
  107. $!
  108. $!#######################################################################
  109. $!
  110. $ ! Find out current disk, directory, compiler and options
  111. $ !
  112. $ my_name = f$env("procedure")
  113. $ workdir = f$env("default")
  114. $ here = f$parse(workdir,,,"device") + f$parse(workdir,,,"directory")
  115. $ axp = f$getsyi("HW_MODEL").ge.1024
  116. $ if axp
  117. $ then
  118. $    ! Alpha AXP
  119. $    ARCH_NAME == "Alpha"
  120. $    ARCH_PREF = "AXP_"
  121. $    HAVE_DECC_VAX = 0
  122. $    USE_DECC_VAX = 0
  123. $    if MAY_USE_GNUC
  124. $    then say "GNU C has not yet been ported to OpenVMS AXP."
  125. $         say "You must use DEC C to build Zip."
  126. $         goto error
  127. $    endif
  128. $    ARCH_CC_P = ARCH_PREF
  129. $    cc = "cc/standard=relax/prefix=all/ansi"
  130. $    defs = "''local_zip'VMS"
  131. $    opts = ""
  132. $    say "Compiling on AXP using DEC C"
  133. $ else
  134. $    ! VAX
  135. $    ARCH_NAME == "VAX"
  136. $    ARCH_PREF = "VAX_"
  137. $    HAVE_DECC_VAX = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes."")
  138. $    HAVE_VAXC_VAX = (f$search("SYS$SYSTEM:VAXC.EXE").nes."")
  139. $    MAY_HAVE_GNUC = (f$trnlnm("GNU_CC").nes."")
  140. $    IF HAVE_DECC_VAX .AND. MAY_USE_DECC
  141. $    THEN
  142. $!      We use DECC:
  143. $      USE_DECC_VAX = 1
  144. $      cc = "cc/decc/standard=vaxc/prefix=all"
  145. $      ARCH_CC_P = "''ARCH_PREF'DECC_"
  146. $      defs = "''local_zip'VMS"
  147. $      opts = ""
  148. $      say "Compiling on VAX using DEC C"
  149. $    ELSE
  150. $!      We use VAXC (or GNU C):
  151. $      USE_DECC_VAX = 0
  152. $      defs = "''local_zip'VMS"
  153. $      opts = ",SYS$DISK:[.VMS]VAXCSHR.OPT/OPTIONS"
  154. $      if (.not.HAVE_VAXC_VAX .and. MAY_HAVE_GNUC) .or. (MAY_USE_GNUC)
  155. $      then
  156. $        ARCH_CC_P = "''ARCH_PREF'GNUC_"
  157. $        cc = "gcc"
  158. $        opts = ",GNU_CC:[000000]GCCLIB.OLB/LIB ''opts'"
  159. $        say "Compiling on VAX using GNU C"
  160. $      else
  161. $        ARCH_CC_P = "''ARCH_PREF'VAXC_"
  162. $        if HAVE_DECC_VAX
  163. $        then
  164. $            cc = "cc/vaxc"
  165. $        else
  166. $            cc = "cc"
  167. $        endif
  168. $        say "Compiling on VAX using VAX C"
  169. $      endif
  170. $    ENDIF
  171. $ endif
  172. $ DEF_UNX = "/def=(''DEFS')"
  173. $ DEF_CLI = "/def=(''DEFS',VMSCLI)"
  174. $ DEF_UTIL = "/def=(''DEFS',UTIL)"
  175. $ LFLAGS = "/notrace"
  176. $ if (opts .nes. "") .and. (f$search("[.vms]vaxcshr.opt") .eqs. "")
  177. $ then    create [.vms]vaxcshr.opt
  178. $    open/append tmp [.vms]vaxcshr.opt
  179. $    write tmp "SYS$SHARE:VAXCRTL.EXE/SHARE"
  180. $    close tmp
  181. $ endif
  182. $ set verify    ! like "echo on", eh?
  183. $ !
  184. $ !------------------------------- Zip section --------------------------------
  185. $ !
  186. $ runoff/out=zip.hlp [.vms]vms_zip.rnh
  187. $ !
  188. $ cc 'DEF_UNX' /obj=zip.'ARCH_CC_P'obj zip.c
  189. $ cc 'DEF_UNX' /obj=crc32.'ARCH_CC_P'obj crc32.c
  190. $ cc 'DEF_UNX' /obj=crctab.'ARCH_CC_P'obj crctab.c
  191. $ cc 'DEF_UNX' /obj=crypt.'ARCH_CC_P'obj crypt.c
  192. $ cc 'DEF_UNX' /obj=ttyio.'ARCH_CC_P'obj ttyio.c
  193. $ cc 'DEF_UNX' /obj=zipfile.'ARCH_CC_P'obj zipfile.c
  194. $ cc 'DEF_UNX' /obj=zipup.'ARCH_CC_P'obj zipup.c
  195. $ cc 'DEF_UNX' /obj=fileio.'ARCH_CC_P'obj fileio.c
  196. $ cc 'DEF_UNX' /obj=globals.'ARCH_CC_P'obj globals.c
  197. $ cc 'DEF_UNX' /obj=util.'ARCH_CC_P'obj util.c
  198. $ cc 'DEF_UNX' /obj=deflate.'ARCH_CC_P'obj deflate.c
  199. $ cc 'DEF_UNX' /obj=trees.'ARCH_CC_P'obj trees.c
  200. $ cc 'DEF_UNX' /obj=bits.'ARCH_CC_P'obj bits.c
  201. $ cc 'DEF_UNX' /obj=vmszip.'ARCH_CC_P'obj/inc=SYS$DISK:[] [.vms]vmszip.c
  202. $ cc 'DEF_UNX' /obj=vms.'ARCH_CC_P'obj/inc=SYS$DISK:[] [.vms]vms.c
  203. $ cc 'DEF_UNX' /obj=vmsmunch.'ARCH_CC_P'obj/inc=SYS$DISK:[] [.vms]vmsmunch.c
  204. $ !
  205. $ if f$search("zip.''ARCH_CC_P'olb") .eqs. "" then -
  206.     lib/obj/create zip.'ARCH_CC_P'olb
  207. $ lib/obj/replace zip.'ARCH_CC_P'olb -
  208.     zip.'ARCH_CC_P'obj;, -
  209.     crc32.'ARCH_CC_P'obj;, crctab.'ARCH_CC_P'obj;, -
  210.     crypt.'ARCH_CC_P'obj;, ttyio.'ARCH_CC_P'obj;, -
  211.     zipfile.'ARCH_CC_P'obj;, zipup.'ARCH_CC_P'obj;, -
  212.     fileio.'ARCH_CC_P'obj;, util.'ARCH_CC_P'obj;, globals.'ARCH_CC_P'obj;,-
  213.     deflate.'ARCH_CC_P'obj;, trees.'ARCH_CC_P'obj;, bits.'ARCH_CC_P'obj;, -
  214.     vmszip.'ARCH_CC_P'obj;, vms.'ARCH_CC_P'obj;, -
  215.     vmsmunch.'ARCH_CC_P'obj;
  216. $ !
  217. $ link'LFLAGS'/exe='zipx_unx'.'ARCH_CC_P'exe -
  218.     zip.'ARCH_CC_P'olb;/incl=(zip,globals)/lib 'opts'
  219. $ !
  220. $ !------------------------ Zip (CLI interface) section -----------------------
  221. $ !
  222. $ set default [.vms]
  223. $ edit/tpu/nosection/nodisplay/command=cvthelp.tpu zip_cli.help
  224. $ set default [-]
  225. $ runoff/out=zip_cli.hlp [.vms]zip_cli.rnh
  226. $ !
  227. $ cc 'DEF_CLI' /obj=zipcli.'ARCH_CC_P'obj zip.c
  228. $ cc 'DEF_CLI'/INCLUDE=SYS$DISK:[] /OBJ=cmdline.'ARCH_CC_P'obj -
  229.     [.vms]cmdline.c
  230. $ set command/obj=zip_cli.'ARCH_CC_P'obj [.vms]zip_cli.cld
  231. $ !
  232. $ if f$search("zipcli.''ARCH_CC_P'olb") .eqs. "" then -
  233.     lib/obj/create zipcli.'ARCH_CC_P'olb
  234. $ lib/obj/replace zipcli.'ARCH_CC_P'olb -
  235.     zipcli.'ARCH_CC_P'obj;, -
  236.     cmdline.'ARCH_CC_P'obj;, zip_cli.'ARCH_CC_P'obj;
  237. $ !
  238. $ link'LFLAGS'/exe='zipx_cli'.'ARCH_CC_P'exe -
  239.     zipcli.'ARCH_CC_P'olb;/incl=(zip)/lib, -
  240.     zip.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts'
  241. $ !
  242. $ !-------------------------- Zip utilities section ---------------------------
  243. $ !
  244. $ cc 'DEF_UTIL' /obj=zipfile_.'ARCH_CC_P'obj zipfile.c
  245. $ cc 'DEF_UTIL' /obj=fileio_.'ARCH_CC_P'obj fileio.c
  246. $ cc 'DEF_UTIL' /obj=util_.'ARCH_CC_P'obj util.c
  247. $ cc 'DEF_UTIL' /obj=crypt_.'ARCH_CC_P'obj crypt.c
  248. $ cc 'DEF_UTIL'/incl=SYS$DISK:[] /obj=vms_.'ARCH_CC_P'obj [.vms]vms.c
  249. $ if f$search("ziputils.''ARCH_CC_P'olb") .eqs. "" then -
  250.     lib/obj/create ziputils.'ARCH_CC_P'olb
  251. $ lib/obj/replace ziputils.'ARCH_CC_P'olb -
  252.     zipfile_.'ARCH_CC_P'obj;, fileio_.'ARCH_CC_P'obj;, -
  253.     util_.'ARCH_CC_P'obj;, globals.'ARCH_CC_P'obj;, -
  254.     crctab.'ARCH_CC_P'obj;, crypt_.'ARCH_CC_P'obj;, ttyio.'ARCH_CC_P'obj;,-
  255.     vms_.'ARCH_CC_P'obj;, vmsmunch.'ARCH_CC_P'obj;
  256. $ cc 'DEF_UNX' /obj=zipcloak.'ARCH_CC_P'obj zipcloak.c
  257. $ cc 'DEF_UNX' /obj=zipnote.'ARCH_CC_P'obj zipnote.c
  258. $ cc 'DEF_UNX' /obj=zipsplit.'ARCH_CC_P'obj zipsplit.c
  259. $ link'LFLAGS'/exe=zipcloak.'ARCH_CC_P'exe zipcloak.'ARCH_CC_P'obj, -
  260.     ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts'
  261. $ link'LFLAGS'/exe=zipnote.'ARCH_CC_P'exe zipnote.'ARCH_CC_P'obj, -
  262.     ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts'
  263. $ link'LFLAGS'/exe=zipsplit.'ARCH_CC_P'exe zipsplit.'ARCH_CC_P'obj, -
  264.     ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts'
  265. $ !
  266. $ !----------------------------- Symbols section ------------------------------
  267. $ !
  268. $ ! Set up symbols for the various executables.  Edit the example below,
  269. $ ! changing "disk:[directory]" as appropriate.
  270. $ !
  271. $ zip           == "$''here'''ZIPEXEC'.''ARCH_CC_P'exe"
  272. $ zipcloak      == "$''here'zipcloak.''ARCH_CC_P'exe"
  273. $ zipnote       == "$''here'zipnote.''ARCH_CC_P'exe"
  274. $ zipsplit      == "$''here'zipsplit.''ARCH_CC_P'exe"
  275. $ !
  276. $error:
  277. $ if here .nes. "" then set default 'here'
  278. $ dummy = f$verify(OLD_VERIFY)
  279. $ exit
  280.