allowing for libwebp* library names

This commit is contained in:
wiredfool 2014-08-22 17:04:26 -07:00
parent 1d58e711fe
commit 136345a5a5

View File

@ -487,6 +487,8 @@ class pil_build_ext(build_ext):
# In Google's precompiled zip it is call "libwebp": # In Google's precompiled zip it is call "libwebp":
if _find_library_file(self, "webp"): if _find_library_file(self, "webp"):
feature.webp = "webp" feature.webp = "webp"
elif _find_library_file(self, "libwebp"):
feature.webp = "libwebp"
if feature.want('webpmux'): if feature.want('webpmux'):
if (_find_include_file(self, "webp/mux.h") and if (_find_include_file(self, "webp/mux.h") and
@ -494,6 +496,9 @@ class pil_build_ext(build_ext):
if (_find_library_file(self, "webpmux") and if (_find_library_file(self, "webpmux") and
_find_library_file(self, "webpdemux")): _find_library_file(self, "webpdemux")):
feature.webpmux = "webpmux" feature.webpmux = "webpmux"
if (_find_library_file(self, "libwebpmux") and
_find_library_file(self, "libwebpdemux")):
feature.webpmux = "libwebpmux"
for f in feature: for f in feature:
if not getattr(feature, f) and feature.require(f): if not getattr(feature, f) and feature.require(f):
@ -559,13 +564,13 @@ class pil_build_ext(build_ext):
libraries=["lcms2"] + extra)) libraries=["lcms2"] + extra))
if os.path.isfile("_webp.c") and feature.webp: if os.path.isfile("_webp.c") and feature.webp:
libs = ["webp"] libs = [feature.webp]
defs = [] defs = []
if feature.webpmux: if feature.webpmux:
defs.append(("HAVE_WEBPMUX", None)) defs.append(("HAVE_WEBPMUX", None))
libs.append("webpmux") libs.append(feature.webpmux)
libs.append("webpdemux") libs.append(feature.webpmux.replace('pmux','pdemux'))
exts.append(Extension( exts.append(Extension(
"PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs)) "PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))