Root/pygame/patches/010-fix-paths.patch

1diff --git a/config_unix.py b/config_unix.py
2index 1cece2a..0fec7e0 100644
3--- a/config_unix.py
4+++ b/config_unix.py
5@@ -69,6 +69,39 @@ class DependencyProg:
6         else:
7             print (self.name + ' '[len(self.name):] + ': not found')
8 
9+class DependencyPkgConfig:
10+ def __init__(self, name, lib):
11+ self.name = name
12+ self.lib_dir = ''
13+ self.inc_dir = ''
14+ self.libs = []
15+ self.cflags = ''
16+ command = os.environ.get('PKG_CONFIG', 'pkg-config')
17+ try:
18+ version = os.popen('%s %s --modversion 2> /dev/null' % (command, lib)).readline()
19+ if not version.strip():
20+ self.found = 0
21+ return
22+
23+ cflags = os.popen('%s %s --cflags 2> /dev/null' % (command, lib)).readline().strip()
24+ libs = os.popen('%s %s --libs 2> /dev/null' % (command, lib)).readline().strip()
25+
26+ self.ver = version
27+ self.found = 1
28+
29+ self.cflags = '%s %s' % (cflags, libs)
30+ except Exception, e:
31+ print e
32+ print ('WARNING: "pkg-config" failed!')
33+ self.found = 0
34+ self.ver = '0'
35+
36+ def configure(self, incdirs, libdir):
37+ if self.found:
38+ print (self.name + ' '[len(self.name):] + ': found ' + self.ver)
39+ else:
40+ print (self.name + ' '[len(self.name):] + ': not found')
41+
42 class Dependency:
43     def __init__(self, name, checkhead, checklib, libs):
44         self.name = name
45@@ -137,18 +170,22 @@ sdl_lib_name = 'SDL'
46 def main():
47     print ('\nHunting dependencies...')
48     DEPS = [
49- DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']),
50+ DependencyPkgConfig('SDL', 'sdl'),
51         Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.so', ['SDL_ttf']),
52- Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.so', ['SDL_image']),
53+ DependencyPkgConfig('IMAGE', 'SDL_image'),
54         Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.so', ['SDL_mixer']),
55         DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3', ['smpeg']),
56- Dependency('PNG', 'png.h', 'libpng', ['png']),
57+ DependencyPkgConfig('PNG', 'libpng'),
58         Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']),
59- Dependency('SCRAP', '', 'libX11', ['X11']),
60         Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.so', ['portmidi']),
61         Dependency('PORTTIME', 'porttime.h', 'libporttime.so', ['porttime']),
62         #Dependency('GFX', 'SDL_gfxPrimitives.h', 'libSDL_gfx.so', ['SDL_gfx']),
63     ]
64+ if not os.environ.get('NO_SCRAP', None):
65+ DEPS += Dependency('SCRAP', '', 'libX11', ['X11']),
66+ else:
67+ DEPS += Dependency('SCRAP', '', '', []),
68+
69     if not DEPS[0].found:
70         print ('Unable to run "sdl-config". Please make sure a development version of SDL is installed.')
71         raise SystemExit
72@@ -159,10 +186,10 @@ def main():
73     else:
74         incdirs = []
75         libdirs = []
76- incdirs += ["/usr"+d for d in origincdirs]
77- libdirs += ["/usr"+d for d in origlibdirs]
78- incdirs += ["/usr/local"+d for d in origincdirs]
79- libdirs += ["/usr/local"+d for d in origlibdirs]
80+# incdirs += ["/usr"+d for d in origincdirs]
81+# libdirs += ["/usr"+d for d in origlibdirs]
82+# incdirs += ["/usr/local"+d for d in origincdirs]
83+# libdirs += ["/usr/local"+d for d in origlibdirs]
84 
85     for arg in DEPS[0].cflags.split():
86         if arg[:2] == '-I':
87
88
89--- a/config_unix.py
90+++ b/config_unix.py
91@@ -182,15 +209,6 @@ def main():
92     for d in DEPS:
93         d.configure(incdirs, libdirs)
94 
95- for d in DEPS[1:]:
96- if not d.found:
97- if not confirm("""
98-Warning, some of the pygame dependencies were not found. Pygame can still
99-compile and install, but games that depend on those missing dependencies
100-will not run. Would you like to continue the configuration?"""):
101- raise SystemExit
102- break
103-
104     return DEPS
105 
106 if __name__ == '__main__':
107

Archive Download this file



interactive