Ravenports generated: 13 Aug 2019 12:20
[ravenports.git] / bucket_AC / firefox
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               firefox
4 VERSION=                68.0.1
5 KEYWORDS=               www
6 VARIANTS=               standard
7 SDESC[standard]=        Mozilla web browser
8 HOMEPAGE=               https://www.mozilla.org/en-US/firefox/
9 CONTACT=                Leonid_Bobrov[mazocomp@disroot.org]
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            MOZILLA/firefox/releases/68.0.1/source
13 DISTFILE[1]=            firefox-68.0.1.source.tar.xz:main
14 DF_INDEX=               1
15 SPKGS[standard]=        single
16
17 OPTIONS_AVAILABLE=      none
18 OPTIONS_STANDARD=       none
19
20 BUILD_DEPENDS=          autoconf213:single:standard
21                         bzip2:static:standard
22                         cbindgen:single:standard
23                         nodejs:primary:standard
24                         python-sqlite3:single:py27
25                         rust:single:standard
26                         yasm:single:standard
27                         nasm:primary:standard
28                         zip:single:standard
29                         clang:compiler:standard
30 BUILDRUN_DEPENDS=       bzip2:shared:standard
31                         dbus-glib:primary:standard
32                         ffmpeg:primary:standard
33                         harfbuzz:primary:standard
34                         icu:single:standard
35                         libcanberra:primary:standard
36                         libevent:single:standard
37                         libffi:single:standard
38                         libnotify:primary:standard
39                         libproxy:single:standard
40                         nss:primary:standard
41                         sqlite:single:standard
42                         startup-notification:single:standard
43
44 USES=                   cpe desktop-utils:single gmake jpeg perl:build
45                         pkgconfig png python:py27 zlib
46 GNOME_COMPONENTS=       gconf gdkpixbuf gtk2 gtk3
47 XORG_COMPONENTS=        pixman xcb
48
49 LICENSE=                MPL:single
50 LICENSE_TERMS=          single:{{WRKSRC}}/toolkit/content/license.html
51 LICENSE_FILE=           MPL:stock
52 LICENSE_SCHEME=         solo
53
54 CPE_VENDOR=             mozilla
55 FPC_EQUIVALENT=         www/firefox
56
57 MUST_CONFIGURE=         yes
58 CONFIGURE_OUTSOURCE=    yes
59
60 QMAKE_ARGS=             --enable-application=browser
61                         --enable-chrome-format=omni
62                         --enable-default-toolkit=cairo-gtk3
63                         --enable-gconf
64                         --enable-install-strip
65                         --enable-official-branding
66                         --enable-optimize
67                         --enable-release
68                         --enable-startup-notification
69                         --enable-strip
70                         --enable-libproxy
71                         --enable-system-ffi
72                         --enable-system-pixman
73                         --enable-system-sqlite
74                         --disable-alsa
75                         --disable-debug
76                         --disable-debug-symbols
77                         --disable-dtrace
78                         --disable-jack
79                         --disable-profiling
80                         --disable-pulseaudio
81                         --disable-tests
82                         --disable-updater
83                         --disable-webrtc
84                         --disable-hardening
85                         --prefix="{{PREFIX}}"
86                         --with-intl-api
87                         --with-system-bz2
88                         --with-system-graphite2
89                         --with-system-harfbuzz
90                         --with-system-icu
91                         --with-system-jpeg="{{LOCALBASE}}"
92                         --with-system-libevent
93                         --with-system-nspr
94                         --with-system-nss
95                         --with-system-png="{{LOCALBASE}}"
96                         --with-system-zlib
97 VAR_OPSYS[freebsd]=     CONFIGURE_ARGS=--enable-jemalloc
98 VAR_OPSYS[linux]=       QMAKE_ARGS=--disable-elf-hack
99
100 post-patch:
101         ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
102                 ${WRKSRC}/browser/app/nsBrowserApp.cpp
103         ${REINPLACE_CMD} -e 's/%u/%U/' -e '/X-MultipleArgs/d' \
104                 -e '/^Icon/s/=.*/=firefox/' \
105                 ${WRKSRC}/taskcluster/docker/firefox-snap/firefox.desktop
106         (cd ${WRKSRC}/gfx/angle/checkout/src/compiler/translator && \
107                 ${REINPLACE_CMD} -e 's|<math.h>|<cmath>|' \
108                 InfoSink.h IntermNode.cpp)
109         # disable SCTP
110         ${REINPLACE_CMD} -e 's|MOZ_SCTP|MOZ_DISABLE_SCTP|' \
111                 ${WRKSRC}/netwerk/moz.build
112         # Set mozilla options
113         @${ECHO_CMD} "--=> Setting configuration <=--"
114         @for arg in ${QMAKE_ARGS}; do \
115                 ${ECHO_CMD} ".mozconfig <<  $$arg" ;\
116                 ${ECHO_CMD} ac_add_options $$arg >> ${WRKSRC}/.mozconfig ;\
117         done
118         @${ECHO_CMD} LDFLAGS=\"-Wl,-rpath,${PREFIX}/lib/firefox\" \
119                 >> ${WRKSRC}/.mozconfig
120
121 post-install:
122         @${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps \
123                 ${STAGEDIR}${PREFIX}/share/applications
124         ${INSTALL_DATA} ${WRKSRC}/taskcluster/docker/firefox-snap/firefox.desktop \
125                 ${STAGEDIR}${PREFIX}/share/applications/
126         ${LN} -sf ${PREFIX}/lib/firefox/browser/chrome/icons/default/default48.png \
127                 ${STAGEDIR}${PREFIX}/share/pixmaps/firefox.png
128
129 pre-configure:
130         (cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf-2.13)
131         (cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf-2.13)
132
133 [FILE:527:descriptions/desc.single]
134 Firefox is a full-featured standard-compliant web browser, built on the
135 Mozilla codebase by thousands of contributors around the world.
136 It is extensible through thousands of user-contributed extensions, and
137 features:
138  * Improved Security;
139  * Improved Tabbed Browsing, with tab grouping;
140  * Private Browsing;
141  * Spell Checking;
142  * Search Suggestions;
143  * Session Restore;
144  * Web Feeds (RSS);
145  * Live Titles;
146  * Integrated Search;
147  * Live Bookmarks;
148  * Pop-up Blocker;
149  * Phishing Protection;
150  * Themes;
151  * Search Engine Manager.
152
153
154 [FILE:107:distinfo]
155 6037f77bdab29d79ca5e3fbd1d32f6c209e09d2066189a13dc7f7491227f5568    311390092 firefox-68.0.1.source.tar.xz
156
157
158 [FILE:1029:manifests/plist.single]
159 %%ONLY-LINUX%%lib/firefox/
160  Throbber-small.gif
161  crashreporter
162  crashreporter.ini
163  libmozsandbox.so
164  minidump-analyzer
165 %%ONLY-LINUX%%lib/firefox/browser/crashreporter-override.ini
166 %%ONLY-LINUX%%lib/firefox/fonts/TwemojiMozilla.ttf
167 bin/firefox
168 lib/firefox/
169  application.ini
170  chrome.manifest
171  dependentlibs.list
172  firefox
173  firefox-bin
174  liblgpllibs.so
175  libmozavcodec.so
176  libmozavutil.so
177  libmozgtk.so
178  libxul.so
179  omni.ja
180  pingsender
181  platform.ini
182  plugin-container
183  removed-files
184 lib/firefox/browser/
185  blocklist.xml
186  chrome.manifest
187  omni.ja
188 lib/firefox/browser/chrome/icons/default/
189  default128.png
190  default16.png
191  default32.png
192  default48.png
193  default64.png
194 lib/firefox/browser/features/
195  formautofill@mozilla.org.xpi
196  fxmonitor@mozilla.org.xpi
197  screenshots@mozilla.org.xpi
198  webcompat-reporter@mozilla.org.xpi
199  webcompat@mozilla.org.xpi
200 lib/firefox/defaults/pref/channel-prefs.js
201 lib/firefox/gmp-clearkey/0.1/
202  libclearkey.so
203  manifest.json
204 lib/firefox/gtk2/libmozgtk.so
205 share/applications/firefox.desktop
206 share/pixmaps/firefox.png
207
208
209 [FILE:4614:patches/patch-addon-search]
210 https://github.com/mozilla/addons/issues/708
211 https://github.com/mozilla/addons-frontend/issues/4610
212
213 diff --git browser/app/profile/firefox.js browser/app/profile/firefox.js
214 index 75c2c5e435e35..4d8c09c02759b 100644
215 --- browser/app/profile/firefox.js.orig 2019-05-17 00:33:14 UTC
216 +++ browser/app/profile/firefox.js
217 @@ -40,8 +40,8 @@ pref("extensions.webextOptionalPermissio
218  pref("extensions.getAddons.cache.enabled", true);
219  pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v3/addons/search/?guid=%IDS%&lang=%LOCALE%");
220  pref("extensions.getAddons.compatOverides.url", "https://services.addons.mozilla.org/api/v3/addons/compat-override/?guid=%IDS%&lang=%LOCALE%");
221 -pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
222 -pref("extensions.webservice.discoverURL", "https://discovery.addons.mozilla.org/%LOCALE%/firefox/discovery/pane/%VERSION%/%OS%/%COMPATIBILITY_MODE%");
223 +pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=Linux&appver=%VERSION%");
224 +pref("extensions.webservice.discoverURL", "https://discovery.addons.mozilla.org/%LOCALE%/firefox/discovery/pane/%VERSION%/Linux/%COMPATIBILITY_MODE%");
225  pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
226  pref("extensions.getAddons.langpacks.url", "https://services.addons.mozilla.org/api/v3/addons/language-tools/?app=firefox&type=language&appversion=%VERSION%");
227  
228 @@ -175,8 +175,8 @@ pref("app.update.service.enabled", true)
229  //  .. etc ..
230  //
231  pref("extensions.update.enabled", true);
232 -pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
233 -pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
234 +pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
235 +pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
236  pref("extensions.update.interval", 86400);  // Check for updates to Extensions and
237                                              // Themes every day
238  
239 --- toolkit/mozapps/extensions/internal/AddonRepository.jsm.orig        2019-05-17 00:35:08 UTC
240 +++ toolkit/mozapps/extensions/internal/AddonRepository.jsm
241 @@ -610,7 +610,7 @@ var AddonRepository = {
242        addon.version = String(aEntry.current_version.version);
243        if (Array.isArray(aEntry.current_version.files)) {
244          for (let file of aEntry.current_version.files) {
245 -          if (file.platform == "all" || file.platform == PLATFORM) {
246 +          if (file.platform == "all" || file.platform == "linux" || file.platform == PLATFORM) {
247              if (file.url) {
248                addon.sourceURI = NetUtil.newURI(file.url);
249              }
250 --- toolkit/mozapps/extensions/internal/XPIDatabase.jsm.orig    2019-05-17 00:35:08 UTC
251 +++ toolkit/mozapps/extensions/internal/XPIDatabase.jsm
252 @@ -400,7 +400,7 @@ class AddonInternal {
253      // Something is causing errors in here
254      try {
255        for (let platform of this.targetPlatforms) {
256 -        if (platform.os == Services.appinfo.OS) {
257 +        if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
258            if (platform.abi) {
259              needsABI = true;
260              if (platform.abi === abi)
261
262
263 [FILE:423:patches/patch-browser-app-nsBrowserApp.cpp]
264 --- browser/app/nsBrowserApp.cpp.orig   2019-05-17 00:33:14 UTC
265 +++ browser/app/nsBrowserApp.cpp
266 @@ -275,6 +275,9 @@ int main(int argc, char* argv[], char* e
267    }
268  #endif
269  
270 +  setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
271 +  setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
272 +
273  #ifdef HAS_DLL_BLOCKLIST
274    DllBlocklist_Initialize(gBlocklistInitFlags);
275  #endif
276
277
278 [FILE:2829:patches/patch-bug1288587]
279 diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
280 index 855214a..1e91d51 100644
281 --- build/moz.configure/init.configure
282 +++ build/moz.configure/init.configure
283 @@ -165,16 +165,17 @@ option(env='PYTHON', nargs=1, help='Python interpreter')
284  # ==============================================================
285  @depends('PYTHON', check_build_environment, mozconfig, '--help')
286  @imports('os')
287  @imports('sys')
288  @imports('subprocess')
289  @imports(_from='mozbuild.configure.util', _import='LineIO')
290  @imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
291  @imports(_from='mozbuild.virtualenv', _import='verify_python_version')
292 +@imports(_from='__builtin__', _import='KeyError')
293  @imports('distutils.sysconfig')
294  def virtualenv_python(env_python, build_env, mozconfig, help):
295      if help:
296          return
297  
298      python = env_python[0] if env_python else None
299  
300      # Ideally we'd rely on the mozconfig injection from mozconfig_options,
301 @@ -184,16 +185,22 @@ def virtualenv_python(env_python, build_env, mozconfig, help):
302          if 'PYTHON' in mozconfig['env']['added']:
303              python = mozconfig['env']['added']['PYTHON']
304          elif 'PYTHON' in mozconfig['env']['modified']:
305              python = mozconfig['env']['modified']['PYTHON'][1]
306          elif 'PYTHON' in mozconfig['vars']['added']:
307              python = mozconfig['vars']['added']['PYTHON']
308          elif 'PYTHON' in mozconfig['vars']['modified']:
309              python = mozconfig['vars']['modified']['PYTHON'][1]
310 +        for i in ('env', 'vars'):
311 +            for j in ('added', 'modified'):
312 +                try:
313 +                    del mozconfig[i][j]['PYTHON']
314 +                except KeyError:
315 +                    pass
316  
317      with LineIO(lambda l: log.error(l)) as out:
318          verify_python_version(out)
319      topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
320      if topobjdir.endswith('/js/src'):
321          topobjdir = topobjdir[:-7]
322  
323      with LineIO(lambda l: log.info(l)) as out:
324 @@ -255,17 +262,20 @@ def virtualenv_python(env_python, build_env, mozconfig
325          log.info('Creating Python environment')
326          manager.build(python)
327  
328      python = normsep(manager.python_path)
329  
330      if not normsep(sys.executable).startswith(normsep(virtualenvs_root)):
331          log.info('Reexecuting in the virtualenv')
332          if env_python:
333 -            del os.environ['PYTHON']
334 +            try:
335 +                del os.environ['PYTHON']
336 +            except KeyError:
337 +                pass
338          # One would prefer to use os.execl, but that's completely borked on
339          # Windows.
340          sys.exit(subprocess.call([python] + sys.argv))
341  
342      # We are now in the virtualenv
343      if not distutils.sysconfig.get_python_lib():
344          die('Could not determine python site packages directory')
345  
346
347
348 [FILE:1253:patches/patch-bug1507655]
349 Revert bug 1497976 as close_fds on Python 2 is too slow
350
351 diff --git build/moz.configure/util.configure build/moz.configure/util.configure
352 index 25862fee7c32..3fc725a5124e 100644
353 --- build/moz.configure/util.configure
354 +++ build/moz.configure/util.configure
355 @@ -22,7 +22,6 @@
356  
357  # A wrapper to obtain a process' output and return code.
358  # Returns a tuple (retcode, stdout, stderr).
359 -@imports('os')
360  @imports(_from='__builtin__', _import='unicode')
361  @imports('subprocess')
362  @imports(_from='mozbuild.shellutil', _import='quote')
363 @@ -45,13 +44,7 @@
364  
365      log.debug('Executing: `%s`', quote(*args))
366      proc = subprocess.Popen(args, stdout=subprocess.PIPE,
367 -                            stderr=subprocess.PIPE,
368 -                            # On Python 2 on Windows, close_fds prevents the
369 -                            # process from inheriting stdout/stderr.
370 -                            # Elsewhere, it simply prevents it from inheriting
371 -                            # extra file descriptors, which is what we want.
372 -                            close_fds=os.name != 'nt',
373 -                            **kwargs)
374 +                            stderr=subprocess.PIPE, **kwargs)
375      stdout, stderr = proc.communicate()
376      return proc.wait(), stdout, stderr
377  
378
379
380 [FILE:3590:patches/patch-bug1559213]
381 commit 717bba28411c
382 Author: Jory A. Pratt <anarchy@gentoo.org>
383 Date:   Thu Jun 13 11:53:00 2019 -0700
384
385     Bug 1559213 - Allow to use system av1 libs instead of bundled.
386 ---
387  config/external/moz.build      |  5 +++--
388  config/system-headers.mozbuild |  8 ++++++++
389  dom/media/platforms/moz.build  |  5 +++++
390  toolkit/moz.configure          | 19 ++++++++++++++++++-
391  4 files changed, 34 insertions(+), 3 deletions(-)
392
393 diff --git config/external/moz.build config/external/moz.build
394 index 03e4fa143bd1..a67d10b11fe6 100644
395 --- config/external/moz.build
396 +++ config/external/moz.build
397 @@ -37,8 +37,9 @@ if not CONFIG['MOZ_SYSTEM_LIBVPX']:
398      external_dirs += ['media/libvpx']
399  
400  if CONFIG['MOZ_AV1']:
401 -    external_dirs += ['media/libaom']
402 -    external_dirs += ['media/libdav1d']
403 +    if not CONFIG['MOZ_SYSTEM_AV1']:
404 +        external_dirs += ['media/libaom']
405 +        external_dirs += ['media/libdav1d']
406  
407  if not CONFIG['MOZ_SYSTEM_PNG']:
408      external_dirs += ['media/libpng']
409 diff --git config/system-headers.mozbuild config/system-headers.mozbuild
410 index bcf5c4925564..48964a999a9b 100644
411 --- config/system-headers.mozbuild
412 +++ config/system-headers.mozbuild
413 @@ -1304,6 +1304,14 @@ if CONFIG['MOZ_ENABLE_CONTENTMANAGER']:
414          'SelectSingleContentItemPage.h',
415      ]
416  
417 +if CONFIG['MOZ_SYSTEM_AV1']:
418 +    system_headers += [
419 +        'aom/aom_decoder.h',
420 +        'aom/aomdx.h',
421 +        'aom/aom_image.h',
422 +        'dav1d/dav1d.h',
423 +    ]
424 +
425  if CONFIG['MOZ_SYSTEM_LIBVPX']:
426      system_headers += [
427          'vpx_mem/vpx_mem.h',
428 diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
429 index 092cee0c9b66..38e45de5b5f0 100644
430 --- dom/media/platforms/moz.build
431 +++ dom/media/platforms/moz.build
432 @@ -80,6 +80,11 @@ if CONFIG['MOZ_AV1']:
433          'agnostic/AOMDecoder.cpp',
434          'agnostic/DAV1DDecoder.cpp',
435      ]
436 +    if CONFIG['MOZ_SYSTEM_AV1']:
437 +        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
438 +        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
439 +        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
440 +        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
441  
442  if CONFIG['MOZ_OMX']:
443      EXPORTS += [
444 diff --git toolkit/moz.configure toolkit/moz.configure
445 index 82b5a59acf42..e2329560b42b 100644
446 --- toolkit/moz.configure
447 +++ toolkit/moz.configure
448 @@ -441,7 +441,23 @@ def av1(value):
449      if value:
450          return True
451  
452 -@depends(target, nasm_version, when=av1 & compile_environment)
453 +option('--with-system-av1',
454 +       help="Use system av1 (located with pkgconfig)")
455 +
456 +system_libaom_info = pkg_check_modules('MOZ_SYSTEM_LIBAOM', 'aom >= 1.0.0',
457 +                                       when='--with-system-av1')
458 +
459 +system_libdav1d_info = pkg_check_modules('MOZ_SYSTEM_LIBDAV1D', 'dav1d >= 0.1.1',
460 +                                         when='--with-system-av1')
461 +
462 +@depends(system_libaom_info, system_libdav1d_info)
463 +def system_av1(system_libaom_info, system_libdav1d_info):
464 +    has_av1_libs = False
465 +    if system_libaom_info and system_libdav1d_info:
466 +        has_av1_libs = True
467 +    return has_av1_libs
468 +
469 +@depends(target, nasm_version, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
470  def dav1d_asm(target, nasm_version):
471      if target.os != 'Android':
472          if target.cpu == 'aarch64':
473 @@ -457,6 +473,7 @@ set_config('MOZ_DAV1D_ASM', dav1d_asm)
474  set_define('MOZ_DAV1D_ASM', dav1d_asm)
475  set_config('MOZ_AV1', av1)
476  set_define('MOZ_AV1', av1)
477 +set_config('MOZ_SYSTEM_AV1', depends_if(system_av1)(lambda _: True))
478  
479  # Built-in fragmented MP4 support.
480  # ==============================================================
481
482
483 [FILE:9009:patches/patch-bug847568]
484 # Allow building against system-wide graphite2/harfbuzz.
485
486 diff --git config/system-headers.mozbuild config/system-headers.mozbuild
487 index 7620b4d00623..09d3db5ca8c0 100644
488 --- config/system-headers.mozbuild
489 +++ config/system-headers.mozbuild
490 @@ -1300,6 +1300,19 @@ if CONFIG['MOZ_ENABLE_CONTENTMANAGER']:
491          'SelectSingleContentItemPage.h',
492      ]
493  
494 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
495 +    system_headers += [
496 +        'graphite2/Font.h',
497 +        'graphite2/Segment.h',
498 +    ]
499 +
500 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
501 +    system_headers += [
502 +        'harfbuzz/hb-glib.h',
503 +        'harfbuzz/hb-ot.h',
504 +        'harfbuzz/hb.h',
505 +    ]
506 +
507  if CONFIG['MOZ_SYSTEM_LIBVPX']:
508      system_headers += [
509          'vpx_mem/vpx_mem.h',
510 diff --git dom/base/moz.build dom/base/moz.build
511 index 8e19020315ae..2fcdbb6f7b42 100644
512 --- dom/base/moz.build
513 +++ dom/base/moz.build
514 @@ -495,6 +495,9 @@ if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
515  if CONFIG['MOZ_X11']:
516      CXXFLAGS += CONFIG['TK_CFLAGS']
517  
518 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
519 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
520 +
521  GENERATED_FILES += [
522      'PropertyUseCounterMap.inc',
523      'UseCounterList.h',
524 diff --git gfx/graphite2/moz-gr-update.sh gfx/graphite2/moz-gr-update.sh
525 index faaab1b17971..04eff5f09882 100644
526 --- gfx/graphite2/moz-gr-update.sh
527 +++ gfx/graphite2/moz-gr-update.sh
528 @@ -1,6 +1,7 @@
529  #!/bin/bash
530  
531  # Script used to update the Graphite2 library in the mozilla source tree
532 +# and bump version for --with-system-graphite2
533  
534  # This script lives in gfx/graphite2, along with the library source,
535  # but must be run from the top level of the mozilla-central tree.
536 @@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
537  #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
538  #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
539  
540 +# chase version for --with-system-graphite2
541 +perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
542 +  if /GR2_VERSION_REQUIRE/" old-configure.in
543 +
544  # summarize what's been touched
545  echo Updated to $RELEASE.
546  echo Here is what changed in the gfx/graphite2 directory:
547  echo
548  
549 -hg stat gfx/graphite2
550 +hg stat old-configure.in gfx/graphite2
551  
552  echo
553  echo If gfx/graphite2/src/files.mk has changed, please make corresponding
554 diff --git gfx/harfbuzz/README-mozilla gfx/harfbuzz/README-mozilla
555 index 22c76a7df020..a01490bd49ee 100644
556 --- gfx/harfbuzz/README-mozilla
557 +++ gfx/harfbuzz/README-mozilla
558 @@ -15,3 +15,8 @@ from within the gfx/harfbuzz directory.
559  
560  If the collection of source files changes, manual updates to moz.build may be
561  needed as we don't use the upstream makefiles.
562 +
563 +The in-tree copy may be omitted during build by --with-system-harfbuzz.
564 +Make sure to keep pkg-config version check within toolkit/moz.configure in sync
565 +with checkout version or increment latest tag by one if it's not based
566 +on upstream release.
567 diff --git gfx/moz.build gfx/moz.build
568 index 771f652e837a..3b358d84e384 100644
569 --- gfx/moz.build
570 +++ gfx/moz.build
571 @@ -10,6 +10,12 @@ with Files('**'):
572  if CONFIG['MOZ_TREE_CAIRO']:
573      DIRS += ['cairo']
574  
575 +if not CONFIG['MOZ_SYSTEM_GRAPHITE2']:
576 +    DIRS += ['graphite2/src' ]
577 +
578 +if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
579 +    DIRS += ['harfbuzz/src']
580 +
581  DIRS += [
582      '2d',
583      'ycbcr',
584 @@ -18,8 +24,6 @@ DIRS += [
585      'qcms',
586      'gl',
587      'layers',
588 -    'graphite2/src',
589 -    'harfbuzz/src',
590      'ots/src',
591      'thebes',
592      'ipc',
593 diff --git gfx/skia/generate_mozbuild.py gfx/skia/generate_mozbuild.py
594 index e06ae3457a47..93faa61594a3 100755
595 --- gfx/skia/generate_mozbuild.py
596 +++ gfx/skia/generate_mozbuild.py
597 @@ -148,6 +148,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
598          '-Wno-unused-private-field',
599      ]
600  
601 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
602 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
603 +
604  if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk3', 'android'):
605      CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
606      CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
607 diff --git gfx/skia/moz.build gfx/skia/moz.build
608 index 2118677ca3a8..e4978b413784 100644
609 --- gfx/skia/moz.build
610 +++ gfx/skia/moz.build
611 @@ -822,6 +822,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
612          '-Wno-unused-private-field',
613      ]
614  
615 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
616 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
617 +
618  if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk3', 'android'):
619      CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
620      CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
621 diff --git gfx/thebes/moz.build gfx/thebes/moz.build
622 index 56f1b9fe3f4b..0ac1100b0df3 100644
623 --- gfx/thebes/moz.build
624 +++ gfx/thebes/moz.build
625 @@ -288,7 +288,13 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
626  
627  LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
628  
629 -DEFINES['GRAPHITE2_STATIC'] = True
630 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
631 +    CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
632 +else:
633 +    DEFINES['GRAPHITE2_STATIC'] = True
634 +
635 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
636 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
637  
638  if CONFIG['CC_TYPE'] == 'clang':
639      # Suppress warnings from Skia header files.
640 diff --git intl/unicharutil/util/moz.build intl/unicharutil/util/moz.build
641 index cb1233c56d7e..06fb1f9f174b 100644
642 --- intl/unicharutil/util/moz.build
643 +++ intl/unicharutil/util/moz.build
644 @@ -25,4 +25,7 @@ UNIFIED_SOURCES += [
645      'nsUnicodeProperties.cpp',
646  ]
647  
648 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
649 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
650 +
651  FINAL_LIBRARY = 'xul'
652 diff --git netwerk/dns/moz.build netwerk/dns/moz.build
653 index 79c26e3e7001..c4d93bc5f7dc 100644
654 --- netwerk/dns/moz.build
655 +++ netwerk/dns/moz.build
656 @@ -76,3 +76,6 @@ USE_LIBS += ['icu']
657  
658  if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
659      CXXFLAGS += ['-Wno-error=shadow']
660 +
661 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
662 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
663 diff --git old-configure.in old-configure.in
664 index 95a58b634593..b614eef85c89 100644
665 --- old-configure.in
666 +++ old-configure.in
667 @@ -3951,6 +3951,27 @@ dnl ========================================================
668  
669  AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
670  
671 +dnl ========================================================
672 +dnl Check for graphite2
673 +dnl ========================================================
674 +if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
675 +    dnl graphite2.pc has bogus version, check manually
676 +    _SAVE_CFLAGS=$CFLAGS
677 +    CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
678 +    AC_TRY_COMPILE([ #include <graphite2/Font.h>
679 +                     #define GR2_VERSION_REQUIRE(major,minor,bugfix)  \
680 +                             ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
681 +                               * 100 + GR2_VERSION_BUGFIX >= \
682 +                               (major) * 10000 + (minor) * 100 + (bugfix) )
683 +                   ], [
684 +                     #if !GR2_VERSION_REQUIRE(1,3,12)
685 +                     #error "Insufficient graphite2 version."
686 +                     #endif
687 +                   ], [],
688 +                   [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
689 +    CFLAGS=$_SAVE_CFLAGS
690 +fi
691 +
692  dnl ========================================================
693  dnl Check for pixman and cairo
694  dnl ========================================================
695 diff --git toolkit/library/moz.build toolkit/library/moz.build
696 index 24f940e1ed7e..079a575adec3 100644
697 --- toolkit/library/moz.build
698 +++ toolkit/library/moz.build
699 @@ -226,6 +226,12 @@ if CONFIG['MOZ_SYSTEM_PNG']:
700  if CONFIG['MOZ_SYSTEM_WEBP']:
701      OS_LIBS += CONFIG['MOZ_WEBP_LIBS']
702  
703 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
704 +    OS_LIBS += CONFIG['MOZ_GRAPHITE2_LIBS']
705 +
706 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
707 +    OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS']
708 +
709  if CONFIG['MOZ_SYSTEM_LIBEVENT']:
710      OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
711  
712 diff --git toolkit/moz.configure toolkit/moz.configure
713 index 9297e4d6f501..d8e273887e4b 100644
714 --- toolkit/moz.configure
715 +++ toolkit/moz.configure
716 @@ -894,6 +894,26 @@ add_old_configure_assignment('FT2_LIBS',
717  add_old_configure_assignment('FT2_CFLAGS',
718                               ft2_info.cflags)
719  
720 +# Graphite2
721 +# ==============================================================
722 +option('--with-system-graphite2',
723 +       help="Use system graphite2 (located with pkgconfig)")
724 +
725 +system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
726 +                                     when='--with-system-graphite2')
727 +
728 +set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
729 +
730 +# HarfBuzz
731 +# ==============================================================
732 +option('--with-system-harfbuzz',
733 +       help="Use system harfbuzz (located with pkgconfig)")
734 +
735 +system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 2.4.0',
736 +                                    when='--with-system-harfbuzz')
737 +
738 +set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
739 +
740  # Marionette remote protocol
741  # ==============================================================
742  #
743
744
745 [FILE:879:patches/patch-dom_media_flac_FlacDecoder.cpp]
746 Enable FLAC on platforms without ffvpx like powerpc*
747
748 diff --git dom/media/flac/FlacDecoder.cpp dom/media/flac/FlacDecoder.cpp
749 index 53fc3c9937f7..b23771ab80fa 100644
750 --- dom/media/flac/FlacDecoder.cpp.orig 2019-05-17 00:33:25 UTC
751 +++ dom/media/flac/FlacDecoder.cpp
752 @@ -7,6 +7,7 @@
753  #include "FlacDecoder.h"
754  #include "MediaContainerType.h"
755  #include "mozilla/StaticPrefs.h"
756 +#include "PDMFactory.h"
757  
758  namespace mozilla {
759  
760 @@ -14,6 +15,10 @@ namespace mozilla {
761  bool FlacDecoder::IsEnabled() {
762  #ifdef MOZ_FFVPX
763    return StaticPrefs::MediaFlacEnabled();
764 +#elif defined(MOZ_FFMPEG)
765 +  RefPtr<PDMFactory> platform = new PDMFactory();
766 +  return StaticPrefs::MediaFlacEnabled() && platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/flac"),
767 +                                    /* DecoderDoctorDiagnostics* */ nullptr);
768  #else
769    // Until bug 1295886 is fixed.
770    return false;
771
772
773 [FILE:893:patches/patch-env-api-keys]
774 # Accept API keys from environment like before bug 1294585
775
776 --- build/moz.configure/keyfiles.configure.orig 2019-05-17 00:33:19 UTC
777 +++ build/moz.configure/keyfiles.configure
778 @@ -18,6 +18,7 @@ def keyfile(desc, default=None, help=Non
779      @checking('for the %s key' % desc, lambda x: x and x is not no_key)
780      @imports(_from='__builtin__', _import='open')
781      @imports(_from='__builtin__', _import='IOError')
782 +    @imports(_from='os', _import='environ')
783      def keyfile(value):
784          if value:
785              try:
786 @@ -28,7 +29,7 @@ def keyfile(desc, default=None, help=Non
787                      raise FatalCheckError("'%s' is empty." % value[0])
788              except IOError as e:
789                  raise FatalCheckError("'%s': %s." % (value[0], e.strerror))
790 -        return no_key
791 +        return environ.get('MOZ_%s_KEY' % desc.upper().replace(' ', '_')) or no_key
792  
793      return keyfile
794  
795
796
797 [FILE:890:patches/patch-gfx_skia_skia_src_core_SkCpu.cpp]
798 Regressed by https://svnweb.freebsd.org/changeset/base/324815
799
800 gfx/skia/skia/src/core/SkCpu.cpp:81:27: error: use of undeclared identifier 'getauxval'
801         uint32_t hwcaps = getauxval(AT_HWCAP);
802                           ^
803
804 --- gfx/skia/skia/src/core/SkCpu.cpp.orig       2019-05-17 00:34:23 UTC
805 +++ gfx/skia/skia/src/core/SkCpu.cpp
806 @@ -70,6 +70,20 @@
807          return features;
808      }
809  
810 +#elif defined(SK_CPU_ARM64) && defined(__FreeBSD__)
811 +    #include <machine/armreg.h>
812 +
813 +    static uint32_t read_cpu_features() {
814 +        uint32_t features = 0;
815 +        uint64_t id_aa64isar0;
816 +
817 +        id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1);
818 +        if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {
819 +            features |= SkCpu::CRC32;
820 +        }
821 +        return features;
822 +    }
823 +
824  #elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
825      #include <sys/auxv.h>
826  
827
828
829 [FILE:316:patches/patch-ipc_chromium_src_base_platform__thread__posix.cc]
830 --- ipc/chromium/src/base/platform_thread_posix.cc.orig 2019-05-17 00:33:26 UTC
831 +++ ipc/chromium/src/base/platform_thread_posix.cc
832 @@ -16,6 +16,8 @@
833  #elif defined(OS_LINUX)
834  #  include <sys/syscall.h>
835  #  include <sys/prctl.h>
836 +#elif defined(OS_DRAGONFLY)
837 +#  include <sys/lwp.h>
838  #endif
839  
840  #if !defined(OS_MACOSX)
841
842
843 [FILE:613:patches/patch-ipc_chromium_src_base_shared__memory__posix.cc]
844 --- ipc/chromium/src/base/shared_memory_posix.cc.orig   2019-05-17 00:33:26 UTC
845 +++ ipc/chromium/src/base/shared_memory_posix.cc
846 @@ -83,6 +83,11 @@ bool SharedMemory::AppendPosixShmPrefix(
847      StringAppendF(str, "snap.%s.", kSnap);
848    }
849  #  endif  // OS_LINUX
850 +#  ifdef OS_DRAGONFLY
851 +  // DragonFly BSD has a userland IPC implementation, we need to prefix the
852 +  // path to shm_open(3), preferably with '/tmp'
853 +  StringAppendF(str, "tmp/");
854 +#  endif
855    // Hopefully the "implementation defined" name length limit is long
856    // enough for this.
857    StringAppendF(str, "org.mozilla.ipc.%d.", static_cast<int>(pid));
858
859
860 [FILE:575:patches/patch-js_src_old-configure.in]
861 --- js/src/old-configure.in.orig        2019-05-17 00:34:24 UTC
862 +++ js/src/old-configure.in
863 @@ -816,7 +816,7 @@ dnl Checks for header files.
864  dnl ========================================================
865  AC_HEADER_DIRENT
866  case "$target_os" in
867 -freebsd*)
868 +freebsd*|dragonfly*)
869  # for stuff like -lXshm
870      CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
871      ;;
872 @@ -935,7 +935,7 @@ then
873      fi
874  
875         case "$target" in
876 -           *-*-freebsd*)
877 +           *-*-freebsd*|*-*-dragonfly*)
878                         AC_DEFINE(_REENTRANT)
879                         AC_DEFINE(_THREAD_SAFE)
880                         dnl -pthread links in -lpthread, so don't specify it explicitly.
881
882
883 [FILE:297:patches/patch-media_libcubeb_src_cubeb__jack.cpp]
884 --- media/libcubeb/src/cubeb_jack.cpp.orig      2019-05-17 00:34:35 UTC
885 +++ media/libcubeb/src/cubeb_jack.cpp
886 @@ -8,7 +8,7 @@
887   */
888  #define _DEFAULT_SOURCE
889  #define _BSD_SOURCE
890 -#ifndef __FreeBSD__
891 +#if !(defined __FreeBSD__ || defined __DragonFly__)
892  #define _POSIX_SOURCE
893  #endif
894  #include <dlfcn.h>
895
896
897 [FILE:231:files/pkg-message-single]
898 ==========================================================================
899
900   If Firefox segfaults, try setting MOZ_FORCE_DISABLE_E10S=1 in
901   environment.
902
903 ==========================================================================
904