1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-25 17:54:39 +02:00

Some pygame cleanups/fixes

This commit is contained in:
Lars-Peter Clausen 2010-02-15 16:31:29 +01:00
parent cb47d681ca
commit 608c1b748e
2 changed files with 79 additions and 3 deletions

View File

@ -19,15 +19,14 @@ define Package/pygame
CATEGORY:=Languages CATEGORY:=Languages
TITLE:=pygame TITLE:=pygame
URL:=http://pygame.org URL:=http://pygame.org
DEPENDS:=+python-mini +libsdl DEPENDS:=+python-mini +libsdl +libpng +libjpeg +libsdl-image +libsdl-mixer
endef endef
define Package/pygame/description define Package/pygame/description
serial port python bindings
endef endef
define Build/Compile define Build/Compile
$(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr") $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr",LOCALBASE="$(STAGING_DIR)/usr")
endef endef
define Package/pygame/install define Package/pygame/install

View File

@ -0,0 +1,77 @@
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':