summaryrefslogtreecommitdiff
path: root/system/evil
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-02-12 17:47:03 +0000
committerMatt A. Tobin <email@mattatobin.com>2022-02-12 14:23:18 -0600
commitf66babd8b8368ada3e5aa29cdef1c77291ee4ddd (patch)
treee3842e2a6bf19090185f9c475b3846e1bb79ac97 /system/evil
downloadGRE-f66babd8b8368ada3e5aa29cdef1c77291ee4ddd.tar.gz
Create the Goanna Runtime Environment
Diffstat (limited to 'system/evil')
-rw-r--r--system/evil/Makefile.in17
-rw-r--r--system/evil/StaticXULComponents.ld5
-rw-r--r--system/evil/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp16
-rw-r--r--system/evil/StaticXULComponentsEnd/moz.build15
-rw-r--r--system/evil/StaticXULComponentsStart.cpp6
-rw-r--r--system/evil/dependentlibs.py139
-rw-r--r--system/evil/gtest/Makefile.in35
-rw-r--r--system/evil/gtest/moz.build24
-rw-r--r--system/evil/gtest/static/moz.build8
-rw-r--r--system/evil/libxul.mk57
-rw-r--r--system/evil/libxul.so-gdb.py.in8
-rw-r--r--system/evil/moz.build274
-rw-r--r--system/evil/nsDllMain.cpp43
-rw-r--r--system/evil/symverscript.in4
-rw-r--r--system/evil/xulrunner.rc5
15 files changed, 656 insertions, 0 deletions
diff --git a/system/evil/Makefile.in b/system/evil/Makefile.in
new file mode 100644
index 000000000..638cf6060
--- /dev/null
+++ b/system/evil/Makefile.in
@@ -0,0 +1,17 @@
+# 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)/system/evil/libxul.mk
+
+include $(topsrcdir)/config/config.mk
+
+# Wrap linker to print linking status periodically to prevent the linking
+# process from getting killed
+EXPAND_LIBS_EXEC := $(PYTHON) $(topsrcdir)/config/link.py
+
+include $(topsrcdir)/config/rules.mk
+
+.PHONY: gtestxul
+gtestxul:
+ $(MAKE) -C $(DEPTH) system/evil/gtest/target LINK_GTEST=1
diff --git a/system/evil/StaticXULComponents.ld b/system/evil/StaticXULComponents.ld
new file mode 100644
index 000000000..e4fe72813
--- /dev/null
+++ b/system/evil/StaticXULComponents.ld
@@ -0,0 +1,5 @@
+SECTIONS {
+ .data.rel.ro : {
+ *(.kPStaticModules)
+ }
+}
diff --git a/system/evil/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp b/system/evil/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp
new file mode 100644
index 000000000..8b5b1f4cb
--- /dev/null
+++ b/system/evil/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp
@@ -0,0 +1,16 @@
+#include "mozilla/Module.h"
+
+/* Ensure end_kPStaticModules is at the end of the .kPStaticModules section
+ * on Windows. Somehow, placing the object last is not enough with PGO/LTCG. */
+#ifdef _MSC_VER
+/* Sections on Windows are in two parts, separated with $. When linking,
+ * sections with the same first part are all grouped, and ordered
+ * alphabetically with the second part as sort key. */
+# pragma section(".kPStaticModules$Z", read)
+# undef NSMODULE_SECTION
+# define NSMODULE_SECTION __declspec(allocate(".kPStaticModules$Z"), dllexport)
+#endif
+/* This could be null, but this needs a dummy value to ensure it actually ends
+ * up in the same section as other NSMODULE_DEFNs, instead of being moved to a
+ * separate readonly section. */
+NSMODULE_DEFN(end_kPStaticModules) = (mozilla::Module*)&NSMODULE_NAME(end_kPStaticModules);
diff --git a/system/evil/StaticXULComponentsEnd/moz.build b/system/evil/StaticXULComponentsEnd/moz.build
new file mode 100644
index 000000000..67989edd4
--- /dev/null
+++ b/system/evil/StaticXULComponentsEnd/moz.build
@@ -0,0 +1,15 @@
+# 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/.
+
+SOURCES += [
+ 'StaticXULComponentsEnd.cpp',
+]
+
+# Don't let LTO reorder StaticXULComponentsStart.o.
+if '-flto' in CONFIG['OS_CXXFLAGS']:
+ SOURCES['StaticXULComponentsEnd.cpp'].flags += ['-fno-lto']
+
+Library('StaticXULComponentsEnd')
+
+DEFINES['MOZILLA_INTERNAL_API'] = True
diff --git a/system/evil/StaticXULComponentsStart.cpp b/system/evil/StaticXULComponentsStart.cpp
new file mode 100644
index 000000000..d2e9a8828
--- /dev/null
+++ b/system/evil/StaticXULComponentsStart.cpp
@@ -0,0 +1,6 @@
+#include "mozilla/Module.h"
+
+/* This could be null, but this needs a dummy value to ensure it actually ends
+ * up in the same section as other NSMODULE_DEFNs, instead of being moved to a
+ * separate readonly section. */
+NSMODULE_DEFN(start_kPStaticModules) = (mozilla::Module*)&NSMODULE_NAME(start_kPStaticModules);
diff --git a/system/evil/dependentlibs.py b/system/evil/dependentlibs.py
new file mode 100644
index 000000000..f2135d7c3
--- /dev/null
+++ b/system/evil/dependentlibs.py
@@ -0,0 +1,139 @@
+# 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/.
+
+'''Given a library, dependentlibs.py prints the list of libraries it depends
+upon that are in the same directory, followed by the library itself.
+'''
+
+import os
+import re
+import subprocess
+import sys
+import mozpack.path as mozpath
+from collections import OrderedDict
+from mozpack.executables import (
+ get_type,
+ ELF,
+ MACHO,
+)
+from buildconfig import substs
+
+def dependentlibs_dumpbin(lib):
+ '''Returns the list of dependencies declared in the given DLL'''
+ try:
+ proc = subprocess.Popen(['dumpbin', '-dependents', lib], stdout = subprocess.PIPE)
+ except OSError:
+ # dumpbin is missing, probably mingw compilation. Try using objdump.
+ return dependentlibs_mingw_objdump(lib)
+ deps = []
+ for line in proc.stdout:
+ # Each line containing an imported library name starts with 4 spaces
+ match = re.match(' (\S+)', line)
+ if match:
+ deps.append(match.group(1))
+ elif len(deps):
+ # There may be several groups of library names, but only the
+ # first one is interesting. The second one is for delayload-ed
+ # libraries.
+ break
+ proc.wait()
+ return deps
+
+def dependentlibs_mingw_objdump(lib):
+ proc = subprocess.Popen(['objdump', '-x', lib], stdout = subprocess.PIPE)
+ deps = []
+ for line in proc.stdout:
+ match = re.match('\tDLL Name: (\S+)', line)
+ if match:
+ deps.append(match.group(1))
+ proc.wait()
+ return deps
+
+def dependentlibs_readelf(lib):
+ '''Returns the list of dependencies declared in the given ELF .so'''
+ proc = subprocess.Popen([substs.get('TOOLCHAIN_PREFIX', '') + 'readelf', '-d', lib], stdout = subprocess.PIPE)
+ deps = []
+ for line in proc.stdout:
+ # Each line has the following format:
+ # tag (TYPE) value
+ # or with BSD readelf:
+ # tag TYPE value
+ # Looking for NEEDED type entries
+ tmp = line.split(' ', 3)
+ if len(tmp) > 3 and 'NEEDED' in tmp[2]:
+ # NEEDED lines look like:
+ # 0x00000001 (NEEDED) Shared library: [libname]
+ # or with BSD readelf:
+ # 0x00000001 NEEDED Shared library: [libname]
+ match = re.search('\[(.*)\]', tmp[3])
+ if match:
+ deps.append(match.group(1))
+ proc.wait()
+ return deps
+
+def dependentlibs_otool(lib):
+ '''Returns the list of dependencies declared in the given MACH-O dylib'''
+ proc = subprocess.Popen([substs['OTOOL'], '-l', lib], stdout = subprocess.PIPE)
+ deps= []
+ cmd = None
+ for line in proc.stdout:
+ # otool -l output contains many different things. The interesting data
+ # is under "Load command n" sections, with the content:
+ # cmd LC_LOAD_DYLIB
+ # cmdsize 56
+ # name libname (offset 24)
+ tmp = line.split()
+ if len(tmp) < 2:
+ continue
+ if tmp[0] == 'cmd':
+ cmd = tmp[1]
+ elif cmd == 'LC_LOAD_DYLIB' and tmp[0] == 'name':
+ deps.append(re.sub('^@executable_path/','',tmp[1]))
+ proc.wait()
+ return deps
+
+def dependentlibs(lib, libpaths, func):
+ '''For a given library, returns the list of recursive dependencies that can
+ be found in the given list of paths, followed by the library itself.'''
+ assert(libpaths)
+ assert(isinstance(libpaths, list))
+ deps = OrderedDict()
+ for dep in func(lib):
+ if dep in deps or os.path.isabs(dep):
+ continue
+ for dir in libpaths:
+ deppath = os.path.join(dir, dep)
+ if os.path.exists(deppath):
+ deps.update(dependentlibs(deppath, libpaths, func))
+ # Black list the ICU data DLL because preloading it at startup
+ # leads to startup performance problems because of its excessive
+ # size (around 10MB).
+ if not dep.startswith("icu"):
+ deps[dep] = deppath
+ break
+
+ return deps
+
+def gen_list(output, lib):
+ libpaths = [os.path.join(substs['DIST'], 'bin')]
+ binary_type = get_type(lib)
+ if binary_type == ELF:
+ func = dependentlibs_readelf
+ elif binary_type == MACHO:
+ func = dependentlibs_otool
+ else:
+ ext = os.path.splitext(lib)[1]
+ assert(ext == '.dll')
+ func = dependentlibs_dumpbin
+
+ deps = dependentlibs(lib, libpaths, func)
+ deps[lib] = mozpath.join(libpaths[0], lib)
+ output.write('\n'.join(deps.keys()) + '\n')
+ return set(deps.values())
+
+def main():
+ gen_list(sys.stdout, sys.argv[1])
+
+if __name__ == '__main__':
+ main()
diff --git a/system/evil/gtest/Makefile.in b/system/evil/gtest/Makefile.in
new file mode 100644
index 000000000..f490b3f97
--- /dev/null
+++ b/system/evil/gtest/Makefile.in
@@ -0,0 +1,35 @@
+# 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/.
+
+# Enforce that the clean/distclean rules removes everything that needs
+# to be removed from this directory.
+ifneq (,$(filter clean distclean,$(MAKECMDGOALS)))
+LINK_GTEST = 1
+endif
+
+ifndef LINK_GTEST
+# Force to not include backend.mk unless LINK_GTEST is defined.
+# Not including backend.mk makes traversing this directory do nothing.
+STANDALONE_MAKEFILE = 1
+
+else
+
+include $(topsrcdir)/toolkit/library/libxul.mk
+
+include $(topsrcdir)/config/config.mk
+
+# Wrap linker to print linking status periodically to prevent the linking
+# process from getting killed
+EXPAND_LIBS_EXEC := $(PYTHON) $(topsrcdir)/config/link.py
+
+ifdef COMPILE_ENVIRONMENT
+target:: $(DIST)/bin/dependentlibs.list.gtest
+endif
+
+$(DIST)/bin/dependentlibs.list.gtest: $(DIST)/bin/dependentlibs.list
+ sed -e 's|$(SHARED_LIBRARY)|gtest/$(SHARED_LIBRARY)|' $< > $@
+
+LINK_PDBFILE = xul-gtest.pdb
+
+endif
diff --git a/system/evil/gtest/moz.build b/system/evil/gtest/moz.build
new file mode 100644
index 000000000..c883e0d29
--- /dev/null
+++ b/system/evil/gtest/moz.build
@@ -0,0 +1,24 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# 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/.
+
+FINAL_TARGET = 'dist/bin/gtest'
+
+USE_LIBS += [
+ 'static:xul',
+ # xul-gtest is an intermediate static library. It is used as FINAL_TARGET
+ # for gtest code.
+ # If the FINAL_TARGET were the library in this directory, then the gtest
+ # code would end up before static:xul, and before StaticXULComponentStart,
+ # which needs to stay first.
+ 'xul-gtest',
+]
+
+# This needs to come after static:xul to avoid things like libfallible coming
+# before StaticXULComponentStart.
+Libxul('xul-gtest-real')
+
+DIRS += [
+ 'static',
+]
diff --git a/system/evil/gtest/static/moz.build b/system/evil/gtest/static/moz.build
new file mode 100644
index 000000000..7c3bf050a
--- /dev/null
+++ b/system/evil/gtest/static/moz.build
@@ -0,0 +1,8 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# 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/.
+
+Library('xul-gtest')
+
+Libxul_defines()
diff --git a/system/evil/libxul.mk b/system/evil/libxul.mk
new file mode 100644
index 000000000..835c2f60c
--- /dev/null
+++ b/system/evil/libxul.mk
@@ -0,0 +1,57 @@
+# 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/.
+
+EXTRA_DEPS += $(topsrcdir)/system/evil/libxul.mk
+
+ifeq (Linux,$(OS_ARCH))
+OS_LDFLAGS += -Wl,-version-script,symverscript
+
+symverscript: $(topsrcdir)/system/evil/symverscript.in
+ $(call py_action,preprocessor, \
+ -DVERSION='xul$(MOZILLA_SYMBOLVERSION)' $< -o $@)
+
+EXTRA_DEPS += symverscript
+endif
+
+# Generate GDB pretty printer-autoload files on Linux and Solaris. OSX's GDB is
+# too old to support Python pretty-printers; if this changes, we could make
+# this 'ifdef GNU_CC'.
+ifeq (,$(filter-out SunOS Linux,$(OS_ARCH)))
+# Create a GDB Python auto-load file alongside the libxul shared library in
+# the build directory.
+PP_TARGETS += LIBXUL_AUTOLOAD
+LIBXUL_AUTOLOAD = $(topsrcdir)/system/evil/libxul.so-gdb.py.in
+LIBXUL_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
+endif
+
+ifeq ($(OS_ARCH),SunOS)
+OS_LDFLAGS += -Wl,-z,defs
+endif
+
+# BFD ld doesn't create multiple PT_LOADs as usual when an unknown section
+# exists. Using an implicit linker script to make it fold that section in
+# .data.rel.ro makes it create multiple PT_LOADs. That implicit linker
+# script however makes gold misbehave, first because it doesn't like that
+# the linker script is given after crtbegin.o, and even past that, replaces
+# the default section rules with those from the script instead of
+# supplementing them. Which leads to a lib with a huge load of sections.
+ifneq (OpenBSD,$(OS_TARGET))
+ifneq (WINNT,$(OS_TARGET))
+ifdef LD_IS_BFD
+OS_LDFLAGS += $(topsrcdir)/system/evil/StaticXULComponents.ld
+endif
+endif
+endif
+
+ifdef _MSC_VER
+get_first_and_last = dumpbin -exports $1 | grep _NSModule@@ | sort -k 3 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
+else
+get_first_and_last = $(TOOLCHAIN_PREFIX)nm -g $1 | grep _NSModule$$ | grep -vw refptr | sort | sed -n 's/^.* _*\([^ ]*\)$$/\1/;1p;$$p'
+endif
+
+LOCAL_CHECKS = test "$$($(get_first_and_last) | xargs echo)" != "start_kPStaticModules_NSModule end_kPStaticModules_NSModule" && echo "NSModules are not ordered appropriately" && exit 1 || exit 0
+
+ifeq (,$(filter-out SunOS Linux,$(OS_ARCH)))
+LOCAL_CHECKS += ; test "$$($(TOOLCHAIN_PREFIX)readelf -l $1 | awk '$1 == "LOAD" { t += 1 } END { print t }')" -le 1 && echo "Only one PT_LOAD segment" && exit 1 || exit 0
+endif
diff --git a/system/evil/libxul.so-gdb.py.in b/system/evil/libxul.so-gdb.py.in
new file mode 100644
index 000000000..dfa73f25b
--- /dev/null
+++ b/system/evil/libxul.so-gdb.py.in
@@ -0,0 +1,8 @@
+""" GDB Python customization auto-loader for libxul """
+#filter substitution
+
+import os.path
+sys.path[0:0] = [os.path.join('@topsrcdir@', 'js', 'src', 'gdb')]
+
+import mozilla.autoload
+mozilla.autoload.register(gdb.current_objfile())
diff --git a/system/evil/moz.build b/system/evil/moz.build
new file mode 100644
index 000000000..0f71103d3
--- /dev/null
+++ b/system/evil/moz.build
@@ -0,0 +1,274 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# 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/.
+
+@template
+def Libxul_defines():
+ LIBRARY_DEFINES['MOZILLA_INTERNAL_API'] = True
+ LIBRARY_DEFINES['IMPL_LIBXUL'] = True
+ if not CONFIG['JS_SHARED_LIBRARY']:
+ LIBRARY_DEFINES['STATIC_EXPORTABLE_JS_API'] = True
+
+@template
+def Libxul(name):
+ GeckoSharedLibrary(name, linkage=None)
+ SHARED_LIBRARY_NAME = 'xul'
+
+ DELAYLOAD_DLLS += [
+ 'comdlg32.dll',
+ 'netapi32.dll',
+ 'secur32.dll',
+ 'wininet.dll',
+ 'winspool.drv'
+ ]
+
+ if CONFIG['ACCESSIBILITY']:
+ DELAYLOAD_DLLS += ['oleacc.dll']
+
+ if CONFIG['OS_ARCH'] == 'WINNT':
+ DELAYLOAD_DLLS += [
+ 'api-ms-win-core-winrt-l1-1-0.dll',
+ 'api-ms-win-core-winrt-string-l1-1-0.dll',
+ ]
+
+ if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
+ LOCAL_INCLUDES += [
+ '/system/interface/windows',
+ '/xpcom/base',
+ ]
+ # config/version.mk says $(srcdir)/$(RCINCLUDE), and this needs to
+ # be valid in both system/evil and system/evil/gtest.
+ # Eventually, the make backend would do its own path canonicalization
+ # and config/version.mk would lift the $(srcdir)
+ RCINCLUDE = '$(DEPTH)/system/evil/xulrunner.rc'
+
+ Libxul_defines()
+
+ if CONFIG['MOZ_NEEDS_LIBATOMIC']:
+ OS_LIBS += ['atomic']
+
+Libxul('xul')
+
+SDK_LIBRARY = True
+
+FORCE_STATIC_LIB = True
+
+STATIC_LIBRARY_NAME = 'xul_s'
+
+SOURCES += [
+ 'StaticXULComponentsStart.cpp',
+]
+
+# This, combined with the fact the file is first, makes the start pointer
+# it contains first in Windows PGO builds.
+SOURCES['StaticXULComponentsStart.cpp'].no_pgo = True
+
+# Don't let LTO reorder StaticXULComponentsStart.o.
+if '-flto' in CONFIG['OS_CXXFLAGS']:
+ SOURCES['StaticXULComponentsStart.cpp'].flags += ['-fno-lto']
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ SOURCES += [
+ 'nsDllMain.cpp',
+ ]
+
+LOCAL_INCLUDES += [
+ '/config',
+ # need widget/windows for resource.h (included from widget.rc)
+ '/system/interface/windows',
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
+ LOCAL_INCLUDES += [
+ '/xpcom/base',
+ ]
+
+DIRS += ['gtest']
+
+# js needs to come after xul for now, because it is an archive and its content
+# is discarded when it comes first.
+USE_LIBS += [
+ 'js',
+]
+
+USE_LIBS += [
+ 'gremedia',
+ 'lgplmedia',
+ 'nspr',
+ 'nss',
+ 'sqlite',
+ 'zlib',
+]
+
+if CONFIG['USE_ICU']:
+ USE_LIBS += [
+ 'icu',
+ ]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
+ USE_LIBS += [
+ 'mozgtk_stub',
+ ]
+
+if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT'] or \
+ CONFIG['MOZ_TREE_FREETYPE']:
+ USE_LIBS += [
+ 'freetype',
+ ]
+
+if CONFIG['MOZ_WMF']:
+ OS_LIBS += [
+ 'mfuuid',
+ 'wmcodecdspuuid',
+ 'strmiids',
+ ]
+
+if CONFIG['OS_ARCH'] == 'FreeBSD':
+ OS_LIBS += [
+ 'util',
+ ]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ OS_LIBS += [
+ 'crypt32',
+ 'shell32',
+ 'ole32',
+ 'version',
+ 'winspool',
+ ]
+
+if CONFIG['OS_ARCH'] == 'Linux':
+ OS_LIBS += [
+ 'rt',
+ ]
+
+OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
+
+if CONFIG['SERVO_TARGET_DIR']:
+ if CONFIG['_MSC_VER']:
+ OS_LIBS += ['%s/geckoservo' % CONFIG['SERVO_TARGET_DIR']]
+ else:
+ OS_LIBS += ['-L%s' % CONFIG['SERVO_TARGET_DIR'], '-lgeckoservo']
+
+if CONFIG['MOZ_SYSTEM_JPEG']:
+ OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
+
+if CONFIG['MOZ_SYSTEM_HUNSPELL']:
+ OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
+
+if not CONFIG['MOZ_TREE_PIXMAN']:
+ OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']
+
+if CONFIG['MOZ_ALSA']:
+ OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
+
+if CONFIG['HAVE_CLOCK_MONOTONIC']:
+ OS_LIBS += CONFIG['REALTIME_LIBS']
+
+if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
+ OS_LIBS += [
+ 'stagefright_foundation',
+ ]
+
+OS_LIBS += CONFIG['ICONV_LIBS']
+
+if CONFIG['MOZ_SNDIO']:
+ OS_LIBS += [
+ 'sndio',
+ ]
+
+if CONFIG['MOZ_ENABLE_DBUS']:
+ OS_LIBS += CONFIG['MOZ_DBUS_GLIB_LIBS']
+
+if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
+ OS_LIBS += [l for l in CONFIG['TK_LIBS']
+ if l not in ('-lgtk-3', '-lgdk-3')]
+ else:
+ OS_LIBS += CONFIG['TK_LIBS']
+ OS_LIBS += CONFIG['XLDFLAGS']
+ OS_LIBS += CONFIG['XLIBS']
+ OS_LIBS += CONFIG['XEXT_LIBS']
+ OS_LIBS += CONFIG['MOZ_PANGO_LIBS']
+ OS_LIBS += CONFIG['XT_LIBS']
+ OS_LIBS += [
+ 'gthread-2.0',
+ ]
+
+if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
+ OS_LIBS += CONFIG['MOZ_STARTUP_NOTIFICATION_LIBS']
+
+if CONFIG['MOZ_ENABLE_LIBPROXY']:
+ OS_LIBS += CONFIG['MOZ_LIBPROXY_LIBS']
+
+if CONFIG['OS_ARCH'] == 'SunOS':
+ OS_LIBS += [
+ 'elf',
+ 'demangle',
+ 'sendfile',
+ ]
+
+if CONFIG['OS_ARCH'] == 'FreeBSD':
+ OS_LIBS += [
+ 'util',
+ ]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ OS_LIBS += [
+ 'shell32',
+ 'ole32',
+ 'version',
+ 'winspool',
+ 'comdlg32',
+ 'imm32',
+ 'msimg32',
+ 'netapi32',
+ 'shlwapi',
+ 'psapi',
+ 'ws2_32',
+ 'dbghelp',
+ 'dwmapi',
+ 'rasapi32',
+ 'rasdlg',
+ 'iphlpapi',
+ 'uxtheme',
+ 'setupapi',
+ 'secur32',
+ 'sensorsapi',
+ 'portabledeviceguids',
+ 'windowscodecs',
+ 'wininet',
+ 'wbemuuid',
+ 'wintrust',
+ 'wtsapi32',
+ 'locationapi',
+ 'sapi',
+ 'dxguid',
+ ]
+ if CONFIG['ACCESSIBILITY']:
+ OS_LIBS += [
+ 'oleacc',
+ ]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+ OS_LIBS += [
+ 'usp10',
+ 'oleaut32',
+ ]
+
+if CONFIG['COMPILE_ENVIRONMENT']:
+ full_libname = '%s%s%s' % (
+ CONFIG['DLL_PREFIX'],
+ LIBRARY_NAME,
+ CONFIG['DLL_SUFFIX']
+ )
+ GENERATED_FILES += ['dependentlibs.list']
+ GENERATED_FILES['dependentlibs.list'].script = 'dependentlibs.py:gen_list'
+ GENERATED_FILES['dependentlibs.list'].inputs = [
+ '!%s' % full_libname,
+ ]
+ FINAL_TARGET_FILES += ['!dependentlibs.list']
+
+# This library needs to be last to make XPCOM module registration work.
+USE_LIBS += ['StaticXULComponentsEnd']
diff --git a/system/evil/nsDllMain.cpp b/system/evil/nsDllMain.cpp
new file mode 100644
index 000000000..36f1630bf
--- /dev/null
+++ b/system/evil/nsDllMain.cpp
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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 <windows.h>
+#include "nsToolkit.h"
+#include "mozilla/Assertions.h"
+#include "mozilla/WindowsVersion.h"
+
+#if defined(__GNUC__)
+// If DllMain gets name mangled, it won't be seen.
+extern "C" {
+#endif
+
+BOOL APIENTRY DllMain(
+ HINSTANCE hModule,
+ DWORD reason,
+ LPVOID lpReserved )
+{
+ switch( reason ) {
+ case DLL_PROCESS_ATTACH:
+ nsToolkit::Startup((HINSTANCE)hModule);
+ break;
+
+ case DLL_THREAD_ATTACH:
+ break;
+
+ case DLL_THREAD_DETACH:
+ break;
+
+ case DLL_PROCESS_DETACH:
+ nsToolkit::Shutdown();
+ break;
+
+ }
+
+ return TRUE;
+}
+
+#if defined(__GNUC__)
+} // extern "C"
+#endif
diff --git a/system/evil/symverscript.in b/system/evil/symverscript.in
new file mode 100644
index 000000000..ef70826ad
--- /dev/null
+++ b/system/evil/symverscript.in
@@ -0,0 +1,4 @@
+#filter substitution
+@VERSION@ {
+ global: *;
+};
diff --git a/system/evil/xulrunner.rc b/system/evil/xulrunner.rc
new file mode 100644
index 000000000..7c5f276bf
--- /dev/null
+++ b/system/evil/xulrunner.rc
@@ -0,0 +1,5 @@
+/* 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 "widget.rc"