Mercurial > pygame
annotate config_msys.py @ 3172:d1b367fc08bc tests-returncode
Use a return code of 1 when the tests fail.
| author | Thomas Kluyver <takowl@gmail.com> |
|---|---|
| date | Wed, 09 Jan 2013 10:13:57 +0000 |
| parents | bfbda12d6559 |
| children |
| rev | line source |
|---|---|
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
1 # Requires Python 2.4 or better and win32api. |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
2 |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
3 """Config on Msys mingw |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
4 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
5 This version expects the Pygame 1.9.0 dependencies as built by |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
6 msys_build_deps.py |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
7 """ |
| 787 | 8 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
9 import dll |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
10 from setup_win_common import get_definitions |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
11 import msys |
| 787 | 12 import os, sys, string |
| 13 from glob import glob | |
| 14 from distutils.sysconfig import get_python_inc | |
| 15 | |
| 16 configcommand = os.environ.get('SDL_CONFIG', 'sdl-config',) | |
| 17 configcommand = configcommand + ' --version --cflags --libs' | |
| 18 localbase = os.environ.get('LOCALBASE', '') | |
| 19 | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
20 #these get prefixes with '/usr/local' and /mingw or the $LOCALBASE |
| 787 | 21 origincdirs = ['/include', '/include/SDL', '/include/SDL11', |
|
1349
c57e7c3ef369
Update Windows config for new deps
Lenard Lindstrom <len-l@telus.net>
parents:
1346
diff
changeset
|
22 '/include/smpeg', '/include/libpng12', ] |
| 787 | 23 origlibdirs = ['/lib'] |
| 24 | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
25 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
26 class ConfigError(Exception): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
27 pass |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
28 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
29 def path_join(a, *p): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
30 return os.path.join(a, *p).replace(os.sep, '/') |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
31 path_split = os.path.split |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
32 |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
33 def print_(*args, **kwds): |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
34 return msys.msys_print(*args, **kwds) |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
35 |
| 787 | 36 def confirm(message): |
| 37 "ask a yes/no question, return result" | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
38 reply = msys.msys_raw_input("\n%s [Y/n]:" % message) |
| 787 | 39 if reply and string.lower(reply[0]) == 'n': |
| 40 return 0 | |
| 41 return 1 | |
| 42 | |
| 43 class DependencyProg: | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
44 needs_dll = True |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
45 def __init__(self, name, envname, exename, minver, msys, defaultlibs=None): |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
46 if defaultlibs is None: |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
47 defaultlibs = [dll.name_to_root(name)] |
| 787 | 48 self.name = name |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
49 try: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
50 command = os.environ[envname] |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
51 except KeyError: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
52 command = exename |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
53 else: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
54 drv, pth = os.path.splitdrive(command) |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
55 if drv: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
56 command = '/' + drv[0] + pth |
| 787 | 57 self.lib_dir = '' |
| 58 self.inc_dir = '' | |
|
807
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
787
diff
changeset
|
59 self.libs = [] |
| 787 | 60 self.cflags = '' |
| 61 try: | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
62 config = msys.run_shell_command([command, '--version', '--cflags', '--libs']) |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
63 ver, flags = config.split('\n', 1) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
64 self.ver = ver.strip() |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
65 flags = flags.split() |
| 787 | 66 if minver and self.ver < minver: |
| 67 err= 'WARNING: requires %s version %s (%s found)' % (self.name, self.ver, minver) | |
| 68 raise ValueError, err | |
| 69 self.found = 1 | |
| 70 self.cflags = '' | |
| 71 for f in flags: | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
72 if f[:2] in ('-I', '-L'): |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
73 self.cflags += f[:2] + msys.msys_to_windows(f[2:]) + ' ' |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
74 elif f[:2] in ('-l', '-D'): |
| 787 | 75 self.cflags += f + ' ' |
| 76 elif f[:3] == '-Wl': | |
| 77 self.cflags += '-Xlinker ' + f + ' ' | |
| 78 except: | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
79 print_('WARNING: "%s" failed!' % command) |
| 787 | 80 self.found = 0 |
| 81 self.ver = '0' | |
|
807
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
787
diff
changeset
|
82 self.libs = defaultlibs |
| 787 | 83 |
| 84 def configure(self, incdirs, libdir): | |
| 85 if self.found: | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
86 print_(self.name + ' '[len(self.name):] + ': found ' + self.ver) |
| 787 | 87 self.found = 1 |
| 88 else: | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
89 print_(self.name + ' '[len(self.name):] + ': not found') |
| 787 | 90 |
| 91 class Dependency: | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
92 needs_dll = True |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
93 def __init__(self, name, checkhead, checklib, libs=None): |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
94 if libs is None: |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
95 libs = [dll.name_to_root(name)] |
| 787 | 96 self.name = name |
| 97 self.inc_dir = None | |
| 98 self.lib_dir = None | |
|
807
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
787
diff
changeset
|
99 self.libs = libs |
| 787 | 100 self.found = 0 |
| 101 self.checklib = checklib | |
| 102 self.checkhead = checkhead | |
| 103 self.cflags = '' | |
| 104 | |
| 105 def configure(self, incdirs, libdirs): | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
106 self.find_inc_dir(incdirs) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
107 self.find_lib_dir(libdirs) |
| 787 | 108 |
| 109 if self.lib_dir and self.inc_dir: | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
110 print_(self.name + ' '[len(self.name):] + ': found') |
| 787 | 111 self.found = 1 |
| 112 else: | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
113 print_(self.name + ' '[len(self.name):] + ': not found') |
| 787 | 114 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
115 def find_inc_dir(self, incdirs): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
116 incname = self.checkhead |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
117 for dir in incdirs: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
118 path = path_join(dir, incname) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
119 if os.path.isfile(path): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
120 self.inc_dir = dir |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
121 return |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
122 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
123 def find_lib_dir(self, libdirs): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
124 libname = self.checklib |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
125 for dir in libdirs: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
126 path = path_join(dir, libname) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
127 if filter(os.path.isfile, glob(path+'*')): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
128 self.lib_dir = dir |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
129 return |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
130 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
131 |
| 787 | 132 class DependencyPython: |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
133 needs_dll = False |
| 787 | 134 def __init__(self, name, module, header): |
| 135 self.name = name | |
| 136 self.lib_dir = '' | |
| 137 self.inc_dir = '' | |
|
807
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
787
diff
changeset
|
138 self.libs = [] |
| 787 | 139 self.cflags = '' |
| 140 self.found = 0 | |
| 141 self.ver = '0' | |
| 142 self.module = module | |
| 143 self.header = header | |
| 144 | |
| 145 def configure(self, incdirs, libdirs): | |
| 146 self.found = 1 | |
| 147 if self.module: | |
| 148 try: | |
| 149 self.ver = __import__(self.module).__version__ | |
| 150 except ImportError: | |
| 151 self.found = 0 | |
| 152 if self.found and self.header: | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
153 fullpath = path_join(get_python_inc(0), self.header) |
| 787 | 154 if not os.path.isfile(fullpath): |
| 155 self.found = 0 | |
| 156 else: | |
| 157 self.inc_dir = os.path.split(fullpath)[0] | |
| 158 if self.found: | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
159 print_(self.name + ' '[len(self.name):] + ': found', self.ver) |
| 787 | 160 else: |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
161 print_(self.name + ' '[len(self.name):] + ': not found') |
| 787 | 162 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
163 class DependencyDLL: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
164 needs_dll = False |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
165 def __init__(self, name, libs=None): |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
166 if libs is None: |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
167 libs = dll.libraries(name) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
168 self.name = 'COPYLIB_' + dll.name_to_root(name) |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
169 self.inc_dir = None |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
170 self.lib_dir = '_' |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
171 self.libs = libs |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
172 self.found = 1 # Alway found to make its COPYLIB work |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
173 self.cflags = '' |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
174 self.lib_name = name |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
175 self.file_name_test = dll.tester(name) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
176 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
177 def configure(self, incdirs, libdirs, start=None): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
178 omit = [] |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
179 if start is not None: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
180 if self.set_path(start): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
181 return |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
182 omit.append(start) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
183 p, f = path_split(start) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
184 if f == 'lib' and self.set_path(path_join(p, 'bin')): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
185 return |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
186 omit.append(start) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
187 # Search other directories |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
188 for dir in libdirs: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
189 if dir not in omit: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
190 if self.set_path(dir): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
191 return |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
192 p, f = path_split(dir) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
193 if f == 'lib' and self.set_path(path_join(p, 'bin')): # cond. and |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
194 return |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
195 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
196 def set_path(self, wdir): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
197 test = self.file_name_test |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
198 try: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
199 files = os.listdir(wdir) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
200 except: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
201 pass |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
202 else: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
203 for f in files: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
204 if test(f) and os.path.isfile(path_join(wdir, f)): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
205 # Found |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
206 self.lib_dir = path_join(wdir, f) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
207 return True |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
208 # Not found |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
209 return False |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
210 |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
211 class DependencyWin: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
212 needs_dll = False |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
213 def __init__(self, name, cflags): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
214 self.name = name |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
215 self.inc_dir = None |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
216 self.lib_dir = None |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
217 self.libs = [] |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
218 self.found = 1 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
219 self.cflags = cflags |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
220 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
221 def configure(self, incdirs, libdirs): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
222 pass |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
223 |
| 787 | 224 |
| 225 def main(): | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
226 m = msys.Msys(require_mingw=False) |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
227 print_('\nHunting dependencies...') |
| 787 | 228 DEPS = [ |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
229 DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2.13', m), |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
230 Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.dll.a'), |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
231 Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.dll.a'), |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
232 Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.dll.a'), |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
233 DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3', m), |
|
2043
eee637420432
Update Windows dependencies build for MinGW GCC 4.5.0.
Lenard Lindstrom <len-l@telus.net>
parents:
1954
diff
changeset
|
234 Dependency('PNG', 'png.h', 'libpng.dll.a'), |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
235 Dependency('JPEG', 'jpeglib.h', 'libjpeg.dll.a'), |
|
1395
6ac8784bad26
Add portmidi to Windows build
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
236 Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.dll.a'), |
|
1481
3749a39d2780
Updated msys config to use a fake PORTTIME variable... so it builds again with mingw.
Rene Dudfield <renesd@gmail.com>
parents:
1434
diff
changeset
|
237 Dependency('PORTTIME', 'portmidi.h', 'libportmidi.dll.a'), |
|
2046
691c36e49876
Update ffmpeg support in Windows config for msys and prebuilt (VC support deprecated as ffpeg does not build with VC anyway)
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
238 Dependency('AVFORMAT', 'libavformat/avformat.h', 'libavformat.dll.a', |
|
691c36e49876
Update ffmpeg support in Windows config for msys and prebuilt (VC support deprecated as ffpeg does not build with VC anyway)
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
239 ['avformat', 'avcodec', 'avutil']), |
|
691c36e49876
Update ffmpeg support in Windows config for msys and prebuilt (VC support deprecated as ffpeg does not build with VC anyway)
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
240 Dependency('SWSCALE', 'libswscale/swscale.h', 'libswscale.dll.a', |
|
691c36e49876
Update ffmpeg support in Windows config for msys and prebuilt (VC support deprecated as ffpeg does not build with VC anyway)
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
241 ['swscale', 'avutil']), |
|
1954
1980b0892495
removed tabs, put in spaces instead.
Rene Dudfield <renesd@gmail.com>
parents:
1935
diff
changeset
|
242 DependencyDLL('TIFF'), |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
243 DependencyDLL('VORBISFILE'), |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
244 DependencyDLL('VORBIS'), |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
245 DependencyDLL('OGG'), |
|
1346
e02be9d3419f
Windows prebuilt configure uses optional prebuilt/Setup_Wihjkih;uihiuh
Lenard Lindstrom <len-l@telus.net>
parents:
916
diff
changeset
|
246 DependencyDLL('FREETYPE'), |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
247 DependencyDLL('Z'), |
|
2046
691c36e49876
Update ffmpeg support in Windows config for msys and prebuilt (VC support deprecated as ffpeg does not build with VC anyway)
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
248 DependencyDLL('AVCODEC'), |
|
691c36e49876
Update ffmpeg support in Windows config for msys and prebuilt (VC support deprecated as ffpeg does not build with VC anyway)
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
249 DependencyDLL('AVUTIL'), |
| 787 | 250 ] |
| 251 | |
| 252 if not DEPS[0].found: | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
253 print_('Unable to run "sdl-config". Please make sure a development version of SDL is installed.') |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
254 sys.exit(1) |
| 787 | 255 |
| 256 if localbase: | |
| 257 incdirs = [localbase+d for d in origincdirs] | |
| 258 libdirs = [localbase+d for d in origlibdirs] | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
259 else: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
260 incdirs = [] |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
261 libdirs = [] |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
262 incdirs += [m.msys_to_windows("/usr/local"+d) for d in origincdirs] |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
263 libdirs += [m.msys_to_windows("/usr/local"+d) for d in origlibdirs] |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
264 if m.mingw_root is not None: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
265 incdirs += [m.msys_to_windows("/mingw"+d) for d in origincdirs] |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
266 libdirs += [m.msys_to_windows("/mingw"+d) for d in origlibdirs] |
| 787 | 267 for arg in string.split(DEPS[0].cflags): |
| 268 if arg[:2] == '-I': | |
| 269 incdirs.append(arg[2:]) | |
| 270 elif arg[:2] == '-L': | |
| 271 libdirs.append(arg[2:]) | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
272 dll_deps = [] |
| 787 | 273 for d in DEPS: |
| 274 d.configure(incdirs, libdirs) | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
275 if d.needs_dll: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
276 dll_dep = DependencyDLL(d.name) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
277 dll_dep.configure(incdirs, libdirs, d.lib_dir) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
278 dll_deps.append(dll_dep) |
| 787 | 279 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
280 DEPS += dll_deps |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
281 for d in get_definitions(): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1349
diff
changeset
|
282 DEPS.append(DependencyWin(d.name, d.value)) |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
283 for d in DEPS: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
284 if isinstance(d, DependencyDLL): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
285 if d.lib_dir == '': |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
286 print_("DLL for %-12s: not found" % d.lib_name) |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
287 else: |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
288 print_("DLL for %-12s: %s" % (d.lib_name, d.lib_dir)) |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
289 |
| 787 | 290 for d in DEPS[1:]: |
| 291 if not d.found: | |
|
2178
bfbda12d6559
Improve support for non-interactive configuration.
Rene Dudfield <renesd@gmail.com>
parents:
2046
diff
changeset
|
292 if "-auto" not in sys.argv and not confirm(""" |
| 787 | 293 Warning, some of the pygame dependencies were not found. Pygame can still |
| 294 compile and install, but games that depend on those missing dependencies | |
| 295 will not run. Would you like to continue the configuration?"""): | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
296 raise SystemExit() |
| 787 | 297 break |
| 298 | |
| 299 return DEPS | |
| 300 | |
| 301 if __name__ == '__main__': | |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
302 print_("""This is the configuration subscript for MSYS. |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
303 Please run "config.py" for full configuration.""") |
| 787 | 304 |
