1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-02 20:03:09 +02:00
openwrt-packages/pygame/patches/10-fix-paths.patch

78 lines
3.0 KiB
Diff
Raw Normal View History

2010-02-15 17:31:29 +02:00
diff --git a/config_unix.py b/config_unix.py
index 1cece2a..0fec7e0 100644
--- a/config_unix.py
+++ b/config_unix.py
@@ -69,6 +69,39 @@ class DependencyProg:
else:
print (self.name + ' '[len(self.name):] + ': not found')
+class DependencyPkgConfig:
+ def __init__(self, name, lib):
+ self.name = name
+ self.lib_dir = ''
+ self.inc_dir = ''
+ self.libs = []
+ self.cflags = ''
+ command = os.environ.get('PKG_CONFIG', 'pkg-config')
+ try:
+ version = os.popen('%s %s --modversion 2> /dev/null' % (command, lib)).readline()
+ if not version.strip():
+ self.found = 0
+ return
+
+ cflags = os.popen('%s %s --cflags 2> /dev/null' % (command, lib)).readline()
+ libs = os.popen('%s %s --libs 2> /dev/null' % (command, lib)).readline()
+
+ self.ver = version
+ self.found = 1
+
+ self.cflags = '%s %s' % (cflags, libs)
+ except Exception, e:
+ print e
+ print ('WARNING: "pkg-config" failed!')
+ self.found = 0
+ self.ver = '0'
+
+ def configure(self, incdirs, libdir):
+ if self.found:
+ print (self.name + ' '[len(self.name):] + ': found ' + self.ver)
+ else:
+ print (self.name + ' '[len(self.name):] + ': not found')
+
class Dependency:
def __init__(self, name, checkhead, checklib, libs):
self.name = name
@@ -137,13 +170,13 @@ sdl_lib_name = 'SDL'
def main():
print ('\nHunting dependencies...')
DEPS = [
- DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']),
+ DependencyPkgConfig('SDL', 'sdl'),
Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.so', ['SDL_ttf']),
- Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.so', ['SDL_image']),
+ DependencyPkgConfig('IMAGE', 'SDL_image'),
Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.so', ['SDL_mixer']),
DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3', ['smpeg']),
- Dependency('PNG', 'png.h', 'libpng', ['png']),
+ DependencyPkgConfig('PNG', 'libpng'),
Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']),
Dependency('SCRAP', '', 'libX11', ['X11']),
Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.so', ['portmidi']),
Dependency('PORTTIME', 'porttime.h', 'libporttime.so', ['porttime']),
@@ -159,10 +182,10 @@ def main():
else:
incdirs = []
libdirs = []
- incdirs += ["/usr"+d for d in origincdirs]
- libdirs += ["/usr"+d for d in origlibdirs]
- incdirs += ["/usr/local"+d for d in origincdirs]
- libdirs += ["/usr/local"+d for d in origlibdirs]
+# incdirs += ["/usr"+d for d in origincdirs]
+# libdirs += ["/usr"+d for d in origlibdirs]
+# incdirs += ["/usr/local"+d for d in origincdirs]
+# libdirs += ["/usr/local"+d for d in origlibdirs]
for arg in DEPS[0].cflags.split():
if arg[:2] == '-I':