blob: e5ca92c89d2741c22b513fd5dbc76b92f0c13e9e [file] [log] [blame]
Hirokazu Yamamotoeeba3562009-02-10 14:27:19 +00001import os
2import sys
3import subprocess
4
5TCL_MAJOR = 8
6TCL_MINOR = 5
7TCL_PATCH = 2
8
9TIX_MAJOR = 8
10TIX_MINOR = 4
11TIX_PATCH = 3
12
13def abspath(name):
14 par = os.path.pardir
15 return os.path.abspath(os.path.join(__file__, par, par, par, par, name))
16
17TCL_DIR = abspath("tcl%d.%d.%d" % (TCL_MAJOR, TCL_MINOR, TCL_PATCH))
18TK_DIR = abspath("tk%d.%d.%d" % (TCL_MAJOR, TCL_MINOR, TCL_PATCH))
19TIX_DIR = abspath("tix%d.%d.%d" % (TIX_MAJOR, TIX_MINOR, TIX_PATCH))
20OUT_DIR = abspath("tcltk")
21
22def have_args(*a):
23 return any(s in sys.argv[1:] for s in a)
24
25def enter(dir):
26 os.chdir(os.path.join(dir, "win"))
27
28def main():
29 debug = have_args("-d", "--debug")
30 clean = have_args("clean")
31 install = have_args("install")
32 tcl = have_args("tcl")
33 tk = have_args("tk")
34 tix = have_args("tix")
35 if not(tcl) and not(tk) and not(tix):
36 tcl = tk = tix = True
37
38 def nmake(makefile, *a):
39 args = ["nmake", "/nologo", "/f", makefile, "DEBUG=%d" % debug]
40 args.extend(a)
41 subprocess.check_call(args)
42
43 if tcl:
44 enter(TCL_DIR)
45 def nmake_tcl(*a):
46 nmake("makefile.vc", *a)
47 if clean:
48 nmake_tcl("clean")
49 elif install:
50 nmake_tcl("install", "INSTALLDIR=" + OUT_DIR)
51 else:
52 nmake_tcl()
53
54 if tk:
55 enter(TK_DIR)
56 def nmake_tk(*a):
57 nmake("makefile.vc", "TCLDIR=" + TCL_DIR, *a)
58 if clean:
59 nmake_tk("clean")
60 elif install:
61 nmake_tk("install", "INSTALLDIR=" + OUT_DIR)
62 else:
63 nmake_tk()
64
65 if tix:
66 enter(TIX_DIR)
67 def nmake_tix(*a):
68 nmake("python.mak",
69 "TCL_MAJOR=%d" % TCL_MAJOR,
70 "TCL_MINOR=%d" % TCL_MINOR,
71 "TCL_PATCH=%d" % TCL_PATCH,
72 "MACHINE=IX86", *a)
73 if clean:
74 nmake_tix("clean")
75 elif install:
76 nmake_tix("install", "INSTALL_DIR=" + OUT_DIR)
77 else:
78 nmake_tix()
79
80if __name__ == '__main__':
81 main()