1 $! $Id: buildvms.com,v 1.2 2006/09/27 11:51:44 michaelsmith Exp $
3 $! VMS procedure to compile and link modules for NEdit
6 $! In case of problems with the install you might contact me at
7 $! zinser@zinser.no-ip.info(preferred) or
8 $! zinser@sysdev.deutsche-boerse.com (work)
10 $! Make procedure history for NEdit
12 $!------------------------------------------------------------------------------
14 $! 0.01 20040229 First version to receive a number
15 $! 0.02 20041109 Init s_case for case sensitive shareable images
16 $! 0.03 20041229 Some more config info (tconfig, conf_check_string)
17 $! 0.04 20050105 Add check for MMS/MMK, does not hurt even for pure DCL build
18 $! 0.05 20060105 Merge in improvements by Michael Smith from NEdit CVS
20 $ ON ERROR THEN GOTO err_exit
23 $ tmpnam = "temp_" + f$getjpi("","pid")
24 $ tt = tmpnam + ".txt"
34 $! Setup variables holding "config" information
40 $ aconf_in_file = "config.hin"
41 $ conf_check_string = ""
46 $ whoami = f$parse(f$enviornment("Procedure"),,,,"NO_CONCEAL")
47 $ mydef = F$parse(whoami,,,"DEVICE")
48 $ mydir = f$parse(whoami,,,"DIRECTORY") - "]["
49 $ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type")
50 $ xmldir = mydef + mydir - ".MAKEFILES]" + ".MICROLINE.XML]"
51 $ startdir = mydef + mydir - ".MAKEFILES]" +"]"
56 $ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
57 $ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
61 $! Default is to build NEdit.
62 $! If requested do cleanup, create dist, then exit
64 $ if (target .nes. "")
69 $ gosub check_compiler
71 $ if (its_decc) then ccopt = ccopt + "/prefix=all"
72 $ if f$length(make) .gt. 0
77 $ set def [-.microline.xml]
85 $ DEFINE SYS DECC$LIBRARY_INCLUDE
86 $ DEFINE XM DECW$INCLUDE
87 $ DEFINE X11 DECW$INCLUDE
90 $ if f$search("LIBNUTIL.OLB") .eqs. "" then library/create/object libNUtil.olb
91 $ if f$search("VMSUTILS.OLB") .eqs. "" then library/create/object vmsutils.olb
93 $ call COMPILE CLEARCASE libNUtil
94 $ call COMPILE DIALOGF libNUtil
95 $ call COMPILE FILEUTILS libNUtil
96 $ call COMPILE GETFILES libNUtil
97 $ call COMPILE MISC libNUtil
98 $ call COMPILE PREFFILE libNUtil
99 $ call COMPILE PRINTUTILS libNUtil
100 $ call COMPILE FONTSEL libNUtil
101 $ call COMPILE MANAGEDLIST libNUtil
102 $ call COMPILE MOTIF libNUtil
103 $ call COMPILE UTILS libNUtil
104 $ call COMPILE VMSUTILS vmsutils
105 $ set def [-.microline.xml]
106 $ if f$search("libXmL.OLB") .eqs. "" then library/create/object libXmL.olb
107 $ call COMPILE Folder libXmL
108 $ call COMPILE Grid libXmL
109 $ call COMPILE GridUtil libXmL
110 $ call COMPILE Progress libXmL
111 $ call COMPILE Tree libXmL
112 $ call COMPILE XmL libXmL
114 $ cflags = ccopt + "/include=[]"
115 $ if f$search("libXlt.OLB") .eqs. "" then library/create/object libXlt.olb
116 $ call COMPILE BubbleButton libXlt
117 $ call COMPILE SlideC libXlt
119 $ cflags = ccopt + "/DEFINE=(USE_ACCESS)/include=[-.xlt]"
120 $ call COMPILE SELECTION
125 $ call COMPILE PREFERENCES
126 $ call COMPILE REGULAREXP
127 $ call COMPILE SEARCH
131 $ call COMPILE WINDOW
132 $ call COMPILE USERCMDS
135 $ call COMPILE TEXTSEL
136 $ call COMPILE TEXTDISP
137 $ call COMPILE TEXTBUF
138 $ call COMPILE TEXTDRAG
139 $ call COMPILE SERVER
140 $ call COMPILE HIGHLIGHT
141 $ call COMPILE HIGHLIGHTDATA
142 $ call COMPILE INTERPRET
143 $ call COMPILE SMARTINDENT
144 $ call COMPILE REGEXCONVERT
145 $ call COMPILE RBTREE
146 $ call COMPILE WINDOWTITLE
147 $ call COMPILE LINKDATE
148 $ call COMPILE CALLTIPS
149 $ call COMPILE RANGESET
150 $ call COMPILE SERVER_COMMON
152 $ if f$search("PARSE.C") .nes. "" then DELETE PARSE.C;*
153 $ COPY PARSE_NOYACC.C PARSE.C
157 $ OBJS := nedit, file, menu, window, selection, search, undo, shift, -
158 help, preferences, tags, userCmds, regularExp, macro, text, -
159 textSel, textDisp, textBuf, textDrag, server, highlight, -
160 highlightData, interpret, parse, smartIndent, regexconvert, -
161 rbTree, windowtitle, linkdate, calltips, rangeset, server_common
163 $ LINK 'lopts' 'OBJS', NEDIT_OPTIONS_FILE/OPT, -
164 [-.microline.xml]libxml/lib, [-.xlt]libXlt/lib, -
165 [-.util]vmsUtils/lib, libNUtil/lib
166 $ LINK 'lopts' nc, server_common.obj, NEDIT_OPTIONS_FILE/OPT, -
167 [-.util]vmsUtils/lib, libNUtil/lib
170 $ if f$type(dnrsl) .eqs. "STRING" then -
171 define decc$no_rooted_search_lists 'dnrsl'
174 $ write sys$output "C compiler required to build ''name'"
177 $ if f$type(dnrsl) .eqs. "STRING" then -
178 define decc$no_rooted_search_lists 'dnrsl'
180 $ write sys$output "Error building ''name'. Exiting..."
182 $!------------------------------------------------------------------------------
184 $! If MMS/MMK are available dump out the descrip.mms if required
187 $ write sys$output "Creating [.util]descrip.mms..."
188 $ create [.util]descrip.mms
189 $ open/append out [.util]descrip.mms
190 $ write out "CFLAGS=", ccopt
191 $ copy sys$input: out
196 DEFINE SYS DECC$LIBRARY_INCLUDE
197 DEFINE XM DECW$INCLUDE
198 DEFINE X11 DECW$INCLUDE
200 OBJS = clearcase.obj, DialogF.obj, getfiles.obj, printUtils.obj, misc.obj,\
201 fileUtils.obj, prefFile.obj, fontsel.obj, managedlist.obj, utils.obj,\
204 all : libNUtil.olb VMSUTILS.olb
207 libNUtil.olb : $(OBJS)
208 $(AR) /CREATE/OBJ libNUtil.olb $(OBJS)
210 VMSUTILS.olb : VMSUTILS.obj
211 $(AR) /CREATE/OBJ VMSUTILS VMSUTILS
214 $ write sys$output "Creating [.microline.xml]descrip.mms..."
215 $ create [.microline.xml]descrip.mms
216 $ open/append out [.microline.xml]descrip.mms
217 $ write out "CFLAGS=", ccopt
218 $ copy sys$input: out
223 DEFINE SYS DECC$LIBRARY_INCLUDE
224 DEFINE XM DECW$INCLUDE
225 DEFINE X11 DECW$INCLUDE
227 $ write out " DEFINE XML ", xmldir
228 $ copy sys$input: out
231 OBJS = Folder.obj, Grid.obj, GridUtil.obj, Progress.obj, Tree.obj, XmL.obj
237 $(AR) /CREATE/OBJ libXmL.olb $(OBJS)
240 $ write sys$output "Creating [.xlt]descrip.mms..."
241 $ create [.xlt]descrip.mms
242 $ open/append out [.xlt]descrip.mms
243 $ write out "CFLAGS=", ccopt, "/include=[]"
244 $ copy sys$input: out
250 DEFINE SYS DECC$LIBRARY_INCLUDE
251 DEFINE XM DECW$INCLUDE
252 DEFINE X11 DECW$INCLUDE
254 OBJS = BubbleButton.obj, SlideC.obj
260 $(AR) /CREATE/OBJ libXlt.olb $(OBJS)
263 $ write sys$output "Creating [.source]descrip.mms..."
264 $ create [.source]descrip.mms
265 $ open/append out [.source]descrip.mms
266 $ write out "CFLAGS=", ccopt, "/define=(USE_ACCESS)/include=[-.xlt]"
267 $ write out "LFLAGS=", lopts
268 $ copy sys$input: out
271 # Makefile for VMS/MMS
277 DEFINE SYS DECC$LIBRARY_INCLUDE
278 DEFINE XM DECW$INCLUDE
279 DEFINE X11 DECW$INCLUDE
281 $ write out " DEFINE XML ", xmldir
282 $ copy sys$input: out
284 copy parse_noyacc.c parse.c
286 SRCS = nedit.c selection.c file.c help.c menu.c preferences.c regularExp.c\
287 search.c shift.c tags.c undo.c window.c userCmds.c macro.c text.c\
288 textSel.c textDisp.c textBuf.c textDrag.c server.c highlight.c\
289 highlightData.c interpret.c smartIndent.c parse.c nc.c regexconvert.c\
290 rbtree.c linkdate.c windowTitle.c calltips.c\
291 rangeset.c, server_common.c
293 OBJS = selection.obj, file.obj, help.obj, menu.obj, preferences.obj, \
294 regularExp.obj, search.obj, shift.obj, tags.obj, undo.obj, window.obj,\
295 userCmds.obj, macro.obj, text.obj, textSel.obj, textDisp.obj,\
296 textBuf.obj, textDrag.obj, server.obj, highlight.obj,\
297 highlightData.obj, interpret.obj, smartIndent.obj, parse.obj,\
298 regexconvert.obj, rbtree.obj, linkdate.obj, windowTitle.obj, \
299 calltips.obj, rangeset.obj, server_common.obj
305 all : nedit.exe nc.exe
306 @ write sys$output "Nedit build completed"
308 nedit.exe : $(NEOBJS) $(OBJS)
309 link/exe=nedit.exe $(NEOBJS),$(OBJS), NEDIT_OPTIONS_FILE/OPT, -
310 [-.microline.xml]libxml/lib, [-.xlt]libXlt/lib, -
311 [-.util]vmsUtils/lib, libNUtil.olb/lib
314 LINK $(NCOBJS), NEDIT_OPTIONS_FILE/OPT, -
315 [-.util]vmsUtils/lib,libNUtil.olb/lib
319 $!------------------------------------------------------------------------------
321 $! Check command line options and set symbols accordingly
323 $!------------------------------------------------------------------------------
325 $! 0.01 20041206 First version to receive a number
331 $ cparm = f$edit(p'i',"upcase")
333 $! Check if parameter actually contains something
335 $ if f$edit(cparm,"trim") .nes. ""
337 $ if cparm .eqs. "DEBUG"
339 $ ccopt = ccopt + "/noopt/deb"
340 $ lopts = lopts + "/deb"
342 $ if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
344 $ start = f$locate("=",cparm) + 1
345 $ len = f$length(cparm) - start
346 $ ccopt = ccopt + f$extract(start,len,cparm)
347 $ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
350 $ if cparm .eqs. "LINK" then linkonly = true
351 $ if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
353 $ start = f$locate("=",cparm) + 1
354 $ len = f$length(cparm) - start
355 $ lopts = lopts + f$extract(start,len,cparm)
357 $ if f$locate("CC=",cparm) .lt. f$length(cparm)
359 $ start = f$locate("=",cparm) + 1
360 $ len = f$length(cparm) - start
361 $ cc_com = f$extract(start,len,cparm)
362 if (cc_com .nes. "DECC") .and. -
363 (cc_com .nes. "VAXC") .and. -
364 (cc_com .nes. "GNUC")
366 $ write sys$output "Unsupported compiler choice ''cc_com' ignored"
367 $ write sys$output "Use DECC, VAXC, or GNUC instead"
369 $ if cc_com .eqs. "DECC" then its_decc = true
370 $ if cc_com .eqs. "VAXC" then its_vaxc = true
371 $ if cc_com .eqs. "GNUC" then its_gnuc = true
374 $ if f$locate("MAKE=",cparm) .lt. f$length(cparm)
376 $ start = f$locate("=",cparm) + 1
377 $ len = f$length(cparm) - start
378 $ mmks = f$extract(start,len,cparm)
379 $ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
383 $ write sys$output "Unsupported make choice ''mmks' ignored"
384 $ write sys$output "Use MMK or MMS instead"
387 $ if cparm .eqs. "CLEAN" then target = "CLEAN"
388 $ if cparm .eqs. "DISTBIN" then target = "DISTBIN"
394 $!------------------------------------------------------------------------------
396 $! Look for the compiler used
399 $! 0.01 20040223 First version to receive a number
400 $! 0.02 20040229 Save/set value of decc$no_rooted_search_lists
402 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
404 $ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
405 $ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
406 $ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
409 $! Exit if no compiler available
411 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
416 $ write sys$output "CC compiler check ... Compaq C"
417 $ if f$trnlnm("decc$no_rooted_search_lists") .nes. ""
419 $ dnrsl = f$trnlnm("decc$no_rooted_search_lists")
421 $ define decc$no_rooted_search_lists 1
423 $ if its_vaxc then write sys$output "CC compiler check ... VAX C"
424 $ if its_gnuc then write sys$output "CC compiler check ... GNU C"
425 $ if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"
426 $ if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"
430 $!------------------------------------------------------------------------------
432 $! Cleanup files created during compilation
435 $ delete/noconfirm/log [.util]*.obj;*,[.util]*.olb;*,[.util]*.mms;*
436 $ delete/noconfirm/log [.Xlt]*.obj;*,[.Xlt]*.olb;*,[.Xlt]*.mms;*
437 $ delete/noconfirm/log [.Microline.XmL]*.obj;*,[.Microline.XmL]*.olb;*,-
438 [.Microline.XmL]*.mms;*
439 $ delete/noconfirm/log [.source]*.obj;*,[.source]*.exe;*,[.source]*.mms;*
441 $!------------------------------------------------------------------------------
443 $! Create backup saveset with binaries and other files needed to run NEdit
446 $ on error then continue
447 $ arch = f$getsyi("arch_name")
449 f$fao("!AS!AS_!AS",name,f$element(0,".",ver_no),f$element(0,".",ver_no))
451 $ delete 'name_ver'-vms-'arch'.bck;*
452 $ create/directory [.'name_ver']
453 $ set protection=w:rwed [-.'name_ver'...]*.*;*
454 $ delete [.'name_ver'...]*.*;*
455 $ delete [.'name_ver'...]*.*;*
456 $ delete [.'name_ver'...]*.*;*
457 $ delete [.'name_ver'...]*.*;*
458 $ delete [.'name_ver'...]*.*;*
459 $ delete [.'name_ver']*.*;*
460 $ create/directory [.'name_ver']
461 $ copy [.source]nedit.exe [.'name_ver']
462 $ copy [.source]nc.exe [.'name_ver']
463 $ copy README [.'name_ver']
464 $ copy COPYRIGHT [.'name_ver']
465 $ copy ReleaseNotes [.'name_ver']
466 $ copy [.doc]NEDIT.DOC [.'name_ver']
467 $ copy [.doc]NEDIT.HTML [.'name_ver']
468 $ copy [.doc]NEDIT.MAN [.'name_ver']
469 $ copy [.doc]NC.MAN [.'name_ver']
470 $ copy [.doc]FAQ.TXT [.'name_ver']
471 $ backup/log [.'name_ver'...] 'name_ver'-vms-'arch'.bck/save_set
473 $!------------------------------------------------------------------------------
475 $! Check and find version of NEdit
478 $ open/read ver_h [.source]help_data.h
480 $ read/end=end_fvloop ver_h line
481 $ if f$locate("NEditVersion",line) .nes. f$length(line)
483 $ ver_no = f$element(0,"\",f$element(1," ",f$element(1,"""",line)))
490 $!------------------------------------------------------------------------------
492 $! Subroutine to compile a source file
495 $ crdt = F$CVTIME(F$FILE_ATTRIBUTES("''p1'.c","RDT"))
497 $ if f$search("''p1'.obj") .nes. "" then -
498 ordt = F$CVTIME(F$FILE_ATTRIBUTES("''p1'.obj","RDT"))
499 $ if "''crdt'" .gts. "''ordt'"
501 $ write sys$output "Compiling ", p1
502 $ cc 'cflags' /object='p1' 'p1'.c
503 $ if p2 .nes."" then library/replace/object 'p2'.olb 'p1'.obj
507 $!------------------------------------------------------------------------------