Mercurial > pygame
annotate make_prebuilt.py @ 3194:9fcb7abf3185 default tip
Remove some gcc 4.7.2 compiler warnings
| author | Lenard Lindstrom <len-l@telus.net> |
|---|---|
| date | Tue, 23 Apr 2013 19:53:36 -0700 |
| parents | aee1b66379f3 |
| children |
| rev | line source |
|---|---|
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
1 import msys |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
2 |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
3 from distutils.extension import read_setup_file |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
4 from optparse import OptionParser |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
5 import os |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
6 import re |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
7 import sys |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
8 |
|
2061
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
9 # For Python 2.x/3.x compatibility |
|
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
10 def geterror(): |
|
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
11 return sys.exc_info()[1] |
|
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
12 |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
13 default_msys_prefix = '/usr/local' |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
14 |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
15 prebuilt_dir = 'prebuilt' |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
16 lib_subdir = 'lib' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
17 |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
18 def print_(*args, **kwds): |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
19 msys.msys_print(*args, **kwds) |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
20 |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
21 class MakePrebuiltError(Exception): |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
22 pass |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
23 |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
24 def file_copy(src, dest): |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
25 if os.path.isdir(dest): |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
26 dest = os.path.join(dest, os.path.split(src)[1]) |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
27 s = open(src, 'rb') |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
28 try: |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
29 d = open(dest, 'wb') |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
30 try: |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
31 d.write(s.read()) |
|
2061
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
32 print_("%s => %s" % (src, dest)) |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
33 finally: |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
34 d.close() |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
35 finally: |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
36 s.close() |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
37 |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
38 def find_import_libraries(path, roots): |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
39 match = re.compile(r'lib(%s)\.dll\.a$' % '|'.join(roots)).match |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
40 return [name for name in os.listdir(path) if match(name) is not None] |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
41 |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
42 def copy_dir(src, dest): |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
43 if dest == '.': |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
44 ignore, dest = os.path.split(src) |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
45 if src == dest: |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
46 raise IOError("%s: Source and destination are identical" % src) |
|
3063
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
47 makedirs(dest) |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
48 for name in os.listdir(src): |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
49 src_path = os.path.join(src, name) |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
50 if os.path.isfile(src_path): |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
51 file_copy(src_path, os.path.join(dest, name)) |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
52 |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
53 def confirm(message): |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
54 "ask a yes/no question, return result" |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
55 reply = msys.msys_raw_input("\n%s [Y/n]:" % message) |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
56 if reply and reply[0].lower() == 'n': |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
57 return 0 |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
58 return 1 |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
59 |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
60 created_dirs = set() |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
61 |
|
3063
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
62 def makedirs(path): |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
63 path = os.path.abspath(path) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
64 if path in created_dirs: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
65 pass |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
66 elif not os.path.exists(path): |
|
3063
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
67 os.makedirs(path) |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
68 created_dirs.add(path) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
69 elif not os.path.isdir(path): |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
70 raise MakePrebuiltError("%s is not a directory" % path) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
71 |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
72 |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
73 def command_line(): |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
74 """Process the command line and return the options""" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
75 |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
76 usage = ("usage: %prog [options] [destination]\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
77 "\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
78 "Assemble the Python 2.5 prebuilt dependencies directory. The\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
79 "default destination is .\\prebuilt .\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
80 "\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
81 "At startup this program may prompt for missing information.\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
82 "Be aware of this before redirecting output or leaving the\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
83 "program unattended. Once the '=== Assembling ===' message appears\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
84 "no more user input is required.") |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
85 |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
86 parser = OptionParser(usage) |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
87 parser.add_option('-f', '--force', action='store_true', dest='force', |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
88 help="Overwrite an existing destination directory" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
89 " without prompting first") |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
90 parser.set_defaults(force=False) |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
91 parser.add_option('-m', '--msys-root', action='store', |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
92 dest='msys_directory', |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
93 help="MSYS directory path, which may include" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
94 " the 1.x subdirectory") |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
95 parser.set_defaults(msys_directory='') |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
96 parser.add_option('-s', '--source', action='store', |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
97 dest='source_directory', |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
98 help="Directory where the DLLs and headers are installed:\n" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
99 "(defaults to MSYS %s)" |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
100 % (default_msys_prefix,)) |
|
2061
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
101 parser.set_defaults(source_directory='') |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
102 return parser.parse_args() |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
103 |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
104 def main(dest_dir=None, src_dir=None, msys_dir=None, force=None): |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
105 # Top level directories. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
106 if dest_dir is None: |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
107 dest_dir = '' |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
108 if src_dir is None: |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
109 source_dir = '' |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
110 if msys_dir is None: |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
111 msys_dir = '' |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
112 if force is None: |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
113 force = False |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
114 if not dest_dir: |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
115 dest_dir = prebuilt_dir |
|
1371
63d0c0d28d59
Give make_prebuilt.py some command line argument checking
Lenard Lindstrom <len-l@telus.net>
parents:
1362
diff
changeset
|
116 if re.match(r'([A-Za-z]:){0,1}[^"<>:|?*]+$', dest_dir) is None: |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
117 print_("Invalid directory path name %s" % (dest_dir,)) |
|
1371
63d0c0d28d59
Give make_prebuilt.py some command line argument checking
Lenard Lindstrom <len-l@telus.net>
parents:
1362
diff
changeset
|
118 return 1 |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
119 dest_dir = os.path.abspath(dest_dir) |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
120 if not force and os.path.isdir(dest_dir): |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
121 if not confirm("Directory %s already exists;\ncontinue" % dest_dir): |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
122 return 1 |
|
3063
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
123 makedirs(dest_dir) |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
124 if not src_dir: |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
125 try: |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
126 m = msys.Msys() |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
127 except msys.MsysException: |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
128 return 0 |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
129 src_dir = os.path.join(m.msys_root, 'local') |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
130 else: |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
131 src_dir = os.path.abspath(src_dir) |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
132 if not os.path.isdir(src_dir): |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
133 print_("Source directory %s not found." % (src_dir,)) |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
134 return 1 |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
135 print_("=== Assembling ===") |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
136 prebuilt_template = os.path.abspath('prebuilt-template') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
137 dest_lib_dir = os.path.join(dest_dir, lib_subdir) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
138 |
|
3063
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
139 # msvcr71.dll or msvcr90.dll linking support. |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
140 src_msvcr71_dir = os.path.join(src_dir, 'lib', 'msvcr71') |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
141 have_msvcr71 = os.path.isdir(src_msvcr71_dir) |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
142 src_msvcr90_dir = os.path.join(src_dir, 'lib', 'msvcr90') |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
143 have_msvcr90 = os.path.isdir(src_msvcr90_dir) |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
144 if have_msvcr71 and have_msvcr90: |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
145 print_("Conflicting builds: " |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
146 "found both msvcr71.dll and msvcr90.dll linkage") |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
147 return 1 |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
148 if have_msvcr71: |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
149 dest_msvcr71_dir = os.path.join(dest_dir, 'lib', 'msvcr71') |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
150 copy_dir(src_msvcr71_dir, dest_msvcr71_dir) |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
151 elif have_msvcr90: |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
152 dest_msvcr90_dir = os.path.join(dest_dir, 'lib', 'msvcr90') |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
153 copy_dir(src_msvcr90_dir, dest_msvcr90_dir) |
|
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
154 |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
155 # Read setup file. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
156 src_file = os.path.join(prebuilt_template, 'Setup_Win.in') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
157 file_copy(src_file, dest_dir) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
158 deps = read_setup_file(src_file) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
159 setup_in = open(src_file) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
160 match = re.compile('[A-Z_][A-Z0-9_]* *=(.*)').match |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
161 header_dir_pat = re.compile(' -I([^ ]+)') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
162 lib_pat = re.compile(' -l([^ ]+)') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
163 macros = [] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
164 for line in setup_in: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
165 matches = match(line) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
166 if matches is not None: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
167 flags = matches.group(1) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
168 header_dirs = header_dir_pat.findall(flags) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
169 libs = lib_pat.findall(flags) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
170 macros.append((header_dirs, libs)) |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
171 |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
172 # Copy DLLs. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
173 src_bin_dir = os.path.join(src_dir, 'bin') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
174 have_dlls = set() |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
175 for dep in deps: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
176 path_elements = dep.library_dirs[0].split('/') # / required by setup. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
177 dll_name = path_elements[-1] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
178 src_dll_path = os.path.join(src_bin_dir, dll_name) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
179 if os.path.exists(src_dll_path): |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
180 if path_elements[0] == '.': |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
181 path_elements = path_elements[2:] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
182 else: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
183 path_elements = path_elements[1:] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
184 dest_dll_dir = dest_dir |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
185 for dir_name in path_elements[:-1]: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
186 dest_dll_dir = os.path.join(dest_dll_dir, dir_name) |
|
3063
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
187 makedirs(dest_dll_dir) |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
188 file_copy(os.path.join(src_bin_dir, dll_name), |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
189 os.path.join(dest_dll_dir, dll_name)) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
190 have_dlls.add(dep.name[8:]) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
191 |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
192 # Copy required import libraries only. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
193 copied_files = set() |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
194 src_lib_dir = os.path.join(src_dir, 'lib') |
|
3063
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
195 makedirs(dest_lib_dir) |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
196 for ignore, libs in macros: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
197 use = False |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
198 for lib in libs: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
199 if lib in have_dlls: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
200 use = True |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
201 break |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
202 if use and lib not in copied_files: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
203 copied_files.add(lib) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
204 lib_name = 'lib%s.dll.a' % lib |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
205 src_lib_path = os.path.join(src_lib_dir, lib_name) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
206 if not os.path.exists(src_lib_path): |
|
2061
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
207 print_("Missing import library %s" % (lib_name,)) |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
208 return 1 |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
209 file_copy(src_lib_path, os.path.join(dest_lib_dir, lib_name)) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
210 |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
211 # Copy required header directories only. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
212 copied_dirs = set() |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
213 for header_dirs, libs in macros: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
214 use = False |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
215 for lib in libs: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
216 if lib in have_dlls: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
217 use = True |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
218 break |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
219 if use: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
220 for header_dir in header_dirs: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
221 path_elements = header_dir.split('/') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
222 if path_elements[0] == '.': |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
223 path_elements = path_elements[2:] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
224 else: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
225 path_elements = path_elements[1:] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
226 src_header_dir = os.path.join(src_dir, *path_elements) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
227 if not os.path.exists(src_header_dir): |
|
2061
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
228 print_("Missing include directory %s" % (src_header_dir,)) |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
229 return 1 |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
230 dest_header_dir = dest_dir |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
231 for dir_name in path_elements: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
232 dest_header_dir = os.path.join(dest_header_dir, dir_name) |
|
3063
aee1b66379f3
Clean up some Windows dependency build issues
Lenard Lindstrom <len-l@telus.net>
parents:
2061
diff
changeset
|
233 makedirs(dest_header_dir) |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
234 if not src_header_dir in copied_dirs: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
235 copy_dir(src_header_dir, dest_header_dir) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
236 copied_dirs.add(src_header_dir) |
|
1915
64baf57aa9d1
Windows dependency build now replaces SDL_config.py with SDL_config_win32.py for use with MSVC
Lenard Lindstrom <len-l@telus.net>
parents:
1371
diff
changeset
|
237 if 'SDL' in have_dlls: |
|
64baf57aa9d1
Windows dependency build now replaces SDL_config.py with SDL_config_win32.py for use with MSVC
Lenard Lindstrom <len-l@telus.net>
parents:
1371
diff
changeset
|
238 # For MSVC use SDL_config_win32.h in place of configure |
|
64baf57aa9d1
Windows dependency build now replaces SDL_config.py with SDL_config_win32.py for use with MSVC
Lenard Lindstrom <len-l@telus.net>
parents:
1371
diff
changeset
|
239 # generated SDL_config.h. |
|
64baf57aa9d1
Windows dependency build now replaces SDL_config.py with SDL_config_win32.py for use with MSVC
Lenard Lindstrom <len-l@telus.net>
parents:
1371
diff
changeset
|
240 file_copy( |
|
64baf57aa9d1
Windows dependency build now replaces SDL_config.py with SDL_config_win32.py for use with MSVC
Lenard Lindstrom <len-l@telus.net>
parents:
1371
diff
changeset
|
241 os.path.join(src_dir, 'include', 'SDL', 'SDL_config_win32.h'), |
|
64baf57aa9d1
Windows dependency build now replaces SDL_config.py with SDL_config_win32.py for use with MSVC
Lenard Lindstrom <len-l@telus.net>
parents:
1371
diff
changeset
|
242 os.path.join(dest_dir, 'include', 'SDL', 'SDL_config.h')) |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
243 |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
244 # Def file bat. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
245 make_defs = open(os.path.join(dest_lib_dir, 'MakeDefs.bat'), 'w') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
246 try: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
247 make_defs.write('@echo off\n' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
248 'rem Make .def files needed for .lib file creation.\n' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
249 'rem Requires pexports.exe on the search path\n' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
250 'rem (found in altbinutils-pe as SourceForge,\n' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
251 'rem http://sourceforge.net/projects/mingwrep/).\n\n') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
252 for dep in deps: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
253 dll_name = os.path.split(dep.library_dirs[0])[1] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
254 lib = dep.name[8:] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
255 lib_name = 'lib%s.dll.a' % lib |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
256 if os.path.exists(os.path.join(dest_lib_dir, lib_name)): |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
257 start = '' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
258 else: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
259 start = 'rem ' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
260 make_defs.write('%spexports %s >%s.def\n' % |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
261 (start, dll_name, lib)) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
262 finally: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
263 make_defs.close() |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
264 |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
265 # Lib import files bat. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
266 make_libs = open(os.path.join(dest_lib_dir, 'MakeLibs.bat'), 'w') |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
267 try: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
268 make_libs.write('@echo off\n' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
269 'rem Make .lib import libraries.\n' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
270 'rem Requires Visual C++ Studio or Toolkit.\n' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
271 'rem VCVARS32.BAT (VCVARS64.BAT (?) for 64 bit build)\n' |
|
2047
db7447dd124d
update Windows dependencies to the latest libraries
Lenard Lindstrom <len-l@telus.net>
parents:
1915
diff
changeset
|
272 'rem must be run first to use LINK.EXE.\n\n') |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
273 for dep in deps: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
274 dll_name = os.path.split(dep.library_dirs[0])[1] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
275 lib = dep.name[8:] |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
276 lib_name = 'lib%s.dll.a' % lib |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
277 if os.path.exists(os.path.join(dest_lib_dir, lib_name)): |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
278 start = '' |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
279 else: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
280 start = 'rem ' |
|
2047
db7447dd124d
update Windows dependencies to the latest libraries
Lenard Lindstrom <len-l@telus.net>
parents:
1915
diff
changeset
|
281 make_libs.write('%sLINK.EXE /LIB /NOLOGO /DEF:%s.def /MACHINE:IX86 /OUT:%s.lib\n' % |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
282 (start, lib, lib)) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
283 finally: |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
284 make_libs.close() |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
285 |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
286 # Top level make batch file for 32 bit build. |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
287 file_copy(os.path.join(prebuilt_template, 'Make32.bat'), dest_lib_dir) |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
288 |
|
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
289 return 0 |
|
1355
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
290 |
|
8a239e483d1a
Preliminary Windows prebuilt make utility
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
291 if __name__ =='__main__': |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
292 options, args = command_line() |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
293 dest_dir = None |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
294 if args: |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
295 dest_dir = args[0] |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
296 try: |
|
2055
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
297 sys.exit(main(dest_dir=dest_dir, |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
298 src_dir=options.source_directory, |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
299 msys_dir=options.msys_directory, |
|
ee2af5cdd5fb
Add --source option to complement msys_build_deps.py --prefix option
Lenard Lindstrom <len-l@telus.net>
parents:
2047
diff
changeset
|
300 force=options.force)) |
|
2061
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
301 except MakePrebuiltError: |
|
5eb35a6e06c0
make Python 3.1 compatible
Lenard Lindstrom <len-l@telus.net>
parents:
2055
diff
changeset
|
302 print_("*** %s; execution halted" % (geterror(),)) |
|
1362
625543bfbaa0
dep build fix and polished up prebuilt make script
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
303 sys.exit(1) |
