Bug 1294490 - Part 5. Add --with-system-webp switch to build. r=glandium
authorAndrew Osmond <aosmond@mozilla.com>
Wed, 03 Oct 2018 17:40:47 -0400
changeset 443878 99d6a3b6e120fc7dc022c6b7989c71cf076d0044
parent 443877 77efeae42385f9fd3d574813349625cbb6dc2123
child 443879 25aa97e7d1062b21a84f3acb950859de09f40533
push id34973
push userebalazs@mozilla.com
push dateThu, 01 Nov 2018 09:13:27 +0000
treeherdermozilla-central@dcc2391cc0dd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1294490
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1294490 - Part 5. Add --with-system-webp switch to build. r=glandium Differential Revision: https://phabricator.services.mozilla.com/D8118
config/external/moz.build
config/system-headers.mozbuild
toolkit/library/moz.build
toolkit/moz.configure
--- a/config/external/moz.build
+++ b/config/external/moz.build
@@ -37,29 +37,31 @@ if not CONFIG['MOZ_SYSTEM_LIBVPX']:
     external_dirs += ['media/libvpx']
 
 if CONFIG['MOZ_AV1']:
     external_dirs += ['media/libaom']
 
 if not CONFIG['MOZ_SYSTEM_PNG']:
     external_dirs += ['media/libpng']
 
+if not CONFIG['MOZ_SYSTEM_WEBP']:
+    external_dirs += ['media/libwebp']
+
 if CONFIG['CPU_ARCH'] == 'arm':
     external_dirs += ['media/openmax_dl/dl']
 
 if CONFIG['MOZ_FFVPX']:
     external_dirs += ['media/ffvpx']
 
 external_dirs += [
     'media/kiss_fft',
     'media/libcubeb',
     'media/libnestegg',
     'media/libogg',
     'media/libopus',
     'media/libtheora',
     'media/libspeex_resampler',
     'media/libsoundtouch',
-    'media/libwebp',
     'media/mp4parse-rust',
     'media/psshparser'
 ]
 
 DIRS += ['../../' + i for i in external_dirs]
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1250,16 +1250,24 @@ if CONFIG['MOZ_LIBAV_FFT']:
         'libavcodec/avfft.h',
     ]
 
 if CONFIG['MOZ_SYSTEM_PNG']:
     system_headers += [
         'png.h',
     ]
 
+if CONFIG['MOZ_SYSTEM_WEBP']:
+    system_headers += [
+        'webp/decode.h',
+        'webp/demux.h',
+        'webp/mux_types.h',
+        'webp/types.h',
+    ]
+
 if CONFIG['MOZ_SYSTEM_ZLIB']:
     system_headers += [
         'zlib.h',
     ]
 
 if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
     system_headers += [
         'libsn/sn-common.h',
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -218,16 +218,19 @@ if CONFIG['MOZ_LIB_SECRET']:
     OS_LIBS += CONFIG['MOZ_LIB_SECRET_LIBS']
 
 if CONFIG['MOZ_SYSTEM_JPEG']:
     OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
 
 if CONFIG['MOZ_SYSTEM_PNG']:
     OS_LIBS += CONFIG['MOZ_PNG_LIBS']
 
+if CONFIG['MOZ_SYSTEM_WEBP']:
+    OS_LIBS += CONFIG['MOZ_WEBP_LIBS']
+
 if CONFIG['MOZ_SYSTEM_LIBEVENT']:
     OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
 
 if CONFIG['MOZ_SYSTEM_LIBVPX']:
     OS_LIBS += CONFIG['MOZ_LIBVPX_LIBS']
 
 if not CONFIG['MOZ_TREE_PIXMAN']:
     OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -824,16 +824,24 @@ def skia_includes(skia):
             '/gfx/skia/skia/include/docs',
             '/gfx/skia/skia/include/gpu',
             '/gfx/skia/skia/include/utils',
         ]
     return includes
 
 set_config('SKIA_INCLUDES', skia_includes)
 
+option('--with-system-webp',
+       help='Use system libwebp (located with pkgconfig)')
+
+system_webp = pkg_check_modules('MOZ_WEBP', 'libwebp >= 1.0.0 libwebpdemux >= 1.0.0',
+                                when='--with-system-webp')
+
+set_config('MOZ_SYSTEM_WEBP', depends(when=system_webp)(lambda: True))
+
 # Build Freetype in the tree
 # ==============================================================
 @depends(target, skia_pdf)
 def tree_freetype(target, skia_pdf):
     if target.os == 'Android' or (skia_pdf and target.os == 'WINNT'):
         return True
 
 set_define('MOZ_TREE_FREETYPE', tree_freetype)