summaryrefslogtreecommitdiff
path: root/www/firefox31/patches
diff options
context:
space:
mode:
authorryoon <ryoon>2014-11-03 12:18:31 +0000
committerryoon <ryoon>2014-11-03 12:18:31 +0000
commitcc023f64741db84706f0eddf892c4214c64ce69c (patch)
tree646c72bed9e01afe45cc638fa237bc054814d7fc /www/firefox31/patches
parenta9200ed52a59db09c0cf49c944c72461c9ad24d6 (diff)
downloadpkgsrc-cc023f64741db84706f0eddf892c4214c64ce69c.tar.gz
Import firefox31-31.2.0 as www/firefox31.
Mozilla Firefox is a free, open-source and cross-platform web browser for Windows, Linux, MacOS X and many other operating systems. It is fast and easy to use, and offers many advantages over other web browsers, such as tabbed browsing and the ability to block pop-up windows. Firefox also offers excellent bookmark and history management, and it can be extended by developers using industry standards such as XML, CSS, JavaScript, C++, etc. Many extensions are available.
Diffstat (limited to 'www/firefox31/patches')
-rw-r--r--www/firefox31/patches/patch-aa468
-rw-r--r--www/firefox31/patches/patch-ak13
-rw-r--r--www/firefox31/patches/patch-al16
-rw-r--r--www/firefox31/patches/patch-ao17
-rw-r--r--www/firefox31/patches/patch-as154
-rw-r--r--www/firefox31/patches/patch-b2g_installer_Makefile.in15
-rw-r--r--www/firefox31/patches/patch-b2g_installer_package-manifest.in13
-rw-r--r--www/firefox31/patches/patch-bf13
-rw-r--r--www/firefox31/patches/patch-bg24
-rw-r--r--www/firefox31/patches/patch-bi12
-rw-r--r--www/firefox31/patches/patch-browser_app_nsBrowserApp.cpp36
-rw-r--r--www/firefox31/patches/patch-browser_app_profile_firefox.js12
-rw-r--r--www/firefox31/patches/patch-browser_installer_package-manifest.in24
-rw-r--r--www/firefox31/patches/patch-browser_locales_en-US_chrome_browser-region_region.properties12
-rw-r--r--www/firefox31/patches/patch-browser_locales_en-US_searchplugins_duckduckgo.xml16
-rw-r--r--www/firefox31/patches/patch-browser_locales_en-US_searchplugins_list.txt11
-rw-r--r--www/firefox31/patches/patch-build_autoconf_compiler-opts.m422
-rw-r--r--www/firefox31/patches/patch-build_autoconf_nss.m446
-rw-r--r--www/firefox31/patches/patch-build_gyp.mozbuild12
-rw-r--r--www/firefox31/patches/patch-build_pgo_profileserver.py13
-rw-r--r--www/firefox31/patches/patch-config_Makefile.in20
-rw-r--r--www/firefox31/patches/patch-config_baseconfig.mk19
-rw-r--r--www/firefox31/patches/patch-config_external_moz.build47
-rw-r--r--www/firefox31/patches/patch-config_rules.mk30
-rw-r--r--www/firefox31/patches/patch-config_stl__wrappers_ios8
-rw-r--r--www/firefox31/patches/patch-config_stl__wrappers_ostream8
-rw-r--r--www/firefox31/patches/patch-config_system-headers60
-rw-r--r--www/firefox31/patches/patch-config_system__wrappers_unwind.h9
-rw-r--r--www/firefox31/patches/patch-content_base_src_moz.build14
-rw-r--r--www/firefox31/patches/patch-content_media_AudioStream.cpp12
-rw-r--r--www/firefox31/patches/patch-content_media_AudioStream.h23
-rw-r--r--www/firefox31/patches/patch-content_media_Makefile.in36
-rw-r--r--www/firefox31/patches/patch-content_media_fmp4_demuxer_bit_reader.cc15
-rw-r--r--www/firefox31/patches/patch-content_media_gstreamer_GStreamerAllocator.cpp12
-rw-r--r--www/firefox31/patches/patch-dom_plugins_ipc_PluginModuleChild.cpp31
-rw-r--r--www/firefox31/patches/patch-dom_plugins_ipc_PluginModuleChild.h13
-rw-r--r--www/firefox31/patches/patch-dom_plugins_ipc_PluginProcessChild.cpp16
-rw-r--r--www/firefox31/patches/patch-dom_system_OSFileConstants.cpp54
-rw-r--r--www/firefox31/patches/patch-extensions_spellcheck_hunspell_src_mozHunspell.cpp17
-rw-r--r--www/firefox31/patches/patch-gfx_graphite2_src_Bidi.cpp16
-rw-r--r--www/firefox31/patches/patch-gfx_moz.build26
-rw-r--r--www/firefox31/patches/patch-gfx_skia_Makefile.in15
-rw-r--r--www/firefox31/patches/patch-gfx_thebes_Makefile.in19
-rw-r--r--www/firefox31/patches/patch-image_decoders_nsJPEGDecoder.cpp363
-rw-r--r--www/firefox31/patches/patch-intl_hyphenation_src_hnjalloc.h14
-rw-r--r--www/firefox31/patches/patch-intl_unicharutil_util_Makefile.in12
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_Makefile.in13
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_moz.build18
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_base__paths.h13
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_debug__util__posix.cc13
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_file__util.h14
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_file__util__posix.cc51
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_message__loop.cc40
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc13
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_platform__thread.h14
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc92
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_process__util.h32
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_process__util__bsd.cc166
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_process__util__posix.cc22
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_scoped__nsautorelease__pool.h45
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_sys__info__posix.cc28
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_base_time__posix.cc15
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_build_build__config.h22
-rw-r--r--www/firefox31/patches/patch-ipc_chromium_src_chrome_common_transport__dib.h13
-rw-r--r--www/firefox31/patches/patch-ipc_glue_GeckoChildProcessHost.cpp48
-rw-r--r--www/firefox31/patches/patch-ipc_glue_ScopedXREEmbed.cpp16
-rw-r--r--www/firefox31/patches/patch-ipc_glue_StringUtil.cpp24
-rw-r--r--www/firefox31/patches/patch-ipc_ipdl_ipdl_cxx_ast.py25
-rw-r--r--www/firefox31/patches/patch-ipc_ipdl_ipdl_cxx_cgen.py27
-rw-r--r--www/firefox31/patches/patch-ipc_ipdl_ipdl_lower.py17
-rw-r--r--www/firefox31/patches/patch-js__src__vm__SPSProfiler.cpp17
-rw-r--r--www/firefox31/patches/patch-js_src_Makefile.in31
-rw-r--r--www/firefox31/patches/patch-js_src_ctypes_CTypes.h28
-rw-r--r--www/firefox31/patches/patch-js_src_frontend_ParseMaps.cpp12
-rw-r--r--www/firefox31/patches/patch-js_src_gc_Memory.cpp20
-rw-r--r--www/firefox31/patches/patch-js_src_jsmath.cpp13
-rw-r--r--www/firefox31/patches/patch-mb44
-rw-r--r--www/firefox31/patches/patch-media_libcubeb_src_Makefile.in12
-rw-r--r--www/firefox31/patches/patch-media_libcubeb_src_cubeb__alsa.c14
-rw-r--r--www/firefox31/patches/patch-media_libcubeb_src_moz.build15
-rw-r--r--www/firefox31/patches/patch-media_libpng_pngpriv.h12
-rw-r--r--www/firefox31/patches/patch-media_libsoundtouch_src_cpu__detect__x86.cpp15
-rw-r--r--www/firefox31/patches/patch-media_libtheora_Makefile.in14
-rw-r--r--www/firefox31/patches/patch-media_libtremor_Makefile.in14
-rw-r--r--www/firefox31/patches/patch-media_libvorbis_Makefile.in14
-rw-r--r--www/firefox31/patches/patch-media_mtransport_third__party_nICEr_src_util_mbslen.c18
-rw-r--r--www/firefox31/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h19
-rw-r--r--www/firefox31/patches/patch-media_webrtc_signaling_signaling.gyp20
-rw-r--r--www/firefox31/patches/patch-media_webrtc_signaling_test_Makefile.in25
-rw-r--r--www/firefox31/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi13
-rw-r--r--www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_audio__coding_codecs_opus_opus.gypi17
-rw-r--r--www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc38
-rw-r--r--www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc30
-rw-r--r--www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture.gypi31
-rw-r--r--www/firefox31/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp18
-rw-r--r--www/firefox31/patches/patch-memory_jemalloc_Makefile.in12
-rw-r--r--www/firefox31/patches/patch-memory_mozalloc_mozalloc__abort.cpp16
-rw-r--r--www/firefox31/patches/patch-mfbt_Alignment.h48
-rw-r--r--www/firefox31/patches/patch-mfbt_Attributes.h32
-rw-r--r--www/firefox31/patches/patch-mfbt_Poison.cpp20
-rw-r--r--www/firefox31/patches/patch-mobile_android_installer_Makefile.in15
-rw-r--r--www/firefox31/patches/patch-mobile_android_installer_package-manifest.in13
-rw-r--r--www/firefox31/patches/patch-modules_libjar_nsZipArchive.cpp15
-rw-r--r--www/firefox31/patches/patch-netwerk_dns_Makefile.in15
-rw-r--r--www/firefox31/patches/patch-pb11
-rw-r--r--www/firefox31/patches/patch-pc12
-rw-r--r--www/firefox31/patches/patch-probes_Makefile.in13
-rw-r--r--www/firefox31/patches/patch-rc14
-rw-r--r--www/firefox31/patches/patch-security_manager_ssl_src_nsNSSComponent.cpp12
-rw-r--r--www/firefox31/patches/patch-storage_src_moz.build20
-rw-r--r--www/firefox31/patches/patch-toolkit_components_osfile_modules_osfile__unix__back.jsm49
-rw-r--r--www/firefox31/patches/patch-toolkit_components_osfile_modules_osfile__unix__front.jsm13
-rw-r--r--www/firefox31/patches/patch-toolkit_library_libxul.mk73
-rw-r--r--www/firefox31/patches/patch-toolkit_toolkit.mozbuild15
-rw-r--r--www/firefox31/patches/patch-toolkit_xre_nsEmbedFunctions.cpp22
-rw-r--r--www/firefox31/patches/patch-webapprt_moz.build22
-rw-r--r--www/firefox31/patches/patch-xb91
-rw-r--r--www/firefox31/patches/patch-xc73
-rw-r--r--www/firefox31/patches/patch-xe75
-rw-r--r--www/firefox31/patches/patch-xf43
-rw-r--r--www/firefox31/patches/patch-xg33
-rw-r--r--www/firefox31/patches/patch-xl27
-rw-r--r--www/firefox31/patches/patch-xm49
-rw-r--r--www/firefox31/patches/patch-xpcom_base_nsDebugImpl.cpp88
-rw-r--r--www/firefox31/patches/patch-xpcom_base_nsStackWalk.cpp59
-rw-r--r--www/firefox31/patches/patch-xpcom_base_nsUUIDGenerator.cpp69
-rw-r--r--www/firefox31/patches/patch-xpcom_base_nsUUIDGenerator.h13
-rw-r--r--www/firefox31/patches/patch-xpcom_base_nscore.h13
-rw-r--r--www/firefox31/patches/patch-xpcom_build_PoisonIOInterposer.h37
-rw-r--r--www/firefox31/patches/patch-xpcom_build_nsXPComInit.cpp28
-rw-r--r--www/firefox31/patches/patch-xpcom_ds_TimeStamp.h20
-rw-r--r--www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_moz.build34
-rw-r--r--www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__asm__mips.S52
-rw-r--r--www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__gcc__x86__unix.cpp13
-rw-r--r--www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__asm__mips.S52
-rw-r--r--www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__gcc__x86__unix.cpp13
-rw-r--r--www/firefox31/patches/patch-xulrunner_installer_Makefile.in15
137 files changed, 4502 insertions, 0 deletions
diff --git a/www/firefox31/patches/patch-aa b/www/firefox31/patches/patch-aa
new file mode 100644
index 00000000000..5a53c6bd751
--- /dev/null
+++ b/www/firefox31/patches/patch-aa
@@ -0,0 +1,468 @@
+$NetBSD: patch-aa,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* The profiler does not support Darwin/PPC so don't try to enable it
+ on that platform.
+
+* Cocoa gamepad backend can only be used if the toolkit is cocoa too.
+
+* The preprocessor macro XP_MACOSX is misused everywhere. They tend to
+ say "#if defined(XP_MACOSX)" to actually mean
+ "#if defined(MOZ_WIDGET_COCOA)". It's okay to equate XP_MACOSX with
+ XP_DARWIN but equating it with MOZ_WIDGET_COCOA is just wrong. As a
+ result, cairo-gtk2 build on Darwin is completely broken and needs
+ heavy patching. Ideally they should be fixed individually but that
+ will be an extremely hard work, so don't define XP_MACOSX for now.
+
+--- configure.in.orig 2014-07-17 01:45:08.000000000 +0000
++++ configure.in
+@@ -962,7 +962,7 @@ MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH
+ MOZ_PNG_CFLAGS="-I$_objdir/dist/include" # needed for freetype compilation
+ MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
+
+-MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
++MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(DEPTH)/js/src)'
+ MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
+ MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
+ XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
+@@ -1676,7 +1676,13 @@ Linux)
+ MOZ_ENABLE_PROFILER_SPS=
+ esac
+ ;;
+-WINNT|Darwin) ;;
++WINNT|Darwin)
++ case "${CPU_ARCH}" in
++ x86 | x86_64) ;;
++ *)
++ MOZ_ENABLE_PROFILER_SPS=
++ esac
++ ;;
+ *)
+ MOZ_ENABLE_PROFILER_SPS=
+ ;;
+@@ -1780,7 +1786,7 @@ case "$host" in
+ ;;
+
+ *-darwin*)
+- HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
++ HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
+ HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
+ HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
+ ;;
+@@ -1912,7 +1918,6 @@ case "$target" in
+ AC_DEFINE(XP_DARWIN)
+ _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
+ else
+- AC_DEFINE(XP_MACOSX)
+ AC_DEFINE(XP_DARWIN)
+ _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
+ # The ExceptionHandling framework is needed for Objective-C exception
+@@ -2522,118 +2527,15 @@ MOZ_CXX11
+
+ AC_LANG_C
+
+-dnl Check for .hidden assembler directive and visibility attribute.
+-dnl Borrowed from glibc configure.in
++dnl Setup default hidden visibility and wrapped system headers.
+ dnl ===============================================================
+ if test "$GNU_CC"; then
+- AC_CACHE_CHECK(for visibility(hidden) attribute,
+- ac_cv_visibility_hidden,
+- [cat > conftest.c <<EOF
+- int foo __attribute__ ((visibility ("hidden"))) = 1;
+-EOF
+- ac_cv_visibility_hidden=no
+- if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+- if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
+- ac_cv_visibility_hidden=yes
+- fi
+- fi
+- rm -f conftest.[cs]
+- ])
+- if test "$ac_cv_visibility_hidden" = "yes"; then
+- AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
+-
+- AC_CACHE_CHECK(for visibility(default) attribute,
+- ac_cv_visibility_default,
+- [cat > conftest.c <<EOF
+- int foo __attribute__ ((visibility ("default"))) = 1;
+-EOF
+- ac_cv_visibility_default=no
+- if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+- if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
+- ac_cv_visibility_default=yes
+- fi
+- fi
+- rm -f conftest.[cs]
+- ])
+- if test "$ac_cv_visibility_default" = "yes"; then
+- AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
+-
+- AC_CACHE_CHECK(for visibility pragma support,
+- ac_cv_visibility_pragma,
+- [cat > conftest.c <<EOF
+-#pragma GCC visibility push(hidden)
+- int foo_hidden = 1;
+-#pragma GCC visibility push(default)
+- int foo_default = 1;
+-EOF
+- ac_cv_visibility_pragma=no
+- if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+- if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
+- if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
+- ac_cv_visibility_pragma=yes
+- fi
+- fi
+- fi
+- rm -f conftest.[cs]
+- ])
+- if test "$ac_cv_visibility_pragma" = "yes"; then
+- AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
+- ac_cv_have_visibility_class_bug,
+- [cat > conftest.c <<EOF
+-#pragma GCC visibility push(hidden)
+-struct __attribute__ ((visibility ("default"))) TestStruct {
+- static void Init();
+-};
+-__attribute__ ((visibility ("default"))) void TestFunc() {
+- TestStruct::Init();
+-}
+-EOF
+- ac_cv_have_visibility_class_bug=no
+- if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
+- ac_cv_have_visibility_class_bug=yes
+- else
+- if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
+- ac_cv_have_visibility_class_bug=yes
+- fi
+- fi
+- rm -rf conftest.{c,S}
+- ])
+-
+- AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
+- ac_cv_have_visibility_builtin_bug,
+- [cat > conftest.c <<EOF
+-#pragma GCC visibility push(hidden)
+-#pragma GCC visibility push(default)
+-#include <string.h>
+-#pragma GCC visibility pop
+-
+-__attribute__ ((visibility ("default"))) void Func() {
+- char c[[100]];
+- memset(c, 0, sizeof(c));
+-}
+-EOF
+- ac_cv_have_visibility_builtin_bug=no
+- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
+- ac_cv_have_visibility_builtin_bug=yes
+- else
+- if test `grep -c "@PLT" conftest.S` = 0; then
+- ac_cv_visibility_builtin_bug=yes
+- fi
+- fi
+- rm -f conftest.{c,S}
+- ])
+- if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
+- "$ac_cv_have_visibility_class_bug" = "no"; then
+- VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
+- WRAP_SYSTEM_INCLUDES=1
+- STL_FLAGS='-I$(DIST)/stl_wrappers'
+- WRAP_STL_INCLUDES=1
+- else
+- VISIBILITY_FLAGS='-fvisibility=hidden'
+- fi # have visibility pragma bug
+- fi # have visibility pragma
+- fi # have visibility(default) attribute
+- fi # have visibility(hidden) attribute
++ AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
++ AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
++ VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
++ WRAP_SYSTEM_INCLUDES=1
++ STL_FLAGS='-I$(DIST)/stl_wrappers'
++ WRAP_STL_INCLUDES=1
+ fi # GNU_CC
+
+ # visibility hidden flag for Sun Studio on Solaris
+@@ -3004,7 +2906,7 @@ dnl Checks for library functions.
+ dnl ========================================================
+ AC_PROG_GCC_TRADITIONAL
+ AC_FUNC_MEMCMP
+-AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r)
++AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
+
+ dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
+ AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
+@@ -3691,6 +3593,14 @@ if test -n "$YASM"; then
+ _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
+ fi
+
++if test -n "${LIBXUL_SDK_DIR}"; then
++ AC_MSG_WARN([pkgsrc: LIBXUL_SDK_DIR is set; assuming we want nss and nspr from xulrunner.])
++ NSPR_CFLAGS="-I${prefix}/include/xulrunner/unstable `pkg-config --cflags nspr`"
++ NSPR_LIBS="`pkg-config --libs nspr`"
++ NSS_CFLAGS="`pkg-config --cflags nss`"
++ NSS_LIBS="`pkg-config --libs nss`"
++fi
++
+ if test -z "$SKIP_LIBRARY_CHECKS"; then
+ dnl system JPEG support
+ dnl ========================================================
+@@ -3718,11 +3628,7 @@ if test "$MOZ_NATIVE_JPEG" = 1; then
+ #include <jpeglib.h> ],
+ [ #if JPEG_LIB_VERSION < $MOZJPEG
+ #error "Insufficient JPEG library version ($MOZJPEG required)."
+- #endif
+- #ifndef JCS_EXTENSIONS
+- #error "libjpeg-turbo JCS_EXTENSIONS required"
+- #endif
+- ],
++ #endif ],
+ MOZ_NATIVE_JPEG=1,
+ AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
+ fi
+@@ -4387,6 +4293,10 @@ cairo-gonk)
+
+ esac
+
++if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
++ AC_DEFINE(XP_MACOSX)
++fi
++
+ AC_SUBST(MOZ_PDF_PRINTING)
+ if test "$MOZ_PDF_PRINTING"; then
+ PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
+@@ -5106,6 +5016,9 @@ if test -n "$MOZ_WEBRTC"; then
+ MOZ_VPX=1
+ MOZ_VPX_ERROR_CONCEALMENT=1
+
++ dnl with libv4l2 we can support more cameras
++ PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2)
++
+ dnl enable once Signaling lands
+ MOZ_WEBRTC_SIGNALING=1
+ AC_DEFINE(MOZ_WEBRTC_SIGNALING)
+@@ -5190,6 +5106,63 @@ if test "${ac_cv_c_attribute_aligned}" !
+ fi
+
+ dnl ========================================================
++dnl Check for libogg
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-ogg,
++[ --with-system-ogg Use system libogg (located with pkgconfig)],
++MOZ_NATIVE_OGG=1,
++MOZ_NATIVE_OGG=)
++
++if test -n "$MOZ_NATIVE_OGG"; then
++ PKG_CHECK_MODULES(MOZ_OGG, ogg >= 1.2.1)
++
++ _SAVE_LIBS=$LIBS
++ LIBS="$LIBS $MOZ_OGG_LIBS"
++ AC_CHECK_FUNC(ogg_set_mem_functions, [],
++ [AC_DEFINE(MOZ_OGG_NO_MEM_REPORTING)])
++ LIBS=$_SAVE_LIBS
++fi
++
++AC_SUBST(MOZ_NATIVE_OGG)
++AC_SUBST(MOZ_OGG_CFLAGS)
++AC_SUBST(MOZ_OGG_LIBS)
++
++dnl ========================================================
++dnl Check for libvorbis
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-vorbis,
++[ --with-system-vorbis Use system libvorbis (located with pkgconfig)],
++MOZ_NATIVE_VORBIS=1,
++MOZ_NATIVE_VORBIS=)
++
++if test -n "$MOZ_NATIVE_VORBIS"; then
++ PKG_CHECK_MODULES(MOZ_VORBIS, vorbis vorbisenc >= 1.3.4)
++fi
++
++AC_SUBST(MOZ_NATIVE_VORBIS)
++AC_SUBST(MOZ_VORBIS_CFLAGS)
++AC_SUBST(MOZ_VORBIS_LIBS)
++
++dnl ========================================================
++dnl Check for integer-only libvorbis aka tremor
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-tremor,
++[ --with-system-tremor Use system libtremor (located with pkgconfig)],
++MOZ_NATIVE_TREMOR=1,
++MOZ_NATIVE_TREMOR=)
++
++if test -n "$MOZ_NATIVE_TREMOR"; then
++ PKG_CHECK_MODULES(MOZ_TREMOR, vorbisidec >= 1.2.1)
++fi
++
++AC_SUBST(MOZ_NATIVE_TREMOR)
++AC_SUBST(MOZ_TREMOR_CFLAGS)
++AC_SUBST(MOZ_TREMOR_LIBS)
++
++dnl ========================================================
+ dnl = Disable Opus audio codec support
+ dnl ========================================================
+ MOZ_ARG_DISABLE_BOOL(opus,
+@@ -5198,6 +5171,97 @@ MOZ_ARG_DISABLE_BOOL(opus,
+ MOZ_OPUS=1)
+
+ dnl ========================================================
++dnl Check for libopus
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-opus,
++[ --with-system-opus Use system libopus (located with pkgconfig)],
++MOZ_NATIVE_OPUS=1,
++MOZ_NATIVE_OPUS=)
++
++if test -n "$MOZ_NATIVE_OPUS"; then
++ PKG_CHECK_MODULES(MOZ_OPUS, opus >= 1.1)
++else
++ MOZ_OPUS_CFLAGS='-I$(topsrcdir)/media/libopus/include'
++fi
++
++AC_SUBST(MOZ_NATIVE_OPUS)
++AC_SUBST(MOZ_OPUS_CFLAGS)
++AC_SUBST(MOZ_OPUS_LIBS)
++
++dnl ========================================================
++dnl Check for libtheora
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-theora,
++[ --with-system-theora Use system libtheora (located with pkgconfig)],
++MOZ_NATIVE_THEORA=1,
++MOZ_NATIVE_THEORA=)
++
++if test -n "$MOZ_NATIVE_THEORA"; then
++ PKG_CHECK_MODULES(MOZ_THEORA, theora >= 1.2)
++fi
++
++AC_SUBST(MOZ_NATIVE_THEORA)
++AC_SUBST(MOZ_THEORA_CFLAGS)
++AC_SUBST(MOZ_THEORA_LIBS)
++
++dnl ========================================================
++dnl Check for libspeex resampler
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-speex,
++[ --with-system-speex Use system libspeex (located with pkgconfig)],
++MOZ_NATIVE_SPEEX=1,
++MOZ_NATIVE_SPEEX=)
++
++if test -n "$MOZ_NATIVE_SPEEX"; then
++ PKG_CHECK_MODULES(MOZ_SPEEX, speexdsp >= 1.2)
++fi
++
++AC_SUBST(MOZ_NATIVE_SPEEX)
++AC_SUBST(MOZ_SPEEX_CFLAGS)
++AC_SUBST(MOZ_SPEEX_LIBS)
++
++dnl ========================================================
++dnl Check for libsoundtouch
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-soundtouch,
++[ --with-system-soundtouch Use system libsoundtouch (located with pkgconfig)],
++MOZ_NATIVE_SOUNDTOUCH=1,
++MOZ_NATIVE_SOUNDTOUCH=)
++
++if test -n "$MOZ_NATIVE_SOUNDTOUCH"; then
++ PKG_CHECK_MODULES(MOZ_SOUNDTOUCH, soundtouch >= 1.8.0)
++
++ AC_LANG_SAVE
++ AC_LANG_CPLUSPLUS
++ _SAVE_CXXFLAGS=$CXXFLAGS
++ CXXFLAGS="$CXXFLAGS $MOZ_SOUNDTOUCH_CFLAGS"
++ AC_CACHE_CHECK(for soundtouch sample type,
++ ac_cv_soundtouch_sample_type,
++ [AC_TRY_COMPILE([#include <SoundTouch.h>
++ #ifndef SOUNDTOUCH_INTEGER_SAMPLES
++ #error soundtouch expects float samples
++ #endif],
++ [],
++ [ac_cv_soundtouch_sample_type=short],
++ [ac_cv_soundtouch_sample_type=float])])
++ CXXFLAGS=$_SAVE_CXXFLAGS
++ AC_LANG_RESTORE
++
++ if test \( -n "$MOZ_SAMPLE_TYPE_S16" -a "$ac_cv_soundtouch_sample_type" != short \) \
++ -o \( -n "$MOZ_SAMPLE_TYPE_FLOAT32" -a "$ac_cv_soundtouch_sample_type" != float \) ; then
++ AC_MSG_ERROR([SoundTouch library is built with incompatible sample type. Either rebuild the library with/without --enable-integer-samples, chase default Mozilla sample type or remove --with-system-soundtouch.])
++ fi
++fi
++
++AC_SUBST(MOZ_NATIVE_SOUNDTOUCH)
++AC_SUBST(MOZ_SOUNDTOUCH_CFLAGS)
++AC_SUBST(MOZ_SOUNDTOUCH_LIBS)
++
++dnl ========================================================
+ dnl = Disable VP8 decoder support
+ dnl ========================================================
+ MOZ_ARG_DISABLE_BOOL(webm,
+@@ -5938,7 +6002,9 @@ MOZ_ARG_DISABLE_BOOL(gamepad,
+ if test "$MOZ_GAMEPAD"; then
+ case "$OS_TARGET" in
+ Darwin)
+- MOZ_GAMEPAD_BACKEND=cocoa
++ if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
++ MOZ_GAMEPAD_BACKEND=cocoa
++ fi
+ ;;
+ WINNT)
+ if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
+@@ -8036,6 +8102,52 @@ if test "$USE_FC_FREETYPE"; then
+ fi
+
+ dnl ========================================================
++dnl Check for harfbuzz
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-harfbuzz,
++[ --with-system-harfbuzz Use system harfbuzz (located with pkgconfig)],
++MOZ_NATIVE_HARFBUZZ=1,
++MOZ_NATIVE_HARFBUZZ=)
++
++if test -n "$MOZ_NATIVE_HARFBUZZ"; then
++ PKG_CHECK_MODULES(MOZ_HARFBUZZ, harfbuzz >= 0.9.25)
++fi
++
++AC_SUBST(MOZ_NATIVE_HARFBUZZ)
++AC_SUBST(MOZ_HARFBUZZ_CFLAGS)
++AC_SUBST(MOZ_HARFBUZZ_LIBS)
++
++dnl ========================================================
++dnl Check for graphite2
++dnl ========================================================
++MOZ_ARG_WITH_BOOL(system-graphite2,
++[ --with-system-graphite2 Use system graphite2 (located with pkgconfig)],
++MOZ_NATIVE_GRAPHITE2=1,
++MOZ_NATIVE_GRAPHITE2=)
++
++if test -n "$MOZ_NATIVE_GRAPHITE2"; then
++ PKG_CHECK_MODULES(MOZ_GRAPHITE2, graphite2)
++
++ dnl graphite2.pc has bogus version, check manually
++ AC_TRY_COMPILE([ #include <graphite2/Font.h>
++ #define GR2_VERSION_REQUIRE(major,minor,bugfix) \
++ ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
++ * 100 + GR2_VERSION_BUGFIX >= \
++ (major) * 10000 + (minor) * 100 + (bugfix) )
++ ], [
++ #if !GR2_VERSION_REQUIRE(1,2,4)
++ #error "Insufficient graphite2 version."
++ #endif
++ ], [],
++ [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
++fi
++
++AC_SUBST(MOZ_NATIVE_GRAPHITE2)
++AC_SUBST(MOZ_GRAPHITE2_CFLAGS)
++AC_SUBST(MOZ_GRAPHITE2_LIBS)
++
++dnl ========================================================
+ dnl Check for pixman and cairo
+ dnl ========================================================
+
diff --git a/www/firefox31/patches/patch-ak b/www/firefox31/patches/patch-ak
new file mode 100644
index 00000000000..370088540d2
--- /dev/null
+++ b/www/firefox31/patches/patch-ak
@@ -0,0 +1,13 @@
+$NetBSD: patch-ak,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- js/src/ctypes/libffi/configure.orig 2013-01-04 23:44:34.000000000 +0000
++++ js/src/ctypes/libffi/configure
+@@ -11278,7 +11278,7 @@ case "$host" in
+ powerpc-*-aix* | rs6000-*-aix*)
+ TARGET=POWERPC_AIX; TARGETDIR=powerpc
+ ;;
+- powerpc-*-freebsd* | powerpc-*-openbsd*)
++ powerpc-*-freebsd* | powerpc-*-openbsd* | powerpc-*-netbsd*)
+ TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
+ ;;
+ powerpc*-*-rtems*)
diff --git a/www/firefox31/patches/patch-al b/www/firefox31/patches/patch-al
new file mode 100644
index 00000000000..c3c702ce1a9
--- /dev/null
+++ b/www/firefox31/patches/patch-al
@@ -0,0 +1,16 @@
+$NetBSD: patch-al,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- storage/src/mozStorageConnection.cpp.orig 2014-04-18 02:04:20.000000000 +0000
++++ storage/src/mozStorageConnection.cpp
+@@ -584,6 +584,11 @@ Connection::initialize(nsIFile *aDatabas
+
+ mDatabaseFile = aDatabaseFile;
+
++ // XXX tnn: the configure script demands that sqlite3 is compiled with
++ // SECURE_DELETE on by default. sqlite3 in pkgsrc does not have that,
++ // so instead we enable secure_delete manually here.
++ (void)ExecuteSimpleSQL(NS_LITERAL_CSTRING("PRAGMA secure_delete = 1;"));
++
+ return NS_OK;
+ }
+
diff --git a/www/firefox31/patches/patch-ao b/www/firefox31/patches/patch-ao
new file mode 100644
index 00000000000..356d06f99cd
--- /dev/null
+++ b/www/firefox31/patches/patch-ao
@@ -0,0 +1,17 @@
+$NetBSD: patch-ao,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- toolkit/mozapps/installer/packager.mk.orig 2014-10-11 15:00:07.000000000 +0000
++++ toolkit/mozapps/installer/packager.mk
+@@ -788,9 +788,9 @@ endif
+ (cd $(DIST)/$(MOZ_PKG_DIR) && $(TAR) --exclude=precomplete $(TAR_CREATE_FLAGS) - .) | \
+ (cd $(DESTDIR)$(installdir) && tar -xf -)
+ $(NSINSTALL) -D $(DESTDIR)$(bindir)
+- $(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME)
+- ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
+-ifdef INSTALL_SDK # Here comes the hard part
++ $(RM) -f $(DESTDIR)$(bindir)/$(MOZILLA_PKG_NAME)
++ ln -s $(installdir)/firefox $(DESTDIR)$(bindir)/$(MOZILLA_PKG_NAME)
++ifeq ($(MOZ_APP_NAME),xulrunner)
+ $(NSINSTALL) -D $(DESTDIR)$(includedir)
+ (cd $(DIST)/include && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
+ (cd $(DESTDIR)$(includedir) && tar -xf -)
diff --git a/www/firefox31/patches/patch-as b/www/firefox31/patches/patch-as
new file mode 100644
index 00000000000..9df7f19d61e
--- /dev/null
+++ b/www/firefox31/patches/patch-as
@@ -0,0 +1,154 @@
+$NetBSD: patch-as,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Treat DragonFly like FreeBSD.
+
+--- js/src/configure.in.orig 2014-05-29 23:30:53.000000000 +0000
++++ js/src/configure.in
+@@ -2082,116 +2082,13 @@ AC_LANG_CPLUSPLUS
+
+ MOZ_CXX11
+
+-dnl Check for .hidden assembler directive and visibility attribute.
+-dnl Borrowed from glibc configure.in
++dnl Setup default hidden visibility and wrapped system headers.
+ dnl ===============================================================
+ if test "$GNU_CC"; then
+- AC_CACHE_CHECK(for visibility(hidden) attribute,
+- ac_cv_visibility_hidden,
+- [cat > conftest.c <<EOF
+- int foo __attribute__ ((visibility ("hidden"))) = 1;
+-EOF
+- ac_cv_visibility_hidden=no
+- if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+- if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
+- ac_cv_visibility_hidden=yes
+- fi
+- fi
+- rm -f conftest.[cs]
+- ])
+- if test "$ac_cv_visibility_hidden" = "yes"; then
+- AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
+-
+- AC_CACHE_CHECK(for visibility(default) attribute,
+- ac_cv_visibility_default,
+- [cat > conftest.c <<EOF
+- int foo __attribute__ ((visibility ("default"))) = 1;
+-EOF
+- ac_cv_visibility_default=no
+- if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+- if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
+- ac_cv_visibility_default=yes
+- fi
+- fi
+- rm -f conftest.[cs]
+- ])
+- if test "$ac_cv_visibility_default" = "yes"; then
+- AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
+-
+- AC_CACHE_CHECK(for visibility pragma support,
+- ac_cv_visibility_pragma,
+- [cat > conftest.c <<EOF
+-#pragma GCC visibility push(hidden)
+- int foo_hidden = 1;
+-#pragma GCC visibility push(default)
+- int foo_default = 1;
+-EOF
+- ac_cv_visibility_pragma=no
+- if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+- if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
+- if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
+- ac_cv_visibility_pragma=yes
+- fi
+- fi
+- fi
+- rm -f conftest.[cs]
+- ])
+- if test "$ac_cv_visibility_pragma" = "yes"; then
+- AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
+- ac_cv_have_visibility_class_bug,
+- [cat > conftest.c <<EOF
+-#pragma GCC visibility push(hidden)
+-struct __attribute__ ((visibility ("default"))) TestStruct {
+- static void Init();
+-};
+-__attribute__ ((visibility ("default"))) void TestFunc() {
+- TestStruct::Init();
+-}
+-EOF
+- ac_cv_have_visibility_class_bug=no
+- if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
+- ac_cv_have_visibility_class_bug=yes
+- else
+- if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
+- ac_cv_have_visibility_class_bug=yes
+- fi
+- fi
+- rm -rf conftest.{c,S}
+- ])
+-
+- AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
+- ac_cv_have_visibility_builtin_bug,
+- [cat > conftest.c <<EOF
+-#pragma GCC visibility push(hidden)
+-#pragma GCC visibility push(default)
+-#include <string.h>
+-#pragma GCC visibility pop
+-
+-__attribute__ ((visibility ("default"))) void Func() {
+- char c[[100]];
+- memset(c, 0, sizeof(c));
+-}
+-EOF
+- ac_cv_have_visibility_builtin_bug=no
+- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
+- ac_cv_have_visibility_builtin_bug=yes
+- else
+- if test `grep -c "@PLT" conftest.S` = 0; then
+- ac_cv_visibility_builtin_bug=yes
+- fi
+- fi
+- rm -f conftest.{c,S}
+- ])
+- if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
+- "$ac_cv_have_visibility_class_bug" = "no"; then
+- VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
+- WRAP_SYSTEM_INCLUDES=1
+- else
+- VISIBILITY_FLAGS='-fvisibility=hidden'
+- fi # have visibility pragma bug
+- fi # have visibility pragma
+- fi # have visibility(default) attribute
+- fi # have visibility(hidden) attribute
++ AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
++ AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
++ VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
++ WRAP_SYSTEM_INCLUDES=1
+ fi # GNU_CC
+
+ # visibility hidden flag for Sun Studio on Solaris
+@@ -3162,7 +3059,7 @@ if test "$MOZ_MEMORY"; then
+ *-darwin*)
+ AC_DEFINE(MOZ_MEMORY_DARWIN)
+ ;;
+- *-*freebsd*)
++ *-*freebsd*|*-*dragonfly*)
+ AC_DEFINE(MOZ_MEMORY_BSD)
+ ;;
+ *-android*|*-linuxandroid*)
+@@ -4100,6 +3997,16 @@ MOZ_SUBCONFIGURE_ICU()
+ dnl ========================================================
+ dnl JavaScript shell
+ dnl ========================================================
++ICU_LIB_NAMES=
++MOZ_NATIVE_ICU=
++MOZ_ARG_WITH_BOOL(system-icu,
++[ --with-system-icu
++ Use system icu (located with pkgconfig)],
++ MOZ_NATIVE_ICU=1)
++
++if test -n "$MOZ_NATIVE_ICU"; then
++ PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
++fi
+
+ AC_HAVE_FUNCS(setlocale)
+ AC_HAVE_FUNCS(localeconv)
diff --git a/www/firefox31/patches/patch-b2g_installer_Makefile.in b/www/firefox31/patches/patch-b2g_installer_Makefile.in
new file mode 100644
index 00000000000..2231db46c86
--- /dev/null
+++ b/www/firefox31/patches/patch-b2g_installer_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-b2g_installer_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- b2g/installer/Makefile.in.orig 2014-07-17 01:45:05.000000000 +0000
++++ b2g/installer/Makefile.in
+@@ -61,6 +61,10 @@ ifneq (,$(filter rtsp,$(NECKO_PROTOCOLS)
+ DEFINES += -DMOZ_RTSP
+ endif
+
++ifdef MOZ_DEBUG
++DEFINES += -DMOZ_DEBUG=1
++endif
++
+ ifdef GKMEDIAS_SHARED_LIBRARY
+ DEFINES += -DGKMEDIAS_SHARED_LIBRARY
+ endif
diff --git a/www/firefox31/patches/patch-b2g_installer_package-manifest.in b/www/firefox31/patches/patch-b2g_installer_package-manifest.in
new file mode 100644
index 00000000000..778d87373fd
--- /dev/null
+++ b/www/firefox31/patches/patch-b2g_installer_package-manifest.in
@@ -0,0 +1,13 @@
+$NetBSD: patch-b2g_installer_package-manifest.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- b2g/installer/package-manifest.in.orig 2014-07-17 01:45:05.000000000 +0000
++++ b2g/installer/package-manifest.in
+@@ -565,7 +565,7 @@
+ @BINPATH@/components/MozKeyboard.js
+ @BINPATH@/components/InputMethod.manifest
+
+-#ifdef MOZ_DEBUG
++#if defined(ENABLE_TESTS) && defined(MOZ_DEBUG)
+ @BINPATH@/components/TestInterfaceJS.js
+ @BINPATH@/components/TestInterfaceJS.manifest
+ #endif
diff --git a/www/firefox31/patches/patch-bf b/www/firefox31/patches/patch-bf
new file mode 100644
index 00000000000..fa3464fab9a
--- /dev/null
+++ b/www/firefox31/patches/patch-bf
@@ -0,0 +1,13 @@
+$NetBSD: patch-bf,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- js/src/jsnativestack.cpp.orig 2013-09-10 03:43:36.000000000 +0000
++++ js/src/jsnativestack.cpp
+@@ -114,7 +114,7 @@ js::GetNativeStackBaseImpl()
+ pthread_attr_init(&sattr);
+ # if defined(__OpenBSD__)
+ stack_t ss;
+-# elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD)
++# elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(__DragonFly__) || defined(NETBSD) || defined(__NetBSD__) /* XXX tnn not sure why NETBSD isn't defined, it looks like it should be ... */
+ /* e.g. on FreeBSD 4.8 or newer, neundorf@kde.org */
+ pthread_attr_get_np(thread, &sattr);
+ # else
diff --git a/www/firefox31/patches/patch-bg b/www/firefox31/patches/patch-bg
new file mode 100644
index 00000000000..f67ac9fe325
--- /dev/null
+++ b/www/firefox31/patches/patch-bg
@@ -0,0 +1,24 @@
+$NetBSD: patch-bg,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- storage/src/SQLiteMutex.h.orig 2013-10-25 22:27:40.000000000 +0000
++++ storage/src/SQLiteMutex.h
+@@ -108,15 +108,19 @@ public:
+ void assertCurrentThreadOwns()
+ {
+ NS_ASSERTION(mMutex, "No mutex associated with this wrapper!");
++#if 0
+ NS_ASSERTION(sqlite3_mutex_held(mMutex),
+ "Mutex is not held, but we expect it to be!");
++#endif
+ }
+
+ void assertNotCurrentThreadOwns()
+ {
+ NS_ASSERTION(mMutex, "No mutex associated with this wrapper!");
++#if 0
+ NS_ASSERTION(sqlite3_mutex_notheld(mMutex),
+ "Mutex is held, but we expect it to not be!");
++#endif
+ }
+ #endif // ifndef DEBUG
+
diff --git a/www/firefox31/patches/patch-bi b/www/firefox31/patches/patch-bi
new file mode 100644
index 00000000000..4895bc191aa
--- /dev/null
+++ b/www/firefox31/patches/patch-bi
@@ -0,0 +1,12 @@
+$NetBSD: patch-bi,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- gfx/angle/src/compiler/osinclude.h.orig 2013-01-04 23:44:32.000000000 +0000
++++ gfx/angle/src/compiler/osinclude.h
+@@ -16,6 +16,7 @@
+ #define ANGLE_OS_WIN
+ #elif defined(__APPLE__) || defined(__linux__) || \
+ defined(__FreeBSD__) || defined(__OpenBSD__) || \
++ defined(__NetBSD__) || defined(__DragonFly__) || \
+ defined(__sun) || defined(ANDROID) || \
+ defined(__GLIBC__) || defined(__GNU__) || \
+ defined(__QNX__)
diff --git a/www/firefox31/patches/patch-browser_app_nsBrowserApp.cpp b/www/firefox31/patches/patch-browser_app_nsBrowserApp.cpp
new file mode 100644
index 00000000000..d9358e952af
--- /dev/null
+++ b/www/firefox31/patches/patch-browser_app_nsBrowserApp.cpp
@@ -0,0 +1,36 @@
+$NetBSD: patch-browser_app_nsBrowserApp.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* Replace XP_MACOSX with XP_DARWIN as the former is not defined when
+ the toolkit is not cocoa.
+
+--- browser/app/nsBrowserApp.cpp.orig 2014-05-06 22:55:09.000000000 +0000
++++ browser/app/nsBrowserApp.cpp
+@@ -18,8 +18,10 @@
+ #include <unistd.h>
+ #endif
+
+-#ifdef XP_MACOSX
++#ifdef XP_DARWIN
+ #include <mach/mach_time.h>
++#endif
++#ifdef MOZ_WIDGET_COCOA
+ #include "MacQuirks.h"
+ #endif
+
+@@ -447,7 +449,7 @@ TimeStamp_Now()
+ }
+
+ return sGetTickCount64() * freq.QuadPart;
+-#elif defined(XP_MACOSX)
++#elif defined(XP_DARWIN)
+ return mach_absolute_time();
+ #elif defined(HAVE_CLOCK_MONOTONIC)
+ struct timespec ts;
+@@ -586,6 +588,7 @@ int main(int argc, char* argv[])
+ TriggerQuirks();
+ #endif
+
++ setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
+ int gotCounters;
+ #if defined(XP_UNIX)
+ struct rusage initialRUsage;
diff --git a/www/firefox31/patches/patch-browser_app_profile_firefox.js b/www/firefox31/patches/patch-browser_app_profile_firefox.js
new file mode 100644
index 00000000000..5ebe563816b
--- /dev/null
+++ b/www/firefox31/patches/patch-browser_app_profile_firefox.js
@@ -0,0 +1,12 @@
+$NetBSD: patch-browser_app_profile_firefox.js,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- browser/app/profile/firefox.js.orig 2013-09-10 03:43:20.000000000 +0000
++++ browser/app/profile/firefox.js
+@@ -354,6 +354,7 @@ pref("browser.search.log", false);
+ pref("browser.search.order.1", "chrome://browser-region/locale/region.properties");
+ pref("browser.search.order.2", "chrome://browser-region/locale/region.properties");
+ pref("browser.search.order.3", "chrome://browser-region/locale/region.properties");
++pref("browser.search.order.4", "chrome://browser-region/locale/region.properties");
+
+ // search bar results always open in a new tab
+ pref("browser.search.openintab", false);
diff --git a/www/firefox31/patches/patch-browser_installer_package-manifest.in b/www/firefox31/patches/patch-browser_installer_package-manifest.in
new file mode 100644
index 00000000000..08ea92a5832
--- /dev/null
+++ b/www/firefox31/patches/patch-browser_installer_package-manifest.in
@@ -0,0 +1,24 @@
+$NetBSD: patch-browser_installer_package-manifest.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Limit SPARC bits to just SPARC (untested, but fixes x86).
+
+--- browser/installer/package-manifest.in.orig 2014-07-17 01:45:07.000000000 +0000
++++ browser/installer/package-manifest.in
+@@ -575,7 +575,7 @@
+ @BINPATH@/components/MozKeyboard.js
+ @BINPATH@/components/InputMethod.manifest
+
+-#ifdef MOZ_DEBUG
++#if defined(ENABLE_TESTS) && defined(MOZ_DEBUG)
+ @BINPATH@/components/TestInterfaceJS.js
+ @BINPATH@/components/TestInterfaceJS.manifest
+ #endif
+@@ -737,7 +737,7 @@
+ #endif
+
+ ; for Solaris SPARC
+-#ifdef SOLARIS
++#if defined(SOLARIS) && defined(SPARC)
+ bin/libfreebl_32fpu_3.so
+ bin/libfreebl_32int_3.so
+ bin/libfreebl_32int64_3.so
diff --git a/www/firefox31/patches/patch-browser_locales_en-US_chrome_browser-region_region.properties b/www/firefox31/patches/patch-browser_locales_en-US_chrome_browser-region_region.properties
new file mode 100644
index 00000000000..91991f200f8
--- /dev/null
+++ b/www/firefox31/patches/patch-browser_locales_en-US_chrome_browser-region_region.properties
@@ -0,0 +1,12 @@
+$NetBSD: patch-browser_locales_en-US_chrome_browser-region_region.properties,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- browser/locales/en-US/chrome/browser-region/region.properties.orig 2013-09-10 03:43:22.000000000 +0000
++++ browser/locales/en-US/chrome/browser-region/region.properties
+@@ -9,6 +9,7 @@ browser.search.defaultenginename=Google
+ browser.search.order.1=Google
+ browser.search.order.2=Yahoo
+ browser.search.order.3=Bing
++browser.search.order.4=DuckDuckGo
+
+ # This is the default set of web based feed handlers shown in the reader
+ # selection UI
diff --git a/www/firefox31/patches/patch-browser_locales_en-US_searchplugins_duckduckgo.xml b/www/firefox31/patches/patch-browser_locales_en-US_searchplugins_duckduckgo.xml
new file mode 100644
index 00000000000..08623e55a49
--- /dev/null
+++ b/www/firefox31/patches/patch-browser_locales_en-US_searchplugins_duckduckgo.xml
@@ -0,0 +1,16 @@
+$NetBSD: patch-browser_locales_en-US_searchplugins_duckduckgo.xml,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- browser/locales/en-US/searchplugins/duckduckgo.xml.orig 2013-09-14 15:17:46.000000000 +0000
++++ browser/locales/en-US/searchplugins/duckduckgo.xml
+@@ -0,0 +1,11 @@
++<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
++<ShortName>DuckDuckGo</ShortName>
++<Description>We believe in better search and not tracking.</Description>
++<InputEncoding>UTF-8</InputEncoding>
++<Image height="16" width="16" type="image/x-icon">data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAANcNAADXDQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJyDsJmlk8pf6+v3s/v7+++zr/fcnIOyzJyDsgCcg7CYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnIOwBJyDscCcg7PZttJ7/7Pfs//////++xO7/S5GA/ycg7P8nIOz2JyDscCcg7AEAAAAAAAAAAAAAAAAnIOwBJyDstScg7P8nIOz/Y8p5/2fHZf9Yv0z/YcF2/1rBUv8nIOz/JyDs/ycg7P8nIOy1JyDsAQAAAAAAAAAAJyDscCcg7P8nIOz/JyDs/4jQoP/p9+n//////05X3v9LkYD/JyDs/ycg7P8nIOz/JyDs/ycg7HAAAAAAJyDsJicg7PYnIOz/JyDs/zUu7f/+/v////////////89N+7/JyDs/yUo7f8nIOz/JyDs/ycg7P8nIOz2JyDsJicg7IAnIOz/JyDs/ycg7P9hXPH////////////t/P//GIr2/wfD+/8Gyfz/DKv5/yM57/8nIOz/JyDs/ycg7H8nIOyzJyDs/ycg7P8nIOz/jov1////////////Otz9/w3G/P8cWfH/JSvt/ycg7P8nIOz/JyDs/ycg7P8nIOyzJyDs5icg7P8nIOz/JyDs/7u5+f///////////27l/v8E0v3/BNL9/wTQ/f8Oofn/IT7v/ycg7P8nIOz/JyDs5icg7OYnIOz/JyDs/ycg7P/p6P3/uWsC////////////5fr//6Po/f8Thfb/DKv5/w6f+f8nIOz/JyDs/ycg7OYnIOyzJyDs/ycg7P8nIOz/9/b+/////////////////7lrAv/V1Pv/JyDs/ycg7P8nIOz/JyDs/ycg7P8nIOyzJyDsgCcg7P8nIOz/JyDs/8/N+///////////////////////iIX1/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDsfycg7CYnIOz2JyDs/ycg7P9FP+7/q6n4/+7u/f/n5v3/fXn0/yoj7P8nIOz/JyDs/ycg7P8nIOz/JyDs9icg7CYAAAAAJyDscCcg7P8nIOz/wsD6/+no/f/Y1/z/eHTz/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDs/ycg7HAAAAAAAAAAACcg7AEnIOy1JyDs/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDs/ycg7LUnIOwBAAAAAAAAAAAAAAAAJyDsAScg7HAnIOz2JyDs/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDs9icg7HAnIOwBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJyDsJicg7IAnIOyzJyDs5icg7OYnIOyzJyDsgCcg7CYAAAAAAAAAAAAAAAAAAAAA+B8AAPAPAADAAwAAwAMAAIABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAACAAQAAwAMAAMADAADwDwAA+B8AAA==</Image>
++<Url type="text/html" method="GET" template="https://duckduckgo.com/">
++<Param name="q" value="{searchTerms}"/>
++<Param name="t" value="freebsd"/>
++</Url>
++<SearchForm>https://duckduckgo.com/</SearchForm>
++</SearchPlugin>
diff --git a/www/firefox31/patches/patch-browser_locales_en-US_searchplugins_list.txt b/www/firefox31/patches/patch-browser_locales_en-US_searchplugins_list.txt
new file mode 100644
index 00000000000..54847267003
--- /dev/null
+++ b/www/firefox31/patches/patch-browser_locales_en-US_searchplugins_list.txt
@@ -0,0 +1,11 @@
+$NetBSD: patch-browser_locales_en-US_searchplugins_list.txt,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- browser/locales/en-US/searchplugins/list.txt.orig 2013-09-10 03:43:22.000000000 +0000
++++ browser/locales/en-US/searchplugins/list.txt
+@@ -1,5 +1,6 @@
+ amazondotcom
+ bing
++duckduckgo
+ eBay
+ google
+ twitter
diff --git a/www/firefox31/patches/patch-build_autoconf_compiler-opts.m4 b/www/firefox31/patches/patch-build_autoconf_compiler-opts.m4
new file mode 100644
index 00000000000..39bf9859c18
--- /dev/null
+++ b/www/firefox31/patches/patch-build_autoconf_compiler-opts.m4
@@ -0,0 +1,22 @@
+$NetBSD: patch-build_autoconf_compiler-opts.m4,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+It's true Clang is required if we use the cocoa toolkit, but we don't
+do that anyway. GCC is perfectly working as long as we use cairo-gtk2.
+
+--- build/autoconf/compiler-opts.m4.orig 2014-05-06 22:55:14.000000000 +0000
++++ build/autoconf/compiler-opts.m4
+@@ -53,14 +53,6 @@ case "$target" in
+ if test -z "$CXX"; then
+ MOZ_PATH_PROGS(CXX, clang++)
+ fi
+- IS_GCC=$($CC -v 2>&1 | grep gcc)
+- if test -n "$IS_GCC"
+- then
+- echo gcc is known to be broken on OS X, please use clang.
+- echo see http://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites
+- echo for more information.
+- exit 1
+- fi
+ ;;
+ esac
+ fi
diff --git a/www/firefox31/patches/patch-build_autoconf_nss.m4 b/www/firefox31/patches/patch-build_autoconf_nss.m4
new file mode 100644
index 00000000000..2d5f631c7f2
--- /dev/null
+++ b/www/firefox31/patches/patch-build_autoconf_nss.m4
@@ -0,0 +1,46 @@
+$NetBSD: patch-build_autoconf_nss.m4,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- build/autoconf/nss.m4.orig 2013-10-25 22:27:10.000000000 +0000
++++ build/autoconf/nss.m4
+@@ -22,18 +22,18 @@ AC_ARG_WITH(nss-exec-prefix,
+ if test -n "$nss_config_exec_prefix"; then
+ nss_config_args="$nss_config_args --exec-prefix=$nss_config_exec_prefix"
+ if test -z "$NSS_CONFIG"; then
+- NSS_CONFIG=$nss_config_exec_prefix/bin/nss-config
++ NSS_CONFIG=$nss_config_exec_prefix/bin/pkg-config
+ fi
+ fi
+ if test -n "$nss_config_prefix"; then
+ nss_config_args="$nss_config_args --prefix=$nss_config_prefix"
+ if test -z "$NSS_CONFIG"; then
+- NSS_CONFIG=$nss_config_prefix/bin/nss-config
++ NSS_CONFIG=$nss_config_prefix/bin/pkg-config
+ fi
+ fi
+
+ unset ac_cv_path_NSS_CONFIG
+- AC_PATH_PROG(NSS_CONFIG, nss-config, no)
++ AC_PATH_PROG(NSS_CONFIG, pkg-config, no)
+ min_nss_version=ifelse([$1], ,3.0.0,$1)
+ AC_MSG_CHECKING(for NSS - version >= $min_nss_version)
+
+@@ -41,14 +41,14 @@ AC_ARG_WITH(nss-exec-prefix,
+ if test "$NSS_CONFIG" = "no"; then
+ no_nss="yes"
+ else
+- NSS_CFLAGS=`$NSS_CONFIG $nss_config_args --cflags`
+- NSS_LIBS=`$NSS_CONFIG $nss_config_args --libs`
++ NSS_CFLAGS=`$NSS_CONFIG $nss_config_args nss --cflags`
++ NSS_LIBS=`$NSS_CONFIG $nss_config_args nss --libs`
+
+- nss_config_major_version=`$NSS_CONFIG $nss_config_args --version | \
++ nss_config_major_version=`$NSS_CONFIG $nss_config_args nss --modversion | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+- nss_config_minor_version=`$NSS_CONFIG $nss_config_args --version | \
++ nss_config_minor_version=`$NSS_CONFIG $nss_config_args nss --modversion | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+- nss_config_micro_version=`$NSS_CONFIG $nss_config_args --version | \
++ nss_config_micro_version=`$NSS_CONFIG $nss_config_args nss --modversion | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ min_nss_major_version=`echo $min_nss_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
diff --git a/www/firefox31/patches/patch-build_gyp.mozbuild b/www/firefox31/patches/patch-build_gyp.mozbuild
new file mode 100644
index 00000000000..f97f5fb4b2a
--- /dev/null
+++ b/www/firefox31/patches/patch-build_gyp.mozbuild
@@ -0,0 +1,12 @@
+$NetBSD: patch-build_gyp.mozbuild,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- build/gyp.mozbuild.orig 2014-04-18 02:02:38.000000000 +0000
++++ build/gyp.mozbuild
+@@ -11,6 +11,7 @@ gyp_vars = {
+ 'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0,
+ 'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0,
+ 'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0,
++ 'use_libv4l2': 1 if CONFIG['MOZ_LIBV4L2_LIBS'] else 0,
+ # basic stuff for everything
+ 'include_internal_video_render': 0,
+ 'clang_use_chrome_plugins': 0,
diff --git a/www/firefox31/patches/patch-build_pgo_profileserver.py b/www/firefox31/patches/patch-build_pgo_profileserver.py
new file mode 100644
index 00000000000..c6fb777a1e4
--- /dev/null
+++ b/www/firefox31/patches/patch-build_pgo_profileserver.py
@@ -0,0 +1,13 @@
+$NetBSD: patch-build_pgo_profileserver.py,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- build/pgo/profileserver.py.orig 2014-03-15 05:19:09.000000000 +0000
++++ build/pgo/profileserver.py
+@@ -59,7 +59,7 @@ if __name__ == '__main__':
+ env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
+ print "jarlog: %s" % env["MOZ_JAR_LOG_FILE"]
+
+- cmdargs = ["http://localhost:%d/index.html" % PORT]
++ cmdargs = ["http://127.0.0.1:%d/index.html" % PORT]
+ runner = FirefoxRunner(profile=profile,
+ binary=build.get_binary_path(where="staged-package"),
+ cmdargs=cmdargs,
diff --git a/www/firefox31/patches/patch-config_Makefile.in b/www/firefox31/patches/patch-config_Makefile.in
new file mode 100644
index 00000000000..404f1716f09
--- /dev/null
+++ b/www/firefox31/patches/patch-config_Makefile.in
@@ -0,0 +1,20 @@
+$NetBSD: patch-config_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- config/Makefile.in.orig 2014-04-18 02:02:39.000000000 +0000
++++ config/Makefile.in
+@@ -77,6 +77,15 @@ export:: $(export-preqs)
+ -DMOZ_NATIVE_LIBEVENT=$(MOZ_NATIVE_LIBEVENT) \
+ -DMOZ_NATIVE_LIBVPX=$(MOZ_NATIVE_LIBVPX) \
+ -DMOZ_NATIVE_ICU=$(MOZ_NATIVE_ICU) \
++ -DMOZ_NATIVE_GRAPHITE2=$(MOZ_NATIVE_GRAPHITE2) \
++ -DMOZ_NATIVE_HARFBUZZ=$(MOZ_NATIVE_HARFBUZZ) \
++ -DMOZ_NATIVE_OGG=$(MOZ_NATIVE_OGG) \
++ -DMOZ_NATIVE_THEORA=$(MOZ_NATIVE_THEORA) \
++ -DMOZ_NATIVE_VORBIS=$(MOZ_NATIVE_VORBIS) \
++ -DMOZ_NATIVE_TREMOR=$(MOZ_NATIVE_TREMOR) \
++ -DMOZ_NATIVE_OPUS=$(MOZ_NATIVE_OPUS) \
++ -DMOZ_NATIVE_SPEEX=$(MOZ_NATIVE_SPEEX) \
++ -DMOZ_NATIVE_SOUNDTOUCH=$(MOZ_NATIVE_SOUNDTOUCH) \
+ $(srcdir)/system-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
+ $(INSTALL) system_wrappers $(DIST)
+
diff --git a/www/firefox31/patches/patch-config_baseconfig.mk b/www/firefox31/patches/patch-config_baseconfig.mk
new file mode 100644
index 00000000000..fd85e043cac
--- /dev/null
+++ b/www/firefox31/patches/patch-config_baseconfig.mk
@@ -0,0 +1,19 @@
+$NetBSD: patch-config_baseconfig.mk,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- config/baseconfig.mk.orig 2014-04-18 02:02:39.000000000 +0000
++++ config/baseconfig.mk
+@@ -2,10 +2,10 @@
+ # directly in python/mozbuild/mozbuild/base.py for gmake validation.
+ # We thus use INCLUDED_AUTOCONF_MK to enable/disable some parts depending
+ # whether a normal build is happening or whether the check is running.
+-includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
++includedir := $(includedir)/${MOZILLA_PKG_NAME}
++idldir = $(datadir)/idl/${MOZILLA_PKG_NAME}
++installdir = $(libdir)/${MOZILLA_PKG_NAME}
++sdkdir = $(libdir)/${MOZILLA_PKG_NAME}
+ ifndef TOP_DIST
+ TOP_DIST = dist
+ endif
diff --git a/www/firefox31/patches/patch-config_external_moz.build b/www/firefox31/patches/patch-config_external_moz.build
new file mode 100644
index 00000000000..544b3518a42
--- /dev/null
+++ b/www/firefox31/patches/patch-config_external_moz.build
@@ -0,0 +1,47 @@
+$NetBSD: patch-config_external_moz.build,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- config/external/moz.build.orig 2014-05-29 23:30:30.000000000 +0000
++++ config/external/moz.build
+@@ -15,13 +15,19 @@ if CONFIG['MOZ_UPDATER']:
+ if not CONFIG['MOZ_NATIVE_BZ2']:
+ external_dirs += ['modules/libbz2']
+
+-if CONFIG['MOZ_VORBIS']:
++if not CONFIG['MOZ_NATIVE_OGG']:
++ external_dirs += ['media/libogg']
++
++if not CONFIG['MOZ_NATIVE_THEORA']:
++ external_dirs += ['media/libtheora']
++
++if CONFIG['MOZ_VORBIS'] and not CONFIG['MOZ_NATIVE_VORBIS']:
+ external_dirs += ['media/libvorbis']
+
+-if CONFIG['MOZ_TREMOR']:
++if CONFIG['MOZ_TREMOR'] and not CONFIG['MOZ_NATIVE_TREMOR']:
+ external_dirs += ['media/libtremor']
+
+-if CONFIG['MOZ_OPUS']:
++if CONFIG['MOZ_OPUS'] and not CONFIG['MOZ_NATIVE_OPUS']:
+ external_dirs += ['media/libopus']
+
+ if CONFIG['MOZ_WEBM']:
+@@ -36,13 +42,15 @@ if CONFIG['MOZ_VPX'] and not CONFIG['MOZ
+ if not CONFIG['MOZ_NATIVE_PNG']:
+ external_dirs += ['media/libpng']
+
++if not CONFIG['MOZ_NATIVE_SPEEX']:
++ external_dirs += ['media/libspeex_resampler']
++
++if not CONFIG['MOZ_NATIVE_SOUNDTOUCH']:
++ external_dirs += ['media/libsoundtouch']
++
+ external_dirs += [
+ 'media/kiss_fft',
+ 'media/libcubeb',
+- 'media/libogg',
+- 'media/libtheora',
+- 'media/libspeex_resampler',
+- 'media/libsoundtouch',
+ ]
+
+ PARALLEL_DIRS += ['../../' + i for i in external_dirs]
diff --git a/www/firefox31/patches/patch-config_rules.mk b/www/firefox31/patches/patch-config_rules.mk
new file mode 100644
index 00000000000..209ab295880
--- /dev/null
+++ b/www/firefox31/patches/patch-config_rules.mk
@@ -0,0 +1,30 @@
+$NetBSD: patch-config_rules.mk,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- config/rules.mk.orig 2014-07-17 01:45:08.000000000 +0000
++++ config/rules.mk
+@@ -832,6 +832,7 @@ endif
+ ifdef DTRACE_PROBE_OBJ
+ EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
+ OBJS += $(DTRACE_PROBE_OBJ)
++EXCLUDED_OBJS += $(DTRACE_PROBE_OBJ)
+ endif
+
+ $(filter %.$(LIB_SUFFIX),$(LIBRARY)): $(OBJS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+@@ -867,7 +868,7 @@ ifdef DTRACE_PROBE_OBJ
+ ifndef DTRACE_LIB_DEPENDENT
+ NON_DTRACE_OBJS := $(filter-out $(DTRACE_PROBE_OBJ),$(OBJS))
+ $(DTRACE_PROBE_OBJ): $(NON_DTRACE_OBJS)
+- dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(NON_DTRACE_OBJS)
++ dtrace -x nolibs -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(NON_DTRACE_OBJS)
+ endif
+ endif
+ endif
+@@ -885,7 +886,7 @@ ifndef INCREMENTAL_LINKER
+ endif
+ ifdef DTRACE_LIB_DEPENDENT
+ ifndef XP_MACOSX
+- dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
++ dtrace -x nolibs -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
+ endif
+ $(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
+ @$(RM) $(DTRACE_PROBE_OBJ)
diff --git a/www/firefox31/patches/patch-config_stl__wrappers_ios b/www/firefox31/patches/patch-config_stl__wrappers_ios
new file mode 100644
index 00000000000..10a7b0d7287
--- /dev/null
+++ b/www/firefox31/patches/patch-config_stl__wrappers_ios
@@ -0,0 +1,8 @@
+$NetBSD: patch-config_stl__wrappers_ios,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- config/stl_wrappers/ios.orig 2013-05-13 18:23:07.000000000 +0000
++++ config/stl_wrappers/ios
+@@ -0,0 +1,3 @@
++#pragma GCC visibility push(default)
++#include_next <ios>
++#pragma GCC visibility pop
diff --git a/www/firefox31/patches/patch-config_stl__wrappers_ostream b/www/firefox31/patches/patch-config_stl__wrappers_ostream
new file mode 100644
index 00000000000..50b5533c6f3
--- /dev/null
+++ b/www/firefox31/patches/patch-config_stl__wrappers_ostream
@@ -0,0 +1,8 @@
+$NetBSD: patch-config_stl__wrappers_ostream,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- config/stl_wrappers/ostream.orig 2013-05-13 18:22:40.000000000 +0000
++++ config/stl_wrappers/ostream
+@@ -0,0 +1,3 @@
++#pragma GCC visibility push(default)
++#include_next <ostream>
++#pragma GCC visibility pop
diff --git a/www/firefox31/patches/patch-config_system-headers b/www/firefox31/patches/patch-config_system-headers
new file mode 100644
index 00000000000..6bef4545b2f
--- /dev/null
+++ b/www/firefox31/patches/patch-config_system-headers
@@ -0,0 +1,60 @@
+$NetBSD: patch-config_system-headers,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- config/system-headers.orig 2014-07-17 01:45:08.000000000 +0000
++++ config/system-headers
+@@ -1048,8 +1048,6 @@ X11/Xlocale.h
+ X11/Xos.h
+ X11/Xutil.h
+ zmouse.h
+-speex/speex_resampler.h
+-soundtouch/SoundTouch.h
+ #if MOZ_NATIVE_PNG==1
+ png.h
+ #endif
+@@ -1117,6 +1115,8 @@ ogg/ogg.h
+ ogg/os_types.h
+ nestegg/nestegg.h
+ cubeb/cubeb.h
++speex/speex_resampler.h
++soundtouch/SoundTouch.h
+ #endif
+ gst/gst.h
+ gst/app/gstappsink.h
+@@ -1145,3 +1145,37 @@ unicode/utypes.h
+ #endif
+ libutil.h
+ unwind.h
++#if MOZ_NATIVE_GRAPHITE2==1
++graphite2/Font.h
++graphite2/Segment.h
++#endif
++#if MOZ_NATIVE_HARFBUZZ==1
++harfbuzz/hb-ot.h
++harfbuzz/hb.h
++#endif
++#if MOZ_NATIVE_OGG==1
++ogg/ogg.h
++ogg/os_types.h
++#endif
++#if MOZ_NATIVE_THEORA==1
++theora/theoradec.h
++#endif
++#if MOZ_NATIVE_VORBIS==1
++vorbis/codec.h
++vorbis/vorbisenc.h
++#endif
++#if MOZ_NATIVE_TREMOR==1
++tremor/ivorbiscodec.h
++#endif
++#if MOZ_NATIVE_OPUS==1
++opus.h
++opus_multistream.h
++opus/opus.h
++opus/opus_multistream.h
++#endif
++#if MOZ_NATIVE_SPEEX==1
++speex/speex_resampler.h
++#endif
++#if MOZ_NATIVE_SOUNDTOUCH==1
++soundtouch/SoundTouch.h
++#endif
diff --git a/www/firefox31/patches/patch-config_system__wrappers_unwind.h b/www/firefox31/patches/patch-config_system__wrappers_unwind.h
new file mode 100644
index 00000000000..b522f7c6317
--- /dev/null
+++ b/www/firefox31/patches/patch-config_system__wrappers_unwind.h
@@ -0,0 +1,9 @@
+$NetBSD: patch-config_system__wrappers_unwind.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- config/system_wrappers/unwind.h.orig 2013-05-13 19:56:18.000000000 +0000
++++ config/system_wrappers/unwind.h
+@@ -0,0 +1,4 @@
++#pragma GCC system_header
++#pragma GCC visibility push(default)
++#include_next <unwind.h>
++#pragma GCC visibility pop
diff --git a/www/firefox31/patches/patch-content_base_src_moz.build b/www/firefox31/patches/patch-content_base_src_moz.build
new file mode 100644
index 00000000000..1c0127cc966
--- /dev/null
+++ b/www/firefox31/patches/patch-content_base_src_moz.build
@@ -0,0 +1,14 @@
+$NetBSD: patch-content_base_src_moz.build,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- content/base/src/moz.build.orig 2014-05-29 23:30:31.000000000 +0000
++++ content/base/src/moz.build
+@@ -176,6 +176,9 @@ SOURCES += [
+ 'nsObjectLoadingContent.cpp',
+ ]
+
++if CONFIG['MOZ_NATIVE_HARFBUZZ']:
++ SOURCES['nsContentUtils.cpp'].flags += [CONFIG['MOZ_HARFBUZZ_CFLAGS']]
++
+ EXTRA_COMPONENTS += [
+ 'contentAreaDropListener.js',
+ 'contentAreaDropListener.manifest',
diff --git a/www/firefox31/patches/patch-content_media_AudioStream.cpp b/www/firefox31/patches/patch-content_media_AudioStream.cpp
new file mode 100644
index 00000000000..7e0679e406d
--- /dev/null
+++ b/www/firefox31/patches/patch-content_media_AudioStream.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-content_media_AudioStream.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- content/media/AudioStream.cpp.orig 2014-04-18 02:02:42.000000000 +0000
++++ content/media/AudioStream.cpp
+@@ -13,7 +13,6 @@
+ #include "mozilla/Mutex.h"
+ #include <algorithm>
+ #include "mozilla/Preferences.h"
+-#include "soundtouch/SoundTouch.h"
+ #include "Latency.h"
+
+ namespace mozilla {
diff --git a/www/firefox31/patches/patch-content_media_AudioStream.h b/www/firefox31/patches/patch-content_media_AudioStream.h
new file mode 100644
index 00000000000..dc7b02852e1
--- /dev/null
+++ b/www/firefox31/patches/patch-content_media_AudioStream.h
@@ -0,0 +1,23 @@
+$NetBSD: patch-content_media_AudioStream.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- content/media/AudioStream.h.orig 2014-07-17 01:45:09.000000000 +0000
++++ content/media/AudioStream.h
+@@ -17,6 +17,7 @@
+ #include "mozilla/RefPtr.h"
+
+ #include "cubeb/cubeb.h"
++#include "soundtouch/SoundTouch.h"
+
+ template <>
+ class nsAutoRefTraits<cubeb_stream> : public nsPointerRefTraits<cubeb_stream>
+@@ -25,10 +26,6 @@ public:
+ static void Release(cubeb_stream* aStream) { cubeb_stream_destroy(aStream); }
+ };
+
+-namespace soundtouch {
+-class SoundTouch;
+-}
+-
+ namespace mozilla {
+
+ class AudioStream;
diff --git a/www/firefox31/patches/patch-content_media_Makefile.in b/www/firefox31/patches/patch-content_media_Makefile.in
new file mode 100644
index 00000000000..b78af59fcfa
--- /dev/null
+++ b/www/firefox31/patches/patch-content_media_Makefile.in
@@ -0,0 +1,36 @@
+$NetBSD: patch-content_media_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- content/media/Makefile.in.orig 2014-05-29 23:30:33.000000000 +0000
++++ content/media/Makefile.in
+@@ -6,3 +6,31 @@ include $(topsrcdir)/config/rules.mk
+
+ CFLAGS += $(GSTREAMER_CFLAGS)
+ CXXFLAGS += $(GSTREAMER_CFLAGS)
++
++ifdef MOZ_NATIVE_OGG
++CXXFLAGS += $(MOZ_OGG_CFLAGS)
++endif
++
++ifdef MOZ_NATIVE_THEORA
++CXXFLAGS += $(MOZ_THEORA_CFLAGS)
++endif
++
++ifdef MOZ_NATIVE_VORBIS
++CXXFLAGS += $(MOZ_VORBIS_CFLAGS)
++endif
++
++ifdef MOZ_NATIVE_TREMOR
++CXXFLAGS += $(MOZ_TREMOR_CFLAGS)
++endif
++
++ifdef MOZ_NATIVE_OPUS
++CXXFLAGS += $(MOZ_OPUS_CFLAGS)
++endif
++
++ifdef MOZ_NATIVE_SPEEX
++CXXFLAGS += $(MOZ_SPEEX_CFLAGS)
++endif
++
++ifdef MOZ_NATIVE_SOUNDTOUCH
++CXXFLAGS += $(MOZ_SOUNDTOUCH_CFLAGS)
++endif
diff --git a/www/firefox31/patches/patch-content_media_fmp4_demuxer_bit_reader.cc b/www/firefox31/patches/patch-content_media_fmp4_demuxer_bit_reader.cc
new file mode 100644
index 00000000000..874fe362052
--- /dev/null
+++ b/www/firefox31/patches/patch-content_media_fmp4_demuxer_bit_reader.cc
@@ -0,0 +1,15 @@
+$NetBSD: patch-content_media_fmp4_demuxer_bit_reader.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Fix build with pre-C++11 compilers like G++ 4.5.3.
+
+--- content/media/fmp4/demuxer/bit_reader.cc.orig 2014-07-17 02:45:09.000000000 +0100
++++ content/media/fmp4/demuxer/bit_reader.cc 2014-07-25 13:00:34.000000000 +0100
+@@ -9,7 +9,7 @@
+
+ BitReader::BitReader(const uint8_t* data, off_t size)
+ : data_(data), bytes_left_(size), num_remaining_bits_in_curr_byte_(0) {
+- DCHECK(data_ != nullptr && bytes_left_ > 0);
++ DCHECK(data_ != 0 && bytes_left_ > 0);
+
+ UpdateCurrByte();
+ }
diff --git a/www/firefox31/patches/patch-content_media_gstreamer_GStreamerAllocator.cpp b/www/firefox31/patches/patch-content_media_gstreamer_GStreamerAllocator.cpp
new file mode 100644
index 00000000000..03908060448
--- /dev/null
+++ b/www/firefox31/patches/patch-content_media_gstreamer_GStreamerAllocator.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-content_media_gstreamer_GStreamerAllocator.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- content/media/gstreamer/GStreamerAllocator.cpp.orig 2014-05-29 23:30:33.000000000 +0000
++++ content/media/gstreamer/GStreamerAllocator.cpp
+@@ -51,7 +51,6 @@ typedef struct
+ #pragma GCC diagnostic ignored "-Wunused-function"
+ G_DEFINE_TYPE(MozGfxMemoryAllocator, moz_gfx_memory_allocator, GST_TYPE_ALLOCATOR);
+ G_DEFINE_TYPE(MozGfxBufferPool, moz_gfx_buffer_pool, GST_TYPE_VIDEO_BUFFER_POOL);
+-#pragma GCC diagnostic pop
+
+ void
+ moz_gfx_memory_reset(MozGfxMemory *mem)
diff --git a/www/firefox31/patches/patch-dom_plugins_ipc_PluginModuleChild.cpp b/www/firefox31/patches/patch-dom_plugins_ipc_PluginModuleChild.cpp
new file mode 100644
index 00000000000..bbbde05bea6
--- /dev/null
+++ b/www/firefox31/patches/patch-dom_plugins_ipc_PluginModuleChild.cpp
@@ -0,0 +1,31 @@
+$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- dom/plugins/ipc/PluginModuleChild.cpp.orig 2013-05-11 19:19:27.000000000 +0000
++++ dom/plugins/ipc/PluginModuleChild.cpp
+@@ -201,7 +201,7 @@ PluginModuleChild::Init(const std::strin
+
+ // TODO: use PluginPRLibrary here
+
+-#if defined(OS_LINUX) || defined(OS_BSD)
++#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ mShutdownFunc =
+ (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
+
+@@ -1836,7 +1836,7 @@ PluginModuleChild::AnswerNP_GetEntryPoin
+ PLUGIN_LOG_DEBUG_METHOD;
+ AssertPluginThread();
+
+-#if defined(OS_LINUX) || defined(OS_BSD)
++#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ return true;
+ #elif defined(OS_WIN) || defined(OS_MACOSX)
+ *_retval = mGetEntryPointsFunc(&mFunctions);
+@@ -1865,7 +1865,7 @@ PluginModuleChild::AnswerNP_Initialize(c
+ SendBackUpXResources(FileDescriptor(xSocketFd));
+ #endif
+
+-#if defined(OS_LINUX) || defined(OS_BSD)
++#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ *_retval = mInitializeFunc(&sBrowserFuncs, &mFunctions);
+ return true;
+ #elif defined(OS_WIN) || defined(OS_MACOSX)
diff --git a/www/firefox31/patches/patch-dom_plugins_ipc_PluginModuleChild.h b/www/firefox31/patches/patch-dom_plugins_ipc_PluginModuleChild.h
new file mode 100644
index 00000000000..a0397f7852b
--- /dev/null
+++ b/www/firefox31/patches/patch-dom_plugins_ipc_PluginModuleChild.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- dom/plugins/ipc/PluginModuleChild.h.orig 2013-05-11 19:19:27.000000000 +0000
++++ dom/plugins/ipc/PluginModuleChild.h
+@@ -325,7 +325,7 @@ private:
+
+ // we get this from the plugin
+ NP_PLUGINSHUTDOWN mShutdownFunc;
+-#if defined(OS_LINUX) || defined(OS_BSD)
++#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ NP_PLUGINUNIXINIT mInitializeFunc;
+ #elif defined(OS_WIN) || defined(OS_MACOSX)
+ NP_PLUGININIT mInitializeFunc;
diff --git a/www/firefox31/patches/patch-dom_plugins_ipc_PluginProcessChild.cpp b/www/firefox31/patches/patch-dom_plugins_ipc_PluginProcessChild.cpp
new file mode 100644
index 00000000000..83efa618e35
--- /dev/null
+++ b/www/firefox31/patches/patch-dom_plugins_ipc_PluginProcessChild.cpp
@@ -0,0 +1,16 @@
+$NetBSD: patch-dom_plugins_ipc_PluginProcessChild.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Just because OS_ARCH is Darwin does not mean
+libplugin_child_interpose.dylib is used.
+
+--- dom/plugins/ipc/PluginProcessChild.cpp.orig 2014-05-06 22:55:25.000000000 +0000
++++ dom/plugins/ipc/PluginProcessChild.cpp
+@@ -42,7 +42,7 @@ namespace plugins {
+ bool
+ PluginProcessChild::Init()
+ {
+-#if defined(XP_MACOSX)
++#if defined(MOZ_WIDGET_COCOA)
+ // Remove the trigger for "dyld interposing" that we added in
+ // GeckoChildProcessHost::PerformAsyncLaunchInternal(), in the host
+ // process just before we were launched. Dyld interposing will still
diff --git a/www/firefox31/patches/patch-dom_system_OSFileConstants.cpp b/www/firefox31/patches/patch-dom_system_OSFileConstants.cpp
new file mode 100644
index 00000000000..23ad5acf82c
--- /dev/null
+++ b/www/firefox31/patches/patch-dom_system_OSFileConstants.cpp
@@ -0,0 +1,54 @@
+$NetBSD: patch-dom_system_OSFileConstants.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* NetBSD 5 does not support posix_spawn(3)
+
+* Replace XP_MACOSX with XP_DARWIN as the former is not defined when
+ the toolkit is not cocoa.
+
+--- dom/system/OSFileConstants.cpp.orig 2014-05-29 23:30:40.000000000 +0000
++++ dom/system/OSFileConstants.cpp
+@@ -9,6 +9,10 @@
+
+ #include "prsystem.h"
+
++#if defined(__NetBSD__)
++#include <sys/param.h>
++#endif
++
+ #if defined(XP_UNIX)
+ #include "unistd.h"
+ #include "dirent.h"
+@@ -26,9 +30,9 @@
+ #include <linux/fadvise.h>
+ #endif // defined(XP_LINUX)
+
+-#if defined(XP_MACOSX)
++#if defined(XP_DARWIN)
+ #include "copyfile.h"
+-#endif // defined(XP_MACOSX)
++#endif // defined(XP_DARWIN)
+
+ #if defined(XP_WIN)
+ #include <windows.h>
+@@ -533,10 +537,10 @@ static const dom::ConstantSpec gLibcProp
+ // The size of |fsblkcnt_t|.
+ { "OSFILE_SIZEOF_FSBLKCNT_T", INT_TO_JSVAL(sizeof (fsblkcnt_t)) },
+
+-#if !defined(ANDROID)
++#if !defined(ANDROID) && (defined(__NetBSD_) && (__NetBSD_Version__ < 600000000))
+ // The size of |posix_spawn_file_actions_t|.
+ { "OSFILE_SIZEOF_POSIX_SPAWN_FILE_ACTIONS_T", INT_TO_JSVAL(sizeof (posix_spawn_file_actions_t)) },
+-#endif // !defined(ANDROID)
++#endif // !defined(ANDROID) && NetBSD 5.*
+
+ // Defining |dirent|.
+ // Size
+@@ -596,7 +600,7 @@ static const dom::ConstantSpec gLibcProp
+
+ { "OSFILE_SIZEOF_STATVFS", INT_TO_JSVAL(sizeof (struct statvfs)) },
+
+- { "OSFILE_OFFSETOF_STATVFS_F_BSIZE", INT_TO_JSVAL(offsetof (struct statvfs, f_bsize)) },
++ { "OSFILE_OFFSETOF_STATVFS_F_FRSIZE", INT_TO_JSVAL(offsetof (struct statvfs, f_frsize)) },
+ { "OSFILE_OFFSETOF_STATVFS_F_BAVAIL", INT_TO_JSVAL(offsetof (struct statvfs, f_bavail)) },
+
+ #endif // defined(XP_UNIX)
diff --git a/www/firefox31/patches/patch-extensions_spellcheck_hunspell_src_mozHunspell.cpp b/www/firefox31/patches/patch-extensions_spellcheck_hunspell_src_mozHunspell.cpp
new file mode 100644
index 00000000000..8b48fe5acaf
--- /dev/null
+++ b/www/firefox31/patches/patch-extensions_spellcheck_hunspell_src_mozHunspell.cpp
@@ -0,0 +1,17 @@
+$NetBSD: patch-extensions_spellcheck_hunspell_src_mozHunspell.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- extensions/spellcheck/hunspell/src/mozHunspell.cpp.orig 2014-02-12 21:28:58.000000000 +0000
++++ extensions/spellcheck/hunspell/src/mozHunspell.cpp
+@@ -426,6 +426,12 @@ mozHunspell::LoadDictionaryList()
+ }
+ }
+
++ // load system hunspell dictionaries
++ nsIFile* hunDir;
++ NS_NewNativeLocalFile(NS_LITERAL_CSTRING("@PREFIX@/share/hunspell"),
++ true, &hunDir);
++ LoadDictionariesFromDir(hunDir);
++
+ // find dictionaries from extensions requiring restart
+ nsCOMPtr<nsISimpleEnumerator> dictDirs;
+ rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY_LIST,
diff --git a/www/firefox31/patches/patch-gfx_graphite2_src_Bidi.cpp b/www/firefox31/patches/patch-gfx_graphite2_src_Bidi.cpp
new file mode 100644
index 00000000000..c83a1d01a41
--- /dev/null
+++ b/www/firefox31/patches/patch-gfx_graphite2_src_Bidi.cpp
@@ -0,0 +1,16 @@
+$NetBSD: patch-gfx_graphite2_src_Bidi.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- gfx/graphite2/src/Bidi.cpp.orig 2013-05-11 19:19:30.000000000 +0000
++++ gfx/graphite2/src/Bidi.cpp
+@@ -30,6 +30,11 @@ of the License or (at your option) any l
+
+ using namespace graphite2;
+
++#ifdef __sun
++#undef CS
++#undef ES
++#endif
++
+ enum DirCode { // Hungarian: dirc
+ Unk = -1,
+ N = 0, // other neutrals (default) - ON
diff --git a/www/firefox31/patches/patch-gfx_moz.build b/www/firefox31/patches/patch-gfx_moz.build
new file mode 100644
index 00000000000..6e87a8ab7d3
--- /dev/null
+++ b/www/firefox31/patches/patch-gfx_moz.build
@@ -0,0 +1,26 @@
+$NetBSD: patch-gfx_moz.build,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- gfx/moz.build.orig 2014-03-15 05:19:16.000000000 +0000
++++ gfx/moz.build
+@@ -7,6 +7,12 @@
+ if CONFIG['MOZ_TREE_CAIRO']:
+ DIRS += ['cairo']
+
++if not CONFIG['MOZ_NATIVE_GRAPHITE2']:
++ DIRS += ['graphite2/src' ]
++
++if not CONFIG['MOZ_NATIVE_HARFBUZZ']:
++ DIRS += ['harfbuzz/src']
++
+ DIRS += [
+ '2d',
+ 'ycbcr',
+@@ -15,8 +21,6 @@ DIRS += [
+ 'qcms',
+ 'gl',
+ 'layers',
+- 'graphite2/src',
+- 'harfbuzz/src',
+ 'ots/src',
+ 'thebes',
+ 'ipc',
diff --git a/www/firefox31/patches/patch-gfx_skia_Makefile.in b/www/firefox31/patches/patch-gfx_skia_Makefile.in
new file mode 100644
index 00000000000..ff7d6a88fa6
--- /dev/null
+++ b/www/firefox31/patches/patch-gfx_skia_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-gfx_skia_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- gfx/skia/Makefile.in.orig 2014-05-29 23:30:46.000000000 +0000
++++ gfx/skia/Makefile.in
+@@ -15,6 +15,10 @@ ifeq (qt,$(MOZ_WIDGET_TOOLKIT))
+ OS_CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(MOZ_PANGO_CFLAGS) $(CAIRO_FT_CFLAGS)
+ endif
+
++ifdef MOZ_NATIVE_HARFBUZZ
++OS_CXXFLAGS += $(MOZ_HARFBUZZ_CFLAGS)
++endif
++
+ include $(topsrcdir)/config/rules.mk
+
+ ifeq ($(CPU_ARCH)_$(GNU_CC),arm_1)
diff --git a/www/firefox31/patches/patch-gfx_thebes_Makefile.in b/www/firefox31/patches/patch-gfx_thebes_Makefile.in
new file mode 100644
index 00000000000..d559cb8f123
--- /dev/null
+++ b/www/firefox31/patches/patch-gfx_thebes_Makefile.in
@@ -0,0 +1,19 @@
+$NetBSD: patch-gfx_thebes_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- gfx/thebes/Makefile.in.orig 2014-04-18 02:02:58.000000000 +0000
++++ gfx/thebes/Makefile.in
+@@ -13,6 +13,14 @@ DEFINES := $(filter-out -DUNICODE,$(DEFI
+ CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
+ CFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
+
++ifdef MOZ_NATIVE_GRAPHITE2
++CXXFLAGS += $(MOZ_GRAPHITE2_CFLAGS)
++endif
++
++ifdef MOZ_NATIVE_HARFBUZZ
++CXXFLAGS += $(MOZ_HARFBUZZ_CFLAGS)
++endif
++
+ ifeq ($(MOZ_WIDGET_TOOLKIT),android)
+ CXXFLAGS += $(CAIRO_FT_CFLAGS)
+ endif
diff --git a/www/firefox31/patches/patch-image_decoders_nsJPEGDecoder.cpp b/www/firefox31/patches/patch-image_decoders_nsJPEGDecoder.cpp
new file mode 100644
index 00000000000..84b3943bd96
--- /dev/null
+++ b/www/firefox31/patches/patch-image_decoders_nsJPEGDecoder.cpp
@@ -0,0 +1,363 @@
+$NetBSD: patch-image_decoders_nsJPEGDecoder.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- image/decoders/nsJPEGDecoder.cpp.orig 2013-05-11 19:19:31.000000000 +0000
++++ image/decoders/nsJPEGDecoder.cpp
+@@ -19,13 +19,28 @@
+
+ extern "C" {
+ #include "iccjpeg.h"
+-}
+
++#ifdef JCS_EXTENSIONS
+ #if defined(IS_BIG_ENDIAN)
+ #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
+ #else
+ #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
+ #endif
++#else
++/* Colorspace conversion (copied from jpegint.h) */
++struct jpeg_color_deconverter {
++ JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
++ JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows));
++};
++
++METHODDEF(void)
++ycc_rgb_convert_argb (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows);
++#endif
++}
+
+ static void cmyk_convert_rgb(JSAMPROW row, JDIMENSION width);
+
+@@ -338,6 +353,7 @@ nsJPEGDecoder::WriteInternal(const char
+ case JCS_GRAYSCALE:
+ case JCS_RGB:
+ case JCS_YCbCr:
++#ifdef JCS_EXTENSIONS
+ // if we're not color managing we can decode directly to
+ // MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
+ if (mCMSMode != eCMSMode_All) {
+@@ -346,6 +362,9 @@ nsJPEGDecoder::WriteInternal(const char
+ } else {
+ mInfo.out_color_space = JCS_RGB;
+ }
++#else
++ mInfo.out_color_space = JCS_RGB;
++#endif
+ break;
+ case JCS_CMYK:
+ case JCS_YCCK:
+@@ -413,6 +432,15 @@ nsJPEGDecoder::WriteInternal(const char
+ return; /* I/O suspension */
+ }
+
++#ifndef JCS_EXTENSIONS
++ /* Force to use our YCbCr to Packed RGB converter when possible */
++ if (!mTransform && (mCMSMode != eCMSMode_All) &&
++ mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
++ /* Special case for the most common case: transform from YCbCr direct into packed ARGB */
++ mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
++ mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
++ }
++#endif
+
+ /* If this is a progressive JPEG ... */
+ mState = mInfo.buffered_image ? JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL;
+@@ -558,7 +586,11 @@ nsJPEGDecoder::OutputScanlines(bool* sus
+ uint32_t *imageRow = ((uint32_t*)mImageData) +
+ (mInfo.output_scanline * mInfo.output_width);
+
++#ifdef JCS_EXTENSIONS
+ if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
++#else
++ if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
++#endif
+ /* Special case: scanline will be directly converted into packed ARGB */
+ if (jpeg_read_scanlines(&mInfo, (JSAMPARRAY)&imageRow, 1) != 1) {
+ *suspend = true; /* suspend */
+@@ -868,6 +900,282 @@ term_source (j_decompress_ptr jd)
+ } // namespace mozilla
+
+
++#ifndef JCS_EXTENSIONS
++/**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
++
++/*
++ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
++ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
++ * The conversion equations to be implemented are therefore
++ * R = Y + 1.40200 * Cr
++ * G = Y - 0.34414 * Cb - 0.71414 * Cr
++ * B = Y + 1.77200 * Cb
++ * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
++ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
++ *
++ * To avoid floating-point arithmetic, we represent the fractional constants
++ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
++ * the products by 2^16, with appropriate rounding, to get the correct answer.
++ * Notice that Y, being an integral input, does not contribute any fraction
++ * so it need not participate in the rounding.
++ *
++ * For even more speed, we avoid doing any multiplications in the inner loop
++ * by precalculating the constants times Cb and Cr for all possible values.
++ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
++ * for 12-bit samples it is still acceptable. It's not very reasonable for
++ * 16-bit samples, but if you want lossless storage you shouldn't be changing
++ * colorspace anyway.
++ * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
++ * values for the G calculation are left scaled up, since we must add them
++ * together before rounding.
++ */
++
++#define SCALEBITS 16 /* speediest right-shift on some machines */
++
++/* Use static tables for color processing. */
++/* Four tables, each 256 entries of 4 bytes totals 4K which is not bad... */
++
++const int Cr_r_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ -0xb3, -0xb2, -0xb1, -0xaf, -0xae, -0xac,
++ -0xab, -0xaa, -0xa8, -0xa7, -0xa5, -0xa4,
++ -0xa3, -0xa1, -0xa0, -0x9e, -0x9d, -0x9c,
++ -0x9a, -0x99, -0x97, -0x96, -0x95, -0x93,
++ -0x92, -0x90, -0x8f, -0x8e, -0x8c, -0x8b,
++ -0x89, -0x88, -0x87, -0x85, -0x84, -0x82,
++ -0x81, -0x80, -0x7e, -0x7d, -0x7b, -0x7a,
++ -0x79, -0x77, -0x76, -0x74, -0x73, -0x72,
++ -0x70, -0x6f, -0x6d, -0x6c, -0x6b, -0x69,
++ -0x68, -0x66, -0x65, -0x64, -0x62, -0x61,
++ -0x5f, -0x5e, -0x5d, -0x5b, -0x5a, -0x58,
++ -0x57, -0x56, -0x54, -0x53, -0x51, -0x50,
++ -0x4f, -0x4d, -0x4c, -0x4a, -0x49, -0x48,
++ -0x46, -0x45, -0x43, -0x42, -0x40, -0x3f,
++ -0x3e, -0x3c, -0x3b, -0x39, -0x38, -0x37,
++ -0x35, -0x34, -0x32, -0x31, -0x30, -0x2e,
++ -0x2d, -0x2b, -0x2a, -0x29, -0x27, -0x26,
++ -0x24, -0x23, -0x22, -0x20, -0x1f, -0x1d,
++ -0x1c, -0x1b, -0x19, -0x18, -0x16, -0x15,
++ -0x14, -0x12, -0x11, -0x0f, -0x0e, -0x0d,
++ -0x0b, -0x0a, -0x08, -0x07, -0x06, -0x04,
++ -0x03, -0x01, 0x00, 0x01, 0x03, 0x04,
++ 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0d,
++ 0x0e, 0x0f, 0x11, 0x12, 0x14, 0x15,
++ 0x16, 0x18, 0x19, 0x1b, 0x1c, 0x1d,
++ 0x1f, 0x20, 0x22, 0x23, 0x24, 0x26,
++ 0x27, 0x29, 0x2a, 0x2b, 0x2d, 0x2e,
++ 0x30, 0x31, 0x32, 0x34, 0x35, 0x37,
++ 0x38, 0x39, 0x3b, 0x3c, 0x3e, 0x3f,
++ 0x40, 0x42, 0x43, 0x45, 0x46, 0x48,
++ 0x49, 0x4a, 0x4c, 0x4d, 0x4f, 0x50,
++ 0x51, 0x53, 0x54, 0x56, 0x57, 0x58,
++ 0x5a, 0x5b, 0x5d, 0x5e, 0x5f, 0x61,
++ 0x62, 0x64, 0x65, 0x66, 0x68, 0x69,
++ 0x6b, 0x6c, 0x6d, 0x6f, 0x70, 0x72,
++ 0x73, 0x74, 0x76, 0x77, 0x79, 0x7a,
++ 0x7b, 0x7d, 0x7e, 0x80, 0x81, 0x82,
++ 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b,
++ 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93,
++ 0x95, 0x96, 0x97, 0x99, 0x9a, 0x9c,
++ 0x9d, 0x9e, 0xa0, 0xa1, 0xa3, 0xa4,
++ 0xa5, 0xa7, 0xa8, 0xaa, 0xab, 0xac,
++ 0xae, 0xaf, 0xb1, 0xb2,
++ };
++
++const int Cb_b_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ -0xe3, -0xe1, -0xdf, -0xde, -0xdc, -0xda,
++ -0xd8, -0xd6, -0xd5, -0xd3, -0xd1, -0xcf,
++ -0xce, -0xcc, -0xca, -0xc8, -0xc6, -0xc5,
++ -0xc3, -0xc1, -0xbf, -0xbe, -0xbc, -0xba,
++ -0xb8, -0xb7, -0xb5, -0xb3, -0xb1, -0xaf,
++ -0xae, -0xac, -0xaa, -0xa8, -0xa7, -0xa5,
++ -0xa3, -0xa1, -0x9f, -0x9e, -0x9c, -0x9a,
++ -0x98, -0x97, -0x95, -0x93, -0x91, -0x90,
++ -0x8e, -0x8c, -0x8a, -0x88, -0x87, -0x85,
++ -0x83, -0x81, -0x80, -0x7e, -0x7c, -0x7a,
++ -0x78, -0x77, -0x75, -0x73, -0x71, -0x70,
++ -0x6e, -0x6c, -0x6a, -0x69, -0x67, -0x65,
++ -0x63, -0x61, -0x60, -0x5e, -0x5c, -0x5a,
++ -0x59, -0x57, -0x55, -0x53, -0x52, -0x50,
++ -0x4e, -0x4c, -0x4a, -0x49, -0x47, -0x45,
++ -0x43, -0x42, -0x40, -0x3e, -0x3c, -0x3a,
++ -0x39, -0x37, -0x35, -0x33, -0x32, -0x30,
++ -0x2e, -0x2c, -0x2b, -0x29, -0x27, -0x25,
++ -0x23, -0x22, -0x20, -0x1e, -0x1c, -0x1b,
++ -0x19, -0x17, -0x15, -0x13, -0x12, -0x10,
++ -0x0e, -0x0c, -0x0b, -0x09, -0x07, -0x05,
++ -0x04, -0x02, 0x00, 0x02, 0x04, 0x05,
++ 0x07, 0x09, 0x0b, 0x0c, 0x0e, 0x10,
++ 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b,
++ 0x1c, 0x1e, 0x20, 0x22, 0x23, 0x25,
++ 0x27, 0x29, 0x2b, 0x2c, 0x2e, 0x30,
++ 0x32, 0x33, 0x35, 0x37, 0x39, 0x3a,
++ 0x3c, 0x3e, 0x40, 0x42, 0x43, 0x45,
++ 0x47, 0x49, 0x4a, 0x4c, 0x4e, 0x50,
++ 0x52, 0x53, 0x55, 0x57, 0x59, 0x5a,
++ 0x5c, 0x5e, 0x60, 0x61, 0x63, 0x65,
++ 0x67, 0x69, 0x6a, 0x6c, 0x6e, 0x70,
++ 0x71, 0x73, 0x75, 0x77, 0x78, 0x7a,
++ 0x7c, 0x7e, 0x80, 0x81, 0x83, 0x85,
++ 0x87, 0x88, 0x8a, 0x8c, 0x8e, 0x90,
++ 0x91, 0x93, 0x95, 0x97, 0x98, 0x9a,
++ 0x9c, 0x9e, 0x9f, 0xa1, 0xa3, 0xa5,
++ 0xa7, 0xa8, 0xaa, 0xac, 0xae, 0xaf,
++ 0xb1, 0xb3, 0xb5, 0xb7, 0xb8, 0xba,
++ 0xbc, 0xbe, 0xbf, 0xc1, 0xc3, 0xc5,
++ 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xcf,
++ 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda,
++ 0xdc, 0xde, 0xdf, 0xe1,
++ };
++
++const int Cr_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ 0x5b6900, 0x5ab22e, 0x59fb5c, 0x59448a, 0x588db8, 0x57d6e6,
++ 0x572014, 0x566942, 0x55b270, 0x54fb9e, 0x5444cc, 0x538dfa,
++ 0x52d728, 0x522056, 0x516984, 0x50b2b2, 0x4ffbe0, 0x4f450e,
++ 0x4e8e3c, 0x4dd76a, 0x4d2098, 0x4c69c6, 0x4bb2f4, 0x4afc22,
++ 0x4a4550, 0x498e7e, 0x48d7ac, 0x4820da, 0x476a08, 0x46b336,
++ 0x45fc64, 0x454592, 0x448ec0, 0x43d7ee, 0x43211c, 0x426a4a,
++ 0x41b378, 0x40fca6, 0x4045d4, 0x3f8f02, 0x3ed830, 0x3e215e,
++ 0x3d6a8c, 0x3cb3ba, 0x3bfce8, 0x3b4616, 0x3a8f44, 0x39d872,
++ 0x3921a0, 0x386ace, 0x37b3fc, 0x36fd2a, 0x364658, 0x358f86,
++ 0x34d8b4, 0x3421e2, 0x336b10, 0x32b43e, 0x31fd6c, 0x31469a,
++ 0x308fc8, 0x2fd8f6, 0x2f2224, 0x2e6b52, 0x2db480, 0x2cfdae,
++ 0x2c46dc, 0x2b900a, 0x2ad938, 0x2a2266, 0x296b94, 0x28b4c2,
++ 0x27fdf0, 0x27471e, 0x26904c, 0x25d97a, 0x2522a8, 0x246bd6,
++ 0x23b504, 0x22fe32, 0x224760, 0x21908e, 0x20d9bc, 0x2022ea,
++ 0x1f6c18, 0x1eb546, 0x1dfe74, 0x1d47a2, 0x1c90d0, 0x1bd9fe,
++ 0x1b232c, 0x1a6c5a, 0x19b588, 0x18feb6, 0x1847e4, 0x179112,
++ 0x16da40, 0x16236e, 0x156c9c, 0x14b5ca, 0x13fef8, 0x134826,
++ 0x129154, 0x11da82, 0x1123b0, 0x106cde, 0x0fb60c, 0x0eff3a,
++ 0x0e4868, 0x0d9196, 0x0cdac4, 0x0c23f2, 0x0b6d20, 0x0ab64e,
++ 0x09ff7c, 0x0948aa, 0x0891d8, 0x07db06, 0x072434, 0x066d62,
++ 0x05b690, 0x04ffbe, 0x0448ec, 0x03921a, 0x02db48, 0x022476,
++ 0x016da4, 0x00b6d2, 0x000000, -0x00b6d2, -0x016da4, -0x022476,
++ -0x02db48, -0x03921a, -0x0448ec, -0x04ffbe, -0x05b690, -0x066d62,
++ -0x072434, -0x07db06, -0x0891d8, -0x0948aa, -0x09ff7c, -0x0ab64e,
++ -0x0b6d20, -0x0c23f2, -0x0cdac4, -0x0d9196, -0x0e4868, -0x0eff3a,
++ -0x0fb60c, -0x106cde, -0x1123b0, -0x11da82, -0x129154, -0x134826,
++ -0x13fef8, -0x14b5ca, -0x156c9c, -0x16236e, -0x16da40, -0x179112,
++ -0x1847e4, -0x18feb6, -0x19b588, -0x1a6c5a, -0x1b232c, -0x1bd9fe,
++ -0x1c90d0, -0x1d47a2, -0x1dfe74, -0x1eb546, -0x1f6c18, -0x2022ea,
++ -0x20d9bc, -0x21908e, -0x224760, -0x22fe32, -0x23b504, -0x246bd6,
++ -0x2522a8, -0x25d97a, -0x26904c, -0x27471e, -0x27fdf0, -0x28b4c2,
++ -0x296b94, -0x2a2266, -0x2ad938, -0x2b900a, -0x2c46dc, -0x2cfdae,
++ -0x2db480, -0x2e6b52, -0x2f2224, -0x2fd8f6, -0x308fc8, -0x31469a,
++ -0x31fd6c, -0x32b43e, -0x336b10, -0x3421e2, -0x34d8b4, -0x358f86,
++ -0x364658, -0x36fd2a, -0x37b3fc, -0x386ace, -0x3921a0, -0x39d872,
++ -0x3a8f44, -0x3b4616, -0x3bfce8, -0x3cb3ba, -0x3d6a8c, -0x3e215e,
++ -0x3ed830, -0x3f8f02, -0x4045d4, -0x40fca6, -0x41b378, -0x426a4a,
++ -0x43211c, -0x43d7ee, -0x448ec0, -0x454592, -0x45fc64, -0x46b336,
++ -0x476a08, -0x4820da, -0x48d7ac, -0x498e7e, -0x4a4550, -0x4afc22,
++ -0x4bb2f4, -0x4c69c6, -0x4d2098, -0x4dd76a, -0x4e8e3c, -0x4f450e,
++ -0x4ffbe0, -0x50b2b2, -0x516984, -0x522056, -0x52d728, -0x538dfa,
++ -0x5444cc, -0x54fb9e, -0x55b270, -0x566942, -0x572014, -0x57d6e6,
++ -0x588db8, -0x59448a, -0x59fb5c, -0x5ab22e,
++ };
++
++const int Cb_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ 0x2c8d00, 0x2c34e6, 0x2bdccc, 0x2b84b2, 0x2b2c98, 0x2ad47e,
++ 0x2a7c64, 0x2a244a, 0x29cc30, 0x297416, 0x291bfc, 0x28c3e2,
++ 0x286bc8, 0x2813ae, 0x27bb94, 0x27637a, 0x270b60, 0x26b346,
++ 0x265b2c, 0x260312, 0x25aaf8, 0x2552de, 0x24fac4, 0x24a2aa,
++ 0x244a90, 0x23f276, 0x239a5c, 0x234242, 0x22ea28, 0x22920e,
++ 0x2239f4, 0x21e1da, 0x2189c0, 0x2131a6, 0x20d98c, 0x208172,
++ 0x202958, 0x1fd13e, 0x1f7924, 0x1f210a, 0x1ec8f0, 0x1e70d6,
++ 0x1e18bc, 0x1dc0a2, 0x1d6888, 0x1d106e, 0x1cb854, 0x1c603a,
++ 0x1c0820, 0x1bb006, 0x1b57ec, 0x1affd2, 0x1aa7b8, 0x1a4f9e,
++ 0x19f784, 0x199f6a, 0x194750, 0x18ef36, 0x18971c, 0x183f02,
++ 0x17e6e8, 0x178ece, 0x1736b4, 0x16de9a, 0x168680, 0x162e66,
++ 0x15d64c, 0x157e32, 0x152618, 0x14cdfe, 0x1475e4, 0x141dca,
++ 0x13c5b0, 0x136d96, 0x13157c, 0x12bd62, 0x126548, 0x120d2e,
++ 0x11b514, 0x115cfa, 0x1104e0, 0x10acc6, 0x1054ac, 0x0ffc92,
++ 0x0fa478, 0x0f4c5e, 0x0ef444, 0x0e9c2a, 0x0e4410, 0x0debf6,
++ 0x0d93dc, 0x0d3bc2, 0x0ce3a8, 0x0c8b8e, 0x0c3374, 0x0bdb5a,
++ 0x0b8340, 0x0b2b26, 0x0ad30c, 0x0a7af2, 0x0a22d8, 0x09cabe,
++ 0x0972a4, 0x091a8a, 0x08c270, 0x086a56, 0x08123c, 0x07ba22,
++ 0x076208, 0x0709ee, 0x06b1d4, 0x0659ba, 0x0601a0, 0x05a986,
++ 0x05516c, 0x04f952, 0x04a138, 0x04491e, 0x03f104, 0x0398ea,
++ 0x0340d0, 0x02e8b6, 0x02909c, 0x023882, 0x01e068, 0x01884e,
++ 0x013034, 0x00d81a, 0x008000, 0x0027e6, -0x003034, -0x00884e,
++ -0x00e068, -0x013882, -0x01909c, -0x01e8b6, -0x0240d0, -0x0298ea,
++ -0x02f104, -0x03491e, -0x03a138, -0x03f952, -0x04516c, -0x04a986,
++ -0x0501a0, -0x0559ba, -0x05b1d4, -0x0609ee, -0x066208, -0x06ba22,
++ -0x07123c, -0x076a56, -0x07c270, -0x081a8a, -0x0872a4, -0x08cabe,
++ -0x0922d8, -0x097af2, -0x09d30c, -0x0a2b26, -0x0a8340, -0x0adb5a,
++ -0x0b3374, -0x0b8b8e, -0x0be3a8, -0x0c3bc2, -0x0c93dc, -0x0cebf6,
++ -0x0d4410, -0x0d9c2a, -0x0df444, -0x0e4c5e, -0x0ea478, -0x0efc92,
++ -0x0f54ac, -0x0facc6, -0x1004e0, -0x105cfa, -0x10b514, -0x110d2e,
++ -0x116548, -0x11bd62, -0x12157c, -0x126d96, -0x12c5b0, -0x131dca,
++ -0x1375e4, -0x13cdfe, -0x142618, -0x147e32, -0x14d64c, -0x152e66,
++ -0x158680, -0x15de9a, -0x1636b4, -0x168ece, -0x16e6e8, -0x173f02,
++ -0x17971c, -0x17ef36, -0x184750, -0x189f6a, -0x18f784, -0x194f9e,
++ -0x19a7b8, -0x19ffd2, -0x1a57ec, -0x1ab006, -0x1b0820, -0x1b603a,
++ -0x1bb854, -0x1c106e, -0x1c6888, -0x1cc0a2, -0x1d18bc, -0x1d70d6,
++ -0x1dc8f0, -0x1e210a, -0x1e7924, -0x1ed13e, -0x1f2958, -0x1f8172,
++ -0x1fd98c, -0x2031a6, -0x2089c0, -0x20e1da, -0x2139f4, -0x21920e,
++ -0x21ea28, -0x224242, -0x229a5c, -0x22f276, -0x234a90, -0x23a2aa,
++ -0x23fac4, -0x2452de, -0x24aaf8, -0x250312, -0x255b2c, -0x25b346,
++ -0x260b60, -0x26637a, -0x26bb94, -0x2713ae, -0x276bc8, -0x27c3e2,
++ -0x281bfc, -0x287416, -0x28cc30, -0x29244a, -0x297c64, -0x29d47e,
++ -0x2a2c98, -0x2a84b2, -0x2adccc, -0x2b34e6,
++ };
++
++
++/* We assume that right shift corresponds to signed division by 2 with
++ * rounding towards minus infinity. This is correct for typical "arithmetic
++ * shift" instructions that shift in copies of the sign bit. But some
++ * C compilers implement >> with an unsigned shift. For these machines you
++ * must define RIGHT_SHIFT_IS_UNSIGNED.
++ * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
++ * It is only applied with constant shift counts. SHIFT_TEMPS must be
++ * included in the variables of any routine using RIGHT_SHIFT.
++ */
++
++#ifdef RIGHT_SHIFT_IS_UNSIGNED
++#define SHIFT_TEMPS INT32 shift_temp;
++#define RIGHT_SHIFT(x,shft) \
++ ((shift_temp = (x)) < 0 ? \
++ (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
++ (shift_temp >> (shft)))
++#else
++#define SHIFT_TEMPS
++#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
++#endif
++
++
++METHODDEF(void)
++ycc_rgb_convert_argb (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows)
++{
++ JDIMENSION num_cols = cinfo->output_width;
++ JSAMPLE * range_limit = cinfo->sample_range_limit;
++
++ SHIFT_TEMPS
++
++ /* This is used if we don't have SSE2 */
++
++ while (--num_rows >= 0) {
++ JSAMPROW inptr0 = input_buf[0][input_row];
++ JSAMPROW inptr1 = input_buf[1][input_row];
++ JSAMPROW inptr2 = input_buf[2][input_row];
++ input_row++;
++ uint32_t *outptr = (uint32_t *) *output_buf++;
++ for (JDIMENSION col = 0; col < num_cols; col++) {
++ int y = GETJSAMPLE(inptr0[col]);
++ int cb = GETJSAMPLE(inptr1[col]);
++ int cr = GETJSAMPLE(inptr2[col]);
++ JSAMPLE * range_limit_y = range_limit + y;
++ /* Range-limiting is essential due to noise introduced by DCT losses. */
++ outptr[col] = 0xFF000000 |
++ ( range_limit_y[Cr_r_tab[cr]] << 16 ) |
++ ( range_limit_y[((int) RIGHT_SHIFT(Cb_g_tab[cb] + Cr_g_tab[cr], SCALEBITS))] << 8 ) |
++ ( range_limit_y[Cb_b_tab[cb]] );
++ }
++ }
++}
++#endif
++
++
+ /**************** Inverted CMYK -> RGB conversion **************/
+ /*
+ * Input is (Inverted) CMYK stored as 4 bytes per pixel.
diff --git a/www/firefox31/patches/patch-intl_hyphenation_src_hnjalloc.h b/www/firefox31/patches/patch-intl_hyphenation_src_hnjalloc.h
new file mode 100644
index 00000000000..c83c8ca867b
--- /dev/null
+++ b/www/firefox31/patches/patch-intl_hyphenation_src_hnjalloc.h
@@ -0,0 +1,14 @@
+$NetBSD: patch-intl_hyphenation_src_hnjalloc.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- intl/hyphenation/src/hnjalloc.h.orig 2013-05-11 19:19:31.000000000 +0000
++++ intl/hyphenation/src/hnjalloc.h
+@@ -56,6 +56,9 @@
+ */
+
+ #include <stdio.h> /* ensure stdio.h is loaded before our macros */
++#ifdef __sun
++#include <wchar.h>
++#endif
+
+ #undef FILE
+ #define FILE hnjFile
diff --git a/www/firefox31/patches/patch-intl_unicharutil_util_Makefile.in b/www/firefox31/patches/patch-intl_unicharutil_util_Makefile.in
new file mode 100644
index 00000000000..9996815dcb5
--- /dev/null
+++ b/www/firefox31/patches/patch-intl_unicharutil_util_Makefile.in
@@ -0,0 +1,12 @@
+$NetBSD: patch-intl_unicharutil_util_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- intl/unicharutil/util/Makefile.in.orig 2014-04-18 02:03:03.000000000 +0000
++++ intl/unicharutil/util/Makefile.in
+@@ -23,3 +23,7 @@ ifdef _MSC_VER
+ OS_COMPILE_CXXFLAGS += -Zl
+ OS_COMPILE_CFLAGS += -Zl
+ endif
++
++ifdef MOZ_NATIVE_HARFBUZZ
++CXXFLAGS += $(MOZ_HARFBUZZ_CFLAGS)
++endif
diff --git a/www/firefox31/patches/patch-ipc_chromium_Makefile.in b/www/firefox31/patches/patch-ipc_chromium_Makefile.in
new file mode 100644
index 00000000000..69100c7e869
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_Makefile.in
@@ -0,0 +1,13 @@
+$NetBSD: patch-ipc_chromium_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/Makefile.in.orig 2014-05-29 23:30:52.000000000 +0000
++++ ipc/chromium/Makefile.in
+@@ -28,6 +28,8 @@ include $(topsrcdir)/config/rules.mk
+
+ ifdef MOZ_NATIVE_LIBEVENT # {
+
++OS_CPPFLAGS += $(filter %/compat, $(MOZ_LIBEVENT_CFLAGS))
++
+ export-preqs = \
+ $(call mkdir_deps,$(CURDIR)/third_party/libevent) \
+ $(NULL)
diff --git a/www/firefox31/patches/patch-ipc_chromium_moz.build b/www/firefox31/patches/patch-ipc_chromium_moz.build
new file mode 100644
index 00000000000..55287215316
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_moz.build
@@ -0,0 +1,18 @@
+$NetBSD: patch-ipc_chromium_moz.build,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Don't assume cocoa toolkit just because OS_ARCH is Darwin.
+
+--- ipc/chromium/moz.build.orig 2014-05-06 22:55:41.000000000 +0000
++++ ipc/chromium/moz.build
+@@ -19,7 +19,10 @@ if CONFIG['OS_ARCH'] == 'WINNT':
+ else:
+ os_posix = 1
+ if CONFIG['OS_ARCH'] == 'Darwin':
+- os_macosx = 1
++ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
++ os_macosx = 1
++ else:
++ os_bsd = 1
+ elif CONFIG['OS_ARCH'] == 'DragonFly':
+ os_dragonfly = 1
+ os_bsd = 1
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_base__paths.h b/www/firefox31/patches/patch-ipc_chromium_src_base_base__paths.h
new file mode 100644
index 00000000000..968920acfd2
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_base__paths.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-ipc_chromium_src_base_base__paths.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/base_paths.h.orig 2013-05-11 19:19:32.000000000 +0000
++++ ipc/chromium/src/base/base_paths.h
+@@ -13,7 +13,7 @@
+ #include "base/base_paths_win.h"
+ #elif defined(OS_MACOSX)
+ #include "base/base_paths_mac.h"
+-#elif defined(OS_LINUX) || defined(OS_BSD)
++#elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ #include "base/base_paths_linux.h"
+ #endif
+ #include "base/path_service.h"
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_debug__util__posix.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_debug__util__posix.cc
new file mode 100644
index 00000000000..412a3de25fa
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_debug__util__posix.cc
@@ -0,0 +1,13 @@
+$NetBSD: patch-ipc_chromium_src_base_debug__util__posix.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/debug_util_posix.cc.orig 2013-05-11 19:19:32.000000000 +0000
++++ ipc/chromium/src/base/debug_util_posix.cc
+@@ -107,7 +107,7 @@ bool DebugUtil::BeingDebugged() {
+ return being_debugged;
+ }
+
+-#elif defined(OS_LINUX)
++#elif defined(OS_LINUX) || defined(OS_SOLARIS)
+
+ // We can look in /proc/self/status for TracerPid. We are likely used in crash
+ // handling, so we are careful not to use the heap or have side effects.
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_file__util.h b/www/firefox31/patches/patch-ipc_chromium_src_base_file__util.h
new file mode 100644
index 00000000000..9bda6a7a4a4
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_file__util.h
@@ -0,0 +1,14 @@
+$NetBSD: patch-ipc_chromium_src_base_file__util.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/file_util.h.orig 2013-12-05 16:07:35.000000000 +0000
++++ ipc/chromium/src/base/file_util.h
+@@ -16,7 +16,9 @@
+ #include <sys/stat.h>
+ #elif defined(OS_POSIX)
+ #include <sys/types.h>
++#if !defined(OS_SOLARIS)
+ #include <fts.h>
++#endif
+ #include <sys/stat.h>
+ #endif
+
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_file__util__posix.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_file__util__posix.cc
new file mode 100644
index 00000000000..3185ff41022
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_file__util__posix.cc
@@ -0,0 +1,51 @@
+$NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* Just because OS_ARCH is Darwin does not mean MacOS X specific
+ implementation should be used.
+
+--- ipc/chromium/src/base/file_util_posix.cc.orig 2014-05-06 22:55:41.000000000 +0000
++++ ipc/chromium/src/base/file_util_posix.cc
+@@ -8,7 +8,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <fnmatch.h>
+-#ifndef ANDROID
++#if !defined(ANDROID) && !defined(OS_SOLARIS)
+ #include <fts.h>
+ #endif
+ #include <libgen.h>
+@@ -67,7 +67,7 @@ bool Delete(const FilePath& path, bool r
+ if (!recursive)
+ return (rmdir(path_str) == 0);
+
+-#ifdef ANDROID
++#if defined(ANDROID) || defined(OS_SOLARIS)
+ // XXX Need ftsless impl for bionic
+ return false;
+ #else
+@@ -140,7 +140,7 @@ bool CopyDirectory(const FilePath& from_
+ return false;
+ }
+
+-#ifdef ANDROID
++#if defined(ANDROID) || defined(OS_SOLARIS)
+ // XXX Need ftsless impl for bionic
+ return false;
+ #else
+@@ -435,7 +435,7 @@ bool SetCurrentDirectory(const FilePath&
+ return !ret;
+ }
+
+-#if !defined(OS_MACOSX)
++#if !defined(MOZ_WIDGET_COCOA)
+ bool GetTempDir(FilePath* path) {
+ const char* tmp = getenv("TMPDIR");
+ if (tmp)
+@@ -499,6 +499,6 @@ bool CopyFile(const FilePath& from_path,
+
+ return result;
+ }
+-#endif // !defined(OS_MACOSX)
++#endif // !defined(MOZ_WIDGET_COCOA)
+
+ } // namespace file_util
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_message__loop.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_message__loop.cc
new file mode 100644
index 00000000000..033f4c19e7f
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_message__loop.cc
@@ -0,0 +1,40 @@
+$NetBSD: patch-ipc_chromium_src_base_message__loop.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Don't assume cocoa toolkit just because OS_ARCH is Darwin.
+
+--- ipc/chromium/src/base/message_loop.cc.orig 2014-05-29 23:30:52.000000000 +0000
++++ ipc/chromium/src/base/message_loop.cc
+@@ -14,20 +14,18 @@
+ #include "base/string_util.h"
+ #include "base/thread_local.h"
+
+-#if defined(OS_MACOSX)
++#if defined(MOZ_WIDGET_COCOA)
+ #include "base/message_pump_mac.h"
+ #endif
+ #if defined(OS_POSIX)
+ #include "base/message_pump_libevent.h"
+ #endif
+-#if defined(OS_LINUX) || defined(OS_BSD)
+ #if defined(MOZ_WIDGET_GTK)
+ #include "base/message_pump_glib.h"
+ #endif
+ #ifdef MOZ_WIDGET_QT
+ #include "base/message_pump_qt.h"
+ #endif
+-#endif
+ #ifdef ANDROID
+ #include "base/message_pump_android.h"
+ #endif
+@@ -135,9 +133,9 @@ MessageLoop::MessageLoop(Type type)
+ }
+ #elif defined(OS_POSIX)
+ if (type_ == TYPE_UI) {
+-#if defined(OS_MACOSX)
++#if defined(MOZ_WIDGET_COCOA)
+ pump_ = base::MessagePumpMac::Create();
+-#elif defined(OS_LINUX) || defined(OS_BSD)
++#elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
+ pump_ = new base::MessagePumpForUI();
+ #endif // OS_LINUX
+ } else if (type_ == TYPE_IO) {
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc
new file mode 100644
index 00000000000..b598d2cedd2
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc
@@ -0,0 +1,13 @@
+$NetBSD: patch-ipc_chromium_src_base_message__pump__libevent.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/message_pump_libevent.cc.orig 2013-05-11 19:19:32.000000000 +0000
++++ ipc/chromium/src/base/message_pump_libevent.cc
+@@ -16,7 +16,7 @@
+ #include "base/scoped_ptr.h"
+ #include "base/time.h"
+ #include "nsDependentSubstring.h"
+-#include "third_party/libevent/event.h"
++#include "event.h"
+
+ // Lifecycle of struct event
+ // Libevent uses two main data structures:
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_platform__thread.h b/www/firefox31/patches/patch-ipc_chromium_src_base_platform__thread.h
new file mode 100644
index 00000000000..31a9ea701ee
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_platform__thread.h
@@ -0,0 +1,14 @@
+$NetBSD: patch-ipc_chromium_src_base_platform__thread.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/platform_thread.h.orig 2013-09-10 03:43:34.000000000 +0000
++++ ipc/chromium/src/base/platform_thread.h
+@@ -25,6 +25,9 @@ typedef pthread_t PlatformThreadHandle;
+ #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(__GLIBC__)
+ #include <unistd.h>
+ typedef pid_t PlatformThreadId;
++#elif defined(OS_SOLARIS)
++#include <sys/lwp.h>
++typedef lwpid_t PlatformThreadId;
+ #elif defined(OS_BSD)
+ #include <sys/types.h>
+ typedef lwpid_t PlatformThreadId;
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc
new file mode 100644
index 00000000000..4930f306516
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc
@@ -0,0 +1,92 @@
+$NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* Just because OS_ARCH is Darwin does not mean MacOS X specific
+ kludges are needed.
+
+--- ipc/chromium/src/base/platform_thread_posix.cc.orig 2014-05-06 22:55:41.000000000 +0000
++++ ipc/chromium/src/base/platform_thread_posix.cc
+@@ -9,8 +9,12 @@
+
+ #if defined(OS_MACOSX)
+ #include <mach/mach.h>
++#include <dlfcn.h>
++#include <string>
+ #elif defined(OS_NETBSD)
++_Pragma("GCC visibility push(default)")
+ #include <lwp.h>
++_Pragma("GCC visibility pop")
+ #elif defined(OS_LINUX)
+ #include <sys/syscall.h>
+ #include <sys/prctl.h>
+@@ -19,15 +23,13 @@
+ #include <sys/thr.h>
+ #endif
+
+-#if !defined(OS_MACOSX)
+ #include <unistd.h>
+-#endif
+
+ #if defined(OS_BSD) && !defined(OS_NETBSD) && !defined(__GLIBC__)
+ #include <pthread_np.h>
+ #endif
+
+-#if defined(OS_MACOSX)
++#if defined(MOZ_WIDGET_COCOA)
+ namespace base {
+ void InitThreading();
+ } // namespace
+@@ -91,7 +93,7 @@ void PlatformThread::Sleep(int duration_
+ sleep_time = remaining;
+ }
+
+-#ifndef OS_MACOSX
++#ifndef MOZ_WIDGET_COCOA
+ // Mac is implemented in platform_thread_mac.mm.
+
+ // static
+@@ -114,19 +116,41 @@ void PlatformThread::SetName(const char*
+ pthread_setname_np(pthread_self(), "%s", (void *)name);
+ #elif defined(OS_BSD) && !defined(__GLIBC__)
+ pthread_set_name_np(pthread_self(), name);
+-#else
++#elif defined(OS_MACOSX)
++ // Copied from platform_thread_mac.mm
++
++ // pthread_setname_np is only available in 10.6 or later, so test
++ // for it at runtime.
++ int (*dynamic_pthread_setname_np)(const char*);
++ *reinterpret_cast<void**>(&dynamic_pthread_setname_np) =
++ dlsym(RTLD_DEFAULT, "pthread_setname_np");
++ if (!dynamic_pthread_setname_np)
++ return;
++
++ // Mac OS X does not expose the length limit of the name, so
++ // hardcode it.
++ const int kMaxNameLength = 63;
++ std::string shortened_name = std::string(name).substr(0, kMaxNameLength);
++ // pthread_setname() fails (harmlessly) in the sandbox, ignore when it does.
++ // See http://crbug.com/47058
++
++ // The name parameter is copied thus it's safe to release it after calling.
++ // Checked against the bionic implementation in bionic/libc/bionic/pthread.c
++ dynamic_pthread_setname_np(shortened_name.c_str());
++#elif !defined(OS_SOLARIS)
++ prctl(PR_SET_NAME, reinterpret_cast<uintptr_t>(name), 0, 0, 0);
+ #endif
+ }
+-#endif // !OS_MACOSX
++#endif // !MOZ_WIDGET_COCOA
+
+ namespace {
+
+ bool CreateThread(size_t stack_size, bool joinable,
+ PlatformThread::Delegate* delegate,
+ PlatformThreadHandle* thread_handle) {
+-#if defined(OS_MACOSX)
++#if defined(MOZ_WIDGET_COCOA)
+ base::InitThreading();
+-#endif // OS_MACOSX
++#endif // MOZ_WIDGET_COCOA
+
+ bool success = false;
+ pthread_attr_t attributes;
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_process__util.h b/www/firefox31/patches/patch-ipc_chromium_src_base_process__util.h
new file mode 100644
index 00000000000..b39c3c92a50
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_process__util.h
@@ -0,0 +1,32 @@
+$NetBSD: patch-ipc_chromium_src_base_process__util.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/process_util.h.orig 2013-09-10 03:43:34.000000000 +0000
++++ ipc/chromium/src/base/process_util.h
+@@ -13,7 +13,7 @@
+ #if defined(OS_WIN)
+ #include <windows.h>
+ #include <tlhelp32.h>
+-#elif defined(OS_LINUX) || defined(__GLIBC__)
++#elif defined(OS_LINUX) || defined(__GLIBC__) || defined(OS_SOLARIS)
+ #include <dirent.h>
+ #include <limits.h>
+ #include <sys/types.h>
+@@ -32,6 +32,9 @@
+ typedef PROCESSENTRY32 ProcessEntry;
+ typedef IO_COUNTERS IoCounters;
+ #elif defined(OS_POSIX)
++#ifndef NAME_MAX
++#define NAME_MAX _POSIX_NAME_MAX
++#endif
+ // TODO(port): we should not rely on a Win32 structure.
+ struct ProcessEntry {
+ int pid;
+@@ -316,7 +319,7 @@ class NamedProcessIterator {
+ #if defined(OS_WIN)
+ HANDLE snapshot_;
+ bool started_iteration_;
+-#elif defined(OS_LINUX) || defined(__GLIBC__)
++#elif defined(OS_LINUX) || defined(__GLIBC__) || defined(OS_SOLARIS)
+ DIR *procfs_dir_;
+ #elif defined(OS_BSD)
+ std::vector<ProcessEntry> content;
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_process__util__bsd.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_process__util__bsd.cc
new file mode 100644
index 00000000000..f8cbf1b4c56
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_process__util__bsd.cc
@@ -0,0 +1,166 @@
+$NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Darwin does not provide kvm_getprocs(3). The code for OS_MACOSX is
+simply copied from process_util_mac.mm
+
+--- ipc/chromium/src/base/process_util_bsd.cc.orig 2014-05-06 22:55:41.000000000 +0000
++++ ipc/chromium/src/base/process_util_bsd.cc
+@@ -15,7 +15,9 @@
+
+ #include <ctype.h>
+ #include <fcntl.h>
++#if defined(OS_BSD)
+ #include <kvm.h>
++#endif
+ #include <unistd.h>
+
+ #include <string>
+@@ -311,6 +313,141 @@ void SetCurrentProcessPrivileges(ChildPr
+
+ #endif
+
++#if defined(OS_MACOSX)
++NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
++ const ProcessFilter* filter)
++ : executable_name_(executable_name),
++ index_of_kinfo_proc_(0),
++ filter_(filter) {
++ // Get a snapshot of all of my processes (yes, as we loop it can go stale, but
++ // but trying to find where we were in a constantly changing list is basically
++ // impossible.
++
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, int(geteuid()) };
++
++ // Since more processes could start between when we get the size and when
++ // we get the list, we do a loop to keep trying until we get it.
++ bool done = false;
++ int try_num = 1;
++ const int max_tries = 10;
++ do {
++ // Get the size of the buffer
++ size_t len = 0;
++ if (sysctl(mib, arraysize(mib), NULL, &len, NULL, 0) < 0) {
++ CHROMIUM_LOG(ERROR) << "failed to get the size needed for the process list";
++ kinfo_procs_.resize(0);
++ done = true;
++ } else {
++ size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
++ // Leave some spare room for process table growth (more could show up
++ // between when we check and now)
++ num_of_kinfo_proc += 4;
++ kinfo_procs_.resize(num_of_kinfo_proc);
++ len = num_of_kinfo_proc * sizeof(struct kinfo_proc);
++ // Load the list of processes
++ if (sysctl(mib, arraysize(mib), &kinfo_procs_[0], &len, NULL, 0) < 0) {
++ // If we get a mem error, it just means we need a bigger buffer, so
++ // loop around again. Anything else is a real error and give up.
++ if (errno != ENOMEM) {
++ CHROMIUM_LOG(ERROR) << "failed to get the process list";
++ kinfo_procs_.resize(0);
++ done = true;
++ }
++ } else {
++ // Got the list, just make sure we're sized exactly right
++ size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
++ kinfo_procs_.resize(num_of_kinfo_proc);
++ done = true;
++ }
++ }
++ } while (!done && (try_num++ < max_tries));
++
++ if (!done) {
++ CHROMIUM_LOG(ERROR) << "failed to collect the process list in a few tries";
++ kinfo_procs_.resize(0);
++ }
++}
++
++NamedProcessIterator::~NamedProcessIterator() {
++}
++
++const ProcessEntry* NamedProcessIterator::NextProcessEntry() {
++ bool result = false;
++ do {
++ result = CheckForNextProcess();
++ } while (result && !IncludeEntry());
++
++ if (result) {
++ return &entry_;
++ }
++
++ return NULL;
++}
++
++bool NamedProcessIterator::CheckForNextProcess() {
++ std::string executable_name_utf8(WideToUTF8(executable_name_));
++
++ std::string data;
++ std::string exec_name;
++
++ for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) {
++ kinfo_proc* kinfo = &kinfo_procs_[index_of_kinfo_proc_];
++
++ // Skip processes just awaiting collection
++ if ((kinfo->kp_proc.p_pid > 0) && (kinfo->kp_proc.p_stat == SZOMB))
++ continue;
++
++ int mib[] = { CTL_KERN, KERN_PROCARGS, kinfo->kp_proc.p_pid };
++
++ // Found out what size buffer we need
++ size_t data_len = 0;
++ if (sysctl(mib, arraysize(mib), NULL, &data_len, NULL, 0) < 0) {
++ CHROMIUM_LOG(ERROR) << "failed to figure out the buffer size for a commandline";
++ continue;
++ }
++
++ data.resize(data_len);
++ if (sysctl(mib, arraysize(mib), &data[0], &data_len, NULL, 0) < 0) {
++ CHROMIUM_LOG(ERROR) << "failed to fetch a commandline";
++ continue;
++ }
++
++ // Data starts w/ the full path null termed, so we have to extract just the
++ // executable name from the path.
++
++ size_t exec_name_end = data.find('\0');
++ if (exec_name_end == std::string::npos) {
++ CHROMIUM_LOG(ERROR) << "command line data didn't match expected format";
++ continue;
++ }
++ size_t last_slash = data.rfind('/', exec_name_end);
++ if (last_slash == std::string::npos)
++ exec_name = data.substr(0, exec_name_end);
++ else
++ exec_name = data.substr(last_slash + 1, exec_name_end - last_slash - 1);
++
++ // Check the name
++ if (executable_name_utf8 == exec_name) {
++ entry_.pid = kinfo->kp_proc.p_pid;
++ entry_.ppid = kinfo->kp_eproc.e_ppid;
++ base::strlcpy(entry_.szExeFile, exec_name.c_str(),
++ sizeof(entry_.szExeFile));
++ // Start w/ the next entry next time through
++ ++index_of_kinfo_proc_;
++ // Done
++ return true;
++ }
++ }
++ return false;
++}
++
++bool NamedProcessIterator::IncludeEntry() {
++ // Don't need to check the name, we did that w/in CheckForNextProcess.
++ if (!filter_)
++ return true;
++ return filter_->Includes(entry_.pid, entry_.ppid);
++}
++#else
+ NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
+ const ProcessFilter* filter)
+ {
+@@ -370,5 +507,6 @@ const ProcessEntry* NamedProcessIterator
+ if (nextEntry >= content.size()) return NULL;
+ return &content[nextEntry++];
+ }
++#endif
+
+ } // namespace base
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_process__util__posix.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_process__util__posix.cc
new file mode 100644
index 00000000000..7df9a2e67ea
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_process__util__posix.cc
@@ -0,0 +1,22 @@
+$NetBSD: patch-ipc_chromium_src_base_process__util__posix.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/process_util_posix.cc.orig 2013-05-11 19:19:32.000000000 +0000
++++ ipc/chromium/src/base/process_util_posix.cc
+@@ -110,7 +110,7 @@ void CloseSuperfluousFds(const base::Inj
+ #if defined(ANDROID)
+ static const rlim_t kSystemDefaultMaxFds = 1024;
+ static const char kFDDir[] = "/proc/self/fd";
+-#elif defined(OS_LINUX)
++#elif defined(OS_LINUX) || defined(OS_SOLARIS)
+ static const rlim_t kSystemDefaultMaxFds = 8192;
+ static const char kFDDir[] = "/proc/self/fd";
+ #elif defined(OS_MACOSX)
+@@ -202,7 +202,7 @@ void CloseSuperfluousFds(const base::Inj
+ // TODO(agl): Remove this function. It's fundamentally broken for multithreaded
+ // apps.
+ void SetAllFDsToCloseOnExec() {
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_SOLARIS)
+ const char fd_dir[] = "/proc/self/fd";
+ #elif defined(OS_MACOSX) || defined(OS_BSD)
+ const char fd_dir[] = "/dev/fd";
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_scoped__nsautorelease__pool.h b/www/firefox31/patches/patch-ipc_chromium_src_base_scoped__nsautorelease__pool.h
new file mode 100644
index 00000000000..009f16df908
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_scoped__nsautorelease__pool.h
@@ -0,0 +1,45 @@
+$NetBSD: patch-ipc_chromium_src_base_scoped__nsautorelease__pool.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Just because OS_ARCH is Darwin does not mean ScopedNSAutoreleasePool
+is needed.
+
+--- ipc/chromium/src/base/scoped_nsautorelease_pool.h.orig 2014-05-06 22:55:41.000000000 +0000
++++ ipc/chromium/src/base/scoped_nsautorelease_pool.h
+@@ -7,13 +7,13 @@
+
+ #include "base/basictypes.h"
+
+-#if defined(OS_MACOSX)
++#if defined(MOZ_WIDGET_COCOA)
+ #if defined(__OBJC__)
+ @class NSAutoreleasePool;
+ #else // __OBJC__
+ class NSAutoreleasePool;
+ #endif // __OBJC__
+-#endif // OS_MACOSX
++#endif // MOZ_WIDGET_COCOA
+
+ namespace base {
+
+@@ -27,10 +27,10 @@ namespace base {
+ // ugly #ifdefs.
+ class ScopedNSAutoreleasePool {
+ public:
+-#if !defined(OS_MACOSX)
++#if !defined(MOZ_WIDGET_COCOA)
+ ScopedNSAutoreleasePool() {}
+ void Recycle() { }
+-#else // OS_MACOSX
++#else // MOZ_WIDGET_COCOA
+ ScopedNSAutoreleasePool();
+ ~ScopedNSAutoreleasePool();
+
+@@ -41,7 +41,7 @@ class ScopedNSAutoreleasePool {
+ void Recycle();
+ private:
+ NSAutoreleasePool* autorelease_pool_;
+-#endif // OS_MACOSX
++#endif // MOZ_WIDGET_COCOA
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedNSAutoreleasePool);
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_sys__info__posix.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_sys__info__posix.cc
new file mode 100644
index 00000000000..c6385585f1c
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_sys__info__posix.cc
@@ -0,0 +1,28 @@
+$NetBSD: patch-ipc_chromium_src_base_sys__info__posix.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/sys_info_posix.cc.orig 2014-04-18 02:03:04.000000000 +0000
++++ ipc/chromium/src/base/sys_info_posix.cc
+@@ -119,7 +119,11 @@ std::wstring SysInfo::GetEnvVar(const wc
+
+ // static
+ std::string SysInfo::OperatingSystemName() {
++#ifdef OS_SOLARIS
++ struct utsname info;
++#else
+ utsname info;
++#endif
+ if (uname(&info) < 0) {
+ NOTREACHED();
+ return "";
+@@ -129,7 +133,11 @@ std::string SysInfo::OperatingSystemName
+
+ // static
+ std::string SysInfo::OperatingSystemVersion() {
++#ifdef OS_SOLARIS
++ struct utsname info;
++#else
+ utsname info;
++#endif
+ if (uname(&info) < 0) {
+ NOTREACHED();
+ return "";
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_base_time__posix.cc b/www/firefox31/patches/patch-ipc_chromium_src_base_time__posix.cc
new file mode 100644
index 00000000000..837b7af9dde
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_base_time__posix.cc
@@ -0,0 +1,15 @@
+$NetBSD: patch-ipc_chromium_src_base_time__posix.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/base/time_posix.cc.orig 2013-05-11 19:19:32.000000000 +0000
++++ ipc/chromium/src/base/time_posix.cc
+@@ -65,8 +65,10 @@ Time Time::FromExploded(bool is_local, c
+ timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this
+ timestruct.tm_yday = 0; // mktime/timegm ignore this
+ timestruct.tm_isdst = -1; // attempt to figure it out
++#ifndef OS_SOLARIS
+ timestruct.tm_gmtoff = 0; // not a POSIX field, so mktime/timegm ignore
+ timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore
++#endif
+
+ time_t seconds;
+ #ifdef ANDROID
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_build_build__config.h b/www/firefox31/patches/patch-ipc_chromium_src_build_build__config.h
new file mode 100644
index 00000000000..e153b57e118
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_build_build__config.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-ipc_chromium_src_build_build__config.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/build/build_config.h.orig 2013-05-11 19:19:32.000000000 +0000
++++ ipc/chromium/src/build/build_config.h
+@@ -27,6 +27,8 @@
+ #define OS_NETBSD 1
+ #elif defined(__OpenBSD__)
+ #define OS_OPENBSD 1
++#elif defined(__sun)
++#define OS_SOLARIS 1
+ #elif defined(_WIN32)
+ #define OS_WIN 1
+ #else
+@@ -42,7 +44,7 @@
+
+ // For access to standard POSIX features, use OS_POSIX instead of a more
+ // specific macro.
+-#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD)
++#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ #define OS_POSIX 1
+ #endif
+
diff --git a/www/firefox31/patches/patch-ipc_chromium_src_chrome_common_transport__dib.h b/www/firefox31/patches/patch-ipc_chromium_src_chrome_common_transport__dib.h
new file mode 100644
index 00000000000..470e107c514
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_chromium_src_chrome_common_transport__dib.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-ipc_chromium_src_chrome_common_transport__dib.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- ipc/chromium/src/chrome/common/transport_dib.h.orig 2013-05-11 19:19:32.000000000 +0000
++++ ipc/chromium/src/chrome/common/transport_dib.h
+@@ -70,7 +70,7 @@ class TransportDIB {
+ typedef base::SharedMemoryHandle Handle;
+ // On Mac, the inode number of the backing file is used as an id.
+ typedef base::SharedMemoryId Id;
+-#elif defined(OS_LINUX)
++#elif defined(OS_LINUX) || defined(OS_SOLARIS)
+ typedef int Handle; // These two ints are SysV IPC shared memory keys
+ typedef int Id;
+ #endif
diff --git a/www/firefox31/patches/patch-ipc_glue_GeckoChildProcessHost.cpp b/www/firefox31/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
new file mode 100644
index 00000000000..b9b3cbc626c
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
@@ -0,0 +1,48 @@
+$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* Just because OS_ARCH is Darwin does not mean MacOS X specific
+ kludges are needed.
+
+--- ipc/glue/GeckoChildProcessHost.cpp.orig 2014-05-29 23:30:53.000000000 +0000
++++ ipc/glue/GeckoChildProcessHost.cpp
+@@ -4,7 +4,13 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
++#if defined(__NetBSD__)
++_Pragma("GCC visibility push(default)")
++#endif
+ #include "GeckoChildProcessHost.h"
++#if defined(__NetBSD__)
++_Pragma("GCC visibility pop")
++#endif
+
+ #if defined(XP_WIN) && defined(MOZ_CONTENT_SANDBOX)
+ #include "sandboxBroker.h"
+@@ -548,7 +554,7 @@ GeckoChildProcessHost::PerformAsyncLaunc
+ // and passing wstrings from one config to the other is unsafe. So
+ // we split the logic here.
+
+-#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
++#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ base::environment_map newEnvVars;
+ ChildPrivileges privs = mPrivileges;
+ if (privs == base::PRIVILEGES_DEFAULT) {
+@@ -671,7 +677,7 @@ GeckoChildProcessHost::PerformAsyncLaunc
+ childArgv.push_back(pidstring);
+
+ #if defined(MOZ_CRASHREPORTER)
+-# if defined(OS_LINUX) || defined(OS_BSD)
++# if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ int childCrashFd, childCrashRemapFd;
+ if (!CrashReporter::CreateNotificationPipeForChild(
+ &childCrashFd, &childCrashRemapFd))
+@@ -704,7 +710,7 @@ GeckoChildProcessHost::PerformAsyncLaunc
+ childArgv.push_back(childProcessType);
+
+ base::LaunchApp(childArgv, mFileMap,
+-#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
++#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) || defined(OS_SOLARIS)
+ newEnvVars, privs,
+ #endif
+ false, &process, arch);
diff --git a/www/firefox31/patches/patch-ipc_glue_ScopedXREEmbed.cpp b/www/firefox31/patches/patch-ipc_glue_ScopedXREEmbed.cpp
new file mode 100644
index 00000000000..46b972af8fc
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_glue_ScopedXREEmbed.cpp
@@ -0,0 +1,16 @@
+$NetBSD: patch-ipc_glue_ScopedXREEmbed.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Walking out of [subprocess].app/Contents/MacOS would only be needed if
+we were using the cocoa toolkit.
+
+--- ipc/glue/ScopedXREEmbed.cpp.orig 2014-05-06 22:55:41.000000000 +0000
++++ ipc/glue/ScopedXREEmbed.cpp
+@@ -66,7 +66,7 @@ ScopedXREEmbed::Start()
+ localFile = do_QueryInterface(parent);
+ NS_ENSURE_TRUE_VOID(localFile);
+
+-#ifdef OS_MACOSX
++#ifdef MOZ_WIDGET_COCOA
+ if (XRE_GetProcessType() == GeckoProcessType_Content) {
+ // We're an XPCOM-using subprocess. Walk out of
+ // [subprocess].app/Contents/MacOS to the real GRE dir.
diff --git a/www/firefox31/patches/patch-ipc_glue_StringUtil.cpp b/www/firefox31/patches/patch-ipc_glue_StringUtil.cpp
new file mode 100644
index 00000000000..29625121c1d
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_glue_StringUtil.cpp
@@ -0,0 +1,24 @@
+$NetBSD: patch-ipc_glue_StringUtil.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Just because OS_ARCH is Darwin does not mean
+sys_string_conversions_mac.mm can be used.
+
+--- ipc/glue/StringUtil.cpp.orig 2014-05-06 22:55:41.000000000 +0000
++++ ipc/glue/StringUtil.cpp
+@@ -64,14 +64,14 @@ namespace base {
+ // converters, and implementing the one that doesn't exist for OS X
+ // and Windows.
+
+-#if !defined(OS_MACOSX) && !defined(OS_WIN)
++#if !defined(MOZ_WIDGET_COCOA) && !defined(OS_WIN)
+ std::string SysWideToUTF8(const std::wstring& wide) {
+ // FIXME/cjones: do this with iconv
+ return GhettoStringConvert<std::wstring, std::string>(wide);
+ }
+ #endif
+
+-#if !defined(OS_MACOSX) && !defined(OS_WIN)
++#if !defined(MOZ_WIDGET_COCOA) && !defined(OS_WIN)
+ std::wstring SysUTF8ToWide(const StringPiece& utf8) {
+ // FIXME/cjones: do this with iconv
+ return GhettoStringConvert<StringPiece, std::wstring>(utf8);
diff --git a/www/firefox31/patches/patch-ipc_ipdl_ipdl_cxx_ast.py b/www/firefox31/patches/patch-ipc_ipdl_ipdl_cxx_ast.py
new file mode 100644
index 00000000000..fca6d2effea
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_ipdl_ipdl_cxx_ast.py
@@ -0,0 +1,25 @@
+$NetBSD: patch-ipc_ipdl_ipdl_cxx_ast.py,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Part of https://bugzilla.mozilla.org/show_bug.cgi?id=1026499:
+Make sure storage provided for attributes is properly aligned
+in the generated C++ code.
+
+--- ipc/ipdl/ipdl/cxx/ast.py.orig 2014-07-17 01:45:18.000000000 +0000
++++ ipc/ipdl/ipdl/cxx/ast.py
+@@ -336,12 +336,13 @@ Type.VOID = Type('void')
+ Type.VOIDPTR = Type('void', ptr=1)
+
+ class TypeArray(Node):
+- def __init__(self, basetype, nmemb):
+- '''the type |basetype DECLNAME[nmemb]|. |nmemb| is an Expr'''
++ def __init__(self, basetype, nmemb, alignType):
++ '''the type |basetype DECLNAME[nmemb]|. |nmemb| is an Expr, |alignType| is a type'''
+ self.basetype = basetype
+ self.nmemb = nmemb
++ self.alignType = alignType
+ def __deepcopy__(self, memo):
+- return TypeArray(deepcopy(self.basetype, memo), nmemb)
++ return TypeArray(deepcopy(self.basetype, memo), nmemb, alignType)
+
+ class TypeEnum(Node):
+ def __init__(self, name=None):
diff --git a/www/firefox31/patches/patch-ipc_ipdl_ipdl_cxx_cgen.py b/www/firefox31/patches/patch-ipc_ipdl_ipdl_cxx_cgen.py
new file mode 100644
index 00000000000..848fcf04f1b
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_ipdl_ipdl_cxx_cgen.py
@@ -0,0 +1,27 @@
+$NetBSD: patch-ipc_ipdl_ipdl_cxx_cgen.py,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Part of https://bugzilla.mozilla.org/show_bug.cgi?id=1026499:
+Make sure storage provided for attributes is properly aligned
+in the generated C++ code.
+
+--- ipc/ipdl/ipdl/cxx/cgen.py.orig 2014-07-17 01:45:18.000000000 +0000
++++ ipc/ipdl/ipdl/cxx/cgen.py
+@@ -101,6 +101,7 @@ class CxxCodeGen(CodePrinter, Visitor):
+ def visitDecl(self, d):
+ # C-syntax arrays make code generation much more annoying
+ if isinstance(d.type, TypeArray):
++ self.write('MOZ_ALIGNED_DECL(')
+ d.type.basetype.accept(self)
+ else:
+ d.type.accept(self)
+@@ -111,7 +112,9 @@ class CxxCodeGen(CodePrinter, Visitor):
+ if isinstance(d.type, TypeArray):
+ self.write('[')
+ d.type.nmemb.accept(self)
+- self.write(']')
++ self.write('], MOZ_ALIGNOF(')
++ d.type.alignType.accept(self)
++ self.write('))')
+
+ def visitParam(self, p):
+ self.visitDecl(p)
diff --git a/www/firefox31/patches/patch-ipc_ipdl_ipdl_lower.py b/www/firefox31/patches/patch-ipc_ipdl_ipdl_lower.py
new file mode 100644
index 00000000000..68dc946c480
--- /dev/null
+++ b/www/firefox31/patches/patch-ipc_ipdl_ipdl_lower.py
@@ -0,0 +1,17 @@
+$NetBSD: patch-ipc_ipdl_ipdl_lower.py,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Part of https://bugzilla.mozilla.org/show_bug.cgi?id=1026499:
+Make sure storage provided for attributes is properly aligned
+in the generated C++ code.
+
+--- ipc/ipdl/ipdl/lower.py.orig 2014-07-17 01:45:18.000000000 +0000
++++ ipc/ipdl/ipdl/lower.py
+@@ -768,7 +768,7 @@ IPDL union type."""
+ if self.recursive:
+ return self.ptrToType()
+ else:
+- return TypeArray(Type('char'), ExprSizeof(self.internalType()))
++ return TypeArray(Type('char'), ExprSizeof(self.internalType()), self.internalType())
+
+ def unionValue(self):
+ # NB: knows that Union's storage C union is named |mValue|
diff --git a/www/firefox31/patches/patch-js__src__vm__SPSProfiler.cpp b/www/firefox31/patches/patch-js__src__vm__SPSProfiler.cpp
new file mode 100644
index 00000000000..e7a1a5f0837
--- /dev/null
+++ b/www/firefox31/patches/patch-js__src__vm__SPSProfiler.cpp
@@ -0,0 +1,17 @@
+$NetBSD: patch-js__src__vm__SPSProfiler.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Unclear fallout from our version of bug 840242, attachment v1: some architectures
+fail to link if we do not add the inlines here - might be compiler/arch specific.
+
+
+--- js/src/vm/SPSProfiler.cpp.orig 2014-04-18 02:03:21.000000000 +0000
++++ js/src/vm/SPSProfiler.cpp
+@@ -4,6 +4,8 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
++#include "jscntxtinlines.h"
++
+ #include "vm/SPSProfiler.h"
+
+ #include "mozilla/DebugOnly.h"
diff --git a/www/firefox31/patches/patch-js_src_Makefile.in b/www/firefox31/patches/patch-js_src_Makefile.in
new file mode 100644
index 00000000000..13801f7c0e1
--- /dev/null
+++ b/www/firefox31/patches/patch-js_src_Makefile.in
@@ -0,0 +1,31 @@
+$NetBSD: patch-js_src_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- js/src/Makefile.in.orig 2014-07-17 01:45:18.000000000 +0000
++++ js/src/Makefile.in
+@@ -20,8 +20,6 @@ run_for_side_effects := $(shell echo 'MA
+ STATIC_LIBRARY_NAME = js_static
+ LIBS = $(NSPR_LIBS)
+
+-DIST_INSTALL = 1
+-
+ ifdef JS_STANDALONE
+ SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,mfbt,$(DEPTH)/mfbt)
+ endif
+@@ -226,7 +224,7 @@ endif
+ ifdef MOZ_SHARED_ICU
+ EXTRA_DSO_LDOPTS += $(MOZ_ICU_LIBS)
+ else
+-SHARED_LIBRARY_LIBS += $(MOZ_ICU_LIBS)
++SHARED_LIBRARY_LIBS += $(filter-out -L% -l% -Wl%,$(MOZ_ICU_LIBS))
+ endif
+
+ # Prevent floating point errors caused by VC++ optimizations
+@@ -350,7 +348,7 @@ endif
+
+ ifdef HAVE_DTRACE
+ $(CURDIR)/javascript-trace.h: $(srcdir)/devtools/javascript-trace.d
+- dtrace -h -s $(srcdir)/devtools/javascript-trace.d -o javascript-trace.h.in
++ dtrace -x nolibs -h -s $(srcdir)/devtools/javascript-trace.d -o javascript-trace.h.in
+ sed -e 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \
+ -e '/const/!s/char \*/const char */g' \
+ javascript-trace.h.in > javascript-trace.h
diff --git a/www/firefox31/patches/patch-js_src_ctypes_CTypes.h b/www/firefox31/patches/patch-js_src_ctypes_CTypes.h
new file mode 100644
index 00000000000..1d65e436b90
--- /dev/null
+++ b/www/firefox31/patches/patch-js_src_ctypes_CTypes.h
@@ -0,0 +1,28 @@
+$NetBSD: patch-js_src_ctypes_CTypes.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- js/src/ctypes/CTypes.h.orig 2014-02-12 21:29:02.000000000 +0000
++++ js/src/ctypes/CTypes.h
+@@ -14,6 +14,23 @@
+ #include "js/Vector.h"
+ #include "vm/String.h"
+
++#if defined(__NetBSD__)
++#include <stdint.h>
++/* XXX why do we have those funky __ #defines in stdint.h? */
++#warning this is a retarded workaround
++#define uint8_t uint8_t
++#define uint16_t uint16_t
++#define uint32_t uint32_t
++#define uint64_t uint64_t
++#define int8_t int8_t
++#define int16_t int16_t
++#define int32_t int32_t
++#define int64_t int64_t
++#define intptr_t intptr_t
++#define uintptr_t uintptr_t
++#define off_t off_t
++#endif
++
+ namespace js {
+ namespace ctypes {
+
diff --git a/www/firefox31/patches/patch-js_src_frontend_ParseMaps.cpp b/www/firefox31/patches/patch-js_src_frontend_ParseMaps.cpp
new file mode 100644
index 00000000000..34ab4811ed3
--- /dev/null
+++ b/www/firefox31/patches/patch-js_src_frontend_ParseMaps.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-js_src_frontend_ParseMaps.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- js/src/frontend/ParseMaps.cpp.orig 2013-09-10 03:43:34.000000000 +0000
++++ js/src/frontend/ParseMaps.cpp
+@@ -132,5 +132,5 @@ frontend::InitAtomMap(JSContext *cx, fro
+ }
+ }
+
+-template class js::frontend::AtomDecls<FullParseHandler>;
+-template class js::frontend::AtomDecls<SyntaxParseHandler>;
++template class frontend::AtomDecls<FullParseHandler>;
++template class frontend::AtomDecls<SyntaxParseHandler>;
diff --git a/www/firefox31/patches/patch-js_src_gc_Memory.cpp b/www/firefox31/patches/patch-js_src_gc_Memory.cpp
new file mode 100644
index 00000000000..5c6f33742b9
--- /dev/null
+++ b/www/firefox31/patches/patch-js_src_gc_Memory.cpp
@@ -0,0 +1,20 @@
+$NetBSD: patch-js_src_gc_Memory.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Make sure mmap() delivers memory with upper 17 bits clear on sparc64 on NetBSD:
+with topdown-vm we would map in the last 4 gig of the address space (past
+the VA hole) otherwise by default, thus busting the JSValue restrictions.
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=994133
+
+
+--- js/src/gc/Memory.cpp.orig 2014-04-09 20:42:54.000000000 +0200
++++ js/src/gc/Memory.cpp 2014-04-09 20:38:34.000000000 +0200
+@@ -312,7 +312,7 @@ gc::InitMemorySubsystem(JSRuntime *rt)
+ static inline void *
+ MapMemory(size_t length, int prot, int flags, int fd, off_t offset)
+ {
+-#if defined(__ia64__)
++#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__))
+ /*
+ * The JS engine assumes that all allocated pointers have their high 17 bits clear,
+ * which ia64's mmap doesn't support directly. However, we can emulate it by passing
diff --git a/www/firefox31/patches/patch-js_src_jsmath.cpp b/www/firefox31/patches/patch-js_src_jsmath.cpp
new file mode 100644
index 00000000000..2a68da7b132
--- /dev/null
+++ b/www/firefox31/patches/patch-js_src_jsmath.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-js_src_jsmath.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- js/src/jsmath.cpp.orig 2013-09-10 03:43:36.000000000 +0000
++++ js/src/jsmath.cpp
+@@ -244,7 +244,7 @@ js::ecmaAtan2(double y, double x)
+ }
+ #endif
+
+-#if defined(SOLARIS) && defined(__GNUC__)
++#if defined(notSOLARIS) && defined(__GNUC__)
+ if (y == 0) {
+ if (IsNegativeZero(x))
+ return js_copysign(M_PI, y);
diff --git a/www/firefox31/patches/patch-mb b/www/firefox31/patches/patch-mb
new file mode 100644
index 00000000000..5350177a0ff
--- /dev/null
+++ b/www/firefox31/patches/patch-mb
@@ -0,0 +1,44 @@
+$NetBSD: patch-mb,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/reflect/xptcall/src/md/unix/Makefile.in.orig 2014-03-15 05:19:39.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/Makefile.in
+@@ -83,6 +83,39 @@ endif
+ # SPARC
+ ######################################################################
+ #
++# Linux/SPARC
++#
++ifeq ($(OS_ARCH),Linux)
++ifneq (,$(findstring sparc,$(OS_TEST)))
++ASFILES := xptcinvoke_asm_sparc_linux_GCC3.s xptcstubs_asm_sparc_solaris.s
++endif
++endif
++#
++# NetBSD/SPARC
++#
++ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc)
++ASFILES := xptcinvoke_asm_sparc_netbsd.s xptcstubs_asm_sparc_netbsd.s
++endif
++#
++# OpenBSD/SPARC
++#
++ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc)
++ASFILES := xptcinvoke_asm_sparc_openbsd.s xptcstubs_asm_sparc_openbsd.s
++endif
++#
++# OpenBSD/SPARC64
++#
++ifneq (,$(filter OpenBSDsparc64 FreeBSDsparc64,$(OS_ARCH)$(OS_TEST)))
++ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
++endif
++#
++# NetBSD/SPARC64
++#
++ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc64)
++CPPSRCS := xptcinvoke_sparc64_netbsd.cpp xptcstubs_sparc64_openbsd.cpp
++ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_netbsd.s
++endif
++#
+ # Solaris/SPARC
+ #
+ ifeq ($(OS_ARCH),SunOS)
diff --git a/www/firefox31/patches/patch-media_libcubeb_src_Makefile.in b/www/firefox31/patches/patch-media_libcubeb_src_Makefile.in
new file mode 100644
index 00000000000..5224aba034d
--- /dev/null
+++ b/www/firefox31/patches/patch-media_libcubeb_src_Makefile.in
@@ -0,0 +1,12 @@
+$NetBSD: patch-media_libcubeb_src_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/libcubeb/src/Makefile.in.orig 2014-05-29 23:31:19.000000000 +0000
++++ media/libcubeb/src/Makefile.in
+@@ -9,3 +9,7 @@ CFLAGS += \
+ $(MOZ_ALSA_CFLAGS) \
+ $(MOZ_PULSEAUDIO_CFLAGS) \
+ $(NULL)
++
++ifdef MOZ_NATIVE_SPEEX
++CFLAGS += $(MOZ_SPEEX_CFLAGS)
++endif
diff --git a/www/firefox31/patches/patch-media_libcubeb_src_cubeb__alsa.c b/www/firefox31/patches/patch-media_libcubeb_src_cubeb__alsa.c
new file mode 100644
index 00000000000..6a7a88c0dfd
--- /dev/null
+++ b/www/firefox31/patches/patch-media_libcubeb_src_cubeb__alsa.c
@@ -0,0 +1,14 @@
+$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/libcubeb/src/cubeb_alsa.c.orig 2013-10-25 22:27:33.000000000 +0000
++++ media/libcubeb/src/cubeb_alsa.c
+@@ -6,6 +6,9 @@
+ */
+ #undef NDEBUG
+ #define _BSD_SOURCE
++#if defined(__NetBSD__)
++#define _NETBSD_SOURCE
++#endif
+ #define _XOPEN_SOURCE 500
+ #include <pthread.h>
+ #include <sys/time.h>
diff --git a/www/firefox31/patches/patch-media_libcubeb_src_moz.build b/www/firefox31/patches/patch-media_libcubeb_src_moz.build
new file mode 100644
index 00000000000..925331a2d86
--- /dev/null
+++ b/www/firefox31/patches/patch-media_libcubeb_src_moz.build
@@ -0,0 +1,15 @@
+$NetBSD: patch-media_libcubeb_src_moz.build,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Don't assume cocoa toolkit just because OS_TARGET is Darwin.
+
+--- media/libcubeb/src/moz.build.orig 2014-05-06 22:56:07.000000000 +0000
++++ media/libcubeb/src/moz.build
+@@ -28,7 +28,7 @@ if CONFIG['OS_ARCH'] == 'OpenBSD':
+ ]
+ DEFINES['USE_SNDIO'] = True
+
+-if CONFIG['OS_TARGET'] == 'Darwin':
++if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ SOURCES += [
+ 'cubeb_audiounit.c',
+ ]
diff --git a/www/firefox31/patches/patch-media_libpng_pngpriv.h b/www/firefox31/patches/patch-media_libpng_pngpriv.h
new file mode 100644
index 00000000000..0e3d9dd9e81
--- /dev/null
+++ b/www/firefox31/patches/patch-media_libpng_pngpriv.h
@@ -0,0 +1,12 @@
+$NetBSD: patch-media_libpng_pngpriv.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/libpng/pngpriv.h.orig 2014-02-12 21:29:13.000000000 +0000
++++ media/libpng/pngpriv.h
+@@ -38,6 +38,7 @@
+ * still required (as of 2011-05-02.)
+ */
+ #define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
++#define _XOPEN_SOURCE 600
+
+ #ifndef PNG_VERSION_INFO_ONLY
+ /* Standard library headers not required by png.h: */
diff --git a/www/firefox31/patches/patch-media_libsoundtouch_src_cpu__detect__x86.cpp b/www/firefox31/patches/patch-media_libsoundtouch_src_cpu__detect__x86.cpp
new file mode 100644
index 00000000000..77eef9974a3
--- /dev/null
+++ b/www/firefox31/patches/patch-media_libsoundtouch_src_cpu__detect__x86.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-media_libsoundtouch_src_cpu__detect__x86.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/libsoundtouch/src/cpu_detect_x86.cpp.orig 2014-04-18 02:03:48.000000000 +0000
++++ media/libsoundtouch/src/cpu_detect_x86.cpp
+@@ -130,7 +130,9 @@ uint detectCPUextensions(void)
+ #endif
+
+ return res & ~_dwDisabledISA;
+-
++#elif defined(__GNUC__)
++ // No cpuid.h --> no cpuid support
++ return 0;
+ #else
+
+ /// One of these is true:
diff --git a/www/firefox31/patches/patch-media_libtheora_Makefile.in b/www/firefox31/patches/patch-media_libtheora_Makefile.in
new file mode 100644
index 00000000000..44c43abc8fa
--- /dev/null
+++ b/www/firefox31/patches/patch-media_libtheora_Makefile.in
@@ -0,0 +1,14 @@
+$NetBSD: patch-media_libtheora_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/libtheora/Makefile.in.orig 2014-03-20 11:09:40.000000000 +0000
++++ media/libtheora/Makefile.in
+@@ -0,0 +1,9 @@
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++
++include $(topsrcdir)/config/rules.mk
++
++ifdef MOZ_NATIVE_OGG
++CFLAGS += $(MOZ_OGG_CFLAGS)
++endif
diff --git a/www/firefox31/patches/patch-media_libtremor_Makefile.in b/www/firefox31/patches/patch-media_libtremor_Makefile.in
new file mode 100644
index 00000000000..82ad57c8884
--- /dev/null
+++ b/www/firefox31/patches/patch-media_libtremor_Makefile.in
@@ -0,0 +1,14 @@
+$NetBSD: patch-media_libtremor_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/libtremor/Makefile.in.orig 2014-03-20 11:09:40.000000000 +0000
++++ media/libtremor/Makefile.in
+@@ -0,0 +1,9 @@
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++
++include $(topsrcdir)/config/rules.mk
++
++ifdef MOZ_NATIVE_OGG
++CFLAGS += $(MOZ_OGG_CFLAGS)
++endif
diff --git a/www/firefox31/patches/patch-media_libvorbis_Makefile.in b/www/firefox31/patches/patch-media_libvorbis_Makefile.in
new file mode 100644
index 00000000000..a5b9bab6694
--- /dev/null
+++ b/www/firefox31/patches/patch-media_libvorbis_Makefile.in
@@ -0,0 +1,14 @@
+$NetBSD: patch-media_libvorbis_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/libvorbis/Makefile.in.orig 2014-03-20 11:09:40.000000000 +0000
++++ media/libvorbis/Makefile.in
+@@ -0,0 +1,9 @@
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++
++include $(topsrcdir)/config/rules.mk
++
++ifdef MOZ_NATIVE_OGG
++CFLAGS += $(MOZ_OGG_CFLAGS)
++endif
diff --git a/www/firefox31/patches/patch-media_mtransport_third__party_nICEr_src_util_mbslen.c b/www/firefox31/patches/patch-media_mtransport_third__party_nICEr_src_util_mbslen.c
new file mode 100644
index 00000000000..3f634466462
--- /dev/null
+++ b/www/firefox31/patches/patch-media_mtransport_third__party_nICEr_src_util_mbslen.c
@@ -0,0 +1,18 @@
+$NetBSD: patch-media_mtransport_third__party_nICEr_src_util_mbslen.c,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/mtransport/third_party/nICEr/src/util/mbslen.c.orig 2014-04-18 02:03:49.000000000 +0000
++++ media/mtransport/third_party/nICEr/src/util/mbslen.c
+@@ -54,6 +54,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ # endif
+ #endif
+
++#ifdef __DragonFly__
++#include <osreldate.h>
++# if __DragonFly_version > 300502
++# define HAVE_XLOCALE
++# endif
++#endif
++
+ #ifdef HAVE_XLOCALE
+ #include <xlocale.h>
+ #endif /* HAVE_XLOCALE */
diff --git a/www/firefox31/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h b/www/firefox31/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h
new file mode 100644
index 00000000000..d058b1ba54b
--- /dev/null
+++ b/www/firefox31/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h
@@ -0,0 +1,19 @@
+$NetBSD: patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h.orig 2014-07-17 01:45:31.000000000 +0000
++++ media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
+@@ -30,7 +30,13 @@
+ * $FreeBSD: src/sys/sys/queue.h,v 1.58 2004/04/07 04:19:49 imp Exp $
+ */
+
+-#ifndef _SYS_QUEUE_H_
++#if (defined(BSD) && !defined(__OpenBSD__)) || defined(DARWIN)
++#include_next <sys/queue.h>
++# if defined(__DragonFly__)
++#define STAILQ_FOREACH_SAFE STAILQ_FOREACH_MUTABLE
++#define TAILQ_FOREACH_SAFE TAILQ_FOREACH_MUTABLE
++# endif
++#elif !defined(_SYS_QUEUE_H_)
+ #define _SYS_QUEUE_H_
+
+ #include <stddef.h>
diff --git a/www/firefox31/patches/patch-media_webrtc_signaling_signaling.gyp b/www/firefox31/patches/patch-media_webrtc_signaling_signaling.gyp
new file mode 100644
index 00000000000..835b624f114
--- /dev/null
+++ b/www/firefox31/patches/patch-media_webrtc_signaling_signaling.gyp
@@ -0,0 +1,20 @@
+$NetBSD: patch-media_webrtc_signaling_signaling.gyp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/webrtc/signaling/signaling.gyp.orig 2014-04-18 02:03:50.000000000 +0000
++++ media/webrtc/signaling/signaling.gyp
+@@ -825,14 +825,13 @@
+ ['OS=="mac"', {
+ 'defines' : [
+ 'SIP_OS_OSX',
+- '_POSIX_SOURCE',
++ # using BSD extensions, leave _POSIX_SOURCE undefined
+ 'CPR_MEMORY_LITTLE_ENDIAN',
+ 'NO_SOCKET_POLLING',
+ 'USE_TIMER_SELECT_BASED',
+ 'FULL_BUILD',
+ 'STUBBED_OUT',
+ 'USE_PRINTF',
+- '_DARWIN_C_SOURCE',
+ 'NO_NSPR_10_SUPPORT',
+ ],
+ }],
diff --git a/www/firefox31/patches/patch-media_webrtc_signaling_test_Makefile.in b/www/firefox31/patches/patch-media_webrtc_signaling_test_Makefile.in
new file mode 100644
index 00000000000..87794002142
--- /dev/null
+++ b/www/firefox31/patches/patch-media_webrtc_signaling_test_Makefile.in
@@ -0,0 +1,25 @@
+$NetBSD: patch-media_webrtc_signaling_test_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/webrtc/signaling/test/Makefile.in.orig 2014-04-18 02:03:51.000000000 +0000
++++ media/webrtc/signaling/test/Makefile.in
+@@ -7,6 +7,7 @@ LIBS = \
+ $(NSPR_LIBS) \
+ $(NSS_LIBS) \
+ $(REALTIME_LIBS) \
++ $(MOZ_LIBV4L2_LIBS) \
+ $(DEPTH)/xpcom/glue/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
+ $(DEPTH)/media/mtransport/standalone/$(LIB_PREFIX)mtransport_s.$(LIB_SUFFIX) \
+ $(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \
+@@ -43,6 +44,12 @@ LIBS += \
+ $(NULL)
+ endif
+
++ifdef MOZ_NATIVE_OPUS
++LIBS += \
++ $(MOZ_OPUS_LIBS) \
++ $(NULL)
++endif
++
+ ifdef MOZ_NATIVE_LIBVPX
+ LIBS += \
+ $(MOZ_LIBVPX_LIBS) \
diff --git a/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi
new file mode 100644
index 00000000000..ce57063ad64
--- /dev/null
+++ b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi
@@ -0,0 +1,13 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_build_common.gypi,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/webrtc/trunk/webrtc/build/common.gypi.orig 2014-04-18 02:03:52.000000000 +0000
++++ media/webrtc/trunk/webrtc/build/common.gypi
+@@ -256,7 +256,7 @@
+ }],
+ ['OS=="dragonfly" or OS=="netbsd"', {
+ 'defines': [
+- # doesn't support pthread_condattr_setclock
++ # doesn't support pthread_condattr_setclock, NetBSD 6 supports it.
+ 'WEBRTC_CLOCK_TYPE_REALTIME',
+ ],
+ }],
diff --git a/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_audio__coding_codecs_opus_opus.gypi b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_audio__coding_codecs_opus_opus.gypi
new file mode 100644
index 00000000000..312de4bc3c5
--- /dev/null
+++ b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_audio__coding_codecs_opus_opus.gypi
@@ -0,0 +1,17 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_modules_audio__coding_codecs_opus_opus.gypi,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/webrtc/trunk/webrtc/modules/audio_coding/codecs/opus/opus.gypi.orig 2014-04-18 02:03:52.000000000 +0000
++++ media/webrtc/trunk/webrtc/modules/audio_coding/codecs/opus/opus.gypi
+@@ -14,9 +14,9 @@
+ 'conditions': [
+ ['build_with_mozilla==1', {
+ # Mozilla provides its own build of the opus library.
+- 'include_dirs': [
+- '/media/libopus/include',
+- ]
++ 'cflags_mozilla': [
++ '$(MOZ_OPUS_CFLAGS)',
++ ],
+ }, {
+ 'dependencies': [
+ '<(DEPTH)/third_party/opus/opus.gyp:opus'
diff --git a/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc
new file mode 100644
index 00000000000..39bdcee8ea3
--- /dev/null
+++ b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc
@@ -0,0 +1,38 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc.orig 2014-05-29 23:31:23.000000000 +0000
++++ media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
+@@ -25,10 +25,21 @@
+ #else
+ #include <linux/videodev2.h>
+ #endif
++#ifdef HAVE_LIBV4L2
++#include <libv4l2.h>
++#endif
+
+ #include "webrtc/system_wrappers/interface/ref_count.h"
+ #include "webrtc/system_wrappers/interface/trace.h"
+
++#ifdef HAVE_LIBV4L2
++#define open v4l2_open
++#define close v4l2_close
++#define dup v4l2_dup
++#define ioctl v4l2_ioctl
++#define mmap v4l2_mmap
++#define munmap v4l2_munmap
++#endif
+
+ namespace webrtc
+ {
+@@ -136,6 +147,11 @@ int32_t DeviceInfoLinux::GetDeviceName(
+ memset(deviceNameUTF8, 0, deviceNameLength);
+ memcpy(cameraName, cap.card, sizeof(cap.card));
+
++ if (cameraName[0] == '\0')
++ {
++ sprintf(cameraName, "Camera at /dev/video%d", deviceNumber);
++ }
++
+ if (deviceNameLength >= strlen(cameraName))
+ {
+ memcpy(deviceNameUTF8, cameraName, strlen(cameraName));
diff --git a/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc
new file mode 100644
index 00000000000..c08afafa3d7
--- /dev/null
+++ b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc
@@ -0,0 +1,30 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc.orig 2014-05-29 23:31:23.000000000 +0000
++++ media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc
+@@ -25,6 +25,9 @@
+ #else
+ #include <linux/videodev2.h>
+ #endif
++#ifdef HAVE_LIBV4L2
++#include <libv4l2.h>
++#endif
+
+ #include <new>
+
+@@ -34,6 +37,15 @@
+ #include "webrtc/system_wrappers/interface/thread_wrapper.h"
+ #include "webrtc/system_wrappers/interface/trace.h"
+
++#ifdef HAVE_LIBV4L2
++#define open v4l2_open
++#define close v4l2_close
++#define dup v4l2_dup
++#define ioctl v4l2_ioctl
++#define mmap v4l2_mmap
++#define munmap v4l2_munmap
++#endif
++
+ namespace webrtc
+ {
+ namespace videocapturemodule
diff --git a/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture.gypi b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture.gypi
new file mode 100644
index 00000000000..856abbf01bf
--- /dev/null
+++ b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture.gypi
@@ -0,0 +1,31 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture.gypi,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi.orig 2013-09-10 03:43:47.000000000 +0000
++++ media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
+@@ -7,6 +7,9 @@
+ # be found in the AUTHORS file in the root of the source tree.
+
+ {
++ 'variables': {
++ 'use_libv4l2%': 0,
++ },
+ 'targets': [
+ {
+ 'target_name': 'video_capture_module',
+@@ -49,6 +52,16 @@
+ }, { # include_internal_video_capture == 1
+ 'conditions': [
+ ['include_v4l2_video_capture==1', {
++ 'conditions': [
++ ['use_libv4l2==1', {
++ 'defines': [
++ 'HAVE_LIBV4L2',
++ ],
++ 'libraries': [
++ '-lv4l2',
++ ],
++ }],
++ ],
+ 'include_dirs': [
+ 'linux',
+ ],
diff --git a/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp
new file mode 100644
index 00000000000..066929a9203
--- /dev/null
+++ b/www/firefox31/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp
@@ -0,0 +1,18 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp.orig 2014-03-15 05:19:30.000000000 +0000
++++ media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp
+@@ -21,6 +21,13 @@ Scott McMurray
+ #include <vector>
+ #include "webrtc/system_wrappers/source/spreadsortlib/constants.hpp"
+
++#ifdef __FreeBSD__
++# include <osreldate.h>
++# if __FreeBSD_version < 900506
++# define getchar boost_getchar
++# endif
++#endif
++
+ namespace boost {
+ namespace detail {
+ //This only works on unsigned data types
diff --git a/www/firefox31/patches/patch-memory_jemalloc_Makefile.in b/www/firefox31/patches/patch-memory_jemalloc_Makefile.in
new file mode 100644
index 00000000000..026da76be91
--- /dev/null
+++ b/www/firefox31/patches/patch-memory_jemalloc_Makefile.in
@@ -0,0 +1,12 @@
+$NetBSD: patch-memory_jemalloc_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- memory/jemalloc/Makefile.in.orig 2014-03-15 05:19:31.000000000 +0000
++++ memory/jemalloc/Makefile.in
+@@ -21,3 +21,7 @@ endif
+ ifdef GNU_CC
+ CFLAGS += -std=gnu99
+ endif
++
++# XXX startup crash workaround for gcc47 on amd64
++jemalloc.$(OBJ_SUFFIX): OS_CFLAGS := $(filter-out -O3 -Ofast,$(OS_CFLAGS))
++jemalloc.$(OBJ_SUFFIX): MOZ_OPTIMIZE_FLAGS=
diff --git a/www/firefox31/patches/patch-memory_mozalloc_mozalloc__abort.cpp b/www/firefox31/patches/patch-memory_mozalloc_mozalloc__abort.cpp
new file mode 100644
index 00000000000..e185bff1c0c
--- /dev/null
+++ b/www/firefox31/patches/patch-memory_mozalloc_mozalloc__abort.cpp
@@ -0,0 +1,16 @@
+$NetBSD: patch-memory_mozalloc_mozalloc__abort.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- memory/mozalloc/mozalloc_abort.cpp.orig 2013-05-11 19:19:46.000000000 +0000
++++ memory/mozalloc/mozalloc_abort.cpp
+@@ -34,7 +34,11 @@ mozalloc_abort(const char* const msg)
+ // Define abort() here, so that it is used instead of the system abort(). This
+ // lets us control the behavior when aborting, in order to get better results
+ // on *NIX platforms. See mozalloc_abort for details.
++#if defined(SOLARIS)
++void std::abort(void)
++#else
+ void abort(void)
++#endif
+ {
+ mozalloc_abort("Redirecting call to abort() to mozalloc_abort\n");
+ }
diff --git a/www/firefox31/patches/patch-mfbt_Alignment.h b/www/firefox31/patches/patch-mfbt_Alignment.h
new file mode 100644
index 00000000000..4bf7228160a
--- /dev/null
+++ b/www/firefox31/patches/patch-mfbt_Alignment.h
@@ -0,0 +1,48 @@
+$NetBSD: patch-mfbt_Alignment.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Make MOZ_ALIGNOF() use gcc's builtin __alignof__.
+From https://bugzilla.mozilla.org/show_bug.cgi?id=1026499
+
+--- mfbt/Alignment.h.orig 2014-07-17 01:45:32.000000000 +0000
++++ mfbt/Alignment.h
+@@ -9,11 +9,20 @@
+ #ifndef mozilla_Alignment_h
+ #define mozilla_Alignment_h
+
++#include "mozilla/Attributes.h"
++
+ #include <stddef.h>
+ #include <stdint.h>
+
+ namespace mozilla {
+
++#if defined(MOZ_HAVE_CXX11_ALIGNAS)
++#define MOZ_ALIGNOF(T) alignof(T)
++#elif defined(__GNUC__)
++#define MOZ_ALIGNOF(T) __alignof__(T)
++#elif defined(_MSC_VER)
++#define MOZ_ALIGNOF(T) __alignof(T)
++#else
+ /*
+ * This class, and the corresponding macro MOZ_ALIGNOF, figures out how many
+ * bytes of alignment a given type needs.
+@@ -32,6 +41,7 @@ class AlignmentFinder
+ };
+
+ #define MOZ_ALIGNOF(T) mozilla::AlignmentFinder<T>::alignment
++#endif
+
+ /*
+ * Declare the MOZ_ALIGNED_DECL macro for declaring aligned types.
+@@ -43,7 +53,10 @@ class AlignmentFinder
+ * will declare a two-character array |arr| aligned to 8 bytes.
+ */
+
+-#if defined(__GNUC__)
++#if defined(MOZ_HAVE_CXX11_ALIGNAS)
++# define MOZ_ALIGNED_DECL(_type, _align) \
++ alignas(_align) _type
++#elif defined(__GNUC__)
+ # define MOZ_ALIGNED_DECL(_type, _align) \
+ _type __attribute__((aligned(_align)))
+ #elif defined(_MSC_VER)
diff --git a/www/firefox31/patches/patch-mfbt_Attributes.h b/www/firefox31/patches/patch-mfbt_Attributes.h
new file mode 100644
index 00000000000..ee1e2692a86
--- /dev/null
+++ b/www/firefox31/patches/patch-mfbt_Attributes.h
@@ -0,0 +1,32 @@
+$NetBSD: patch-mfbt_Attributes.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- mfbt/Attributes.h.orig 2014-07-17 01:45:32.000000000 +0000
++++ mfbt/Attributes.h
+@@ -54,6 +54,9 @@
+ # ifndef __has_extension
+ # define __has_extension __has_feature /* compatibility, for older versions of clang */
+ # endif
++# if __has_extension(cxx_alignas)
++# define MOZ_HAVE_CXX11_ALIGNAS
++# endif
+ # if __has_extension(cxx_constexpr)
+ # define MOZ_HAVE_CXX11_CONSTEXPR
+ # endif
+@@ -75,6 +78,9 @@
+ # endif
+ #elif defined(__GNUC__)
+ # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
++# if MOZ_GCC_VERSION_AT_LEAST(4, 8, 0)
++# define MOZ_HAVE_CXX11_ALIGNAS
++# endif
+ # if MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
+ # define MOZ_HAVE_CXX11_OVERRIDE
+ # define MOZ_HAVE_CXX11_FINAL final
+@@ -96,6 +102,7 @@
+ # define MOZ_HAVE_NORETURN __attribute__((noreturn))
+ #elif defined(_MSC_VER)
+ # if _MSC_VER >= 1800
++# define MOZ_HAVE_CXX11_ALIGNAS
+ # define MOZ_HAVE_CXX11_DELETE
+ # endif
+ # if _MSC_VER >= 1700
diff --git a/www/firefox31/patches/patch-mfbt_Poison.cpp b/www/firefox31/patches/patch-mfbt_Poison.cpp
new file mode 100644
index 00000000000..a8259c95996
--- /dev/null
+++ b/www/firefox31/patches/patch-mfbt_Poison.cpp
@@ -0,0 +1,20 @@
+$NetBSD: patch-mfbt_Poison.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* Use posix_madvise(3) instead of madvise(3) for Solaris/SunOS.
+ Solaris/SunOS's madvise(3) is not enabled in this context,
+ and its first argument type is different from NetBSD/Linux's one.
+
+--- mfbt/Poison.cpp.orig 2013-09-11 03:22:45.000000000 +0000
++++ mfbt/Poison.cpp
+@@ -125,7 +125,11 @@ ReleaseRegion(void *region, uintptr_t si
+ static bool
+ ProbeRegion(uintptr_t region, uintptr_t size)
+ {
++#if !defined(__sun__)
+ if (madvise(reinterpret_cast<void*>(region), size, MADV_NORMAL)) {
++#else
++ if (posix_madvise(reinterpret_cast<void*>(region), size, MADV_NORMAL)) {
++#endif
+ return true;
+ } else {
+ return false;
diff --git a/www/firefox31/patches/patch-mobile_android_installer_Makefile.in b/www/firefox31/patches/patch-mobile_android_installer_Makefile.in
new file mode 100644
index 00000000000..98853fbd88d
--- /dev/null
+++ b/www/firefox31/patches/patch-mobile_android_installer_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-mobile_android_installer_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- mobile/android/installer/Makefile.in.orig 2014-07-17 01:45:33.000000000 +0000
++++ mobile/android/installer/Makefile.in
+@@ -41,6 +41,10 @@ BINPATH = bin
+ endif
+ DEFINES += -DBINPATH=$(BINPATH)
+
++ifdef MOZ_DEBUG
++DEFINES += -DMOZ_DEBUG=1
++endif
++
+ ifdef ENABLE_MARIONETTE
+ DEFINES += -DENABLE_MARIONETTE=1
+ endif
diff --git a/www/firefox31/patches/patch-mobile_android_installer_package-manifest.in b/www/firefox31/patches/patch-mobile_android_installer_package-manifest.in
new file mode 100644
index 00000000000..9000df50996
--- /dev/null
+++ b/www/firefox31/patches/patch-mobile_android_installer_package-manifest.in
@@ -0,0 +1,13 @@
+$NetBSD: patch-mobile_android_installer_package-manifest.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- mobile/android/installer/package-manifest.in.orig 2014-07-17 01:45:33.000000000 +0000
++++ mobile/android/installer/package-manifest.in
+@@ -424,7 +424,7 @@
+ @BINPATH@/components/dom_webspeechsynth.xpt
+ #endif
+
+-#ifdef MOZ_DEBUG
++#if defined(ENABLE_TESTS) && defined(MOZ_DEBUG)
+ @BINPATH@/components/TestInterfaceJS.js
+ @BINPATH@/components/TestInterfaceJS.manifest
+ #endif
diff --git a/www/firefox31/patches/patch-modules_libjar_nsZipArchive.cpp b/www/firefox31/patches/patch-modules_libjar_nsZipArchive.cpp
new file mode 100644
index 00000000000..cb848748d47
--- /dev/null
+++ b/www/firefox31/patches/patch-modules_libjar_nsZipArchive.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-modules_libjar_nsZipArchive.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- modules/libjar/nsZipArchive.cpp.orig 2013-06-18 11:01:37.000000000 +0000
++++ modules/libjar/nsZipArchive.cpp
+@@ -590,7 +590,9 @@ MOZ_WIN_MEM_TRY_BEGIN
+ // Success means optimized jar layout from bug 559961 is in effect
+ uint32_t readaheadLength = xtolong(startp);
+ if (readaheadLength) {
+-#if defined(XP_UNIX)
++#if defined(OS_SOLARIS)
++ posix_madvise(const_cast<uint8_t*>(startp), readaheadLength, POSIX_MADV_WILLNEED);
++#elif defined(XP_UNIX)
+ madvise(const_cast<uint8_t*>(startp), readaheadLength, MADV_WILLNEED);
+ #elif defined(XP_WIN)
+ if (aFd) {
diff --git a/www/firefox31/patches/patch-netwerk_dns_Makefile.in b/www/firefox31/patches/patch-netwerk_dns_Makefile.in
new file mode 100644
index 00000000000..4e6220062d7
--- /dev/null
+++ b/www/firefox31/patches/patch-netwerk_dns_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-netwerk_dns_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- netwerk/dns/Makefile.in.orig 2014-04-18 02:04:03.000000000 +0000
++++ netwerk/dns/Makefile.in
+@@ -5,6 +5,10 @@
+
+ include $(topsrcdir)/config/rules.mk
+
++ifdef MOZ_NATIVE_HARFBUZZ
++CXXFLAGS += $(MOZ_HARFBUZZ_CFLAGS)
++endif
++
+ # Generate the include file containing compact, static definitions
+ # for effective TLD data.
+ etld_data.inc: $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat
diff --git a/www/firefox31/patches/patch-pb b/www/firefox31/patches/patch-pb
new file mode 100644
index 00000000000..28cf0f3618b
--- /dev/null
+++ b/www/firefox31/patches/patch-pb
@@ -0,0 +1,11 @@
+$NetBSD: patch-pb,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xulrunner/installer/libxul.pc.in.orig 2013-07-30 00:59:18.000000000 +0000
++++ xulrunner/installer/libxul.pc.in
+@@ -7,5 +7,5 @@ Name: libxul
+ Description: The Mozilla Runtime and Embedding Engine
+ Version: %MOZILLA_VERSION%
+ Requires: %NSPR_NAME% >= %NSPR_VERSION%
+-Libs: -L${sdkdir}/lib %MOZ_XUL_LINK%
++Libs: -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner %MOZ_XUL_LINK%
+ Cflags: -I${includedir} %WCHAR_CFLAGS%
diff --git a/www/firefox31/patches/patch-pc b/www/firefox31/patches/patch-pc
new file mode 100644
index 00000000000..56dfa84da7d
--- /dev/null
+++ b/www/firefox31/patches/patch-pc
@@ -0,0 +1,12 @@
+$NetBSD: patch-pc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xulrunner/installer/libxul-embedding.pc.in.orig 2013-07-30 00:59:18.000000000 +0000
++++ xulrunner/installer/libxul-embedding.pc.in
+@@ -6,5 +6,6 @@ idldir=%idldir%
+ Name: libxul-embedding
+ Description: Static library for version-independent embedding of the Mozilla runtime
+ Version: %MOZILLA_VERSION%
+-Libs: -L${sdkdir}/lib -lxpcomglue -ldl
++# XXXtnn -ldl removed
++Libs: -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lxpcomglue
+ Cflags: -DXPCOM_GLUE -I${includedir} %WCHAR_CFLAGS%
diff --git a/www/firefox31/patches/patch-probes_Makefile.in b/www/firefox31/patches/patch-probes_Makefile.in
new file mode 100644
index 00000000000..ae2a647e39d
--- /dev/null
+++ b/www/firefox31/patches/patch-probes_Makefile.in
@@ -0,0 +1,13 @@
+$NetBSD: patch-probes_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- probes/Makefile.in.orig 2014-07-17 01:45:36.000000000 +0000
++++ probes/Makefile.in
+@@ -7,7 +7,7 @@ export:: $(DIST)/include/mozilla-trace.h
+
+ # Replace _DTRACE_VERSION with INCLUDE_MOZILLA_DTRACE
+ $(DIST)/include/mozilla-trace.h: mozilla-trace.d Makefile
+- dtrace -h -s $(srcdir)/mozilla-trace.d -o mozilla-trace.h.tmp
++ dtrace -x nolibs -h -s $(srcdir)/mozilla-trace.d -o mozilla-trace.h.tmp
+ sed -e 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \
+ mozilla-trace.h.tmp > $(DIST)/include/mozilla-trace.h
+ rm mozilla-trace.h.tmp
diff --git a/www/firefox31/patches/patch-rc b/www/firefox31/patches/patch-rc
new file mode 100644
index 00000000000..0d73da646d5
--- /dev/null
+++ b/www/firefox31/patches/patch-rc
@@ -0,0 +1,14 @@
+$NetBSD: patch-rc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- browser/branding/unofficial/locales/en-US/brand.dtd.orig 2013-01-04 23:44:28.000000000 +0000
++++ browser/branding/unofficial/locales/en-US/brand.dtd
+@@ -2,7 +2,7 @@
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+-<!ENTITY brandShortName "Mozilla Developer Preview">
+-<!ENTITY brandFullName "Mozilla Developer Preview">
++<!ENTITY brandShortName "Browser">
++<!ENTITY brandFullName "Browser">
+ <!ENTITY vendorShortName "mozilla.org">
+ <!ENTITY trademarkInfo.part1 " ">
diff --git a/www/firefox31/patches/patch-security_manager_ssl_src_nsNSSComponent.cpp b/www/firefox31/patches/patch-security_manager_ssl_src_nsNSSComponent.cpp
new file mode 100644
index 00000000000..194bff4ce92
--- /dev/null
+++ b/www/firefox31/patches/patch-security_manager_ssl_src_nsNSSComponent.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-security_manager_ssl_src_nsNSSComponent.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- security/manager/ssl/src/nsNSSComponent.cpp.orig 2013-09-10 03:43:51.000000000 +0000
++++ security/manager/ssl/src/nsNSSComponent.cpp
+@@ -49,6 +49,7 @@
+
+ #include "nss.h"
+ #include "ssl.h"
++#define NSS_ENABLE_ECC 1
+ #include "sslproto.h"
+ #include "secmod.h"
+ #include "secmime.h"
diff --git a/www/firefox31/patches/patch-storage_src_moz.build b/www/firefox31/patches/patch-storage_src_moz.build
new file mode 100644
index 00000000000..4b8da3c7094
--- /dev/null
+++ b/www/firefox31/patches/patch-storage_src_moz.build
@@ -0,0 +1,20 @@
+$NetBSD: patch-storage_src_moz.build,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- storage/src/moz.build.orig 2014-07-17 01:45:38.000000000 +0000
++++ storage/src/moz.build
+@@ -48,11 +48,14 @@ FINAL_LIBRARY = 'storagecomps'
+ # (such as NSS) might trigger an initialization of sqlite and allocation
+ # of memory using the default allocator, prior to the storage service
+ # registering its allocator, causing memory management failures (bug 938730).
++# However, this is not an issue if both the jemalloc allocator and the default
++# allocator are the same thing.
+ #
+ # Note: On Windows our sqlite build assumes we use jemalloc. If you disable
+ # MOZ_STORAGE_MEMORY on Windows, you will also need to change the "ifdef
+ # MOZ_MEMORY" options in db/sqlite3/src/Makefile.in.
+-if CONFIG['MOZ_MEMORY'] and not CONFIG['MOZ_NATIVE_SQLITE']:
++if CONFIG['MOZ_MEMORY'] and (not CONFIG['MOZ_NATIVE_SQLITE']
++ or CONFIG['MOZ_NATIVE_JEMALLOC']):
+ if CONFIG['OS_TARGET'] != 'Android':
+ DEFINES['MOZ_STORAGE_MEMORY'] = True
+
diff --git a/www/firefox31/patches/patch-toolkit_components_osfile_modules_osfile__unix__back.jsm b/www/firefox31/patches/patch-toolkit_components_osfile_modules_osfile__unix__back.jsm
new file mode 100644
index 00000000000..00bf8ff6237
--- /dev/null
+++ b/www/firefox31/patches/patch-toolkit_components_osfile_modules_osfile__unix__back.jsm
@@ -0,0 +1,49 @@
+$NetBSD: patch-toolkit_components_osfile_modules_osfile__unix__back.jsm,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Based on martin@'s patch for firefox 27.0
+
+* Use off_t for st_size
+* Use function name for NetBSD
+
+--- toolkit/components/osfile/modules/osfile_unix_back.jsm.orig 2014-05-29 23:31:41.000000000 +0000
++++ toolkit/components/osfile/modules/osfile_unix_back.jsm
+@@ -228,8 +228,8 @@
+ let statvfs = new SharedAll.HollowStructure("statvfs",
+ Const.OSFILE_SIZEOF_STATVFS);
+
+- statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_BSIZE,
+- "f_bsize", Type.unsigned_long.implementation);
++ statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_FRSIZE,
++ "f_frsize", Type.unsigned_long.implementation);
+ statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_BAVAIL,
+ "f_bavail", Type.fsblkcnt_t.implementation);
+
+@@ -626,21 +626,22 @@
+ return Stat.fxstat(ver, fd, buf);
+ };
+ } else if (OS.Constants.Sys.Name == "NetBSD") {
+- // NetBSD 5.0 and newer
+- libc.declareLazyFFI(SysFile, "stat",
+- "__stat50", ctypes.default_abi,
++ // NetBSD 5.0 uses *30, and netbsd-6 uses *50
++ let v = OS.Constants.libc.OSFILE_SIZEOF_TIME_T < 8 ? "30" : "50";
++ libc.declareLazyFFI(SysFile, "stat",
++ "__stat"+v, ctypes.default_abi,
+ /*return*/ Type.negativeone_or_nothing,
+ /*path*/ Type.path,
+ /*buf*/ Type.stat.out_ptr
+ );
+ libc.declareLazyFFI(SysFile, "lstat",
+- "__lstat50", ctypes.default_abi,
++ "__lstat"+v, ctypes.default_abi,
+ /*return*/ Type.negativeone_or_nothing,
+ /*path*/ Type.path,
+ /*buf*/ Type.stat.out_ptr
+ );
+- libc.declareLazyFFI(SysFile, "fstat",
+- "__fstat50", ctypes.default_abi,
++ libc.declareLazyFFI(SysFile, "fstat", libc,
++ "__fstat"+v, ctypes.default_abi,
+ /*return*/ Type.negativeone_or_nothing,
+ /*fd*/ Type.fd,
+ /*buf*/ Type.stat.out_ptr
diff --git a/www/firefox31/patches/patch-toolkit_components_osfile_modules_osfile__unix__front.jsm b/www/firefox31/patches/patch-toolkit_components_osfile_modules_osfile__unix__front.jsm
new file mode 100644
index 00000000000..2996f087cf4
--- /dev/null
+++ b/www/firefox31/patches/patch-toolkit_components_osfile_modules_osfile__unix__front.jsm
@@ -0,0 +1,13 @@
+$NetBSD: patch-toolkit_components_osfile_modules_osfile__unix__front.jsm,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- toolkit/components/osfile/modules/osfile_unix_front.jsm.orig 2014-05-29 23:31:41.000000000 +0000
++++ toolkit/components/osfile/modules/osfile_unix_front.jsm
+@@ -373,7 +373,7 @@
+ throw_on_negative("statvfs", UnixFile.statvfs(sourcePath, fileSystemInfoPtr));
+
+ let bytes = new Type.uint64_t.implementation(
+- fileSystemInfo.f_bsize * fileSystemInfo.f_bavail);
++ fileSystemInfo.f_frsize * fileSystemInfo.f_bavail);
+
+ return bytes.value;
+ };
diff --git a/www/firefox31/patches/patch-toolkit_library_libxul.mk b/www/firefox31/patches/patch-toolkit_library_libxul.mk
new file mode 100644
index 00000000000..5390269e9e2
--- /dev/null
+++ b/www/firefox31/patches/patch-toolkit_library_libxul.mk
@@ -0,0 +1,73 @@
+$NetBSD: patch-toolkit_library_libxul.mk,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- toolkit/library/libxul.mk.orig 2014-07-17 01:45:41.000000000 +0000
++++ toolkit/library/libxul.mk
+@@ -77,6 +77,34 @@ ifdef MOZ_NATIVE_HUNSPELL
+ EXTRA_DSO_LDOPTS += $(MOZ_HUNSPELL_LIBS)
+ endif
+
++ifdef MOZ_NATIVE_OGG
++EXTRA_DSO_LDOPTS += $(MOZ_OGG_LIBS)
++endif
++
++ifdef MOZ_NATIVE_THEORA
++EXTRA_DSO_LDOPTS += $(MOZ_THEORA_LIBS)
++endif
++
++ifdef MOZ_NATIVE_VORBIS
++EXTRA_DSO_LDOPTS += $(MOZ_VORBIS_LIBS)
++endif
++
++ifdef MOZ_NATIVE_TREMOR
++EXTRA_DSO_LDOPTS += $(MOZ_TREMOR_LIBS)
++endif
++
++ifdef MOZ_NATIVE_OPUS
++EXTRA_DSO_LDOPTS += $(MOZ_OPUS_LIBS)
++endif
++
++ifdef MOZ_NATIVE_SPEEX
++EXTRA_DSO_LDOPTS += $(MOZ_SPEEX_LIBS)
++endif
++
++ifdef MOZ_NATIVE_SOUNDTOUCH
++EXTRA_DSO_LDOPTS += $(MOZ_SOUNDTOUCH_LIBS)
++endif
++
+ ifdef MOZ_NATIVE_LIBEVENT
+ EXTRA_DSO_LDOPTS += $(MOZ_LIBEVENT_LIBS)
+ endif
+@@ -89,12 +117,24 @@ ifndef MOZ_TREE_PIXMAN
+ EXTRA_DSO_LDOPTS += $(MOZ_PIXMAN_LIBS)
+ endif
+
++ifdef MOZ_NATIVE_GRAPHITE2
++EXTRA_DSO_LDOPTS += $(MOZ_GRAPHITE2_LIBS)
++endif
++
++ifdef MOZ_NATIVE_HARFBUZZ
++EXTRA_DSO_LDOPTS += $(MOZ_HARFBUZZ_LIBS)
++endif
++
+ ifdef MOZ_DMD
+ EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,dmd,$(DIST)/lib)
+ endif
+
+ EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib)
+
++ifdef MOZ_LIBV4L2_LIBS
++EXTRA_DSO_LDOPTS += $(MOZ_LIBV4L2_LIBS)
++endif
++
+ ifdef MOZ_WEBRTC
+ ifeq (WINNT,$(OS_TARGET))
+ ifndef MOZ_HAS_WINSDK_WITH_D3D
+@@ -231,7 +271,7 @@ ifdef MOZ_ENABLE_QT
+ EXTRA_DSO_LDOPTS += $(MOZ_QT_LDFLAGS) $(XEXT_LIBS)
+ endif
+
+-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
++ifeq (Darwin,$(OS_ARCH))
+ ifdef MOZ_GSTREAMER
+ EXTRA_DSO_LDOPTS += $(GSTREAMER_LIBS)
+ endif
diff --git a/www/firefox31/patches/patch-toolkit_toolkit.mozbuild b/www/firefox31/patches/patch-toolkit_toolkit.mozbuild
new file mode 100644
index 00000000000..4c742d03452
--- /dev/null
+++ b/www/firefox31/patches/patch-toolkit_toolkit.mozbuild
@@ -0,0 +1,15 @@
+$NetBSD: patch-toolkit_toolkit.mozbuild,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- toolkit/toolkit.mozbuild.orig 2013-12-05 16:07:58.000000000 +0000
++++ toolkit/toolkit.mozbuild
+@@ -43,8 +43,8 @@ add_tier_dir('platform', [
+ if CONFIG['MOZ_AUTH_EXTENSION']:
+ add_tier_dir('platform', 'extensions/auth')
+
+-if CONFIG['MOZ_UPDATER']:
+- add_tier_dir('platform', 'other-licenses/bsdiff')
++#if CONFIG['MOZ_UPDATER']:
++# add_tier_dir('platform', 'other-licenses/bsdiff')
+
+ # Gecko/Core components.
+
diff --git a/www/firefox31/patches/patch-toolkit_xre_nsEmbedFunctions.cpp b/www/firefox31/patches/patch-toolkit_xre_nsEmbedFunctions.cpp
new file mode 100644
index 00000000000..38684ce6f53
--- /dev/null
+++ b/www/firefox31/patches/patch-toolkit_xre_nsEmbedFunctions.cpp
@@ -0,0 +1,22 @@
+$NetBSD: patch-toolkit_xre_nsEmbedFunctions.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- toolkit/xre/nsEmbedFunctions.cpp.orig 2013-05-11 19:19:55.000000000 +0000
++++ toolkit/xre/nsEmbedFunctions.cpp
+@@ -239,7 +239,7 @@ XRE_SetRemoteExceptionHandler(const char
+ {
+ #if defined(XP_WIN) || defined(XP_MACOSX)
+ return CrashReporter::SetRemoteExceptionHandler(nsDependentCString(aPipe));
+-#elif defined(OS_LINUX)
++#elif defined(OS_LINUX) || defined(OS_SOLARIS)
+ return CrashReporter::SetRemoteExceptionHandler();
+ #else
+ # error "OOP crash reporter unsupported on this platform"
+@@ -351,7 +351,7 @@ XRE_InitChildProcess(int aArgc,
+ // Bug 684322 will add better visibility into this condition
+ NS_WARNING("Could not setup crash reporting\n");
+ }
+-# elif defined(OS_LINUX)
++# elif defined(OS_LINUX) || defined(OS_SOLARIS)
+ // on POSIX, |crashReporterArg| is "true" if crash reporting is
+ // enabled, false otherwise
+ if (0 != strcmp("false", crashReporterArg) &&
diff --git a/www/firefox31/patches/patch-webapprt_moz.build b/www/firefox31/patches/patch-webapprt_moz.build
new file mode 100644
index 00000000000..027f4d535eb
--- /dev/null
+++ b/www/firefox31/patches/patch-webapprt_moz.build
@@ -0,0 +1,22 @@
+$NetBSD: patch-webapprt_moz.build,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Don't assume cocoa toolkit just because OS_ARCH is Darwin.
+
+--- webapprt/moz.build.orig 2014-05-06 22:56:37.000000000 +0000
++++ webapprt/moz.build
+@@ -6,7 +6,7 @@
+
+ if CONFIG['OS_ARCH'] == 'WINNT':
+ DIRS += ['win']
+-elif CONFIG['OS_ARCH'] == 'Darwin':
++elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ DIRS += ['mac']
+ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
+ DIRS += ['gtk2']
+@@ -45,4 +45,4 @@ if CONFIG['MOZILLA_OFFICIAL']:
+ DEFINES['GRE_MILESTONE'] = CONFIG['GRE_MILESTONE']
+ DEFINES['MOZ_APP_BASENAME'] = CONFIG['MOZ_APP_BASENAME']
+
+-JAR_MANIFESTS += ['jar.mn']
+\ No newline at end of file
++JAR_MANIFESTS += ['jar.mn']
diff --git a/www/firefox31/patches/patch-xb b/www/firefox31/patches/patch-xb
new file mode 100644
index 00000000000..524708f76f9
--- /dev/null
+++ b/www/firefox31/patches/patch-xb
@@ -0,0 +1,91 @@
+$NetBSD: patch-xb,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+NetBSD/sparc64 xptcall support code. From pkgsrc/www/firefox3/files/
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_netbsd.cpp.orig 2013-01-09 15:25:54.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_netbsd.cpp
+@@ -0,0 +1,84 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ *
++ * The contents of this file are subject to the Netscape Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/NPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is mozilla.org code.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation. Portions created by Netscape are
++ * Copyright (C) 1998 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s):
++ */
++
++/* Platform specific code to invoke XPCOM methods on native objects */
++
++#include "xptcprivate.h"
++
++#if !defined(__sparc64__) && !defined(_LP64)
++#error "This code is for Sparc64 only"
++#endif
++
++extern "C" PRUint32
++invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s)
++{
++ /*
++ We need to copy the parameters for this function to locals and use them
++ from there since the parameters occupy the same stack space as the stack
++ we're trying to populate.
++ */
++ PRUint64 *l_d = d;
++ nsXPTCVariant *l_s = s;
++ PRUint64 l_paramCount = paramCount;
++ PRUint64 regCount = 0; // return the number of registers to load from the stack
++
++ for(PRUint64 i = 0; i < l_paramCount; i++, l_d++, l_s++)
++ {
++ if (regCount < 5) regCount++;
++
++ if (l_s->IsPtrData())
++ {
++ *l_d = (PRUint64)l_s->ptr;
++ continue;
++ }
++ switch (l_s->type)
++ {
++ case nsXPTType::T_I8 : *((PRInt64*)l_d) = l_s->val.i8; break;
++ case nsXPTType::T_I16 : *((PRInt64*)l_d) = l_s->val.i16; break;
++ case nsXPTType::T_I32 : *((PRInt64*)l_d) = l_s->val.i32; break;
++ case nsXPTType::T_I64 : *((PRInt64*)l_d) = l_s->val.i64; break;
++
++ case nsXPTType::T_U8 : *((PRUint64*)l_d) = l_s->val.u8; break;
++ case nsXPTType::T_U16 : *((PRUint64*)l_d) = l_s->val.u16; break;
++ case nsXPTType::T_U32 : *((PRUint64*)l_d) = l_s->val.u32; break;
++ case nsXPTType::T_U64 : *((PRUint64*)l_d) = l_s->val.u64; break;
++
++ /* in the case of floats, we want to put the bits in to the
++ 64bit space right justified... floats in the paramter array on
++ sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip
++ the space that would be occupied by %f0, %f2, etc.
++ */
++ case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f; break;
++ case nsXPTType::T_DOUBLE: *((double*)l_d) = l_s->val.d; break;
++ case nsXPTType::T_BOOL : *((PRInt64*)l_d) = l_s->val.b; break;
++ case nsXPTType::T_CHAR : *((PRUint64*)l_d) = l_s->val.c; break;
++ case nsXPTType::T_WCHAR : *((PRInt64*)l_d) = l_s->val.wc; break;
++
++ default:
++ // all the others are plain pointer types
++ *((void**)l_d) = l_s->val.p;
++ break;
++ }
++ }
++
++ return regCount;
++}
diff --git a/www/firefox31/patches/patch-xc b/www/firefox31/patches/patch-xc
new file mode 100644
index 00000000000..9f77c3c40a9
--- /dev/null
+++ b/www/firefox31/patches/patch-xc
@@ -0,0 +1,73 @@
+$NetBSD: patch-xc,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+NetBSD/sparc64 xptcall support code. From pkgsrc/www/firefox3/files/
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc64_netbsd.s.orig 2013-01-09 15:25:54.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc64_netbsd.s
+@@ -0,0 +1,66 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ *
++ * The contents of this file are subject to the Netscape Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/NPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is mozilla.org code.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation. Portions created by Netscape are
++ * Copyright (C) 1999 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s):
++ */
++
++ .global SharedStub
++
++/*
++ in the frame for the function that called SharedStub are the
++ rest of the parameters we need
++
++*/
++
++SharedStub:
++! we don't create a new frame yet, but work within the frame of the calling
++! function to give ourselves the other parameters we want
++
++ mov %o0, %o1 ! shuffle the index up to 2nd place
++ mov %i0, %o0 ! the original 'this'
++ add %fp, 0x7ff + 136, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this')
++
++! save off the original incoming parameters that arrived in
++! registers, the ABI guarantees the space for us to do this
++ stx %i1, [%fp + 0x7ff + 136]
++ stx %i2, [%fp + 0x7ff + 144]
++ stx %i3, [%fp + 0x7ff + 152]
++ stx %i4, [%fp + 0x7ff + 160]
++ stx %i5, [%fp + 0x7ff + 168]
++! now we can build our own stack frame
++ save %sp,-(128 + 64),%sp ! room for the register window and
++ ! struct pointer, rounded up to 0 % 64
++! our function now appears to have been called
++! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args)
++! so we can just copy these through
++
++ mov %i0, %o0
++ mov %i1, %o1
++ mov %i2, %o2
++ call PrepareAndDispatch
++ nop
++ mov %o0,%i0 ! propagate return value
++ b .LL1
++ nop
++.LL1:
++ ret
++ restore
++
++ .size SharedStub, .-SharedStub
++ .type SharedStub, #function
diff --git a/www/firefox31/patches/patch-xe b/www/firefox31/patches/patch-xe
new file mode 100644
index 00000000000..dbd6489c38d
--- /dev/null
+++ b/www/firefox31/patches/patch-xe
@@ -0,0 +1,75 @@
+$NetBSD: patch-xe,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp.orig 2013-01-04 23:44:47.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp
+@@ -100,6 +100,15 @@ extern "C" {
+ }
+ }
+
++/*
++ * SYMBOL PREFIX must be "_" for aout symbols and "" for ELF
++ */
++#ifndef __ELF__
++#define SYMBOLPREFIX "_"
++#else
++#define SYMBOLPREFIX
++#endif
++
+ XPTC_PUBLIC_API(nsresult)
+ XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
+ uint32_t paramCount, nsXPTCVariant* params)
+@@ -107,30 +116,30 @@ XPTC_InvokeByIndex(nsISupports* that, ui
+ uint32_t result;
+
+ __asm__ __volatile__(
+- "movl %4, sp@-\n\t"
+- "movl %3, sp@-\n\t"
+- "jbsr _invoke_count_words\n\t" /* count words */
+- "addql #8, sp\n\t"
+- "lsll #2, d0\n\t" /* *= 4 */
+- "movl sp, a2\n\t" /* save original sp */
+- "subl d0, sp\n\t" /* make room for params */
+- "movl sp, a0\n\t"
+- "movl %4, sp@-\n\t"
+- "movl %3, sp@-\n\t"
+- "movl a0, sp@-\n\t"
+- "jbsr _invoke_copy_to_stack\n\t" /* copy params */
+- "addl #12, sp\n\t"
+- "movl %1, a0\n\t"
+- "movl a0@, a1\n\t"
+- "movl %2, d0\n\t" /* function index */
+- "movl a0, d1\n\t"
+- "movw a1@(8,d0:l:8), a0\n\t"
+- "addl a0, d1\n\t"
+- "movl a1@(12,d0:l:8), a1\n\t"
+- "movl d1, sp@-\n\t"
+- "jbsr a1@\n\t"
+- "movl a2, sp\n\t" /* restore original sp */
+- "movl d0, %0\n\t"
++ "movl %4, %%sp@-\n\t"
++ "movl %3, %%sp@-\n\t"
++ "jbsr "SYMBOLPREFIX"invoke_count_words\n\t" /* count words */
++ "addql #8, %%sp\n\t"
++ "lsll #2, %%d0\n\t" /* *= 4 */
++ "movl %%sp, %%a2\n\t" /* save original sp */
++ "subl %%d0, %%sp\n\t" /* make room for params */
++ "movl %%sp, %%a0\n\t"
++ "movl %4, %%sp@-\n\t"
++ "movl %3, %%sp@-\n\t"
++ "movl %%a0, %%sp@-\n\t"
++ "jbsr "SYMBOLPREFIX"invoke_copy_to_stack\n\t" /* copy params */
++ "addl #12, %%sp\n\t"
++ "movl %1, %%a0\n\t"
++ "movl %%a0@, %%a1\n\t"
++ "movl %2, %%d0\n\t" /* function index */
++ "movl %%a0, %%d1\n\t"
++ "movw %%a1@(8,%%d0:l:8), %%a0\n\t"
++ "addl %%a0, %%d1\n\t"
++ "movl %%a1@(12,%%d0:l:8), %%a1\n\t"
++ "movl %%d1, %%sp@-\n\t"
++ "jbsr %%a1@\n\t"
++ "movl %%a2, %%sp\n\t" /* restore original sp */
++ "movl %%d0, %0\n\t"
+ : "=g" (result) /* %0 */
+ : "g" (that), /* %1 */
+ "g" (methodIndex), /* %2 */
diff --git a/www/firefox31/patches/patch-xf b/www/firefox31/patches/patch-xf
new file mode 100644
index 00000000000..3af3d46d0ff
--- /dev/null
+++ b/www/firefox31/patches/patch-xf
@@ -0,0 +1,43 @@
+$NetBSD: patch-xf,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+NetBSD/m68k xptcall support code. From pkgsrc/www/firefox/patch-ae.
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp.orig 2013-01-04 23:44:47.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp
+@@ -91,17 +91,27 @@ extern "C" {
+ }
+ }
+
++/*
++ * Beware: use % instead of %% for register identifiers in a preprocessor macro
++ * SYMBOL PREFIX must be "_" for aout and "" for ELF
++ */
++#ifndef __ELF__
++#define SYMBOLPREFIX "_"
++#else
++#define SYMBOLPREFIX
++#endif
++
+ #define STUB_ENTRY(n) \
+ __asm__( \
+- ".global _Stub"#n"__14nsXPTCStubBase\n\t" \
+-"_Stub"#n"__14nsXPTCStubBase:\n\t" \
+- "link a6,#0 \n\t" \
+- "lea a6@(12), a0 \n\t" /* pointer to args */ \
+- "movl a0, sp@- \n\t" \
+- "movl #"#n", sp@- \n\t" /* method index */ \
+- "movl a6@(8), sp@- \n\t" /* this */ \
+- "jbsr _PrepareAndDispatch \n\t" \
+- "unlk a6 \n\t" \
++ ".global "SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t" \
++SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t" \
++ "link %a6,#0 \n\t" \
++ "lea %a6@(12), %a0 \n\t" /* pointer to args */ \
++ "movl %a0, %sp@- \n\t" \
++ "movl #"#n", %sp@- \n\t" /* method index */ \
++ "movl %a6@(8), %sp@- \n\t" /* this */ \
++ "jbsr "SYMBOLPREFIX"PrepareAndDispatch\n\t" \
++ "unlk %a6 \n\t" \
+ "rts \n\t" \
+ );
+
diff --git a/www/firefox31/patches/patch-xg b/www/firefox31/patches/patch-xg
new file mode 100644
index 00000000000..073e5a76686
--- /dev/null
+++ b/www/firefox31/patches/patch-xg
@@ -0,0 +1,33 @@
+$NetBSD: patch-xg,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+NetBSD/arm xptcall support code. From pkgsrc/www/firefox/patch-bm.
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp.orig 2013-01-04 23:44:47.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp
+@@ -86,18 +86,23 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+ * so they are contiguous with values passed on the stack, and then calls
+ * PrepareAndDispatch() to do the dirty work.
+ */
++#ifndef __ELF__
++#define SYMBOLPREFIX "_"
++#else
++#define SYMBOLPREFIX
++#endif
+
+ #define STUB_ENTRY(n) \
+ __asm__( \
+- ".global _Stub"#n"__14nsXPTCStubBase\n\t" \
+-"_Stub"#n"__14nsXPTCStubBase:\n\t" \
++ ".global "SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t" \
++SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t" \
+ "stmfd sp!, {r1, r2, r3} \n\t" \
+ "mov ip, sp \n\t" \
+ "stmfd sp!, {fp, ip, lr, pc} \n\t" \
+ "sub fp, ip, #4 \n\t" \
+ "mov r1, #"#n" \n\t" /* = methodIndex */ \
+ "add r2, sp, #16 \n\t" \
+- "bl _PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \
++ "bl "SYMBOLPREFIX"PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \
+ "ldmea fp, {fp, sp, lr} \n\t" \
+ "add sp, sp, #12 \n\t" \
+ "mov pc, lr \n\t" \
diff --git a/www/firefox31/patches/patch-xl b/www/firefox31/patches/patch-xl
new file mode 100644
index 00000000000..f9a91c1d4db
--- /dev/null
+++ b/www/firefox31/patches/patch-xl
@@ -0,0 +1,27 @@
+$NetBSD: patch-xl,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+NetBSD ppc xptcall support code. Originally from pkgsrc/www/mozilla.
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s.orig 2014-02-12 21:29:26.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s
+@@ -20,15 +20,15 @@
+
+ .section ".text"
+ .align 2
+- .globl XPTC_InvokeByIndex
+- .type XPTC_InvokeByIndex,@function
++ .globl NS_InvokeByIndex_P
++ .type NS_InvokeByIndex_P,@function
+
+ #
+-# XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
+-# uint32_t paramCount, nsXPTCVariant* params)
++# NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
++# PRUint32 paramCount, nsXPTCVariant* params)
+ #
+
+-XPTC_InvokeByIndex:
++NS_InvokeByIndex_P:
+ stwu sp,-32(sp) # setup standard stack frame
+ mflr r0 # save LR
+ stw r3,8(sp) # r3 <= that
diff --git a/www/firefox31/patches/patch-xm b/www/firefox31/patches/patch-xm
new file mode 100644
index 00000000000..489fa778dde
--- /dev/null
+++ b/www/firefox31/patches/patch-xm
@@ -0,0 +1,49 @@
+$NetBSD: patch-xm,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+NetBSD/ppc xptcall support code. Originally from pkgsrc/www/mozilla.
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp.orig 2013-01-04 23:44:47.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp
+@@ -5,9 +5,9 @@
+
+ // Platform specific code to invoke XPCOM methods on native objects
+
+-// The purpose of XPTC_InvokeByIndex() is to map a platform
++// The purpose of NS_InvokeByIndex_P() is to map a platform
+ // indepenpent call to the platform ABI. To do that,
+-// XPTC_InvokeByIndex() has to determine the method to call via vtable
++// NS_InvokeByIndex_P() has to determine the method to call via vtable
+ // access. The parameters for the method are read from the
+ // nsXPTCVariant* and prepared for the native ABI. For the Linux/PPC
+ // ABI this means that the first 8 integral and floating point
+@@ -69,8 +69,10 @@ invoke_copy_to_stack(uint32_t* d,
+ if ((uint32_t) d & 4) d++; // doubles are 8-byte aligned on stack
+ *((double*) d) = s->val.d;
+ d += 2;
++#if __GXX_ABI_VERSION < 100
+ if (gpr < GPR_COUNT)
+ gpr += 2;
++#endif
+ }
+ }
+ else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
+@@ -79,8 +81,10 @@ invoke_copy_to_stack(uint32_t* d,
+ else {
+ *((float*) d) = s->val.f;
+ d += 1;
++#if __GXX_ABI_VERSION < 100
+ if (gpr < GPR_COUNT)
+ gpr += 1;
++#endif
+ }
+ }
+ else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64
+@@ -107,6 +111,6 @@ invoke_copy_to_stack(uint32_t* d,
+ }
+
+ extern "C"
+-XPTC_PUBLIC_API(nsresult)
+-XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
++EXPORT_XPCOM_API(nsresult)
++NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
+ uint32_t paramCount, nsXPTCVariant* params);
diff --git a/www/firefox31/patches/patch-xpcom_base_nsDebugImpl.cpp b/www/firefox31/patches/patch-xpcom_base_nsDebugImpl.cpp
new file mode 100644
index 00000000000..3e3b9569cab
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_base_nsDebugImpl.cpp
@@ -0,0 +1,88 @@
+$NetBSD: patch-xpcom_base_nsDebugImpl.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/base/nsDebugImpl.cpp.orig 2014-05-29 23:31:50.000000000 +0000
++++ xpcom/base/nsDebugImpl.cpp
+@@ -44,12 +44,43 @@
+ #endif
+ #endif
+
+-#if defined(XP_MACOSX)
++#if defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
++ || defined(__NetBSD__) || defined(__OpenBSD__)
+ #include <stdbool.h>
+ #include <unistd.h>
++#include <sys/param.h>
+ #include <sys/sysctl.h>
+ #endif
+
++#if defined(__OpenBSD__)
++#include <sys/proc.h>
++#endif
++
++#if defined(__DragonFly__) || defined(__FreeBSD__)
++#include <sys/user.h>
++#endif
++
++#if defined(__NetBSD__)
++#undef KERN_PROC
++#define KERN_PROC KERN_PROC2
++#define KINFO_PROC struct kinfo_proc2
++#else
++#define KINFO_PROC struct kinfo_proc
++#endif
++
++#if defined(XP_MACOSX)
++#define KP_FLAGS kp_proc.p_flag
++#elif defined(__DragonFly__)
++#define KP_FLAGS kp_flags
++#elif defined(__FreeBSD__)
++#define KP_FLAGS ki_flag
++#elif defined(__OpenBSD__) && !defined(_P_TRACED)
++#define KP_FLAGS p_psflags
++#define P_TRACED PS_TRACED
++#else
++#define KP_FLAGS p_flag
++#endif
++
+ #include "mozilla/mozalloc_abort.h"
+
+ static void
+@@ -143,16 +174,22 @@ nsDebugImpl::GetIsDebuggerAttached(bool*
+
+ #if defined(XP_WIN)
+ *aResult = ::IsDebuggerPresent();
+-#elif defined(XP_MACOSX)
++#elif defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
++ || defined(__NetBSD__) || defined(__OpenBSD__)
+ // Specify the info we're looking for
+- int mib[4];
+- mib[0] = CTL_KERN;
+- mib[1] = KERN_PROC;
+- mib[2] = KERN_PROC_PID;
+- mib[3] = getpid();
++ int mib[] = {
++ CTL_KERN,
++ KERN_PROC,
++ KERN_PROC_PID,
++ getpid(),
++#if defined(__NetBSD__) || defined(__OpenBSD__)
++ sizeof(KINFO_PROC),
++ 1,
++#endif
++ };
+ size_t mibSize = sizeof(mib) / sizeof(int);
+
+- struct kinfo_proc info;
++ KINFO_PROC info;
+ size_t infoSize = sizeof(info);
+ memset(&info, 0, infoSize);
+
+@@ -162,7 +199,7 @@ nsDebugImpl::GetIsDebuggerAttached(bool*
+ return NS_OK;
+ }
+
+- if (info.kp_proc.p_flag & P_TRACED) {
++ if (info.KP_FLAGS & P_TRACED) {
+ *aResult = true;
+ }
+ #endif
diff --git a/www/firefox31/patches/patch-xpcom_base_nsStackWalk.cpp b/www/firefox31/patches/patch-xpcom_base_nsStackWalk.cpp
new file mode 100644
index 00000000000..19e753c25de
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_base_nsStackWalk.cpp
@@ -0,0 +1,59 @@
+$NetBSD: patch-xpcom_base_nsStackWalk.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* Replace XP_MACOSX with XP_DARWIN as the former is not defined when
+ the toolkit is not cocoa.
+
+--- xpcom/base/nsStackWalk.cpp.orig 2014-05-29 23:31:50.000000000 +0000
++++ xpcom/base/nsStackWalk.cpp
+@@ -33,8 +33,8 @@ static CriticalAddress gCriticalAddress;
+ #include <dlfcn.h>
+ #endif
+
+-#define NSSTACKWALK_SUPPORTS_MACOSX \
+- (defined(XP_MACOSX) && \
++#define NSSTACKWALK_SUPPORTS_DARWIN \
++ (defined(XP_DARWIN) && \
+ (defined(__i386) || defined(__ppc__) || defined(HAVE__UNWIND_BACKTRACE)))
+
+ #define NSSTACKWALK_SUPPORTS_LINUX \
+@@ -42,11 +42,11 @@ static CriticalAddress gCriticalAddress;
+ ((defined(__GNUC__) && (defined(__i386) || defined(PPC))) || \
+ defined(HAVE__UNWIND_BACKTRACE)))
+
+-#define NSSTACKWALK_SUPPORTS_SOLARIS \
++#define notNSSTACKWALK_SUPPORTS_SOLARIS \
+ (defined(__sun) && \
+ (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
+
+-#if NSSTACKWALK_SUPPORTS_MACOSX
++#if NSSTACKWALK_SUPPORTS_DARWIN
+ #include <pthread.h>
+ #include <CoreServices/CoreServices.h>
+
+@@ -838,7 +838,7 @@ NS_FormatCodeAddressDetails(void *aPC, c
+
+ // WIN32 x86 stack walking code
+ // i386 or PPC Linux stackwalking code or Solaris
+-#elif HAVE_DLADDR && (HAVE__UNWIND_BACKTRACE || NSSTACKWALK_SUPPORTS_LINUX || NSSTACKWALK_SUPPORTS_SOLARIS || NSSTACKWALK_SUPPORTS_MACOSX)
++#elif HAVE_DLADDR && (HAVE__UNWIND_BACKTRACE || NSSTACKWALK_SUPPORTS_LINUX || NSSTACKWALK_SUPPORTS_SOLARIS || NSSTACKWALK_SUPPORTS_DARWIN)
+
+ #include <stdlib.h>
+ #include <string.h>
+@@ -1162,7 +1162,7 @@ FramePointerStackWalk(NS_WalkStackCallba
+ (long(next) & 3)) {
+ break;
+ }
+-#if (defined(__ppc__) && defined(XP_MACOSX)) || defined(__powerpc64__)
++#if (defined(__ppc__) && defined(XP_DARWIN)) || defined(__powerpc64__)
+ // ppc mac or powerpc64 linux
+ void *pc = *(bp+2);
+ bp += 3;
+@@ -1192,7 +1192,7 @@ FramePointerStackWalk(NS_WalkStackCallba
+ }
+
+ #define X86_OR_PPC (defined(__i386) || defined(PPC) || defined(__ppc__))
+-#if X86_OR_PPC && (NSSTACKWALK_SUPPORTS_MACOSX || NSSTACKWALK_SUPPORTS_LINUX) // i386 or PPC Linux or Mac stackwalking code
++#if X86_OR_PPC && (NSSTACKWALK_SUPPORTS_DARWIN || NSSTACKWALK_SUPPORTS_LINUX) // i386 or PPC Linux or Mac stackwalking code
+
+ EXPORT_XPCOM_API(nsresult)
+ NS_StackWalk(NS_WalkStackCallback aCallback, uint32_t aSkipFrames,
diff --git a/www/firefox31/patches/patch-xpcom_base_nsUUIDGenerator.cpp b/www/firefox31/patches/patch-xpcom_base_nsUUIDGenerator.cpp
new file mode 100644
index 00000000000..5b14621da3e
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_base_nsUUIDGenerator.cpp
@@ -0,0 +1,69 @@
+$NetBSD: patch-xpcom_base_nsUUIDGenerator.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/base/nsUUIDGenerator.cpp.orig 2014-07-17 01:45:42.000000000 +0000
++++ xpcom/base/nsUUIDGenerator.cpp
+@@ -15,6 +15,10 @@
+
+ #include "nsUUIDGenerator.h"
+
++#ifdef ANDROID
++extern "C" NS_EXPORT void arc4random_buf(void *, size_t);
++#endif
++
+ using namespace mozilla;
+
+ NS_IMPL_ISUPPORTS(nsUUIDGenerator, nsIUUIDGenerator)
+@@ -34,7 +38,7 @@ nsUUIDGenerator::Init()
+ // We're a service, so we're guaranteed that Init() is not going
+ // to be reentered while we're inside Init().
+
+-#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(ANDROID)
++#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(HAVE_ARC4RANDOM)
+ /* initialize random number generator using NSPR random noise */
+ unsigned int seed;
+
+@@ -67,7 +71,7 @@ nsUUIDGenerator::Init()
+ return NS_ERROR_FAILURE;
+ #endif
+
+-#endif /* non XP_WIN and non XP_MACOSX */
++#endif /* non XP_WIN and non XP_MACOSX and non ARC4RANDOM */
+
+ return NS_OK;
+ }
+@@ -114,13 +118,16 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsI
+ * back to it; instead, we use the value returned when we called
+ * initstate, since older glibc's have broken setstate() return values
+ */
+-#ifndef ANDROID
++#ifndef HAVE_ARC4RANDOM
+ setstate(mState);
+ #endif
+
++#ifdef HAVE_ARC4RANDOM_BUF
++ arc4random_buf(id, sizeof(nsID));
++#else /* HAVE_ARC4RANDOM_BUF */
+ size_t bytesLeft = sizeof(nsID);
+ while (bytesLeft > 0) {
+-#ifdef ANDROID
++#ifdef HAVE_ARC4RANDOM
+ long rval = arc4random();
+ const size_t mRBytes = 4;
+ #else
+@@ -141,6 +148,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsI
+
+ bytesLeft -= toWrite;
+ }
++#endif /* HAVE_ARC4RANDOM_BUF */
+
+ /* Put in the version */
+ id->m2 &= 0x0fff;
+@@ -150,7 +158,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsI
+ id->m3[0] &= 0x3f;
+ id->m3[0] |= 0x80;
+
+-#ifndef ANDROID
++#ifndef HAVE_ARC4RANDOM
+ /* Restore the previous RNG state */
+ setstate(mSavedState);
+ #endif
diff --git a/www/firefox31/patches/patch-xpcom_base_nsUUIDGenerator.h b/www/firefox31/patches/patch-xpcom_base_nsUUIDGenerator.h
new file mode 100644
index 00000000000..0bdf59de94e
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_base_nsUUIDGenerator.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-xpcom_base_nsUUIDGenerator.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/base/nsUUIDGenerator.h.orig 2014-05-29 23:31:50.000000000 +0000
++++ xpcom/base/nsUUIDGenerator.h
+@@ -27,7 +27,7 @@ private:
+ protected:
+
+ mozilla::Mutex mLock;
+-#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(ANDROID)
++#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(HAVE_ARC4RANDOM)
+ char mState[128];
+ char *mSavedState;
+ uint8_t mRBytes;
diff --git a/www/firefox31/patches/patch-xpcom_base_nscore.h b/www/firefox31/patches/patch-xpcom_base_nscore.h
new file mode 100644
index 00000000000..996d9e7cf86
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_base_nscore.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-xpcom_base_nscore.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/base/nscore.h.orig 2014-05-29 23:31:50.000000000 +0000
++++ xpcom/base/nscore.h
+@@ -114,7 +114,7 @@
+ * NS_HIDDEN_(int) NS_FASTCALL func2(char *foo);
+ */
+
+-#if defined(__i386__) && defined(__GNUC__)
++#if defined(__i386__) && defined(__GNUC__) && !(defined(__clang__) && __clang_major__ == 3 && __clang_minor__ == 4 && __clang_patchlevel__ == 0)
+ #define NS_FASTCALL __attribute__ ((regparm (3), stdcall))
+ #define NS_CONSTRUCTOR_FASTCALL __attribute__ ((regparm (3), stdcall))
+ #elif defined(XP_WIN) && !defined(_WIN64)
diff --git a/www/firefox31/patches/patch-xpcom_build_PoisonIOInterposer.h b/www/firefox31/patches/patch-xpcom_build_PoisonIOInterposer.h
new file mode 100644
index 00000000000..4b44e2a415a
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_build_PoisonIOInterposer.h
@@ -0,0 +1,37 @@
+$NetBSD: patch-xpcom_build_PoisonIOInterposer.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+Replace XP_MACOSX with XP_DARWIN as the former is not defined when
+the toolkit is not cocoa.
+
+--- xpcom/build/PoisonIOInterposer.h.orig 2014-05-29 23:31:50.000000000 +0000
++++ xpcom/build/PoisonIOInterposer.h
+@@ -44,7 +44,7 @@ bool IsDebugFile(intptr_t aFileID);
+ */
+ void InitPoisonIOInterposer();
+
+-#ifdef XP_MACOSX
++#ifdef XP_DARWIN
+ /**
+ * Check that writes are dirty before reporting I/O (Mac OS X only)
+ * This is necessary for late-write checks on Mac OS X, but reading the buffer
+@@ -52,7 +52,7 @@ void InitPoisonIOInterposer();
+ * to do this for everything else that uses
+ */
+ void OnlyReportDirtyWrites();
+-#endif /* XP_MACOSX */
++#endif /* XP_DARWIN */
+
+ /**
+ * Clear IO poisoning, this is only safe to do on the main-thread when no other
+@@ -70,9 +70,9 @@ namespace mozilla {
+ inline bool IsDebugFile(intptr_t aFileID){ return true; }
+ inline void InitPoisonIOInterposer(){}
+ inline void ClearPoisonIOInterposer(){}
+-#ifdef XP_MACOSX
++#ifdef XP_DARWIN
+ inline void OnlyReportDirtyWrites(){}
+-#endif /* XP_MACOSX */
++#endif /* XP_DARWIN */
+ } // namespace mozilla
+ #endif /* __cplusplus */
+
diff --git a/www/firefox31/patches/patch-xpcom_build_nsXPComInit.cpp b/www/firefox31/patches/patch-xpcom_build_nsXPComInit.cpp
new file mode 100644
index 00000000000..3052fcff3ab
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_build_nsXPComInit.cpp
@@ -0,0 +1,28 @@
+$NetBSD: patch-xpcom_build_nsXPComInit.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/build/nsXPComInit.cpp.orig 2014-05-29 23:31:50.000000000 +0000
++++ xpcom/build/nsXPComInit.cpp
+@@ -128,7 +128,9 @@ extern nsresult nsStringInputStreamConst
+ #include "mozilla/VisualEventTracer.h"
+ #endif
+
++#ifndef MOZ_OGG_NO_MEM_REPORTING
+ #include "ogg/ogg.h"
++#endif
+ #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
+ #include "vpx_mem/vpx_mem.h"
+ #endif
+@@ -564,11 +566,13 @@ NS_InitXPCOM2(nsIServiceManager* *result
+ // this oddness.
+ mozilla::SetICUMemoryFunctions();
+
++#ifndef MOZ_OGG_NO_MEM_REPORTING
+ // Do the same for libogg.
+ ogg_set_mem_functions(OggReporter::CountingMalloc,
+ OggReporter::CountingCalloc,
+ OggReporter::CountingRealloc,
+ OggReporter::CountingFree);
++#endif
+
+ #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
+ // And for VPX.
diff --git a/www/firefox31/patches/patch-xpcom_ds_TimeStamp.h b/www/firefox31/patches/patch-xpcom_ds_TimeStamp.h
new file mode 100644
index 00000000000..7f4fb4837c4
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_ds_TimeStamp.h
@@ -0,0 +1,20 @@
+$NetBSD: patch-xpcom_ds_TimeStamp.h,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+http://gnats.netbsd.org/47233
+
+--- xpcom/ds/TimeStamp.h.orig 2013-01-04 23:44:47.000000000 +0000
++++ xpcom/ds/TimeStamp.h
+@@ -130,11 +130,11 @@ private:
+ // NOTE: this MUST be a >= test, because int64_t(double(INT64_MAX))
+ // overflows and gives INT64_MIN.
+ if (aTicks >= double(INT64_MAX))
+- return TimeDuration::FromTicks(INT64_MAX);
++ return TimeDuration::FromTicks(int64_t(INT64_MAX));
+
+ // This MUST be a <= test.
+ if (aTicks <= double(INT64_MIN))
+- return TimeDuration::FromTicks(INT64_MIN);
++ return TimeDuration::FromTicks(int64_t(INT64_MIN));
+
+ return TimeDuration::FromTicks(int64_t(aTicks));
+ }
diff --git a/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_moz.build b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_moz.build
new file mode 100644
index 00000000000..63426ab7d8c
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_moz.build
@@ -0,0 +1,34 @@
+$NetBSD: patch-xpcom_reflect_xptcall_src_md_unix_moz.build,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* Support NetBSD/amd64 and DragonFly/amd64.
+
+* OS_TEST can never be powerpc.
+
+--- xpcom/reflect/xptcall/src/md/unix/moz.build.orig 2014-05-06 22:56:39.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/moz.build
+@@ -9,7 +9,7 @@ if CONFIG['OS_ARCH'] == 'Darwin':
+ 'xptcinvoke_darwin.cpp',
+ 'xptcstubs_darwin.cpp',
+ ]
+- if CONFIG['OS_TEST'] == 'powerpc':
++ if CONFIG['OS_TEST'] == 'ppc':
+ SOURCES += [
+ 'xptcinvoke_asm_ppc_rhapsody.s',
+ ]
+@@ -19,14 +19,14 @@ if CONFIG['OS_ARCH'] == 'Darwin':
+ if '86' in CONFIG['OS_TEST'] and CONFIG['OS_TEST'] != 'x86_64':
+ DEFINES['MOZ_NEED_LEADING_UNDERSCORE'] = True
+
+-if CONFIG['OS_ARCH'] in ('NetBSD', 'OpenBSD', 'GNU'):
++if CONFIG['OS_ARCH'] in ('OpenBSD', 'GNU'):
+ if CONFIG['CPU_ARCH'] == 'x86':
+ SOURCES += [
+ 'xptcinvoke_gcc_x86_unix.cpp',
+ 'xptcstubs_gcc_x86_unix.cpp'
+ ]
+
+-if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD') or \
++if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD', 'NetBSD', 'DragonFly') or \
+ CONFIG['OS_ARCH'].startswith('GNU_'):
+ if CONFIG['OS_TEST'] == 'x86_64':
+ SOURCES += [
diff --git a/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__asm__mips.S b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__asm__mips.S
new file mode 100644
index 00000000000..cc2fb403e43
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__asm__mips.S
@@ -0,0 +1,52 @@
+$NetBSD: patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__asm__mips.S,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.S.orig 2014-03-15 05:19:39.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.S
+@@ -16,6 +16,47 @@
+ #include <sys/asm.h>
+ #endif
+
++#ifdef __NetBSD__
++# include <machine/regdef.h>
++# include <machine/asm.h>
++# ifndef fp
++# define fp s8
++# endif
++# ifndef PTRLOG
++# if SZREG == 4
++# define PTRLOG 2
++# else
++# define PTRLOG 3
++# endif
++# endif
++# ifndef SETUP_GP
++# if defined(__mips_o32)
++# define SETUP_GP \
++ .set push; \
++ .set noreorder; \
++ .cpload t9; \
++ .set pop
++# define SAVE_GP(x) \
++ .cprestore x
++# else
++# define SETUP_GP
++# define SAVE_GP(x)
++# endif
++# endif
++# ifndef ALSZ
++# if defined(__mips_n32) || defined(__mips_n64)
++# define ALSZ 15
++# define ALMASK ~15
++# else
++# define ALSZ 7
++# define ALMASK ~7
++# endif
++# endif
++#else
++# include <sys/regdef.h>
++# include <sys/asm.h>
++#endif
++
+ # NARGSAVE is the argument space in the callers frame, including extra
+ # 'shadowed' space for the argument registers. The minimum of 4
+ # argument slots is sometimes predefined in the header files.
diff --git a/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__gcc__x86__unix.cpp b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__gcc__x86__unix.cpp
new file mode 100644
index 00000000000..857bcd0aa6e
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__gcc__x86__unix.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__gcc__x86__unix.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp.orig 2013-05-11 19:19:56.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp
+@@ -9,7 +9,7 @@
+ #include "xptc_gcc_x86_unix.h"
+
+ extern "C" {
+-static void ATTRIBUTE_USED __attribute__ ((regparm(3)))
++void ATTRIBUTE_USED __attribute__ ((regparm(3)))
+ invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* d)
+ {
+ for(uint32_t i = paramCount; i >0; i--, d++, s++)
diff --git a/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__asm__mips.S b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__asm__mips.S
new file mode 100644
index 00000000000..a2c4fcad180
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__asm__mips.S
@@ -0,0 +1,52 @@
+$NetBSD: patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__asm__mips.S,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.S.orig 2014-03-15 05:19:39.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.S
+@@ -14,6 +14,47 @@
+ #include <sys/asm.h>
+ #endif
+
++#ifdef __NetBSD__
++# include <machine/regdef.h>
++# include <machine/asm.h>
++# ifndef fp
++# define fp s8
++# endif
++# ifndef PTRLOG
++# if SZREG == 4
++# define PTRLOG 2
++# else
++# define PTRLOG 3
++# endif
++# endif
++# ifndef SETUP_GP
++# if defined(__mips_o32)
++# define SETUP_GP \
++ .set push; \
++ .set noreorder; \
++ .cpload t9; \
++ .set pop
++# define SAVE_GP(x) \
++ .cprestore x
++# else
++# define SETUP_GP
++# define SAVE_GP(x)
++# endif
++# endif
++# ifndef ALSZ
++# if defined(__mips_n32) || defined(__mips_n64)
++# define ALSZ 15
++# define ALMASK ~15
++# else
++# define ALSZ 7
++# define ALMASK ~7
++# endif
++# endif
++#else
++# include <sys/regdef.h>
++# include <sys/asm.h>
++#endif
++
+ # NARGSAVE is the argument space in the callers frame, including extra
+ # 'shadowed' space for the argument registers. The minimum of 4
+ # argument slots is sometimes predefined in the header files.
diff --git a/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__gcc__x86__unix.cpp b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__gcc__x86__unix.cpp
new file mode 100644
index 00000000000..56338d469b3
--- /dev/null
+++ b/www/firefox31/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__gcc__x86__unix.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__gcc__x86__unix.cpp,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp.orig 2013-05-11 19:19:56.000000000 +0000
++++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp
+@@ -10,7 +10,7 @@
+ #include "xptc_gcc_x86_unix.h"
+
+ extern "C" {
+-static nsresult ATTRIBUTE_USED
++nsresult ATTRIBUTE_USED
+ __attribute__ ((regparm (3)))
+ PrepareAndDispatch(uint32_t methodIndex, nsXPTCStubBase* self, uint32_t* args)
+ {
diff --git a/www/firefox31/patches/patch-xulrunner_installer_Makefile.in b/www/firefox31/patches/patch-xulrunner_installer_Makefile.in
new file mode 100644
index 00000000000..39d7d5d4713
--- /dev/null
+++ b/www/firefox31/patches/patch-xulrunner_installer_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-xulrunner_installer_Makefile.in,v 1.1 2014/11/03 12:18:32 ryoon Exp $
+
+* Install pkg-config pc files to package specific directory.
+
+--- xulrunner/installer/Makefile.in.orig 2013-07-30 00:59:18.000000000 +0000
++++ xulrunner/installer/Makefile.in
+@@ -96,7 +96,7 @@ endif
+
+ install:: $(pkg_config_files)
+ @echo pkg_config_file: $(pkg_config_files)
+- $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(libdir)/pkgconfig
++ $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)${PREFIX}/lib/${MOZILLA_PKG_NAME}/pkgconfig
+
+ GARBAGE += $(pkg_config_files)
+