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

  1. $ ! LINK_ZIP.COM
  2. $ !
  3. $ !    Command procedure to (re)link the VMS versions of
  4. $ !    Zip, ZipCloak, ZipNote, and ZipSplit
  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. $ on error then goto error
  14. $ on control_y then goto error
  15. $ OLD_VERIFY = f$verify(0)
  16. $!
  17. $ say := write sys$output
  18. $!##################### Read settings from environment ########################
  19. $!
  20. $ if f$type(LOCAL_ZIP).eqs.""
  21. $ then
  22. $    local_zip = ""
  23. $ else    ! Trim blanks and append comma if missing
  24. $    local_zip = f$edit(local_zip, "TRIM")
  25. $    if f$extract(f$length(local_zip)-1, 1, local_zip).nes."," then -
  26.         local_zip = local_zip + ","
  27. $ endif
  28. $! Check for the presence of "VMSCLI" in local_zip. If yes, we will define
  29. $! the foreign command for "zip" to use the executable containing the
  30. $! CLI interface.
  31. $ pos_cli = f$locate("VMSCLI",local_zip)
  32. $ len_local_zip = f$length(local_zip)
  33. $ if pos_cli.ne.len_local_zip
  34. $ then
  35. $   CLI_IS_DEFAULT = 1
  36. $   ! Remove "VMSCLI" macro from local_zip. The Zip executable including
  37. $   ! the CLI interface is now created unconditionally.
  38. $   local_zip = f$extract(0, pos_cli, local_zip) + -
  39. $        f$extract(pos_cli+7, len_local_zip-(pos_cli+7), local_zip)
  40. $ else
  41. $   CLI_IS_DEFAULT = 0
  42. $ endif
  43. $ delete/symbol/local pos_cli
  44. $ delete/symbol/local len_local_zip
  45. $!##################### Customizing section #############################
  46. $!
  47. $ zipx_unx = "zip"
  48. $ zipx_cli = "zip_cli"
  49. $!
  50. $ MAY_USE_DECC = 1
  51. $ MAY_USE_GNUC = 0
  52. $!
  53. $! Process command line parameters requesting optional features:
  54. $ arg_cnt = 1
  55. $ argloop:
  56. $  current_arg_name = "P''arg_cnt'"
  57. $  curr_arg = f$edit('current_arg_name',"UPCASE")
  58. $  IF curr_arg .eqs. "" THEN GOTO argloop_out
  59. $  IF curr_arg .eqs. "VAXC"
  60. $  THEN MAY_USE_DECC = 0
  61. $    MAY_USE_GNUC = 0
  62. $  ENDIF
  63. $  IF curr_arg .eqs. "DECC"
  64. $  THEN MAY_USE_DECC = 1
  65. $    MAY_USE_GNUC = 0
  66. $  ENDIF
  67. $  IF curr_arg .eqs. "GNUC"
  68. $  THEN MAY_USE_DECC = 0
  69. $    MAY_USE_GNUC = 1
  70. $  ENDIF
  71. $  IF (curr_arg .eqs. "VMSCLI") .or. (curr_arg .eqs. "CLI")
  72. $  THEN
  73. $    CLI_IS_DEFAULT = 1
  74. $  ENDIF
  75. $  IF (curr_arg .eqs. "NOVMSCLI") .or. (curr_arg .eqs. "NOCLI")
  76. $  THEN
  77. $    CLI_IS_DEFAULT = 0
  78. $  ENDIF
  79. $  arg_cnt = arg_cnt + 1
  80. $ GOTO argloop
  81. $ argloop_out:
  82. $!
  83. $ if CLI_IS_DEFAULT
  84. $ then
  85. $    ZIPEXEC = zipx_cli
  86. $ else
  87. $    ZIPEXEC = zipx_unx
  88. $ endif
  89. $!
  90. $!#######################################################################
  91. $!
  92. $ ! Find out current disk, directory, compiler and options
  93. $ !
  94. $ my_name = f$env("procedure")
  95. $ workdir = f$env("default")
  96. $ here = f$parse(workdir,,,"device") + f$parse(workdir,,,"directory")
  97. $ axp = f$getsyi("HW_MODEL").ge.1024
  98. $ if axp
  99. $ then
  100. $    ! Alpha AXP
  101. $    ARCH_NAME == "Alpha"
  102. $    ARCH_PREF = "AXP_"
  103. $    HAVE_DECC_VAX = 0
  104. $    USE_DECC_VAX = 0
  105. $    IF (f$search("SYS$DISK:[]ZIP.''ARCH_PREF'OLB").nes."")
  106. $    THEN
  107. $      say "Cannot find any AXP object library for Zip."
  108. $      say "  You must keep all binary files of the object distribution"
  109. $      say "  in the current directory !"
  110. $      goto error
  111. $    ENDIF
  112. $    if MAY_USE_GNUC
  113. $    then say "GNU C has not yet been ported to OpenVMS AXP."
  114. $         say "You must use DEC C to build Zip."
  115. $         goto error
  116. $    endif
  117. $    ARCH_CC_P = ARCH_PREF
  118. $    opts = ""
  119. $    say "Linking on AXP using DEC C"
  120. $ else
  121. $    ! VAX
  122. $    ARCH_NAME == "VAX"
  123. $    ARCH_PREF = "VAX_"
  124. $       ! check which object libraries are present:
  125. $    HAVE_DECC_VAX =(f$search("SYS$DISK:[]ZIP.''ARCH_PREF'DECC_OLB").nes."")
  126. $    HAVE_VAXC_VAX =(f$search("SYS$DISK:[]ZIP.''ARCH_PREF'VAXC_OLB").nes."")
  127. $    HAVE_GNUC_VAX =(f$search("SYS$DISK:[]ZIP.''ARCH_PREF'GNUC_OLB").nes."")
  128. $    IF .not.HAVE_DECC_VAX .and. .not.HAVE_VAXC_VAX .and. .not.HAVE_GNUC_VAX
  129. $    THEN
  130. $      say "Cannot find any VAX object library for Zip."
  131. $      say "  You must keep all binary files of the object distribution"
  132. $      say "  in the current directory !"
  133. $      goto error
  134. $    ENDIF
  135. $    IF HAVE_DECC_VAX .AND. MAY_USE_DECC
  136. $    THEN
  137. $!      We use DECC:
  138. $      USE_DECC_VAX = 1
  139. $      ARCH_CC_P = "''ARCH_PREF'DECC_"
  140. $      opts = ""
  141. $      say "Linking on VAX using DEC C"
  142. $    ELSE
  143. $!      We use VAXC (or GNU C):
  144. $      USE_DECC_VAX = 0
  145. $      opts = ",SYS$DISK:[.VMS]VAXCSHR.OPT/OPTIONS"
  146. $      if HAVE_GNUC_VAX .and. (.not.HAVE_VAXC_VAX .or. MAY_USE_GNUC)
  147. $      then
  148. $        ARCH_CC_P = "''ARCH_PREF'GNUC_"
  149. $        opts = ",GNU_CC:[000000]GCCLIB.OLB/LIB ''opts'"
  150. $        say "Linking on VAX using GNU C"
  151. $      else
  152. $        ARCH_CC_P = "''ARCH_PREF'VAXC_"
  153. $        say "Linking on VAX using VAX C"
  154. $      endif
  155. $    ENDIF
  156. $ endif
  157. $ LFLAGS = "/notrace"
  158. $ if (opts .nes. "") .and. (f$search("[.vms]vaxcshr.opt") .eqs. "")
  159. $ then    create [.vms]vaxcshr.opt
  160. $    open/append tmp [.vms]vaxcshr.opt
  161. $    write tmp "SYS$SHARE:VAXCRTL.EXE/SHARE"
  162. $    close tmp
  163. $ endif
  164. $ set verify    ! like "echo on", eh?
  165. $ !
  166. $ !------------------------------- Zip section --------------------------------
  167. $ !
  168. $ link'LFLAGS'/exe='ZIPEXEC'.'ARCH_CC_P'exe -
  169.     zip.'ARCH_CC_P'olb;/incl=(zip,globals)/lib 'opts'
  170. $ !
  171. $ !------------------------ Zip (CLI interface) section -----------------------
  172. $ !
  173. $ link'LFLAGS'/exe='zipx_cli'.'ARCH_CC_P'exe -
  174.     zipcli.'ARCH_CC_P'olb;/incl=(zip)/lib, -
  175.     zip.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts'
  176. $ !
  177. $ !-------------------------- Zip utilities section ---------------------------
  178. $ !
  179. $ link'LFLAGS'/exe=zipcloak.'ARCH_CC_P'exe zipcloak.'ARCH_CC_P'obj, -
  180.     ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts'
  181. $ link'LFLAGS'/exe=zipnote.'ARCH_CC_P'exe zipnote.'ARCH_CC_P'obj, -
  182.     ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts'
  183. $ link'LFLAGS'/exe=zipsplit.'ARCH_CC_P'exe zipsplit.'ARCH_CC_P'obj, -
  184.     ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts'
  185. $ !
  186. $ !----------------------------- Symbols section ------------------------------
  187. $ !
  188. $ ! Set up symbols for the various executables.  Edit the example below,
  189. $ ! changing "disk:[directory]" as appropriate.
  190. $ !
  191. $ zip           == "$''here'''ZIPEXEC'.''ARCH_CC_P'exe"
  192. $ zipcloak      == "$''here'zipcloak.''ARCH_CC_P'exe"
  193. $ zipnote       == "$''here'zipnote.''ARCH_CC_P'exe"
  194. $ zipsplit      == "$''here'zipsplit.''ARCH_CC_P'exe"
  195. $ !
  196. $error:
  197. $ dummy = f$verify(OLD_VERIFY)
  198. $ exit
  199.