source: smplayer/trunk/zlib-1.2.6/make_vms.com@ 125

Last change on this file since 125 was 124, checked in by Silvan Scherrer, 14 years ago

SMPlayer: 0.7.1 trunk update

File size: 23.5 KB
Line 
1$! make libz under VMS written by
2$! Martin P.J. Zinser
3$!
4$! In case of problems with the install you might contact me at
5$! [email protected](preferred) or
6$! [email protected] (work)
7$!
8$! Make procedure history for Zlib
9$!
10$!------------------------------------------------------------------------------
11$! Version history
12$! 0.01 20060120 First version to receive a number
13$! 0.02 20061008 Adapt to new Makefile.in
14$! 0.03 20091224 Add support for large file check
15$! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite
16$! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in
17$!
18$ on error then goto err_exit
19$ set proc/parse=ext
20$!
21$ true = 1
22$ false = 0
23$ tmpnam = "temp_" + f$getjpi("","pid")
24$ tt = tmpnam + ".txt"
25$ tc = tmpnam + ".c"
26$ th = tmpnam + ".h"
27$ define/nolog tconfig 'th'
28$ its_decc = false
29$ its_vaxc = false
30$ its_gnuc = false
31$ s_case = False
32$!
33$! Setup variables holding "config" information
34$!
35$ Make = ""
36$ name = "Zlib"
37$ version = "?.?.?"
38$ v_string = "ZLIB_VERSION"
39$ v_file = "zlib.h"
40$ ccopt = ""
41$ lopts = ""
42$ dnsrl = ""
43$ aconf_in_file = "zconf.h.in#zconf.h_in"
44$ conf_check_string = ""
45$ linkonly = false
46$ optfile = name + ".opt"
47$ libdefs = ""
48$ axp = f$getsyi("HW_MODEL").ge.1024 .and. f$getsyi("HW_MODEL").lt.4096
49$!
50$ whoami = f$parse(f$enviornment("Procedure"),,,,"NO_CONCEAL")
51$ mydef = F$parse(whoami,,,"DEVICE")
52$ mydir = f$parse(whoami,,,"DIRECTORY") - "]["
53$ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type")
54$!
55$! Check for MMK/MMS
56$!
57$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
58$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
59$!
60$!
61$ gosub find_version
62$!
63$ open/write topt tmp.opt
64$ open/write optf 'optfile'
65$!
66$ gosub check_opts
67$!
68$! Look for the compiler used
69$!
70$ gosub check_compiler
71$ close topt
72$!
73$ if its_decc
74$ then
75$ ccopt = "/prefix=all" + ccopt
76$ if f$trnlnm("SYS") .eqs. ""
77$ then
78$ if axp
79$ then
80$ define sys sys$library:
81$ else
82$ ccopt = "/decc" + ccopt
83$ define sys decc$library_include:
84$ endif
85$ endif
86$ endif
87$ if its_vaxc .or. its_gnuc
88$ then
89$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
90$ endif
91$!
92$! Build a fake configure input header
93$!
94$ open/write conf_hin config.hin
95$ write conf_hin "#undef _LARGEFILE64_SOURCE"
96$ close conf_hin
97$!
98$!
99$ i = 0
100$FIND_ACONF:
101$ fname = f$element(i,"#",aconf_in_file)
102$ if fname .eqs. "#" then goto AMISS_ERR
103$ if f$search(fname) .eqs. ""
104$ then
105$ i = i + 1
106$ goto find_aconf
107$ endif
108$ open/read/err=aconf_err aconf_in 'fname'
109$ open/write aconf zconf.h
110$ACONF_LOOP:
111$ read/end_of_file=aconf_exit aconf_in line
112$ work = f$edit(line, "compress,trim")
113$ if f$extract(0,6,work) .nes. "#undef"
114$ then
115$ if f$extract(0,12,work) .nes. "#cmakedefine"
116$ then
117$ write aconf line
118$ endif
119$ else
120$ cdef = f$element(1," ",work)
121$ gosub check_config
122$ endif
123$ goto aconf_loop
124$ACONF_EXIT:
125$ write aconf "#define VMS 1"
126$ write aconf "#include <unistd.h>"
127$ write aconf "#include <unixio.h>"
128$ write aconf "#ifdef _LARGEFILE"
129$ write aconf "#define off64_t __off64_t"
130$ write aconf "#define fopen64 fopen"
131$ write aconf "#define fseeko64 fseeko"
132$ write aconf "#define lseek64 lseek"
133$ write aconf "#define ftello64 ftell"
134$ write aconf "#endif"
135$ close aconf_in
136$ close aconf
137$ if f$search("''th'") .nes. "" then delete 'th';*
138$! Build the thing plain or with mms
139$!
140$ write sys$output "Compiling Zlib sources ..."
141$ if make.eqs.""
142$ then
143$ dele example.obj;*,minigzip.obj;*
144$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
145 adler32.c zlib.h zconf.h
146$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
147 compress.c zlib.h zconf.h
148$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
149 crc32.c zlib.h zconf.h
150$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
151 deflate.c deflate.h zutil.h zlib.h zconf.h
152$ CALL MAKE gzclose.OBJ "CC ''CCOPT' gzclose" -
153 gzclose.c zutil.h zlib.h zconf.h
154$ CALL MAKE gzlib.OBJ "CC ''CCOPT' gzlib" -
155 gzlib.c zutil.h zlib.h zconf.h
156$ CALL MAKE gzread.OBJ "CC ''CCOPT' gzread" -
157 gzread.c zutil.h zlib.h zconf.h
158$ CALL MAKE gzwrite.OBJ "CC ''CCOPT' gzwrite" -
159 gzwrite.c zutil.h zlib.h zconf.h
160$ CALL MAKE infback.OBJ "CC ''CCOPT' infback" -
161 infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
162$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
163 inffast.c zutil.h zlib.h zconf.h inffast.h
164$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
165 inflate.c zutil.h zlib.h zconf.h infblock.h
166$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
167 inftrees.c zutil.h zlib.h zconf.h inftrees.h
168$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
169 trees.c deflate.h zutil.h zlib.h zconf.h
170$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
171 uncompr.c zlib.h zconf.h
172$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
173 zutil.c zutil.h zlib.h zconf.h
174$ write sys$output "Building Zlib ..."
175$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
176$ write sys$output "Building example..."
177$ CALL MAKE example.OBJ "CC ''CCOPT' example" -
178 test/example.c zlib.h zconf.h
179$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
180$ if f$search("x11vms:xvmsutils.olb") .nes. ""
181$ then
182$ write sys$output "Building minigzip..."
183$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
184 test/minigzip.c zlib.h zconf.h
185$ call make minigzip.exe -
186 "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
187 minigzip.obj libz.olb
188$ endif
189$ else
190$ gosub crea_mms
191$ write sys$output "Make ''name' ''version' with ''Make' "
192$ 'make'
193$ endif
194$!
195$! Alpha gets a shareable image
196$!
197$ If axp
198$ Then
199$ gosub crea_olist
200$ write sys$output "Creating libzshr.exe"
201$ call anal_obj_axp modules.opt _link.opt
202$ if s_case
203$ then
204$ open/append optf modules.opt
205$ write optf "case_sensitive=YES"
206$ close optf
207$ endif
208$ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,_link.opt/opt
209$ endif
210$ write sys$output "Zlib build completed"
211$ exit
212$CC_ERR:
213$ write sys$output "C compiler required to build ''name'"
214$ goto err_exit
215$ERR_EXIT:
216$ set message/facil/ident/sever/text
217$ close/nolog optf
218$ close/nolog topt
219$ close/nolog conf_hin
220$ close/nolog aconf_in
221$ close/nolog aconf
222$ close/nolog out
223$ close/nolog min
224$ close/nolog mod
225$ close/nolog h_in
226$ write sys$output "Exiting..."
227$ exit 2
228$!
229$!
230$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
231$ V = 'F$Verify(0)
232$! P1 = What we are trying to make
233$! P2 = Command to make it
234$! P3 - P8 What it depends on
235$
236$ If F$Search(P1) .Eqs. "" Then Goto Makeit
237$ Time = F$CvTime(F$File(P1,"RDT"))
238$arg=3
239$Loop:
240$ Argument = P'arg
241$ If Argument .Eqs. "" Then Goto Exit
242$ El=0
243$Loop2:
244$ File = F$Element(El," ",Argument)
245$ If File .Eqs. " " Then Goto Endl
246$ AFile = ""
247$Loop3:
248$ OFile = AFile
249$ AFile = F$Search(File)
250$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
251$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
252$ Goto Loop3
253$NextEL:
254$ El = El + 1
255$ Goto Loop2
256$EndL:
257$ arg=arg+1
258$ If arg .Le. 8 Then Goto Loop
259$ Goto Exit
260$
261$Makeit:
262$ VV=F$VERIFY(0)
263$ write sys$output P2
264$ 'P2
265$ VV='F$Verify(VV)
266$Exit:
267$ If V Then Set Verify
268$ENDSUBROUTINE
269$!------------------------------------------------------------------------------
270$!
271$! Check command line options and set symbols accordingly
272$!
273$!------------------------------------------------------------------------------
274$! Version history
275$! 0.01 20041206 First version to receive a number
276$! 0.02 20060126 Add new "HELP" target
277$ CHECK_OPTS:
278$ i = 1
279$ OPT_LOOP:
280$ if i .lt. 9
281$ then
282$ cparm = f$edit(p'i',"upcase")
283$!
284$! Check if parameter actually contains something
285$!
286$ if f$edit(cparm,"trim") .nes. ""
287$ then
288$ if cparm .eqs. "DEBUG"
289$ then
290$ ccopt = ccopt + "/noopt/deb"
291$ lopts = lopts + "/deb"
292$ endif
293$ if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
294$ then
295$ start = f$locate("=",cparm) + 1
296$ len = f$length(cparm) - start
297$ ccopt = ccopt + f$extract(start,len,cparm)
298$ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
299 then s_case = true
300$ endif
301$ if cparm .eqs. "LINK" then linkonly = true
302$ if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
303$ then
304$ start = f$locate("=",cparm) + 1
305$ len = f$length(cparm) - start
306$ lopts = lopts + f$extract(start,len,cparm)
307$ endif
308$ if f$locate("CC=",cparm) .lt. f$length(cparm)
309$ then
310$ start = f$locate("=",cparm) + 1
311$ len = f$length(cparm) - start
312$ cc_com = f$extract(start,len,cparm)
313 if (cc_com .nes. "DECC") .and. -
314 (cc_com .nes. "VAXC") .and. -
315 (cc_com .nes. "GNUC")
316$ then
317$ write sys$output "Unsupported compiler choice ''cc_com' ignored"
318$ write sys$output "Use DECC, VAXC, or GNUC instead"
319$ else
320$ if cc_com .eqs. "DECC" then its_decc = true
321$ if cc_com .eqs. "VAXC" then its_vaxc = true
322$ if cc_com .eqs. "GNUC" then its_gnuc = true
323$ endif
324$ endif
325$ if f$locate("MAKE=",cparm) .lt. f$length(cparm)
326$ then
327$ start = f$locate("=",cparm) + 1
328$ len = f$length(cparm) - start
329$ mmks = f$extract(start,len,cparm)
330$ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
331$ then
332$ make = mmks
333$ else
334$ write sys$output "Unsupported make choice ''mmks' ignored"
335$ write sys$output "Use MMK or MMS instead"
336$ endif
337$ endif
338$ if cparm .eqs. "HELP" then gosub bhelp
339$ endif
340$ i = i + 1
341$ goto opt_loop
342$ endif
343$ return
344$!------------------------------------------------------------------------------
345$!
346$! Look for the compiler used
347$!
348$! Version history
349$! 0.01 20040223 First version to receive a number
350$! 0.02 20040229 Save/set value of decc$no_rooted_search_lists
351$! 0.03 20060202 Extend handling of GNU C
352$! 0.04 20090402 Compaq -> hp
353$CHECK_COMPILER:
354$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
355$ then
356$ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
357$ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
358$ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
359$ endif
360$!
361$! Exit if no compiler available
362$!
363$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
364$ then goto CC_ERR
365$ else
366$ if its_decc
367$ then
368$ write sys$output "CC compiler check ... hp C"
369$ if f$trnlnm("decc$no_rooted_search_lists") .nes. ""
370$ then
371$ dnrsl = f$trnlnm("decc$no_rooted_search_lists")
372$ endif
373$ define/nolog decc$no_rooted_search_lists 1
374$ else
375$ if its_vaxc then write sys$output "CC compiler check ... VAX C"
376$ if its_gnuc
377$ then
378$ write sys$output "CC compiler check ... GNU C"
379$ if f$trnlnm(topt) then write topt "gnu_cc:[000000]gcclib.olb/lib"
380$ if f$trnlnm(optf) then write optf "gnu_cc:[000000]gcclib.olb/lib"
381$ cc = "gcc"
382$ endif
383$ if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"
384$ if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"
385$ endif
386$ endif
387$ return
388$!------------------------------------------------------------------------------
389$!
390$! If MMS/MMK are available dump out the descrip.mms if required
391$!
392$CREA_MMS:
393$ write sys$output "Creating descrip.mms..."
394$ create descrip.mms
395$ open/append out descrip.mms
396$ copy sys$input: out
397$ deck
398# descrip.mms: MMS description file for building zlib on VMS
399# written by Martin P.J. Zinser
400# <[email protected] or [email protected]>
401
402OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\
403 gzread.obj, gzwrite.obj, uncompr.obj, infback.obj\
404 deflate.obj, trees.obj, zutil.obj, inflate.obj, \
405 inftrees.obj, inffast.obj
406
407$ eod
408$ write out "CFLAGS=", ccopt
409$ write out "LOPTS=", lopts
410$ copy sys$input: out
411$ deck
412
413all : example.exe minigzip.exe libz.olb
414 @ write sys$output " Example applications available"
415
416libz.olb : libz.olb($(OBJS))
417 @ write sys$output " libz available"
418
419example.exe : example.obj libz.olb
420 link $(LOPTS) example,libz.olb/lib
421
422minigzip.exe : minigzip.obj libz.olb