1$! $Id: vmsbuild.com,v 1.52 2010/08/08 17:57:02 tom Exp $ 2$! VMS build-script for vile. Requires installed C compiler 3$! 4$! Screen Configurations 5$! --------------------- 6$! To build vile, type: 7$! $ @vmsbuild [vile [<compiler> [bld_target]]] 8$! To build xvile, type 9$! $ @vmsbuild xvile [<compiler> [bld_target]] 10$! 11$! where: 12$! <compiler> :== { decc | vaxc } 13$! 14$! The default compiler on VAX hosts is vaxc, else decc (Alpha hosts). 15$! 16$! Configuration Note 17$! ------------------ 18$! If you elect to build both vile and xvile from the same source 19$! directory, be sure to execute these commands before each build: 20$! 21$! $ del *.obj;* 22$! $ del ne*.h;* 23$! 24$! These commands create a clean build environment for the 25$! editor's two different screen configurations (X versus SMG). 26$! 27$! ----------------------------------------------------------- 28$ hlp = f$edit("''p1'", "UPCASE") 29$ if "''hlp'" .eqs. "HELP" .or. - 30 "''hlp'" .eqs. "-H" .or. - 31 "''hlp'" .eqs. "-?" .or. - 32 "''hlp'" .eqs. "?" then gosub usage 33$ if "''hlp'" .eqs. "" .or. - 34 "''hlp'" .eqs. "VILE" .or. - 35 "''hlp'" .eqs. "VILE.EXE" .or. - 36 "''hlp'" .eqs. "XVILE" .or. - 37 "''hlp'" .eqs. "XVILE.EXE" then goto start 38$! 39$! handle the <bldtarget> 40$ gosub 'p1 41$ exit 42$! 43$ start: 44$! ----------------------------------------------------------- 45$! decide if we will use MMS, noting that MMS 3.8 is broken. 46$! if you're stuck with a broken MMS, here's where to fix this script. 47$ if f$search("SYS$SYSTEM:MMS.EXE").eqs."" 48$ then 49$ using_mms = 0 50$ else 51$ using_mms = 1 52$ endif 53$! ----------------------------------------------------------- 54$! pickup user's compiler choice, if any 55$! 56$ gosub parm2_compiler 57$! ----------------------------------------------------------- 58$! Build the option-file 59$! 60$ open/write optf vms_link.opt 61$ write optf "Identification=""Vile 9.8""" 62$ write optf "basic.obj" 63$ write optf "bind.obj" 64$ write optf "blist.obj" 65$ write optf "btree.obj" 66$ write optf "buffer.obj" 67$ write optf "csrch.obj" 68$ write optf "display.obj" 69$ write optf "dumbterm.obj" 70$ write optf "eval.obj" 71$ write optf "exec.obj" 72$ write optf "externs.obj" 73$ write optf "fences.obj" 74$ write optf "file.obj" 75$ write optf "filec.obj" 76$ write optf "fileio.obj" 77$ write optf "finderr.obj" 78$ write optf "glob.obj" 79$ write optf "globals.obj" 80$ write optf "history.obj" 81$ write optf "input.obj" 82$ write optf "insert.obj" 83$ write optf "itbuff.obj" 84$ write optf "isearch.obj" 85$ write optf "line.obj" 86$ write optf "map.obj" 87$ write optf "modes.obj" 88$ write optf "msgs.obj" 89$ write optf "npopen.obj" 90$ write optf "nullterm.obj" 91$ write optf "oneliner.obj" 92$ write optf "opers.obj" 93$ write optf "path.obj" 94$ write optf "random.obj" 95$ write optf "regexp.obj" 96$ write optf "region.obj" 97$ write optf "search.obj" 98$ write optf "select.obj" 99$ write optf "spawn.obj" 100$ write optf "statevar.obj" 101$ write optf "tags.obj" 102$ write optf "tbuff.obj" 103$ write optf "termio.obj" 104$ write optf "ucrypt.obj" 105$ write optf "undo.obj" 106$ write optf "version.obj" 107$ write optf "vms2unix.obj" 108$ write optf "vmspipe.obj" 109$ write optf "watch.obj" 110$ write optf "window.obj" 111$ write optf "word.obj" 112$ write optf "wordmov.obj" 113$! ---------------------------------- 114$! Look for the compiler used and specify architecture. 115$! 116$!!! gosub set_compiler 117$!!! gosub set_symbols 118$! 119$ CC = "CC" 120$ arch = "UNKNOWN" 121$! 122$ if f$getsyi("ARCH_NAME") .eqs. "Alpha" 123$ then 124$ arch = "__alpha__=1" 125$ if "''comp'" .eqs. "" then gosub decc_config 126$ endif 127$! 128$ if f$getsyi("ARCH_NAME") .eqs. "IA64" 129$ then 130$ arch = "__ia64__=1" 131$ if "''comp'" .eqs. "" then gosub decc_config 132$ endif 133$! 134$ if f$getsyi("ARCH_NAME") .eqs. "VAX" 135$ then 136$ arch = "__vax__=1" 137$ if "''comp'" .nes. "" then goto screen_config 138$ if f$search("SYS$SYSTEM:VAXC.EXE").nes."" 139$ then 140$ gosub vaxc_config 141$ else 142$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes."" 143$ then 144$ gosub decc_config 145$ else 146$ DEFS = ",HAVE_STRERROR" 147$ if f$trnlnm("GNU_CC").eqs."" 148$ then 149$ write sys$output "C compiler required to rebuild vile" 150$ close optf 151$ exit 152$ else 153$ write optf "gnu_cc:[000000]gcclib.olb/lib" 154$ comp = "__gcc__=1" 155$ CC = "GCC" 156$ endif 157$ endif 158$ endif 159$ endif 160$ 161$ if "''arch'" .eqs. "UNKNOWN" 162$ then 163$ write sys$output "Cannot determine architecture type" 164$ exit 1 165$ endif 166$! 167$ screen_config: 168$! 169$ MKTBLS :== $SYS$DISK:'F$DIRECTORY()MKTBLS.EXE ! make a foreign command 170$! 171$ if "''p1'" .nes. "XVILE" .and. "''p1'" .nes. "XVILE.EXE" 172$ then 173$! for regular vile, use these: 174$ SCREEN := vmsvt 175$ TARGET := vile 176$ SCRDEF := "DISP_VMSVT,scrn_chosen" 177$ mmstar = "__vile__=1" 178$ else 179$! for building the X toolkit version: 180$ SCREEN := x11 181$ TARGET := xvile 182$ SCRDEF = "NO_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen" 183$ mmstar = "__xvile__=1" 184$! 185$! Find out which X-Version we're running. This will fail for older 186$! VMS versions (i.e., v5.5-1). Therefore, choose DECWindows XUI for 187$! default. 188$! 189$ On Error Then GoTo XUI 190$ @sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version 191$ if f$extract(4,3,decw$version).eqs."1.0" 192$ then 193$ write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share" 194$ endif 195$ if f$extract(4,3,decw$version).eqs."1.1" 196$ then 197$ write optf "menu.obj" 198$ write optf "x11menu.obj" 199$ write optf "sys$share:decw$xmlibshr.exe/share" 200$ write optf "sys$share:decw$xtshr.exe/share" 201$ SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen" 202$ mmstar = "__xmvile__=1" 203$ GoTo MAIN2 204$ endif 205$ if f$extract(4,3,decw$version).eqs."1.2" 206$ then 207$ write optf "menu.obj" 208$ write optf "x11menu.obj" 209$ write optf "sys$share:decw$xmlibshr12.exe/share" 210$ write optf "sys$share:decw$xtlibshrr5.exe/share" 211$ SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen" 212$ mmstar = "__xmvile__=1" 213$ GoTo MAIN2 214$ endif 215$ GoTo MAIN 216$! 217$ XUI : 218$ write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share" 219$! 220$ MAIN : 221$ write optf "sys$share:decw$xtshr.exe/share" 222$ write optf "sys$share:decw$xlibshr.exe/share" 223$ endif 224$! 225$ MAIN2 : 226$ if using_vaxc .eq. 1 then write optf "sys$library:vaxcrtl.exe/share" 227$ close optf 228$! -------------- vms_link.opt is created ------------- 229$ if f$edit("''p1'", "UPCASE") .eqs. "VMS_LINK.OPT" 230$ then 231$! mms called this script to build vms_link.opt. all done 232$ exit 233$ endif 234$! 235$ if using_mms .eq. 0 236$ then 237$! can also use /Debug /Listing, /Show=All 238$ 239$ CFLAGS := 'CFLAGS/Diagnostics /Define=("os_chosen","''SCRDEF'''DEFS'") /Include=([]) 240$ 241$ if "''p3'" .nes. "" then gosub 'p3 242$ if "''p3'" .nes. "" then exit 1 243$! 244$ gosub all 245$! 246$ else 247$ mms/ignore=warning/macro=('comp','mmstar','arch') 'p3 248$ endif 249$ exit 250$! 251$ all: 252$ if f$search("mktbls.exe") .eqs. "" 253$ then 254$ call make mktbls 255$! sys$library:vaxcrtl.olb did not ship with VMS V8.2 HP rx2600 IA64, 256$! nor with layered product HP C V7.1-011 on OpenVMS IA64 V8.2 257$ if f$search("SYS$LIBRARY:VAXCRTL.OLB") .nes. "" 258$ then 259$ link /exec=mktbls/map/cross mktbls.obj,SYS$LIBRARY:VAXCRTL/LIB 260$ else 261$ link /exec=mktbls/map/cross mktbls.obj 262$ endif 263$ endif 264$ if f$search("nebind.h") .eqs. "" then mktbls cmdtbl 265$ if f$search("nemode.h") .eqs. "" then mktbls modetbl 266$! 267$ call make main 268$ call make 'SCREEN 269$ call make basic 270$ call make bind 271$ call make blist 272$ call make btree 273$ call make buffer 274$ call make csrch 275$ call make display 276$ call make dumbterm 277$ call make eval 278$ call make exec 279$ call make externs 280$ call make fences 281$ call make file 282$ call make filec 283$ call make fileio 284$ call make finderr 285$ call make glob 286$ call make globals 287$ call make history 288$ call make input 289$ call make insert 290$ call make itbuff 291$ call make isearch 292$ call make line 293$ call make map 294$ if "''mmstar'" .eqs. "__xmvile__=1" then call make menu 295$ if "''mmstar'" .eqs. "__xmvile__=1" then call make x11menu 296$ call make modes 297$ call make msgs 298$ call make npopen 299$ call make nullterm 300$ call make oneliner 301$ call make opers 302$ call make path 303$ call make random 304$ call make regexp 305$ call make region 306$ call make search 307$ call make select 308$ call make spawn 309$ call make statevar 310$ call make tags 311$ call make tbuff 312$ call make termio 313$ call make ucrypt 314$ call make undo 315$ call make version 316$ call make vms2unix 317$ call make vmspipe 318$ call make watch 319$ call make window 320$ call make word 321$ call make wordmov 322$! 323$ link /exec='target/map/cross main.obj, 'SCREEN.obj, vms_link/opt 324$ gosub build_last 325$ return 326$! 327$ install: 328$ WRITE SYS$ERROR "** no rule for install" 329$ gosub build_last 330$ return 331$! 332$ clobber : 333$ write sys$output "clobbering build products" 334$ if f$search("vile.com") .nes. "" then delete vile.com;* 335$ if f$search("xvile.com") .nes. "" then delete xvile.com;* 336$ if f$search("*.exe") .nes. "" then delete *.exe;* 337$ gosub clean 338$ return 339$! 340$ clean: 341$ write sys$output "cleaning build by-products" 342$ if f$search("*.obj") .nes. "" then delete *.obj;* 343$ if f$search("*.bak") .nes. "" then delete *.bak;* 344$ if f$search("*.lis") .nes. "" then delete *.lis;* 345$ if f$search("*.log") .nes. "" then delete *.log;* 346$ if f$search("*.map") .nes. "" then delete *.map;* 347$ if f$search("*.opt") .nes. "" then delete *.opt;* 348$ if f$search("ne*.h") .nes. "" then delete ne*.h;* 349$ if f$search("$(MKTBLS)") .nes. "" then delete $(MKTBLS); 350$ gosub build_last 351$ return 352$! 353$ build_last : 354$ if f$search("*.dia") .nes. "" then delete *.dia;* 355$ if f$search("*.lis") .nes. "" then purge *.lis 356$ if f$search("*.obj") .nes. "" then purge *.obj 357$ if f$search("*.map") .nes. "" then purge *.map 358$ if f$search("*.opt") .nes. "" then purge *.opt 359$ if f$search("*.exe") .nes. "" then purge *.exe 360$ if f$search("*.log") .nes. "" then purge *.log 361$ return 362$! 363$ vms_link_opt : 364$ exit 1 365$! 366$! Runs VILE from the current directory (used for testing) 367$ vile_com : 368$ if "''f$search("vile.com")'" .nes. "" then delete vile.com;* 369$ copy nl: vile.com 370$ open/append test_script vile.com 371$ write test_script "$ temp = f$environment(""procedure"")" 372$ write test_script "$ temp = temp -" 373$ write test_script " - f$parse(temp,,,""version"",""syntax_only"") -" 374$ write test_script " - f$parse(temp,,,""type"",""syntax_only"")" 375$ write test_script "$ vile :== $ 'temp'.exe" 376$ write test_script "$ define/user_mode sys$input sys$command" 377$ write test_script "$ define/user_mode sys$output sys$command" 378$ write test_script "$ vile 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8" 379$ close test_script 380$ write sys$output "** made vile.com" 381$ return 382$! 383$! Runs XVILE from the current directory (used for testing) 384$ xvile_com : 385$ if "''f$search("xvile.com")'" .nes. "" then delete xvile.com;* 386$ copy nl: xvile.com 387$ open/append test_script xvile.com 388$ write test_script "$ temp = f$environment(""procedure"")" 389$ write test_script "$ temp = temp -" 390$ write test_script " - f$parse(temp,,,""name"",""syntax_only"") -" 391$ write test_script " - f$parse(temp,,,""version"",""syntax_only"") -" 392$ write test_script " - f$parse(temp,,,""type"",""syntax_only"")" 393$ write test_script "$ xvile :== $ 'temp'xvile.exe" 394$ write test_script "$ define/user_mode sys$input sys$command" 395$ write test_script "$ define/user_mode sys$output sys$command" 396$ write test_script "$ xvile 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8" 397$ close test_script 398$ write sys$output "** made xvile.com" 399$ return 400$! 401$! Test-drivers 402$ test_io : 403$ gosub parm2_compiler 'p2 404$ gosub set_compiler 405$ gosub set_symbols 406$! 407$ call make test_io 408$ call make vmsvt 409$ call make nullterm 410$ call linkit test_io test_io.obj,vmsvt.obj,nullterm.obj 411$! 412$ return 413$! -------------------------------- 414$! Set compiler symbol "comp" based on 2nd parameter. 415$ parm2_compiler: 416$ comp = "" 417$ using_vaxc = 0 418$ if "''p2'" .nes. "" 419$ then 420$ comp = f$edit(p2, "UPCASE") 421$ if "''comp'" .eqs. "VAXC" 422$ then 423$ gosub vaxc_config 424$ else 425$ if "''comp'" .eqs. "DECC" 426$ then 427$ gosub decc_config 428$ else 429$ gosub usage 430$ endif 431$ endif 432$ endif 433$ return 434$! ---------------------------------- 435$! Look for the compiler used and specify architecture. 436$ set_compiler: 437$ CC = "CC" 438$ arch = "UNKNOWN" 439$! 440$ if f$getsyi("ARCH_NAME") .eqs. "Alpha" 441$ then 442$ arch = "__alpha__=1" 443$ if "''comp'" .eqs. "" then gosub decc_config 444$ endif 445$! 446$ if f$getsyi("ARCH_NAME") .eqs. "IA64" 447$ then 448$ arch = "__ia64__=1" 449$ if "''comp'" .eqs. "" then gosub decc_config 450$ endif 451$! 452$ if f$getsyi("ARCH_NAME") .eqs. "VAX" 453$ then 454$ arch = "__vax__=1" 455$ if "''comp'" .nes. "" then goto done_compiler 456$ if f$search("SYS$SYSTEM:VAXC.EXE").nes."" 457$ then 458$ gosub vaxc_config 459$ else 460$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes."" 461$ then 462$ gosub decc_config 463$ else 464$ DEFS = ",HAVE_STRERROR" 465$ if f$trnlnm("GNU_CC").eqs."" 466$ then 467$ write sys$output "C compiler required to rebuild vile" 468$ exit 469$ else 470$ comp = "__gcc__=1" 471$ CC = "GCC" 472$ endif 473$ endif 474$ endif 475$ endif 476$ 477$ if "''arch'" .eqs. "UNKNOWN" 478$ then 479$ write sys$output "Cannot determine architecture type" 480$ exit 1 481$ endif 482$ done_compiler: 483$ return 484$! ---------------------------------- 485$! Look for the compiler used and specify architecture. 486$ set_symbols: 487$ MKTBLS :== $SYS$DISK:'F$DIRECTORY()MKTBLS.EXE ! make a foreign command 488$! 489$ if "''p1'" .eqs. "XVILE" .or. "''p1'" .eqs. "XVILE.EXE" 490$ then 491$! for building the X toolkit version: 492$ SCREEN := x11 493$ TARGET := xvile 494$ SCRDEF = "NO_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen" 495$ mmstar = "__xvile__=1" 496$! 497$! Find out which X-Version we're running. This will fail for older 498$! VMS versions (i.e., v5.5-1). Therefore, choose DECWindows XUI for 499$! default. 500$! 501$ On Error Then GoTo done_symbol 502$ @sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version 503$ if f$extract(4,3,decw$version).eqs."1.1" 504$ then 505$ SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen" 506$ mmstar = "__xmvile__=1" 507$ endif 508$ if f$extract(4,3,decw$version).eqs."1.2" 509$ then 510$ SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen" 511$ mmstar = "__xmvile__=1" 512$ endif 513$ else 514$! for regular vile, use these: 515$ SCREEN := vmsvt 516$ TARGET := vile 517$ SCRDEF := "DISP_VMSVT,scrn_chosen" 518$ mmstar = "__vile__=1" 519$ endif 520$! can also use /Debug /Listing, /Show=All 521$ CFLAGS := 'CFLAGS/Diagnostics /Define=("os_chosen","''SCRDEF'''DEFS'") /Include=([]) 522$ if using_mms .eq. 0 523$ then 524$ BUILDS = "with_dcl" 525$ else 526$ BUILDS = "with_mms" 527$ endif 528$ done_symbol : 529$ return 530$! 531$ make: subroutine 532$ if f$search("''p1'.obj") .eqs. "" 533$ then 534$ write sys$output "compiling ''p1'" 535$ 'CC 'CFLAGS 'p1.c 536$ if f$search("''p1'.dia") .nes. "" then delete 'p1.dia;* 537$ endif 538$ exit 539$ endsubroutine 540$! 541$ linkit: subroutine 542$! sys$library:vaxcrtl.olb did not ship with VMS V8.2 HP rx2600 IA64, 543$! nor with layered product HP C V7.1-011 on OpenVMS IA64 V8.2 544$ if f$search("SYS$LIBRARY:VAXCRTL.OLB") .nes. "" 545$ then 546$ link /exec='p1/map/cross 'p2,SYS$LIBRARY:VAXCRTL/LIB 547$ else 548$ link /exec='p1/map/cross 'p2 549$ endif 550$ exit 551$ endsubroutine 552$! 553$ vaxc_config: 554$ comp = "__vaxc__=1" 555$ CFLAGS = "/VAXC" 556$ DEFS = ",HAVE_STRERROR" 557$ using_vaxc = 1 558$ if f$trnlnm("SYS") .eqs. "" then define sys sys$library: 559$ return 560$! 561$ decc_config: 562$ comp = "__decc__=1" 563$ if f$getsyi("ARCH_NAME") .eqs. "Alpha" 564$ then 565$ CFLAGS = "/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES" 566$ DEFS = ",HAVE_ALARM,HAVE_STRERROR" 567$ else 568$ if f$getsyi("ARCH_NAME") .eqs. "IA64" 569$ then 570$ CFLAGS = "/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES" 571$ DEFS = ",HAVE_ALARM,HAVE_STRERROR,USE_IEEE_FLOAT" 572$ else 573$ CFLAGS = "/DECC/prefix=all" 574$ DEFS = ",HAVE_ALARM,HAVE_STRERROR" 575$ endif 576$ endif 577$ if f$trnlnm("SYS") .eqs."" then define sys decc$library_include: 578$ return 579$! 580$ usage: 581$ write sys$output "usage: " 582$ write sys$output " $ @vmsbuild [vile [{decc | vaxc} [<bldtarget>]]]" 583$ write sys$output " or" 584$ write sys$output " $ @vmsbuild xvile [{decc | vaxc} [<bldtarget>]]" 585$ write sys$output "bldtarget is one of" 586$ write sys$output " all install clobber clean" 587$ write sys$output " vile_com xvile_com" 588$ write sys$output " test_io test_btree test_regexp" 589$ exit 2 590