diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 270: Replace the logic used previously to check for libpng12. Check for supported

Message ID 20130505162716.22444.35446.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org May 5, 2013, 4:27 p.m. UTC
------------------------------------------------------------
revno: 270
author: Joe Konno <joe.konno@intel.com>
committer: Alexandros Frantzis <alexandros.frantzis@canonical.com>
branch nick: trunk
timestamp: Sun 2013-05-05 19:23:53 +0300
message:
  Replace the logic used previously to check for libpng12. Check for supported
  libpng versions -- as of writing, 1.2.x and 1.5.x. This logic assumes each
  subsequent major release of libpng comes with a libpngXY .pc file. Stop
  checking when a supported version is found.
        
  More may be added to the "supp_png_pkgs" iterable as they are tested. Each
  addition is a 2-tuple, the first element being the expected pkg-config file,
  the second the minimum supported version of that major release.
modified:
  src/wscript_build
  wscript


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'src/wscript_build'
--- src/wscript_build	2013-04-03 16:29:31 +0000
+++ src/wscript_build	2013-05-05 16:23:53 +0000
@@ -3,7 +3,7 @@ 
                                             f.name.find('android') == -1 and
                                             f.name.find('native-state-') == -1 and
                                             f.name.find('gl-state-') == -1]
-common_uselibs = ['libpng12']
+common_uselibs = ['libpng']
 common_defines = ['USE_EXCEPTIONS']
 
 libmatrix_sources = [f for f in bld.path.ant_glob('libmatrix/*.cc')

=== modified file 'wscript'
--- wscript	2013-04-03 16:29:31 +0000
+++ wscript	2013-05-05 16:23:53 +0000
@@ -93,11 +93,21 @@ 
         ctx.check_cxx(function_name = func, header_name = header,
                       uselib = uselib, mandatory = True)
 
-    # Check required packages
-    req_pkgs = [('libpng12', 'libpng12')]
-    for (pkg, uselib) in req_pkgs:
-        ctx.check_cfg(package = pkg, uselib_store = uselib,
-                      args = '--cflags --libs', mandatory = True)
+    # Check for a supported version of libpng
+    supp_png_pkgs = (('libpng12', '1.2'), ('libpng15', '1.5'),)
+    have_png = False
+    for (pkg, atleast) in supp_png_pkgs:
+        try:
+            pkg_ver = ctx.check_cfg(package=pkg, uselib_store='libpng', atleast_version=atleast,
+                                    args = ['--cflags', '--libs'])
+        except:
+            continue
+        else:
+            have_png = True
+            break
+
+    if not have_png:
+        ctx.fatal('You need to install a supported version of libpng: ' + str(supp_png_pkgs))
 
     # Check optional packages
     opt_pkgs = [('x11', 'x11', list_contains(Options.options.flavors, 'x11')),