diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /config/external | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'config/external')
41 files changed, 2245 insertions, 0 deletions
diff --git a/config/external/fdlibm/moz.build b/config/external/fdlibm/moz.build new file mode 100644 index 0000000000..343645f0ce --- /dev/null +++ b/config/external/fdlibm/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +with Files("**"): + BUG_COMPONENT = ("Core", "JavaScript Engine") + +DIRS += [ + "../../../modules/fdlibm", +] diff --git a/config/external/ffi/moz.build b/config/external/ffi/moz.build new file mode 100644 index 0000000000..19c93501c1 --- /dev/null +++ b/config/external/ffi/moz.build @@ -0,0 +1,149 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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_LIBRARY = "js" + +if CONFIG["MOZ_SYSTEM_FFI"]: + OS_LIBS += CONFIG["MOZ_FFI_LIBS"] +else: + AllowCompilerWarnings() + NoVisibilityFlags() + + CONFIGURE_DEFINE_FILES += [ + "/js/src/ctypes/libffi/fficonfig.h", + ] + LOCAL_INCLUDES += [ + "!/js/src/ctypes/libffi", + "!/js/src/ctypes/libffi/include", + "/js/src/ctypes/libffi/include", + "/js/src/ctypes/libffi/src/%s" % CONFIG["FFI_TARGET_DIR"], + ] + + DEFINES["TARGET"] = CONFIG["FFI_TARGET"] + DEFINES[CONFIG["FFI_TARGET"]] = True + DEFINES["FFI_NO_RAW_API"] = True + DEFINES["FFI_BUILDING"] = True + DEFINES["HAVE_AS_ASCII_PSEUDO_OP"] = True + DEFINES["HAVE_AS_STRING_PSEUDO_OP"] = True + + if CONFIG["MOZ_DEBUG"]: + DEFINES["FFI_DEBUG"] = True + if not CONFIG["MOZ_NO_DEBUG_RTL"]: + DEFINES["USE_DEBUG_RTL"] = True + SOURCES += [ + "/js/src/ctypes/libffi/src/debug.c", + ] + + if CONFIG["OS_TARGET"] != "WINNT": + DEFINES["HAVE_HIDDEN_VISIBILITY_ATTRIBUTE"] = True + + if CONFIG["INTEL_ARCHITECTURE"]: + DEFINES["HAVE_AS_X86_PCREL"] = True + + # Don't bother setting EH_FRAME_FLAGS on Windows. + # Quoted defines confuse msvcc.sh, and the value isn't used there. + if CONFIG["OS_TARGET"] != "WINNT": + if CONFIG["FFI_TARGET"] == "ARM": + DEFINES["EH_FRAME_FLAGS"] = '"aw"' + else: + DEFINES["EH_FRAME_FLAGS"] = '"a"' + + # Common source files. + SOURCES += [ + "/js/src/ctypes/libffi/src/closures.c", + "/js/src/ctypes/libffi/src/java_raw_api.c", + "/js/src/ctypes/libffi/src/prep_cif.c", + "/js/src/ctypes/libffi/src/raw_api.c", + "/js/src/ctypes/libffi/src/types.c", + ] + + # Per-platform sources and flags. + ffi_srcs = () + ffi_h_defines = [] + if CONFIG["FFI_TARGET"] == "X86_WIN64": + if CONFIG["CC_TYPE"] == "clang-cl": + ffi_srcs = ("ffiw64.c",) + # libffi asm needs to be preprocessed for MSVC's assembler + GeneratedFile( + "win64_intel.asm", + inputs=[ + "/js/src/ctypes/libffi/src/x86/win64_intel.S", + "!/js/src/ctypes/libffi/fficonfig.h", + "!/js/src/ctypes/libffi/include/ffi.h", + ], + script="preprocess_libffi_asm.py", + flags=["$(DEFINES)", "$(LOCAL_INCLUDES)"], + ) + SOURCES += ["!win64_intel.asm"] + else: + ffi_srcs = ("ffiw64.c", "win64.S") + + elif CONFIG["FFI_TARGET"] == "X86_64": + DEFINES["HAVE_AS_X86_64_UNWIND_SECTION_TYPE"] = True + ffi_srcs = ("ffi64.c", "unix64.S", "ffiw64.c", "win64.S") + + elif CONFIG["FFI_TARGET"] == "X86_WIN32" and CONFIG["CC_TYPE"] == "clang-cl": + ffi_srcs = ("ffi.c",) + # libffi asm needs to be preprocessed for MSVC's assembler + GeneratedFile( + "sysv_intel.asm", + inputs=[ + "/js/src/ctypes/libffi/src/x86/sysv_intel.S", + "!/js/src/ctypes/libffi/fficonfig.h", + "!/js/src/ctypes/libffi/include/ffi.h", + ], + script="preprocess_libffi_asm.py", + flags=["$(DEFINES)", "$(LOCAL_INCLUDES)"], + ) + SOURCES += ["!sysv_intel.asm"] + ASFLAGS += ["-safeseh"] + + elif CONFIG["FFI_TARGET"] == "ARM_WIN64": + ffi_srcs = ("ffi.c",) + + # libffi asm needs to be preprocessed for MSVC's assembler + GeneratedFile( + "win64_armasm.asm", + inputs=[ + "/js/src/ctypes/libffi/src/aarch64/win64_armasm.S", + "!/js/src/ctypes/libffi/fficonfig.h", + "!/js/src/ctypes/libffi/include/ffi.h", + ], + script="preprocess_libffi_asm.py", + flags=["$(DEFINES)", "$(LOCAL_INCLUDES)"], + ) + SOURCES += ["!win64_armasm.asm"] + + else: + ffi_srcs = ("ffi.c", "sysv.S") + + if CONFIG["FFI_TARGET"] in ("X86_WIN32", "X86_DARWIN") and CONFIG["CC_TYPE"] in ( + "gcc", + "clang", + ): + DEFINES["SYMBOL_UNDERSCORE"] = True + + if CONFIG["OS_ARCH"] == "Darwin" and CONFIG["CPU_ARCH"] in ("arm", "aarch64"): + DEFINES["FFI_EXEC_TRAMPOLINE_TABLE"] = True + ffi_h_defines.append("FFI_EXEC_TRAMPOLINE_TABLE") + + elif ( + CONFIG["OS_ARCH"] in ("Darwin", "FreeBSD", "GNU_kFreeBSD", "OpenBSD", "SunOS") + or CONFIG["OS_TARGET"] == "Android" + ): + DEFINES["FFI_MMAP_EXEC_WRIT"] = True + + SOURCES += [ + "/js/src/ctypes/libffi/src/%s/%s" % (CONFIG["FFI_TARGET_DIR"], s) + for s in sorted(ffi_srcs) + ] + + GeneratedFile( + "/js/src/ctypes/libffi/include/ffi.h", + script="subst_header.py", + inputs=["/js/src/ctypes/libffi/include/ffi.h.in"], + flags=ffi_h_defines, + ) diff --git a/config/external/ffi/preprocess_libffi_asm.py b/config/external/ffi/preprocess_libffi_asm.py new file mode 100644 index 0000000000..4808c3a7e4 --- /dev/null +++ b/config/external/ffi/preprocess_libffi_asm.py @@ -0,0 +1,25 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Souce Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distibuted with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import os +import shlex +import subprocess + +import buildconfig +import mozpack.path as mozpath + + +def main(output, input_asm, ffi_h, ffi_config_h, defines, includes): + defines = shlex.split(defines) + includes = shlex.split(includes) + # CPP uses -E which generates #line directives. -EP suppresses them. + # -TC forces the compiler to treat the input as C. + cpp = buildconfig.substs["CPP"] + ["-EP"] + ["-TC"] + input_asm = mozpath.relpath(input_asm, os.getcwd()) + args = cpp + defines + includes + [input_asm] + print(" ".join(args)) + preprocessed = subprocess.check_output(args) + output.write(preprocessed) diff --git a/config/external/ffi/subst_header.py b/config/external/ffi/subst_header.py new file mode 100644 index 0000000000..e1448ff889 --- /dev/null +++ b/config/external/ffi/subst_header.py @@ -0,0 +1,32 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Souce Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distibuted with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import sys + +import buildconfig +from mozbuild.preprocessor import Preprocessor + + +def main(output, input_file, *defines): + pp = Preprocessor() + pp.context.update( + { + "FFI_EXEC_TRAMPOLINE_TABLE": "0", + "HAVE_LONG_DOUBLE": "0", + "TARGET": buildconfig.substs["FFI_TARGET"], + "VERSION": "", + } + ) + for d in defines: + pp.context.update({d: "1"}) + pp.do_filter("substitution") + pp.setMarker(None) + pp.out = output + pp.do_include(input_file) + + +if __name__ == "__main__": + main(*sys.agv[1:]) diff --git a/config/external/freetype2/moz.build b/config/external/freetype2/moz.build new file mode 100644 index 0000000000..3d025e1ee4 --- /dev/null +++ b/config/external/freetype2/moz.build @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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("freetype") + +if CONFIG["MOZ_TREE_FREETYPE"]: + DIRS += [ + "/modules/freetype2", + ] +else: + OS_LIBS += CONFIG["FT2_LIBS"] diff --git a/config/external/icu/common/moz.build b/config/external/icu/common/moz.build new file mode 100644 index 0000000000..b670c06222 --- /dev/null +++ b/config/external/icu/common/moz.build @@ -0,0 +1,34 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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("icuuc") +FINAL_LIBRARY = "icu" + +DEFINES["U_COMMON_IMPLEMENTATION"] = True + +LOCAL_INCLUDES += ["/intl/icu/source/i18n"] + +include("../defs.mozbuild") +include("sources.mozbuild") + +SOURCES += sources + +if CONFIG["TARGET_ENDIANNESS"] == "big": + HostLibrary("host_icuuc") + HOST_DEFINES["U_COMMON_IMPLEMENTATION"] = True + HOST_SOURCES += sources + HOST_SOURCES += other_sources + +# Clang 16 added an error that can be downgraded, but won't be downgradable +# in clang 17. +# https://unicode-org.atlassian.net/browse/ICU-22113 +if ( + CONFIG["CC_TYPE"] in ("clang", "clang-cl") + and int(CONFIG["CC_VERSION"].split(".")[0]) == 16 +): + SOURCES["/intl/icu/source/common/ubidi.cpp"].flags += [ + "-Wno-error=enum-constexpr-conversion" + ] diff --git a/config/external/icu/common/sources.mozbuild b/config/external/icu/common/sources.mozbuild new file mode 100644 index 0000000000..5ffd366683 --- /dev/null +++ b/config/external/icu/common/sources.mozbuild @@ -0,0 +1,305 @@ +# THIS FILE IS GENERATED BY /intl/icu_sources_data.py DO NOT EDIT +sources = [ + '/intl/icu/source/common/appendable.cpp', + '/intl/icu/source/common/bmpset.cpp', + '/intl/icu/source/common/brkeng.cpp', + '/intl/icu/source/common/brkiter.cpp', + '/intl/icu/source/common/bytesinkutil.cpp', + '/intl/icu/source/common/bytestream.cpp', + '/intl/icu/source/common/bytestrie.cpp', + '/intl/icu/source/common/bytestriebuilder.cpp', + '/intl/icu/source/common/caniter.cpp', + '/intl/icu/source/common/characterproperties.cpp', + '/intl/icu/source/common/chariter.cpp', + '/intl/icu/source/common/charstr.cpp', + '/intl/icu/source/common/cmemory.cpp', + '/intl/icu/source/common/cstring.cpp', + '/intl/icu/source/common/dictbe.cpp', + '/intl/icu/source/common/dictionarydata.cpp', + '/intl/icu/source/common/dtintrv.cpp', + '/intl/icu/source/common/edits.cpp', + '/intl/icu/source/common/emojiprops.cpp', + '/intl/icu/source/common/errorcode.cpp', + '/intl/icu/source/common/filteredbrk.cpp', + '/intl/icu/source/common/filterednormalizer2.cpp', + '/intl/icu/source/common/loadednormalizer2impl.cpp', + '/intl/icu/source/common/localebuilder.cpp', + '/intl/icu/source/common/localematcher.cpp', + '/intl/icu/source/common/localeprioritylist.cpp', + '/intl/icu/source/common/locavailable.cpp', + '/intl/icu/source/common/locbased.cpp', + '/intl/icu/source/common/locdispnames.cpp', + '/intl/icu/source/common/locdistance.cpp', + '/intl/icu/source/common/locdspnm.cpp', + '/intl/icu/source/common/locid.cpp', + '/intl/icu/source/common/loclikely.cpp', + '/intl/icu/source/common/loclikelysubtags.cpp', + '/intl/icu/source/common/locmap.cpp', + '/intl/icu/source/common/locresdata.cpp', + '/intl/icu/source/common/locutil.cpp', + '/intl/icu/source/common/lsr.cpp', + '/intl/icu/source/common/lstmbe.cpp', + '/intl/icu/source/common/messagepattern.cpp', + '/intl/icu/source/common/mlbe.cpp', + '/intl/icu/source/common/normalizer2.cpp', + '/intl/icu/source/common/normalizer2impl.cpp', + '/intl/icu/source/common/normlzr.cpp', + '/intl/icu/source/common/parsepos.cpp', + '/intl/icu/source/common/patternprops.cpp', + '/intl/icu/source/common/propname.cpp', + '/intl/icu/source/common/punycode.cpp', + '/intl/icu/source/common/putil.cpp', + '/intl/icu/source/common/rbbi.cpp', + '/intl/icu/source/common/rbbi_cache.cpp', + '/intl/icu/source/common/rbbidata.cpp', + '/intl/icu/source/common/rbbinode.cpp', + '/intl/icu/source/common/rbbirb.cpp', + '/intl/icu/source/common/rbbiscan.cpp', + '/intl/icu/source/common/rbbisetb.cpp', + '/intl/icu/source/common/rbbistbl.cpp', + '/intl/icu/source/common/rbbitblb.cpp', + '/intl/icu/source/common/resbund.cpp', + '/intl/icu/source/common/resource.cpp', + '/intl/icu/source/common/restrace.cpp', + '/intl/icu/source/common/ruleiter.cpp', + '/intl/icu/source/common/schriter.cpp', + '/intl/icu/source/common/serv.cpp', + '/intl/icu/source/common/servlk.cpp', + '/intl/icu/source/common/servlkf.cpp', + '/intl/icu/source/common/servls.cpp', + '/intl/icu/source/common/servnotf.cpp', + '/intl/icu/source/common/servrbf.cpp', + '/intl/icu/source/common/servslkf.cpp', + '/intl/icu/source/common/sharedobject.cpp', + '/intl/icu/source/common/simpleformatter.cpp', + '/intl/icu/source/common/static_unicode_sets.cpp', + '/intl/icu/source/common/stringpiece.cpp', + '/intl/icu/source/common/stringtriebuilder.cpp', + '/intl/icu/source/common/uarrsort.cpp', + '/intl/icu/source/common/ubidi.cpp', + '/intl/icu/source/common/ubidi_props.cpp', + '/intl/icu/source/common/ubidiln.cpp', + '/intl/icu/source/common/ubidiwrt.cpp', + '/intl/icu/source/common/ubrk.cpp', + '/intl/icu/source/common/ucase.cpp', + '/intl/icu/source/common/ucasemap.cpp', + '/intl/icu/source/common/ucasemap_titlecase_brkiter.cpp', + '/intl/icu/source/common/uchar.cpp', + '/intl/icu/source/common/ucharstrie.cpp', + '/intl/icu/source/common/ucharstriebuilder.cpp', + '/intl/icu/source/common/ucharstrieiterator.cpp', + '/intl/icu/source/common/uchriter.cpp', + '/intl/icu/source/common/ucln_cmn.cpp', + '/intl/icu/source/common/ucmndata.cpp', + '/intl/icu/source/common/ucnv.cpp', + '/intl/icu/source/common/ucnv_bld.cpp', + '/intl/icu/source/common/ucnv_cb.cpp', + '/intl/icu/source/common/ucnv_cnv.cpp', + '/intl/icu/source/common/ucnv_err.cpp', + '/intl/icu/source/common/ucnv_io.cpp', + '/intl/icu/source/common/ucnv_u16.cpp', + '/intl/icu/source/common/ucnv_u32.cpp', + '/intl/icu/source/common/ucnv_u7.cpp', + '/intl/icu/source/common/ucnv_u8.cpp', + '/intl/icu/source/common/ucnvbocu.cpp', + '/intl/icu/source/common/ucnvlat1.cpp', + '/intl/icu/source/common/ucnvscsu.cpp', + '/intl/icu/source/common/ucol_swp.cpp', + '/intl/icu/source/common/ucptrie.cpp', + '/intl/icu/source/common/ucurr.cpp', + '/intl/icu/source/common/udata.cpp', + '/intl/icu/source/common/udatamem.cpp', + '/intl/icu/source/common/udataswp.cpp', + '/intl/icu/source/common/uenum.cpp', + '/intl/icu/source/common/uhash.cpp', + '/intl/icu/source/common/uhash_us.cpp', + '/intl/icu/source/common/uinit.cpp', + '/intl/icu/source/common/uinvchar.cpp', + '/intl/icu/source/common/uiter.cpp', + '/intl/icu/source/common/ulist.cpp', + '/intl/icu/source/common/uloc.cpp', + '/intl/icu/source/common/uloc_keytype.cpp', + '/intl/icu/source/common/uloc_tag.cpp', + '/intl/icu/source/common/umapfile.cpp', + '/intl/icu/source/common/umath.cpp', + '/intl/icu/source/common/umutablecptrie.cpp', + '/intl/icu/source/common/umutex.cpp', + '/intl/icu/source/common/unames.cpp', + '/intl/icu/source/common/unifiedcache.cpp', + '/intl/icu/source/common/unifilt.cpp', + '/intl/icu/source/common/unifunct.cpp', + '/intl/icu/source/common/uniset.cpp', + '/intl/icu/source/common/uniset_closure.cpp', + '/intl/icu/source/common/uniset_props.cpp', + '/intl/icu/source/common/unisetspan.cpp', + '/intl/icu/source/common/unistr.cpp', + '/intl/icu/source/common/unistr_case.cpp', + '/intl/icu/source/common/unistr_case_locale.cpp', + '/intl/icu/source/common/unistr_cnv.cpp', + '/intl/icu/source/common/unistr_props.cpp', + '/intl/icu/source/common/unistr_titlecase_brkiter.cpp', + '/intl/icu/source/common/unormcmp.cpp', + '/intl/icu/source/common/uobject.cpp', + '/intl/icu/source/common/uprops.cpp', + '/intl/icu/source/common/uresbund.cpp', + '/intl/icu/source/common/uresdata.cpp', + '/intl/icu/source/common/uscript.cpp', + '/intl/icu/source/common/uscript_props.cpp', + '/intl/icu/source/common/uset.cpp', + '/intl/icu/source/common/uset_props.cpp', + '/intl/icu/source/common/usetiter.cpp', + '/intl/icu/source/common/usprep.cpp', + '/intl/icu/source/common/ustack.cpp', + '/intl/icu/source/common/ustr_cnv.cpp', + '/intl/icu/source/common/ustr_titlecase_brkiter.cpp', + '/intl/icu/source/common/ustrcase.cpp', + '/intl/icu/source/common/ustrcase_locale.cpp', + '/intl/icu/source/common/ustrenum.cpp', + '/intl/icu/source/common/ustrfmt.cpp', + '/intl/icu/source/common/ustring.cpp', + '/intl/icu/source/common/ustrtrns.cpp', + '/intl/icu/source/common/utext.cpp', + '/intl/icu/source/common/utf_impl.cpp', + '/intl/icu/source/common/util.cpp', + '/intl/icu/source/common/utrace.cpp', + '/intl/icu/source/common/utrie.cpp', + '/intl/icu/source/common/utrie2.cpp', + '/intl/icu/source/common/utrie2_builder.cpp', + '/intl/icu/source/common/utrie_swap.cpp', + '/intl/icu/source/common/uts46.cpp', + '/intl/icu/source/common/utypes.cpp', + '/intl/icu/source/common/uvector.cpp', + '/intl/icu/source/common/uvectr32.cpp', + '/intl/icu/source/common/uvectr64.cpp', + '/intl/icu/source/common/wintz.cpp', +] +other_sources = [ + '/intl/icu/source/common/bytestrieiterator.cpp', + '/intl/icu/source/common/cstr.cpp', + '/intl/icu/source/common/cwchar.cpp', + '/intl/icu/source/common/icudataver.cpp', + '/intl/icu/source/common/icuplug.cpp', + '/intl/icu/source/common/pluralmap.cpp', + '/intl/icu/source/common/propsvec.cpp', + '/intl/icu/source/common/resbund_cnv.cpp', + '/intl/icu/source/common/ubiditransform.cpp', + '/intl/icu/source/common/ucat.cpp', + '/intl/icu/source/common/ucnv2022.cpp', + '/intl/icu/source/common/ucnv_ct.cpp', + '/intl/icu/source/common/ucnv_ext.cpp', + '/intl/icu/source/common/ucnv_lmb.cpp', + '/intl/icu/source/common/ucnv_set.cpp', + '/intl/icu/source/common/ucnvdisp.cpp', + '/intl/icu/source/common/ucnvhz.cpp', + '/intl/icu/source/common/ucnvisci.cpp', + '/intl/icu/source/common/ucnvmbcs.cpp', + '/intl/icu/source/common/ucnvsel.cpp', + '/intl/icu/source/common/uidna.cpp', + '/intl/icu/source/common/unorm.cpp', + '/intl/icu/source/common/ures_cnv.cpp', + '/intl/icu/source/common/usc_impl.cpp', + '/intl/icu/source/common/ushape.cpp', + '/intl/icu/source/common/ustr_wcs.cpp', + '/intl/icu/source/common/util_props.cpp', +] +EXPORTS.unicode += [ + '/intl/icu/source/common/unicode/appendable.h', + '/intl/icu/source/common/unicode/brkiter.h', + '/intl/icu/source/common/unicode/bytestream.h', + '/intl/icu/source/common/unicode/bytestrie.h', + '/intl/icu/source/common/unicode/bytestriebuilder.h', + '/intl/icu/source/common/unicode/caniter.h', + '/intl/icu/source/common/unicode/casemap.h', + '/intl/icu/source/common/unicode/char16ptr.h', + '/intl/icu/source/common/unicode/chariter.h', + '/intl/icu/source/common/unicode/dbbi.h', + '/intl/icu/source/common/unicode/docmain.h', + '/intl/icu/source/common/unicode/dtintrv.h', + '/intl/icu/source/common/unicode/edits.h', + '/intl/icu/source/common/unicode/enumset.h', + '/intl/icu/source/common/unicode/errorcode.h', + '/intl/icu/source/common/unicode/filteredbrk.h', + '/intl/icu/source/common/unicode/icudataver.h', + '/intl/icu/source/common/unicode/icuplug.h', + '/intl/icu/source/common/unicode/idna.h', + '/intl/icu/source/common/unicode/localebuilder.h', + '/intl/icu/source/common/unicode/localematcher.h', + '/intl/icu/source/common/unicode/localpointer.h', + '/intl/icu/source/common/unicode/locdspnm.h', + '/intl/icu/source/common/unicode/locid.h', + '/intl/icu/source/common/unicode/messagepattern.h', + '/intl/icu/source/common/unicode/normalizer2.h', + '/intl/icu/source/common/unicode/normlzr.h', + '/intl/icu/source/common/unicode/parseerr.h', + '/intl/icu/source/common/unicode/parsepos.h', + '/intl/icu/source/common/unicode/platform.h', + '/intl/icu/source/common/unicode/ptypes.h', + '/intl/icu/source/common/unicode/putil.h', + '/intl/icu/source/common/unicode/rbbi.h', + '/intl/icu/source/common/unicode/rep.h', + '/intl/icu/source/common/unicode/resbund.h', + '/intl/icu/source/common/unicode/schriter.h', + '/intl/icu/source/common/unicode/simpleformatter.h', + '/intl/icu/source/common/unicode/std_string.h', + '/intl/icu/source/common/unicode/strenum.h', + '/intl/icu/source/common/unicode/stringoptions.h', + '/intl/icu/source/common/unicode/stringpiece.h', + '/intl/icu/source/common/unicode/stringtriebuilder.h', + '/intl/icu/source/common/unicode/symtable.h', + '/intl/icu/source/common/unicode/ubidi.h', + '/intl/icu/source/common/unicode/ubiditransform.h', + '/intl/icu/source/common/unicode/ubrk.h', + '/intl/icu/source/common/unicode/ucasemap.h', + '/intl/icu/source/common/unicode/ucat.h', + '/intl/icu/source/common/unicode/uchar.h', + '/intl/icu/source/common/unicode/ucharstrie.h', + '/intl/icu/source/common/unicode/ucharstriebuilder.h', + '/intl/icu/source/common/unicode/uchriter.h', + '/intl/icu/source/common/unicode/uclean.h', + '/intl/icu/source/common/unicode/ucnv.h', + '/intl/icu/source/common/unicode/ucnv_cb.h', + '/intl/icu/source/common/unicode/ucnv_err.h', + '/intl/icu/source/common/unicode/ucnvsel.h', + '/intl/icu/source/common/unicode/uconfig.h', + '/intl/icu/source/common/unicode/ucpmap.h', + '/intl/icu/source/common/unicode/ucptrie.h', + '/intl/icu/source/common/unicode/ucurr.h', + '/intl/icu/source/common/unicode/udata.h', + '/intl/icu/source/common/unicode/udisplaycontext.h', + '/intl/icu/source/common/unicode/uenum.h', + '/intl/icu/source/common/unicode/uidna.h', + '/intl/icu/source/common/unicode/uiter.h', + '/intl/icu/source/common/unicode/uldnames.h', + '/intl/icu/source/common/unicode/uloc.h', + '/intl/icu/source/common/unicode/umachine.h', + '/intl/icu/source/common/unicode/umisc.h', + '/intl/icu/source/common/unicode/umutablecptrie.h', + '/intl/icu/source/common/unicode/unifilt.h', + '/intl/icu/source/common/unicode/unifunct.h', + '/intl/icu/source/common/unicode/unimatch.h', + '/intl/icu/source/common/unicode/uniset.h', + '/intl/icu/source/common/unicode/unistr.h', + '/intl/icu/source/common/unicode/unorm.h', + '/intl/icu/source/common/unicode/unorm2.h', + '/intl/icu/source/common/unicode/uobject.h', + '/intl/icu/source/common/unicode/urename.h', + '/intl/icu/source/common/unicode/urep.h', + '/intl/icu/source/common/unicode/ures.h', + '/intl/icu/source/common/unicode/uscript.h', + '/intl/icu/source/common/unicode/uset.h', + '/intl/icu/source/common/unicode/usetiter.h', + '/intl/icu/source/common/unicode/ushape.h', + '/intl/icu/source/common/unicode/usprep.h', + '/intl/icu/source/common/unicode/ustring.h', + '/intl/icu/source/common/unicode/ustringtrie.h', + '/intl/icu/source/common/unicode/utext.h', + '/intl/icu/source/common/unicode/utf.h', + '/intl/icu/source/common/unicode/utf16.h', + '/intl/icu/source/common/unicode/utf32.h', + '/intl/icu/source/common/unicode/utf8.h', + '/intl/icu/source/common/unicode/utf_old.h', + '/intl/icu/source/common/unicode/utrace.h', + '/intl/icu/source/common/unicode/utypes.h', + '/intl/icu/source/common/unicode/uvernum.h', + '/intl/icu/source/common/unicode/uversion.h', +] diff --git a/config/external/icu/data/convert_icudata.py b/config/external/icu/data/convert_icudata.py new file mode 100644 index 0000000000..b09affb9d8 --- /dev/null +++ b/config/external/icu/data/convert_icudata.py @@ -0,0 +1,20 @@ +# 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/. + +import os +import subprocess + +import buildconfig + + +def main(output, data_file): + output.close() + subprocess.run( + [ + os.path.join(buildconfig.topobjdir, "dist", "host", "bin", "icupkg"), + "-tb", + data_file, + output.name, + ] + ) diff --git a/config/external/icu/data/icu_data.S b/config/external/icu/data/icu_data.S new file mode 100644 index 0000000000..6ca4ce5973 --- /dev/null +++ b/config/external/icu/data/icu_data.S @@ -0,0 +1,29 @@ +/* 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/. */ + +#if defined(_WIN32) && defined(__i386__) +// Mark the object as SAFESEH-enabled. +.def @feat.00; +.scl 3; +.type 0; +.endef +.global @feat.00 +.set @feat.00, 1 +#endif + +.global ICU_DATA_SYMBOL +#if defined(__APPLE__) +.data +.const +#elif defined(__wasi__) +.section .rodata,"",@ +#else +.section .rodata +#endif +.balign 16 +ICU_DATA_SYMBOL: +.incbin ICU_DATA_FILE +#ifdef __wasi__ +.size ICU_DATA_SYMBOL, . - ICU_DATA_SYMBOL +#endif diff --git a/config/external/icu/data/icudt73l.dat b/config/external/icu/data/icudt73l.dat Binary files differnew file mode 100644 index 0000000000..b2780e7c75 --- /dev/null +++ b/config/external/icu/data/icudt73l.dat diff --git a/config/external/icu/data/moz.build b/config/external/icu/data/moz.build new file mode 100644 index 0000000000..715f73550d --- /dev/null +++ b/config/external/icu/data/moz.build @@ -0,0 +1,40 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +# Build a library containing the ICU data for use in the JS shell, so that +# JSAPI consumers don't have to deal with setting ICU's data path. +Library("icudata") + +LOCAL_INCLUDES += ["."] + +prefix = "" +if (CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CPU_ARCH"] == "x86") or CONFIG[ + "OS_ARCH" +] == "Darwin": + prefix = "_" + +data_file = { + "little": "icudt%sl.dat" % CONFIG["MOZ_ICU_VERSION"], + "big": "icudt%sb.dat" % CONFIG["MOZ_ICU_VERSION"], +} +data_dir = { + "little": SRCDIR, + "big": OBJDIR, +} +endianness = CONFIG["TARGET_ENDIANNESS"] or "little" +DEFINES["ICU_DATA_FILE"] = '"%s/%s"' % (data_dir[endianness], data_file[endianness]) +DEFINES["ICU_DATA_SYMBOL"] = "%sicudt%s_dat" % (prefix, CONFIG["MOZ_ICU_VERSION"]) +SOURCES += [ + "icu_data.S", +] + +if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] == "clang-cl": + USE_INTEGRATED_CLANGCL_AS = True + +if CONFIG["TARGET_ENDIANNESS"] == "big": + GeneratedFile( + data_file["big"], script="convert_icudata.py", inputs=[data_file["little"]] + ) diff --git a/config/external/icu/defs.mozbuild b/config/external/icu/defs.mozbuild new file mode 100644 index 0000000000..bcb9f3b301 --- /dev/null +++ b/config/external/icu/defs.mozbuild @@ -0,0 +1,74 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +# Also see <http://www.icu-project.org/repos/icu/tags/latest/icu4c/readme.html#RecBuild> for the +# recommended build options when compiling ICU. +# Don't use icu namespace automatically in client code. +DEFINES['U_USING_ICU_NAMESPACE'] = 0 +# Don't include obsolete header files. +DEFINES['U_NO_DEFAULT_INCLUDE_UTF_HEADERS'] = 1 +DEFINES['U_HIDE_OBSOLETE_UTF_OLD_H'] = 1 + +# Remove chunks of the library that we don't need (yet). +DEFINES['UCONFIG_NO_LEGACY_CONVERSION'] = True +DEFINES['UCONFIG_NO_TRANSLITERATION'] = True +DEFINES['UCONFIG_NO_REGULAR_EXPRESSIONS'] = True + +# We don't need to pass data to and from legacy char* APIs. +DEFINES['U_CHARSET_IS_UTF8'] = True + +# Add 'explicit' keyword to UnicodeString constructors. +DEFINES['UNISTR_FROM_CHAR_EXPLICIT'] = "explicit" +DEFINES['UNISTR_FROM_STRING_EXPLICIT'] = "explicit" + +# Disable dynamic loading of ICU data as a loadable library. +DEFINES['U_ENABLE_DYLOAD'] = 0 + +if not CONFIG['HAVE_LANGINFO_CODESET']: + DEFINES['U_HAVE_NL_LANGINFO_CODESET'] = 0 + +if CONFIG['MOZ_DEBUG']: + DEFINES['U_DEBUG'] = 1 + +# ICU requires RTTI +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-frtti'] +elif CONFIG['OS_TARGET'] == 'WINNT': + # Remove the -GR- flag so we don't get a bunch of warning spam. + COMPILE_FLAGS['OS_CXXFLAGS'] = [ + f for f in COMPILE_FLAGS['OS_CXXFLAGS'] if f != '-GR-' + ] + ['-GR'] + +DisableStlWrapping() +AllowCompilerWarnings() + +# We allow compiler warnings, but we can at least cut down on spammy +# warnings that get triggered for every file. +if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): + CFLAGS += [ + '-Wno-c++20-compat', + '-Wno-comma', + '-Wno-implicit-const-int-float-conversion', + '-Wno-macro-redefined', + '-Wno-microsoft-include', + '-Wno-tautological-unsigned-enum-zero-compare', + '-Wno-unreachable-code-loop-increment', + '-Wno-unreachable-code-return', + ] + CXXFLAGS += [ + '-Wno-c++20-compat', + '-Wno-comma', + '-Wno-implicit-const-int-float-conversion', + '-Wno-macro-redefined', + '-Wno-microsoft-include', + '-Wno-tautological-unsigned-enum-zero-compare', + '-Wno-unreachable-code-loop-increment', + '-Wno-unreachable-code-return', + ] + +for k, v in DEFINES.items(): + if k != 'UCONFIG_NO_LEGACY_CONVERSION': + HOST_DEFINES[k] = v diff --git a/config/external/icu/i18n/moz.build b/config/external/icu/i18n/moz.build new file mode 100644 index 0000000000..07adbcc7a1 --- /dev/null +++ b/config/external/icu/i18n/moz.build @@ -0,0 +1,23 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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("icui18n") +FINAL_LIBRARY = "icu" + +DEFINES["U_I18N_IMPLEMENTATION"] = True + +LOCAL_INCLUDES += ["/intl/icu/source/common"] + +include("../defs.mozbuild") +include("sources.mozbuild") + +SOURCES += sources + +if CONFIG["TARGET_ENDIANNESS"] == "big": + HostLibrary("host_icui18n") + HOST_DEFINES["U_I18N_IMPLEMENTATION"] = True + HOST_SOURCES += sources + HOST_SOURCES += other_sources diff --git a/config/external/icu/i18n/sources.mozbuild b/config/external/icu/i18n/sources.mozbuild new file mode 100644 index 0000000000..676c808eef --- /dev/null +++ b/config/external/icu/i18n/sources.mozbuild @@ -0,0 +1,344 @@ +# THIS FILE IS GENERATED BY /intl/icu_sources_data.py DO NOT EDIT +sources = [ + '/intl/icu/source/i18n/astro.cpp', + '/intl/icu/source/i18n/basictz.cpp', + '/intl/icu/source/i18n/bocsu.cpp', + '/intl/icu/source/i18n/buddhcal.cpp', + '/intl/icu/source/i18n/calendar.cpp', + '/intl/icu/source/i18n/cecal.cpp', + '/intl/icu/source/i18n/chnsecal.cpp', + '/intl/icu/source/i18n/choicfmt.cpp', + '/intl/icu/source/i18n/coleitr.cpp', + '/intl/icu/source/i18n/coll.cpp', + '/intl/icu/source/i18n/collation.cpp', + '/intl/icu/source/i18n/collationbuilder.cpp', + '/intl/icu/source/i18n/collationcompare.cpp', + '/intl/icu/source/i18n/collationdata.cpp', + '/intl/icu/source/i18n/collationdatabuilder.cpp', + '/intl/icu/source/i18n/collationdatareader.cpp', + '/intl/icu/source/i18n/collationdatawriter.cpp', + '/intl/icu/source/i18n/collationfastlatin.cpp', + '/intl/icu/source/i18n/collationfastlatinbuilder.cpp', + '/intl/icu/source/i18n/collationfcd.cpp', + '/intl/icu/source/i18n/collationiterator.cpp', + '/intl/icu/source/i18n/collationkeys.cpp', + '/intl/icu/source/i18n/collationroot.cpp', + '/intl/icu/source/i18n/collationrootelements.cpp', + '/intl/icu/source/i18n/collationruleparser.cpp', + '/intl/icu/source/i18n/collationsets.cpp', + '/intl/icu/source/i18n/collationsettings.cpp', + '/intl/icu/source/i18n/collationtailoring.cpp', + '/intl/icu/source/i18n/collationweights.cpp', + '/intl/icu/source/i18n/compactdecimalformat.cpp', + '/intl/icu/source/i18n/coptccal.cpp', + '/intl/icu/source/i18n/curramt.cpp', + '/intl/icu/source/i18n/currfmt.cpp', + '/intl/icu/source/i18n/currpinf.cpp', + '/intl/icu/source/i18n/currunit.cpp', + '/intl/icu/source/i18n/dangical.cpp', + '/intl/icu/source/i18n/datefmt.cpp', + '/intl/icu/source/i18n/dayperiodrules.cpp', + '/intl/icu/source/i18n/dcfmtsym.cpp', + '/intl/icu/source/i18n/decContext.cpp', + '/intl/icu/source/i18n/decimfmt.cpp', + '/intl/icu/source/i18n/decNumber.cpp', + '/intl/icu/source/i18n/displayoptions.cpp', + '/intl/icu/source/i18n/double-conversion-bignum-dtoa.cpp', + '/intl/icu/source/i18n/double-conversion-bignum.cpp', + '/intl/icu/source/i18n/double-conversion-cached-powers.cpp', + '/intl/icu/source/i18n/double-conversion-double-to-string.cpp', + '/intl/icu/source/i18n/double-conversion-fast-dtoa.cpp', + '/intl/icu/source/i18n/double-conversion-string-to-double.cpp', + '/intl/icu/source/i18n/double-conversion-strtod.cpp', + '/intl/icu/source/i18n/dtfmtsym.cpp', + '/intl/icu/source/i18n/dtitvfmt.cpp', + '/intl/icu/source/i18n/dtitvinf.cpp', + '/intl/icu/source/i18n/dtptngen.cpp', + '/intl/icu/source/i18n/dtrule.cpp', + '/intl/icu/source/i18n/erarules.cpp', + '/intl/icu/source/i18n/ethpccal.cpp', + '/intl/icu/source/i18n/fmtable.cpp', + '/intl/icu/source/i18n/format.cpp', + '/intl/icu/source/i18n/formatted_string_builder.cpp', + '/intl/icu/source/i18n/formattedval_iterimpl.cpp', + '/intl/icu/source/i18n/formattedval_sbimpl.cpp', + '/intl/icu/source/i18n/formattedvalue.cpp', + '/intl/icu/source/i18n/fphdlimp.cpp', + '/intl/icu/source/i18n/fpositer.cpp', + '/intl/icu/source/i18n/gregocal.cpp', + '/intl/icu/source/i18n/gregoimp.cpp', + '/intl/icu/source/i18n/hebrwcal.cpp', + '/intl/icu/source/i18n/indiancal.cpp', + '/intl/icu/source/i18n/islamcal.cpp', + '/intl/icu/source/i18n/iso8601cal.cpp', + '/intl/icu/source/i18n/japancal.cpp', + '/intl/icu/source/i18n/listformatter.cpp', + '/intl/icu/source/i18n/measfmt.cpp', + '/intl/icu/source/i18n/measunit.cpp', + '/intl/icu/source/i18n/measunit_extra.cpp', + '/intl/icu/source/i18n/measure.cpp', + '/intl/icu/source/i18n/msgfmt.cpp', + '/intl/icu/source/i18n/nfrs.cpp', + '/intl/icu/source/i18n/nfrule.cpp', + '/intl/icu/source/i18n/nfsubs.cpp', + '/intl/icu/source/i18n/number_affixutils.cpp', + '/intl/icu/source/i18n/number_asformat.cpp', + '/intl/icu/source/i18n/number_capi.cpp', + '/intl/icu/source/i18n/number_compact.cpp', + '/intl/icu/source/i18n/number_currencysymbols.cpp', + '/intl/icu/source/i18n/number_decimalquantity.cpp', + '/intl/icu/source/i18n/number_decimfmtprops.cpp', + '/intl/icu/source/i18n/number_fluent.cpp', + '/intl/icu/source/i18n/number_formatimpl.cpp', + '/intl/icu/source/i18n/number_grouping.cpp', + '/intl/icu/source/i18n/number_integerwidth.cpp', + '/intl/icu/source/i18n/number_longnames.cpp', + '/intl/icu/source/i18n/number_mapper.cpp', + '/intl/icu/source/i18n/number_modifiers.cpp', + '/intl/icu/source/i18n/number_multiplier.cpp', + '/intl/icu/source/i18n/number_notation.cpp', + '/intl/icu/source/i18n/number_output.cpp', + '/intl/icu/source/i18n/number_padding.cpp', + '/intl/icu/source/i18n/number_patternmodifier.cpp', + '/intl/icu/source/i18n/number_patternstring.cpp', + '/intl/icu/source/i18n/number_rounding.cpp', + '/intl/icu/source/i18n/number_scientific.cpp', + '/intl/icu/source/i18n/number_simple.cpp', + '/intl/icu/source/i18n/number_skeletons.cpp', + '/intl/icu/source/i18n/number_symbolswrapper.cpp', + '/intl/icu/source/i18n/number_usageprefs.cpp', + '/intl/icu/source/i18n/number_utils.cpp', + '/intl/icu/source/i18n/numfmt.cpp', + '/intl/icu/source/i18n/numparse_affixes.cpp', + '/intl/icu/source/i18n/numparse_compositions.cpp', + '/intl/icu/source/i18n/numparse_currency.cpp', + '/intl/icu/source/i18n/numparse_decimal.cpp', + '/intl/icu/source/i18n/numparse_impl.cpp', + '/intl/icu/source/i18n/numparse_parsednumber.cpp', + '/intl/icu/source/i18n/numparse_scientific.cpp', + '/intl/icu/source/i18n/numparse_symbols.cpp', + '/intl/icu/source/i18n/numparse_validators.cpp', + '/intl/icu/source/i18n/numrange_capi.cpp', + '/intl/icu/source/i18n/numrange_fluent.cpp', + '/intl/icu/source/i18n/numrange_impl.cpp', + '/intl/icu/source/i18n/numsys.cpp', + '/intl/icu/source/i18n/olsontz.cpp', + '/intl/icu/source/i18n/persncal.cpp', + '/intl/icu/source/i18n/pluralranges.cpp', + '/intl/icu/source/i18n/plurfmt.cpp', + '/intl/icu/source/i18n/plurrule.cpp', + '/intl/icu/source/i18n/quantityformatter.cpp', + '/intl/icu/source/i18n/rbnf.cpp', + '/intl/icu/source/i18n/rbtz.cpp', + '/intl/icu/source/i18n/region.cpp', + '/intl/icu/source/i18n/reldatefmt.cpp', + '/intl/icu/source/i18n/reldtfmt.cpp', + '/intl/icu/source/i18n/rulebasedcollator.cpp', + '/intl/icu/source/i18n/scriptset.cpp', + '/intl/icu/source/i18n/search.cpp', + '/intl/icu/source/i18n/selfmt.cpp', + '/intl/icu/source/i18n/sharedbreakiterator.cpp', + '/intl/icu/source/i18n/simpletz.cpp', + '/intl/icu/source/i18n/smpdtfmt.cpp', + '/intl/icu/source/i18n/smpdtfst.cpp', + '/intl/icu/source/i18n/sortkey.cpp', + '/intl/icu/source/i18n/standardplural.cpp', + '/intl/icu/source/i18n/string_segment.cpp', + '/intl/icu/source/i18n/stsearch.cpp', + '/intl/icu/source/i18n/taiwncal.cpp', + '/intl/icu/source/i18n/timezone.cpp', + '/intl/icu/source/i18n/tmunit.cpp', + '/intl/icu/source/i18n/tmutamt.cpp', + '/intl/icu/source/i18n/tmutfmt.cpp', + '/intl/icu/source/i18n/tzfmt.cpp', + '/intl/icu/source/i18n/tzgnames.cpp', + '/intl/icu/source/i18n/tznames.cpp', + '/intl/icu/source/i18n/tznames_impl.cpp', + '/intl/icu/source/i18n/tzrule.cpp', + '/intl/icu/source/i18n/tztrans.cpp', + '/intl/icu/source/i18n/ucal.cpp', + '/intl/icu/source/i18n/ucln_in.cpp', + '/intl/icu/source/i18n/ucol.cpp', + '/intl/icu/source/i18n/ucol_res.cpp', + '/intl/icu/source/i18n/ucol_sit.cpp', + '/intl/icu/source/i18n/ucoleitr.cpp', + '/intl/icu/source/i18n/udat.cpp', + '/intl/icu/source/i18n/udateintervalformat.cpp', + '/intl/icu/source/i18n/udatpg.cpp', + '/intl/icu/source/i18n/ufieldpositer.cpp', + '/intl/icu/source/i18n/uitercollationiterator.cpp', + '/intl/icu/source/i18n/ulistformatter.cpp', + '/intl/icu/source/i18n/umsg.cpp', + '/intl/icu/source/i18n/units_complexconverter.cpp', + '/intl/icu/source/i18n/units_converter.cpp', + '/intl/icu/source/i18n/units_data.cpp', + '/intl/icu/source/i18n/units_router.cpp', + '/intl/icu/source/i18n/unum.cpp', + '/intl/icu/source/i18n/unumsys.cpp', + '/intl/icu/source/i18n/upluralrules.cpp', + '/intl/icu/source/i18n/usearch.cpp', + '/intl/icu/source/i18n/uspoof.cpp', + '/intl/icu/source/i18n/uspoof_impl.cpp', + '/intl/icu/source/i18n/utf16collationiterator.cpp', + '/intl/icu/source/i18n/utf8collationiterator.cpp', + '/intl/icu/source/i18n/utmscale.cpp', + '/intl/icu/source/i18n/vtzone.cpp', + '/intl/icu/source/i18n/windtfmt.cpp', + '/intl/icu/source/i18n/winnmfmt.cpp', + '/intl/icu/source/i18n/wintzimpl.cpp', + '/intl/icu/source/i18n/zonemeta.cpp', +] +other_sources = [ + '/intl/icu/source/i18n/alphaindex.cpp', + '/intl/icu/source/i18n/anytrans.cpp', + '/intl/icu/source/i18n/brktrans.cpp', + '/intl/icu/source/i18n/casetrn.cpp', + '/intl/icu/source/i18n/cpdtrans.cpp', + '/intl/icu/source/i18n/csdetect.cpp', + '/intl/icu/source/i18n/csmatch.cpp', + '/intl/icu/source/i18n/csr2022.cpp', + '/intl/icu/source/i18n/csrecog.cpp', + '/intl/icu/source/i18n/csrmbcs.cpp', + '/intl/icu/source/i18n/csrsbcs.cpp', + '/intl/icu/source/i18n/csrucode.cpp', + '/intl/icu/source/i18n/csrutf8.cpp', + '/intl/icu/source/i18n/esctrn.cpp', + '/intl/icu/source/i18n/fmtable_cnv.cpp', + '/intl/icu/source/i18n/funcrepl.cpp', + '/intl/icu/source/i18n/gender.cpp', + '/intl/icu/source/i18n/inputext.cpp', + '/intl/icu/source/i18n/name2uni.cpp', + '/intl/icu/source/i18n/nortrans.cpp', + '/intl/icu/source/i18n/nultrans.cpp', + '/intl/icu/source/i18n/quant.cpp', + '/intl/icu/source/i18n/rbt.cpp', + '/intl/icu/source/i18n/rbt_data.cpp', + '/intl/icu/source/i18n/rbt_pars.cpp', + '/intl/icu/source/i18n/rbt_rule.cpp', + '/intl/icu/source/i18n/rbt_set.cpp', + '/intl/icu/source/i18n/regexcmp.cpp', + '/intl/icu/source/i18n/regeximp.cpp', + '/intl/icu/source/i18n/regexst.cpp', + '/intl/icu/source/i18n/regextxt.cpp', + '/intl/icu/source/i18n/rematch.cpp', + '/intl/icu/source/i18n/remtrans.cpp', + '/intl/icu/source/i18n/repattrn.cpp', + '/intl/icu/source/i18n/scientificnumberformatter.cpp', + '/intl/icu/source/i18n/strmatch.cpp', + '/intl/icu/source/i18n/strrepl.cpp', + '/intl/icu/source/i18n/titletrn.cpp', + '/intl/icu/source/i18n/tolowtrn.cpp', + '/intl/icu/source/i18n/toupptrn.cpp', + '/intl/icu/source/i18n/translit.cpp', + '/intl/icu/source/i18n/transreg.cpp', + '/intl/icu/source/i18n/tridpars.cpp', + '/intl/icu/source/i18n/ucsdet.cpp', + '/intl/icu/source/i18n/ulocdata.cpp', + '/intl/icu/source/i18n/unesctrn.cpp', + '/intl/icu/source/i18n/uni2name.cpp', + '/intl/icu/source/i18n/uregex.cpp', + '/intl/icu/source/i18n/uregexc.cpp', + '/intl/icu/source/i18n/uregion.cpp', + '/intl/icu/source/i18n/uspoof_build.cpp', + '/intl/icu/source/i18n/uspoof_conf.cpp', + '/intl/icu/source/i18n/utrans.cpp', + '/intl/icu/source/i18n/vzone.cpp', + '/intl/icu/source/i18n/zrule.cpp', + '/intl/icu/source/i18n/ztrans.cpp', +] +EXPORTS.unicode += [ + '/intl/icu/source/i18n/unicode/alphaindex.h', + '/intl/icu/source/i18n/unicode/basictz.h', + '/intl/icu/source/i18n/unicode/calendar.h', + '/intl/icu/source/i18n/unicode/choicfmt.h', + '/intl/icu/source/i18n/unicode/coleitr.h', + '/intl/icu/source/i18n/unicode/coll.h', + '/intl/icu/source/i18n/unicode/compactdecimalformat.h', + '/intl/icu/source/i18n/unicode/curramt.h', + '/intl/icu/source/i18n/unicode/currpinf.h', + '/intl/icu/source/i18n/unicode/currunit.h', + '/intl/icu/source/i18n/unicode/datefmt.h', + '/intl/icu/source/i18n/unicode/dcfmtsym.h', + '/intl/icu/source/i18n/unicode/decimfmt.h', + '/intl/icu/source/i18n/unicode/displayoptions.h', + '/intl/icu/source/i18n/unicode/dtfmtsym.h', + '/intl/icu/source/i18n/unicode/dtitvfmt.h', + '/intl/icu/source/i18n/unicode/dtitvinf.h', + '/intl/icu/source/i18n/unicode/dtptngen.h', + '/intl/icu/source/i18n/unicode/dtrule.h', + '/intl/icu/source/i18n/unicode/fieldpos.h', + '/intl/icu/source/i18n/unicode/fmtable.h', + '/intl/icu/source/i18n/unicode/format.h', + '/intl/icu/source/i18n/unicode/formattednumber.h', + '/intl/icu/source/i18n/unicode/formattedvalue.h', + '/intl/icu/source/i18n/unicode/fpositer.h', + '/intl/icu/source/i18n/unicode/gender.h', + '/intl/icu/source/i18n/unicode/gregocal.h', + '/intl/icu/source/i18n/unicode/listformatter.h', + '/intl/icu/source/i18n/unicode/measfmt.h', + '/intl/icu/source/i18n/unicode/measunit.h', + '/intl/icu/source/i18n/unicode/measure.h', + '/intl/icu/source/i18n/unicode/msgfmt.h', + '/intl/icu/source/i18n/unicode/nounit.h', + '/intl/icu/source/i18n/unicode/numberformatter.h', + '/intl/icu/source/i18n/unicode/numberrangeformatter.h', + '/intl/icu/source/i18n/unicode/numfmt.h', + '/intl/icu/source/i18n/unicode/numsys.h', + '/intl/icu/source/i18n/unicode/plurfmt.h', + '/intl/icu/source/i18n/unicode/plurrule.h', + '/intl/icu/source/i18n/unicode/rbnf.h', + '/intl/icu/source/i18n/unicode/rbtz.h', + '/intl/icu/source/i18n/unicode/regex.h', + '/intl/icu/source/i18n/unicode/region.h', + '/intl/icu/source/i18n/unicode/reldatefmt.h', + '/intl/icu/source/i18n/unicode/scientificnumberformatter.h', + '/intl/icu/source/i18n/unicode/search.h', + '/intl/icu/source/i18n/unicode/selfmt.h', + '/intl/icu/source/i18n/unicode/simplenumberformatter.h', + '/intl/icu/source/i18n/unicode/simpletz.h', + '/intl/icu/source/i18n/unicode/smpdtfmt.h', + '/intl/icu/source/i18n/unicode/sortkey.h', + '/intl/icu/source/i18n/unicode/stsearch.h', + '/intl/icu/source/i18n/unicode/tblcoll.h', + '/intl/icu/source/i18n/unicode/timezone.h', + '/intl/icu/source/i18n/unicode/tmunit.h', + '/intl/icu/source/i18n/unicode/tmutamt.h', + '/intl/icu/source/i18n/unicode/tmutfmt.h', + '/intl/icu/source/i18n/unicode/translit.h', + '/intl/icu/source/i18n/unicode/tzfmt.h', + '/intl/icu/source/i18n/unicode/tznames.h', + '/intl/icu/source/i18n/unicode/tzrule.h', + '/intl/icu/source/i18n/unicode/tztrans.h', + '/intl/icu/source/i18n/unicode/ucal.h', + '/intl/icu/source/i18n/unicode/ucol.h', + '/intl/icu/source/i18n/unicode/ucoleitr.h', + '/intl/icu/source/i18n/unicode/ucsdet.h', + '/intl/icu/source/i18n/unicode/udat.h', + '/intl/icu/source/i18n/unicode/udateintervalformat.h', + '/intl/icu/source/i18n/unicode/udatpg.h', + '/intl/icu/source/i18n/unicode/udisplayoptions.h', + '/intl/icu/source/i18n/unicode/ufieldpositer.h', + '/intl/icu/source/i18n/unicode/uformattable.h', + '/intl/icu/source/i18n/unicode/uformattednumber.h', + '/intl/icu/source/i18n/unicode/uformattedvalue.h', + '/intl/icu/source/i18n/unicode/ugender.h', + '/intl/icu/source/i18n/unicode/ulistformatter.h', + '/intl/icu/source/i18n/unicode/ulocdata.h', + '/intl/icu/source/i18n/unicode/umsg.h', + '/intl/icu/source/i18n/unicode/unirepl.h', + '/intl/icu/source/i18n/unicode/unum.h', + '/intl/icu/source/i18n/unicode/unumberformatter.h', + '/intl/icu/source/i18n/unicode/unumberoptions.h', + '/intl/icu/source/i18n/unicode/unumberrangeformatter.h', + '/intl/icu/source/i18n/unicode/unumsys.h', + '/intl/icu/source/i18n/unicode/upluralrules.h', + '/intl/icu/source/i18n/unicode/uregex.h', + '/intl/icu/source/i18n/unicode/uregion.h', + '/intl/icu/source/i18n/unicode/ureldatefmt.h', + '/intl/icu/source/i18n/unicode/usearch.h', + '/intl/icu/source/i18n/unicode/usimplenumberformatter.h', + '/intl/icu/source/i18n/unicode/uspoof.h', + '/intl/icu/source/i18n/unicode/utmscale.h', + '/intl/icu/source/i18n/unicode/utrans.h', + '/intl/icu/source/i18n/unicode/vtzone.h', +] diff --git a/config/external/icu/icupkg/moz.build b/config/external/icu/icupkg/moz.build new file mode 100644 index 0000000000..39314fbda7 --- /dev/null +++ b/config/external/icu/icupkg/moz.build @@ -0,0 +1,27 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +HostProgram("icupkg") + +LOCAL_INCLUDES += [ + "/intl/icu/source/common", + "/intl/icu/source/i18n", + "/intl/icu/source/tools/toolutil", +] + +include("../defs.mozbuild") +include("sources.mozbuild") + +HOST_SOURCES += sources +HOST_SOURCES += [ + "/intl/icu/source/stubdata/stubdata.cpp", +] + +HOST_USE_LIBS += [ + "host_icui18n", + "host_icutoolutil", + "host_icuuc", +] diff --git a/config/external/icu/icupkg/sources.mozbuild b/config/external/icu/icupkg/sources.mozbuild new file mode 100644 index 0000000000..42bb0447bf --- /dev/null +++ b/config/external/icu/icupkg/sources.mozbuild @@ -0,0 +1,4 @@ +# THIS FILE IS GENERATED BY /intl/icu_sources_data.py DO NOT EDIT +sources = [ + '/intl/icu/source/tools/icupkg/icupkg.cpp', +] diff --git a/config/external/icu/moz.build b/config/external/icu/moz.build new file mode 100644 index 0000000000..296d60d521 --- /dev/null +++ b/config/external/icu/moz.build @@ -0,0 +1,22 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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("icu") + +if CONFIG["MOZ_SYSTEM_ICU"]: + OS_LIBS += CONFIG["MOZ_ICU_LIBS"] +else: + DIRS += [ + "common", + "data", + "i18n", + ] + if CONFIG["TARGET_ENDIANNESS"] == "big": + DIRS += [ + "toolutil", + "icupkg", + ] + USE_LIBS += ["icudata"] diff --git a/config/external/icu/toolutil/moz.build b/config/external/icu/toolutil/moz.build new file mode 100644 index 0000000000..e8dc827c2b --- /dev/null +++ b/config/external/icu/toolutil/moz.build @@ -0,0 +1,20 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +HostLibrary("host_icutoolutil") +FINAL_LIBRARY = "icu" + +DEFINES["U_TOOLUTIL_IMPLEMENTATION"] = True + +LOCAL_INCLUDES += [ + "/intl/icu/source/common", + "/intl/icu/source/i18n", +] + +include("../defs.mozbuild") +include("sources.mozbuild") + +HOST_SOURCES += sources diff --git a/config/external/icu/toolutil/sources.mozbuild b/config/external/icu/toolutil/sources.mozbuild new file mode 100644 index 0000000000..7810475ec8 --- /dev/null +++ b/config/external/icu/toolutil/sources.mozbuild @@ -0,0 +1,27 @@ +# THIS FILE IS GENERATED BY /intl/icu_sources_data.py DO NOT EDIT +sources = [ + '/intl/icu/source/tools/toolutil/collationinfo.cpp', + '/intl/icu/source/tools/toolutil/dbgutil.cpp', + '/intl/icu/source/tools/toolutil/denseranges.cpp', + '/intl/icu/source/tools/toolutil/filestrm.cpp', + '/intl/icu/source/tools/toolutil/filetools.cpp', + '/intl/icu/source/tools/toolutil/flagparser.cpp', + '/intl/icu/source/tools/toolutil/package.cpp', + '/intl/icu/source/tools/toolutil/pkg_genc.cpp', + '/intl/icu/source/tools/toolutil/pkg_gencmn.cpp', + '/intl/icu/source/tools/toolutil/pkg_icu.cpp', + '/intl/icu/source/tools/toolutil/pkgitems.cpp', + '/intl/icu/source/tools/toolutil/ppucd.cpp', + '/intl/icu/source/tools/toolutil/swapimpl.cpp', + '/intl/icu/source/tools/toolutil/toolutil.cpp', + '/intl/icu/source/tools/toolutil/ucbuf.cpp', + '/intl/icu/source/tools/toolutil/ucln_tu.cpp', + '/intl/icu/source/tools/toolutil/ucm.cpp', + '/intl/icu/source/tools/toolutil/ucmstate.cpp', + '/intl/icu/source/tools/toolutil/udbgutil.cpp', + '/intl/icu/source/tools/toolutil/unewdata.cpp', + '/intl/icu/source/tools/toolutil/uoptions.cpp', + '/intl/icu/source/tools/toolutil/uparse.cpp', + '/intl/icu/source/tools/toolutil/writesrc.cpp', + '/intl/icu/source/tools/toolutil/xmlparser.cpp', +] diff --git a/config/external/icu4x/icu4x_data.S b/config/external/icu4x/icu4x_data.S new file mode 100644 index 0000000000..95a647f9ef --- /dev/null +++ b/config/external/icu4x/icu4x_data.S @@ -0,0 +1,29 @@ +/* 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/. */ + +#if defined(_WIN32) && defined(__i386__) +// Mark the object as SAFESEH-enabled. +.def @feat.00; +.scl 3; +.type 0; +.endef +.global @feat.00 +.set @feat.00, 1 +#endif + +.global ICU4X_DATA_SYMBOL +#if defined(__APPLE__) +.data +.const +#elif defined(__wasi__) +.section .rodata,"",@ +#else +.section .rodata +#endif +.balign 16 +ICU4X_DATA_SYMBOL: +.incbin ICU4X_DATA_FILE +#ifdef __wasi__ +.size ICU4X_DATA_SYMBOL, . - ICU4X_DATA_SYMBOL +#endif diff --git a/config/external/icu4x/moz.build b/config/external/icu4x/moz.build new file mode 100644 index 0000000000..63273b83ff --- /dev/null +++ b/config/external/icu4x/moz.build @@ -0,0 +1,35 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +# Build the ICU4X data directly into the binary file. This is an experiment that can +# be enabled by adding `ac_add_options --enable-icu4x` to your mozconfig. +# See `intl/ICU4X.md`. + +if CONFIG["MOZ_ICU4X"]: + DEFINES["MOZ_ICU4X"] = 1 + Library("icu4xdata") + LOCAL_INCLUDES += ["."] + + # The "mangled" symbol gets prefixed by a "_" in certain platforms. + symbol_prefix = "" + if (CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CPU_ARCH"] == "x86") or CONFIG[ + "OS_ARCH" + ] == "Darwin": + symbol_prefix = "_" + + # To re-generate this file run: intl/update-icu4x.sh + DEFINES["ICU4X_DATA_FILE"] = '"icu4x.postcard"' + + # In C++ this data will be available via: + # + # extern uint8_t icu4x_static_locale_data; + # uint8_t firstByte = (&icu4x_static_locale_data)[0]; + DEFINES["ICU4X_DATA_SYMBOL"] = "%s%s" % (symbol_prefix, "icu4x_static_locale_data") + + # This is assembly which has instructions to include the binary locale data directly. + SOURCES += [ + "icu4x_data.S", + ] diff --git a/config/external/lgpllibs/moz.build b/config/external/lgpllibs/moz.build new file mode 100644 index 0000000000..d7c38ac630 --- /dev/null +++ b/config/external/lgpllibs/moz.build @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +# The lgpllibs library stores symbols from third-party LGPL licensed libraries, +# such as libav and libsoundtouch. It fulfills the requirement of dynamically +# linking these symbols into gecko. +# +# Any library added here should also be reflected in the about:license page. + +GeckoSharedLibrary("lgpllibs", linkage=None) +SHARED_LIBRARY_NAME = "lgpllibs" diff --git a/config/external/moz.build b/config/external/moz.build new file mode 100644 index 0000000000..a0877c9d71 --- /dev/null +++ b/config/external/moz.build @@ -0,0 +1,80 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +external_dirs = [] + +DIRS += [ + "lgpllibs", + "rlbox", + "sqlite", +] + +if CONFIG["MOZ_USING_WASM_SANDBOXING"]: + DIRS += [ + "rlbox_wasm2c_sandbox", + "wasm2c_sandbox_compiler", + ] + +if not CONFIG["MOZ_SYSTEM_JPEG"]: + external_dirs += ["media/libjpeg"] + +DIRS += [ + "/third_party/msgpack", + "/third_party/sipcc", +] + +if CONFIG["MOZ_ICU4X"]: + DIRS += ["icu4x"] + +# There's no "native" brotli or woff2 yet, but probably in the future... +external_dirs += ["modules/brotli"] +external_dirs += ["modules/woff2"] + +external_dirs += ["modules/xz-embedded"] + +if CONFIG["MOZ_VORBIS"]: + external_dirs += ["media/libvorbis"] + +if CONFIG["MOZ_TREMOR"]: + external_dirs += ["media/libtremor"] + +if not CONFIG["MOZ_SYSTEM_LIBVPX"]: + external_dirs += ["media/libvpx"] + +if CONFIG["MOZ_AV1"]: + external_dirs += ["media/libaom"] + external_dirs += ["media/libdav1d"] + +if not CONFIG["MOZ_SYSTEM_PNG"]: + external_dirs += ["media/libpng"] + +if not CONFIG["MOZ_SYSTEM_WEBP"]: + external_dirs += ["media/libwebp"] + +if CONFIG["CPU_ARCH"] == "arm": + external_dirs += ["media/openmax_dl/dl"] + +if CONFIG["MOZ_FFVPX"]: + external_dirs += ["media/ffvpx"] + +if CONFIG["MOZ_JXL"]: + external_dirs += ["media/libjxl", "media/highway"] + +external_dirs += [ + "media/kiss_fft", + "media/libcubeb", + "media/libmkv", + "media/libnestegg", + "media/libogg", + "media/libopus", + "media/libtheora", + "media/libspeex_resampler", + "media/libsoundtouch", + "media/mp4parse-rust", + "media/psshparser", +] + +DIRS += ["../../" + i for i in external_dirs] diff --git a/config/external/nspr/_pl_bld.h b/config/external/nspr/_pl_bld.h new file mode 100644 index 0000000000..57fb0e988f --- /dev/null +++ b/config/external/nspr/_pl_bld.h @@ -0,0 +1,6 @@ +/* + * This file was previously generated at build time to set some preprocessor + * macros for use by plvrsion.c, but that file will set the values to (empty) + * defaults if they're not set, so this is just a stub to avoid having to + * generate another header file at build time. + */ diff --git a/config/external/nspr/_pr_bld.h b/config/external/nspr/_pr_bld.h new file mode 100644 index 0000000000..1e36c69f13 --- /dev/null +++ b/config/external/nspr/_pr_bld.h @@ -0,0 +1,6 @@ +/* + * This file was previously generated at build time to set some preprocessor + * macros for use by prvrsion.c, but that file will set the values to (empty) + * defaults if they're not set, so this is just a stub to avoid having to + * generate another header file at build time. + */ diff --git a/config/external/nspr/ds/moz.build b/config/external/nspr/ds/moz.build new file mode 100644 index 0000000000..d2676e2093 --- /dev/null +++ b/config/external/nspr/ds/moz.build @@ -0,0 +1,34 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +if CONFIG["MOZ_FOLD_LIBS"]: + Library("plds4") +else: + SharedLibrary("plds4") + SOURCES += ["/nsprpub/lib/ds/plvrsion.c"] + USE_LIBS += ["nspr4"] + +# We allow warnings for third-party code that can be updated from upstream. +# TODO: fix NSPR warnings and remove this +AllowCompilerWarnings() + +DEFINES["_NSPR_BUILD_"] = True + +LOCAL_INCLUDES += [ + "/config/external/nspr", + "/nsprpub/pr/include", +] + +EXPORTS.nspr += [ + "/nsprpub/lib/ds/plarena.h", + "/nsprpub/lib/ds/plarenas.h", + "/nsprpub/lib/ds/plhash.h", +] + +SOURCES += [ + "/nsprpub/lib/ds/plarena.c", + "/nsprpub/lib/ds/plhash.c", +] diff --git a/config/external/nspr/libc/moz.build b/config/external/nspr/libc/moz.build new file mode 100644 index 0000000000..62bb8814f6 --- /dev/null +++ b/config/external/nspr/libc/moz.build @@ -0,0 +1,45 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +if CONFIG["MOZ_FOLD_LIBS"]: + Library("plc4") +else: + SharedLibrary("plc4") + SOURCES += ["/nsprpub/lib/libc/src/plvrsion.c"] + USE_LIBS += ["nspr4"] + +# We allow warnings for third-party code that can be updated from upstream. +# TODO: fix NSPR warnings and remove this +AllowCompilerWarnings() + +DEFINES["_NSPR_BUILD_"] = True + +LOCAL_INCLUDES += [ + "/config/external/nspr", +] + +EXPORTS.nspr += [ + "/nsprpub/lib/libc/include/plbase64.h", + "/nsprpub/lib/libc/include/plerror.h", + "/nsprpub/lib/libc/include/plgetopt.h", + "/nsprpub/lib/libc/include/plstr.h", +] + +SOURCES += [ + "/nsprpub/lib/libc/src/base64.c", + "/nsprpub/lib/libc/src/plerror.c", + "/nsprpub/lib/libc/src/plgetopt.c", + "/nsprpub/lib/libc/src/strcase.c", + "/nsprpub/lib/libc/src/strcat.c", + "/nsprpub/lib/libc/src/strchr.c", + "/nsprpub/lib/libc/src/strcmp.c", + "/nsprpub/lib/libc/src/strcpy.c", + "/nsprpub/lib/libc/src/strdup.c", + "/nsprpub/lib/libc/src/strlen.c", + "/nsprpub/lib/libc/src/strpbrk.c", + "/nsprpub/lib/libc/src/strstr.c", + "/nsprpub/lib/libc/src/strtok.c", +] diff --git a/config/external/nspr/moz.build b/config/external/nspr/moz.build new file mode 100644 index 0000000000..f2b3d4e8c1 --- /dev/null +++ b/config/external/nspr/moz.build @@ -0,0 +1,28 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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("nspr") + +if CONFIG["MOZ_BUILD_NSPR"]: + DIRS += [ + "pr", + "ds", + "libc", + ] + if CONFIG["MOZ_FOLD_LIBS"]: + # When folding libraries, nspr is actually in the nss library. + USE_LIBS += [ + "nss", + ] + else: + USE_LIBS += [ + "nspr4", + "plc4", + "plds4", + ] + EXPORTS.nspr += ["prcpucfg.h"] +else: + OS_LIBS += CONFIG["NSPR_LIBS"] diff --git a/config/external/nspr/pr/moz.build b/config/external/nspr/pr/moz.build new file mode 100644 index 0000000000..5fdc3c9f1b --- /dev/null +++ b/config/external/nspr/pr/moz.build @@ -0,0 +1,254 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +if CONFIG["MOZ_FOLD_LIBS"]: + Library("nspr4") +else: + SharedLibrary("nspr4") + +# We allow warnings for third-party code that can be updated from upstream. +# TODO: fix NSPR warnings and remove this +AllowCompilerWarnings() + +DEFINES["_NSPR_BUILD_"] = True +if CONFIG["OS_ARCH"] == "Linux": + OS_LIBS += CONFIG["REALTIME_LIBS"] + DEFINES["LINUX"] = True + DEFINES["HAVE_FCNTL_FILE_LOCKING"] = True + DEFINES["HAVE_POINTER_LOCALTIME_R"] = True + DEFINES["_GNU_SOURCE"] = True + SOURCES += ["/nsprpub/pr/src/md/unix/linux.c"] + if CONFIG["CPU_ARCH"] == "x86_64": + SOURCES += ["/nsprpub/pr/src/md/unix/os_Linux_x86_64.s"] + elif CONFIG["CPU_ARCH"] == "x86": + DEFINES["i386"] = True + SOURCES += ["/nsprpub/pr/src/md/unix/os_Linux_x86.s"] + elif CONFIG["CPU_ARCH"] == "ppc": + SOURCES += ["/nsprpub/pr/src/md/unix/os_Linux_ppc.s"] +elif CONFIG["OS_TARGET"] in ("FreeBSD", "OpenBSD", "NetBSD"): + DEFINES["HAVE_BSD_FLOCK"] = True + DEFINES["HAVE_SOCKLEN_T"] = True + DEFINES["HAVE_POINTER_LOCALTIME_R"] = True + DEFINES[CONFIG["OS_TARGET"].upper()] = True + SOURCES += ["/nsprpub/pr/src/md/unix/%s.c" % CONFIG["OS_TARGET"].lower()] +elif CONFIG["OS_TARGET"] == "Darwin": + OS_LIBS += ["-framework CoreServices"] + # See also IncreaseDescriptorLimits in toolkit/xre/nsAppRunner.cpp + DEFINES["FD_SETSIZE"] = 4096 + DEFINES["_DARWIN_UNLIMITED_SELECT"] = True + DEFINES["HAS_CONNECTX"] = True + DEFINES["DARWIN"] = True + DEFINES["HAVE_BSD_FLOCK"] = True + DEFINES["HAVE_SOCKLEN_T"] = True + DEFINES["HAVE_POINTER_LOCALTIME_R"] = True + SOURCES += [ + "/nsprpub/pr/src/md/unix/darwin.c", + "/nsprpub/pr/src/md/unix/os_Darwin.s", + ] + DEFINES["HAVE_CRT_EXTERNS_H"] = True +elif CONFIG["OS_TARGET"] == "SunOS": + DEFINES["HAVE_FCNTL_FILE_LOCKING"] = True + DEFINES["HAVE_SOCKLEN_T"] = True + DEFINES["_PR_HAVE_OFF64_T"] = True + DEFINES["_PR_INET6"] = True + DEFINES["SOLARIS"] = True + SOURCES += ["/nsprpub/pr/src/md/unix/solaris.c"] + if CONFIG["CPU_ARCH"] == "x86_64": + SOURCES += ["/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s"] + elif CONFIG["CPU_ARCH"] == "x86": + SOURCES += ["/nsprpub/pr/src/md/unix/os_SunOS_x86.s"] + elif CONFIG["CPU_ARCH"] == "sparc64": + ASFLAGS += ["-x", "assembler-with-cpp", "-D_ASM"] + SOURCES += ["/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s"] +elif CONFIG["OS_TARGET"] == "WINNT": + OS_LIBS += [ + "advapi32", + "wsock32", + "ws2_32", + "mswsock", + "winmm", + ] + DEFINES["XP_PC"] = True + DEFINES["WIN32"] = True + # For historical reasons we use the WIN95 NSPR target instead of + # WINNT. + DEFINES["WIN95"] = True + DEFINES["WINNT"] = False + DEFINES["_PR_GLOBAL_THREADS_ONLY"] = True + if not CONFIG["DEBUG"]: + DEFINES["DO_NOT_WAIT_FOR_CONNECT_OVERLAPPED_OPERATIONS"] = True + if CONFIG["CPU_ARCH"] == "x86_64": + DEFINES["_AMD64_"] = True + elif CONFIG["CPU_ARCH"] == "x86": + DEFINES["_X86_"] = True + elif CONFIG["CPU_ARCH"] == "aarch64": + DEFINES["_ARM64_"] = True + else: + error("Unsupported CPU_ARCH value: %s" % CONFIG["CPU_ARCH"]) +else: + error( + 'Not a supported OS_TARGET for NSPR in moz.build: "%s". Use --with-system-nspr' + % CONFIG["OS_TARGET"] + ) + + +LOCAL_INCLUDES += [ + "/config/external/nspr", + "/nsprpub/pr/include", + "/nsprpub/pr/include/private", +] + +SOURCES += [ + "/nsprpub/pr/src/io/prpolevt.c", # conflicting definition of PRFilePrivate + "/nsprpub/pr/src/misc/praton.c", # duplicate definition of index_hex +] + +UNIFIED_SOURCES += [ + "/nsprpub/pr/src/io/prfdcach.c", + "/nsprpub/pr/src/io/priometh.c", + "/nsprpub/pr/src/io/pripv6.c", + "/nsprpub/pr/src/io/prlayer.c", + "/nsprpub/pr/src/io/prlog.c", + "/nsprpub/pr/src/io/prmapopt.c", + "/nsprpub/pr/src/io/prmmap.c", + "/nsprpub/pr/src/io/prmwait.c", + "/nsprpub/pr/src/io/prprf.c", + "/nsprpub/pr/src/io/prscanf.c", + "/nsprpub/pr/src/io/prstdio.c", + "/nsprpub/pr/src/linking/prlink.c", + "/nsprpub/pr/src/malloc/prmalloc.c", + "/nsprpub/pr/src/malloc/prmem.c", + "/nsprpub/pr/src/md/prosdep.c", + "/nsprpub/pr/src/memory/prseg.c", + "/nsprpub/pr/src/memory/prshma.c", + "/nsprpub/pr/src/misc/pratom.c", + "/nsprpub/pr/src/misc/prdtoa.c", + "/nsprpub/pr/src/misc/prenv.c", + "/nsprpub/pr/src/misc/prerr.c", + "/nsprpub/pr/src/misc/prerror.c", + "/nsprpub/pr/src/misc/prerrortable.c", + "/nsprpub/pr/src/misc/prinit.c", + "/nsprpub/pr/src/misc/prinrval.c", + "/nsprpub/pr/src/misc/pripc.c", + "/nsprpub/pr/src/misc/prlog2.c", + "/nsprpub/pr/src/misc/prnetdb.c", + "/nsprpub/pr/src/misc/prrng.c", + "/nsprpub/pr/src/misc/prsystem.c", + "/nsprpub/pr/src/misc/prtime.c", + "/nsprpub/pr/src/misc/prtpool.c", + "/nsprpub/pr/src/threads/prcmon.c", + "/nsprpub/pr/src/threads/prrwlock.c", + "/nsprpub/pr/src/threads/prtpd.c", +] + +if CONFIG["OS_TARGET"] != "WINNT": + DEFINES["_PR_PTHREADS"] = True + UNIFIED_SOURCES += [ + "/nsprpub/pr/src/md/unix/unix.c", + "/nsprpub/pr/src/md/unix/unix_errors.c", + "/nsprpub/pr/src/md/unix/uxproces.c", + "/nsprpub/pr/src/md/unix/uxrng.c", + "/nsprpub/pr/src/md/unix/uxshm.c", + "/nsprpub/pr/src/pthreads/ptio.c", + "/nsprpub/pr/src/pthreads/ptmisc.c", + "/nsprpub/pr/src/pthreads/ptsynch.c", + "/nsprpub/pr/src/pthreads/ptthread.c", + ] +else: + SOURCES += [ + # ntinrval.c needs windows.h without WIN32_LEAN_AND_MEAN, so it can't be + # unified after any file that pulled in windows.h in lean-and-mean mode. + "/nsprpub/pr/src/md/windows/ntinrval.c", + # w32poll.c needs a custom value of FD_SETSIZE for winsock.h. + "/nsprpub/pr/src/md/windows/w32poll.c", + # w95sock.c needs winsock2.h which conflicts with winsock.h. + "/nsprpub/pr/src/md/windows/w95sock.c", + ] + UNIFIED_SOURCES += [ + "/nsprpub/pr/src/io/prdir.c", + "/nsprpub/pr/src/io/prfile.c", + "/nsprpub/pr/src/io/prio.c", + "/nsprpub/pr/src/io/prsocket.c", + "/nsprpub/pr/src/md/windows/ntgc.c", + "/nsprpub/pr/src/md/windows/ntmisc.c", + "/nsprpub/pr/src/md/windows/ntsec.c", + "/nsprpub/pr/src/md/windows/ntsem.c", + "/nsprpub/pr/src/md/windows/w32ipcsem.c", + "/nsprpub/pr/src/md/windows/w32rng.c", + "/nsprpub/pr/src/md/windows/w32shm.c", + "/nsprpub/pr/src/md/windows/w95cv.c", + "/nsprpub/pr/src/md/windows/w95dllmain.c", + "/nsprpub/pr/src/md/windows/w95io.c", + "/nsprpub/pr/src/md/windows/w95thred.c", + "/nsprpub/pr/src/md/windows/win32_errors.c", + "/nsprpub/pr/src/misc/pripcsem.c", + "/nsprpub/pr/src/threads/combined/prucpu.c", + "/nsprpub/pr/src/threads/combined/prucv.c", + "/nsprpub/pr/src/threads/combined/prulock.c", + "/nsprpub/pr/src/threads/combined/prustack.c", + "/nsprpub/pr/src/threads/combined/pruthr.c", + "/nsprpub/pr/src/threads/prcthr.c", + "/nsprpub/pr/src/threads/prdump.c", + "/nsprpub/pr/src/threads/prmon.c", + "/nsprpub/pr/src/threads/prsem.c", + ] + +EXPORTS.nspr += [ + "/nsprpub/pr/include/nspr.h", + "/nsprpub/pr/include/pratom.h", + "/nsprpub/pr/include/prbit.h", + "/nsprpub/pr/include/prclist.h", + "/nsprpub/pr/include/prcmon.h", + "/nsprpub/pr/include/prcvar.h", + "/nsprpub/pr/include/prdtoa.h", + "/nsprpub/pr/include/prenv.h", + "/nsprpub/pr/include/prerr.h", + "/nsprpub/pr/include/prerror.h", + "/nsprpub/pr/include/prinet.h", + "/nsprpub/pr/include/prinit.h", + "/nsprpub/pr/include/prinrval.h", + "/nsprpub/pr/include/prio.h", + "/nsprpub/pr/include/pripcsem.h", + "/nsprpub/pr/include/prlink.h", + "/nsprpub/pr/include/prlock.h", + "/nsprpub/pr/include/prlog.h", + "/nsprpub/pr/include/prlong.h", + "/nsprpub/pr/include/prmem.h", + "/nsprpub/pr/include/prmon.h", + "/nsprpub/pr/include/prmwait.h", + "/nsprpub/pr/include/prnetdb.h", + "/nsprpub/pr/include/prpdce.h", + "/nsprpub/pr/include/prprf.h", + "/nsprpub/pr/include/prproces.h", + "/nsprpub/pr/include/prrng.h", + "/nsprpub/pr/include/prrwlock.h", + "/nsprpub/pr/include/prshm.h", + "/nsprpub/pr/include/prshma.h", + "/nsprpub/pr/include/prsystem.h", + "/nsprpub/pr/include/prthread.h", + "/nsprpub/pr/include/prtime.h", + "/nsprpub/pr/include/prtpool.h", + "/nsprpub/pr/include/prtrace.h", + "/nsprpub/pr/include/prtypes.h", + "/nsprpub/pr/include/prvrsion.h", + "/nsprpub/pr/include/prwin16.h", +] + +EXPORTS.nspr.md += [ + "/nsprpub/pr/include/md/_darwin.cfg", + "/nsprpub/pr/include/md/_freebsd.cfg", + "/nsprpub/pr/include/md/_linux.cfg", + "/nsprpub/pr/include/md/_netbsd.cfg", + "/nsprpub/pr/include/md/_openbsd.cfg", + "/nsprpub/pr/include/md/_solaris.cfg", + "/nsprpub/pr/include/md/_win95.cfg", +] + +EXPORTS.nspr.private += [ + "/nsprpub/pr/include/private/pprio.h", + "/nsprpub/pr/include/private/pprthred.h", + "/nsprpub/pr/include/private/prpriv.h", +] diff --git a/config/external/nspr/prcpucfg.h b/config/external/nspr/prcpucfg.h new file mode 100644 index 0000000000..e5c5aeead9 --- /dev/null +++ b/config/external/nspr/prcpucfg.h @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; 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/. */ + +#ifndef NSPR_PRCPUCFG_H_ +#define NSPR_PRCPUCFG_H_ + +/* + * Need to support conditionals that are defined in both the top-level build + * system as well as NSS' build system for now. + */ +#if defined(XP_DARWIN) || defined(DARWIN) +# include "md/_darwin.cfg" +#elif defined(XP_WIN) || defined(_WINDOWS) +# include "md/_win95.cfg" +#elif defined(__FreeBSD__) +# include "md/_freebsd.cfg" +#elif defined(__NetBSD__) +# include "md/_netbsd.cfg" +#elif defined(__OpenBSD__) +# include "md/_openbsd.cfg" +#elif defined(__linux__) +# include "md/_linux.cfg" +#elif defined(__sun__) +# include "md/_solaris.cfg" +#else +# error "Unsupported platform!" +#endif + +#endif /* NSPR_PRCPUCFG_H_ */ diff --git a/config/external/rlbox/moz.build b/config/external/rlbox/moz.build new file mode 100644 index 0000000000..d3ffdc430a --- /dev/null +++ b/config/external/rlbox/moz.build @@ -0,0 +1,28 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +EXPORTS.mozilla.rlbox += [ + "/third_party/rlbox/include/rlbox.hpp", + "/third_party/rlbox/include/rlbox_app_pointer.hpp", + "/third_party/rlbox/include/rlbox_conversion.hpp", + "/third_party/rlbox/include/rlbox_helpers.hpp", + "/third_party/rlbox/include/rlbox_noop_sandbox.hpp", + "/third_party/rlbox/include/rlbox_policy_types.hpp", + "/third_party/rlbox/include/rlbox_range.hpp", + "/third_party/rlbox/include/rlbox_sandbox.hpp", + "/third_party/rlbox/include/rlbox_stdlib.hpp", + "/third_party/rlbox/include/rlbox_stdlib_polyfill.hpp", + "/third_party/rlbox/include/rlbox_struct_support.hpp", + "/third_party/rlbox/include/rlbox_type_traits.hpp", + "/third_party/rlbox/include/rlbox_types.hpp", + "/third_party/rlbox/include/rlbox_unwrap.hpp", + "/third_party/rlbox/include/rlbox_wrapper_traits.hpp", + "rlbox_config.h", +] + +SOURCES += ["rlbox_thread_locals.cpp"] + +FINAL_LIBRARY = "xul" diff --git a/config/external/rlbox/rlbox_config.h b/config/external/rlbox/rlbox_config.h new file mode 100644 index 0000000000..c9aa34e4db --- /dev/null +++ b/config/external/rlbox/rlbox_config.h @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 20; 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/. */ + +#ifndef RLBOX_CONFIG +#define RLBOX_CONFIG + +#include "mozilla/Assertions.h" + +// All uses of rlbox's function and callbacks invocations are on a single +// thread right now, so we disable rlbox thread checks for performance +// See (Bug 1739298) for more details +#define RLBOX_SINGLE_THREADED_INVOCATIONS + +#define RLBOX_CUSTOM_ABORT(msg) MOZ_CRASH_UNSAFE_PRINTF("RLBox crash: %s", msg) + +// The MingW compiler does not correctly handle static thread_local inline +// members. This toggles a workaround that allows the host application (firefox) +// to provide TLS storage via functions. This can be removed if the MingW bug is +// fixed. +#define RLBOX_EMBEDDER_PROVIDES_TLS_STATIC_VARIABLES + +// When instantiating a wasm sandbox, rlbox requires the name of the wasm module +// being instantiated. LLVM and wasm2c use the module name by choosing the name +// used to generate the wasm file. In Firefox this is a static library called +// rlbox +#define RLBOX_WASM2C_MODULE_NAME rlbox + +#endif diff --git a/config/external/rlbox/rlbox_thread_locals.cpp b/config/external/rlbox/rlbox_thread_locals.cpp new file mode 100644 index 0000000000..157177c0e0 --- /dev/null +++ b/config/external/rlbox/rlbox_thread_locals.cpp @@ -0,0 +1,17 @@ +/* -*- Mode: C++; tab-width: 20; 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/. */ + +// Load general firefox configuration of RLBox +#include "mozilla/rlbox/rlbox_config.h" + +#define RLBOX_USE_STATIC_CALLS() rlbox_noop_sandbox_lookup_symbol +#include "mozilla/rlbox/rlbox_noop_sandbox.hpp" + +#include "mozilla/rlbox/rlbox.hpp" + +// The MingW compiler does not correctly handle static thread_local inline +// members. We instead TLS storage via functions. This can be removed if the +// MingW bug is fixed. +RLBOX_NOOP_SANDBOX_STATIC_VARIABLES(); diff --git a/config/external/rlbox_wasm2c_sandbox/moz.build b/config/external/rlbox_wasm2c_sandbox/moz.build new file mode 100644 index 0000000000..02e09973a7 --- /dev/null +++ b/config/external/rlbox_wasm2c_sandbox/moz.build @@ -0,0 +1,24 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +EXPORTS.mozilla.rlbox += [ + "/third_party/rlbox_wasm2c_sandbox/include/rlbox_wasm2c_sandbox.hpp", + "/third_party/rlbox_wasm2c_sandbox/include/rlbox_wasm2c_tls.hpp", +] +EXPORTS += [ + "/third_party/rlbox_wasm2c_sandbox/include/wasm2c_rt_mem.h", + "/third_party/rlbox_wasm2c_sandbox/include/wasm2c_rt_minwasi.h", +] + +SOURCES += [ + "/third_party/rlbox_wasm2c_sandbox/src/wasm2c_rt_mem.c", + "/third_party/rlbox_wasm2c_sandbox/src/wasm2c_rt_minwasi.c", + "rlbox_wasm2c_thread_locals.cpp", +] + +LOCAL_INCLUDES += ["/third_party/wasm2c/wasm2c/"] + +FINAL_LIBRARY = "xul" diff --git a/config/external/rlbox_wasm2c_sandbox/moz.yaml b/config/external/rlbox_wasm2c_sandbox/moz.yaml new file mode 100644 index 0000000000..ffded2a0e3 --- /dev/null +++ b/config/external/rlbox_wasm2c_sandbox/moz.yaml @@ -0,0 +1,34 @@ +schema: 1 + +bugzilla: + product: Core + component: "General" + +origin: + name: rlbox_wasm2c_sandbox + description: rlbox integration for the wasm2c sandboxed code + url: https://github.com/PLSysSec/rlbox_wasm2c_sandbox/tree/upstream-wasm2c + + release: 7e4ff0ebca2c7644a297bfe51a53b9904f0999b2 (2023-04-13T05:07:28Z). + revision: 7e4ff0ebca2c7644a297bfe51a53b9904f0999b2 + + license: MIT + license-file: LICENSE + +vendoring: + url: https://github.com/PLSysSec/rlbox_wasm2c_sandbox + source-hosting: github + vendor-directory: third_party/rlbox_wasm2c_sandbox + + exclude: + # dirs + - test + # files + - .clang-format + - .clang-tidy + - .gitignore + - .travis.yml + - AppSandbox.md + - CMakeLists.txt + - LibrarySandbox.md + - README.md diff --git a/config/external/rlbox_wasm2c_sandbox/rlbox_wasm2c_thread_locals.cpp b/config/external/rlbox_wasm2c_sandbox/rlbox_wasm2c_thread_locals.cpp new file mode 100644 index 0000000000..f37a868406 --- /dev/null +++ b/config/external/rlbox_wasm2c_sandbox/rlbox_wasm2c_thread_locals.cpp @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 20; 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/. */ + +#ifdef MOZ_USING_WASM_SANDBOXING + +// For MOZ_CRASH_UNSAFE_PRINTF +# include "mozilla/Assertions.h" + +# include "mozilla/mozalloc_oom.h" + +// Load general firefox configuration of RLBox +# include "mozilla/rlbox/rlbox_config.h" +# include "mozilla/rlbox/rlbox_wasm2c_tls.hpp" +# include "wasm-rt.h" + +# include "nsExceptionHandler.h" + +// The MingW compiler does not correctly handle static thread_local inline +// members. We instead TLS storage via functions. This can be removed if the +// MingW bug is fixed. +RLBOX_WASM2C_SANDBOX_STATIC_VARIABLES(); + +extern "C" { + +// Any error encountered by the wasm2c runtime or wasm sandboxed library code +// is configured to call the below trap handler. +void moz_wasm2c_trap_handler(wasm_rt_trap_t code) { + MOZ_CRASH_UNSAFE_PRINTF("wasm2c crash: %s", wasm_rt_strerror(code)); +} + +// The below function is called if a malloc in sandboxed code returns null +// This indicates that the sandbox has run out of memory. +void moz_wasm2c_memgrow_failed() { + CrashReporter::AnnotateCrashReport( + CrashReporter::Annotation::WasmLibrarySandboxMallocFailed, true); +} + +// This function is called when mozalloc_handle_oom is called from within +// the sandbox. We redirect to that function, ignoring the ctx argument, which +// is the sandbox itself. +void w2c_env_mozalloc_handle_oom(void* ctx, uint32_t size) { + mozalloc_handle_oom(size); +} +} + +#endif diff --git a/config/external/sqlite/moz.build b/config/external/sqlite/moz.build new file mode 100644 index 0000000000..6294924c56 --- /dev/null +++ b/config/external/sqlite/moz.build @@ -0,0 +1,18 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +DIRS += ["../../../third_party/sqlite3/src"] +if CONFIG["MOZ_FOLD_LIBS"]: + Library("sqlite") + # When folding libraries, sqlite is actually in the nss library. + USE_LIBS += [ + "nss", + ] +else: + SharedLibrary("sqlite") + SHARED_LIBRARY_NAME = "mozsqlite3" + + SYMBOLS_FILE = "/third_party/sqlite3/src/sqlite.symbols" diff --git a/config/external/wasm2c_sandbox_compiler/moz.build b/config/external/wasm2c_sandbox_compiler/moz.build new file mode 100644 index 0000000000..fdf9785bec --- /dev/null +++ b/config/external/wasm2c_sandbox_compiler/moz.build @@ -0,0 +1,78 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +LOCAL_INCLUDES += [ + "/third_party/picosha2/", + "/third_party/wasm2c/include/", +] + +GeneratedFile( + "wabt/config.h", + script="preprocess_wasm2c_config.py", + entry_point="generate_config", + inputs=["/third_party/wasm2c/src/config.h.in"], +) + +# Wabt sources +HOST_SOURCES += [ + "/third_party/wasm2c/src/apply-names.cc", + "/third_party/wasm2c/src/binary-reader-ir.cc", + "/third_party/wasm2c/src/binary-reader-logging.cc", + "/third_party/wasm2c/src/binary-reader-objdump.cc", + "/third_party/wasm2c/src/binary-reader-opcnt.cc", + "/third_party/wasm2c/src/binary-reader.cc", + "/third_party/wasm2c/src/binary-writer-spec.cc", + "/third_party/wasm2c/src/binary-writer.cc", + "/third_party/wasm2c/src/binary.cc", + "/third_party/wasm2c/src/binding-hash.cc", + "/third_party/wasm2c/src/color.cc", + "/third_party/wasm2c/src/common.cc", + "/third_party/wasm2c/src/config.cc", + "/third_party/wasm2c/src/decompiler.cc", + "/third_party/wasm2c/src/emscripten-helpers.cc", + "/third_party/wasm2c/src/error-formatter.cc", + "/third_party/wasm2c/src/expr-visitor.cc", + "/third_party/wasm2c/src/feature.cc", + "/third_party/wasm2c/src/filenames.cc", + "/third_party/wasm2c/src/generate-names.cc", + "/third_party/wasm2c/src/ir-util.cc", + "/third_party/wasm2c/src/ir.cc", + "/third_party/wasm2c/src/leb128.cc", + "/third_party/wasm2c/src/lexer-source-line-finder.cc", + "/third_party/wasm2c/src/lexer-source.cc", + "/third_party/wasm2c/src/literal.cc", + "/third_party/wasm2c/src/opcode-code-table.c", + "/third_party/wasm2c/src/opcode.cc", + "/third_party/wasm2c/src/option-parser.cc", + "/third_party/wasm2c/src/resolve-names.cc", + "/third_party/wasm2c/src/sha256.cc", + "/third_party/wasm2c/src/shared-validator.cc", + "/third_party/wasm2c/src/stream.cc", + "/third_party/wasm2c/src/token.cc", + "/third_party/wasm2c/src/tracing.cc", + "/third_party/wasm2c/src/type-checker.cc", + "/third_party/wasm2c/src/utf8.cc", + "/third_party/wasm2c/src/validator.cc", + "/third_party/wasm2c/src/wast-lexer.cc", + "/third_party/wasm2c/src/wast-parser.cc", + "/third_party/wasm2c/src/wat-writer.cc", +] + +# wasm2c sources +HOST_SOURCES += [ + "/third_party/wasm2c/src/c-writer.cc", + "/third_party/wasm2c/src/prebuilt/wasm2c_header_bottom.cc", + "/third_party/wasm2c/src/prebuilt/wasm2c_header_top.cc", + "/third_party/wasm2c/src/prebuilt/wasm2c_source_declarations.cc", + "/third_party/wasm2c/src/prebuilt/wasm2c_source_includes.cc", + "/third_party/wasm2c/src/tools/wasm2c.cc", +] + +HOST_CXXFLAGS += [ + "-Wno-implicit-fallthrough", +] + +HostProgram("wasm2c") diff --git a/config/external/wasm2c_sandbox_compiler/moz.yaml b/config/external/wasm2c_sandbox_compiler/moz.yaml new file mode 100644 index 0000000000..1aa2ee2188 --- /dev/null +++ b/config/external/wasm2c_sandbox_compiler/moz.yaml @@ -0,0 +1,47 @@ +schema: 1 + +bugzilla: + product: Core + component: "General" + +origin: + name: wasm2c_sandbox_compiler + description: wasm2c fork used for rlbox sandboxing + url: https://github.com/WebAssembly/wabt + + release: d24691ba62c371fb8dc2634956030e7102302174 (2023-05-05T23:57:24Z). + revision: d24691ba62c371fb8dc2634956030e7102302174 + + license: Apache-2.0 + license-file: LICENSE + +vendoring: + url: https://github.com/WebAssembly/wabt + source-hosting: github + vendor-directory: third_party/wasm2c + exclude: + # dirs + - cmake + - docs + - fuzz-in + - include/wabt/interp + - man + - scripts + - src/interp + - src/template + - test + - third_party + - wasm2c/examples + # files + - .* + - CMakeLists.txt + - Contributing.md + - Makefile + - README.md + - ubsan.blacklist + - src/tools/s* + - src/tools/wasm-* + - src/tools/wast* + - src/tools/wat* + - src/tools/wasm2w* + - wasm2c/wasm-rt-exceptions* diff --git a/config/external/wasm2c_sandbox_compiler/preprocess_wasm2c_config.py b/config/external/wasm2c_sandbox_compiler/preprocess_wasm2c_config.py new file mode 100644 index 0000000000..7193868032 --- /dev/null +++ b/config/external/wasm2c_sandbox_compiler/preprocess_wasm2c_config.py @@ -0,0 +1,137 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Souce Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distibuted with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import itertools + +# The wasm2c source relies on CMAKE to generate a config file to be used to build the project +# Since we do not use cmake, this script automates the generation of a similar config suitable +# for firefox builds +# The script has a list of known variables it can replace and throws an error if it encounters a +# new variable (for instance when the in-tree source is updated) + +# This python script knows how to replace the following variables normally configured by cmake for +# the wasm2c source +known_vars = [ + '#cmakedefine WABT_VERSION_STRING "@WABT_VERSION_STRING@"', + "#cmakedefine WABT_DEBUG @WABT_DEBUG@", + "#cmakedefine01 HAVE_ALLOCA_H", + "#cmakedefine01 HAVE_UNISTD_H", + "#cmakedefine01 HAVE_SNPRINTF", + "#cmakedefine01 HAVE_SSIZE_T", + "#cmakedefine01 HAVE_STRCASECMP", + "#cmakedefine01 HAVE_WIN32_VT100", + "#cmakedefine01 WABT_BIG_ENDIAN", + "#cmakedefine01 HAVE_OPENSSL_SHA_H", + "#cmakedefine01 COMPILER_IS_CLANG", + "#cmakedefine01 COMPILER_IS_GNU", + "#cmakedefine01 COMPILER_IS_MSVC", + "#cmakedefine01 WITH_EXCEPTIONS", + "#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@", +] + +# The above variables are replaced with the code shown below +replaced_variables = """ +// mozilla-config.h defines the following which is used +// - HAVE_ALLOCA_H +// - HAVE_UNISTD_H +#include "mozilla-config.h" + +#define WABT_VERSION_STRING "Firefox-in-tree-version" + +#define WABT_DEBUG 0 + +/* We don't require color printing of wasm2c errors on any platform */ +#define HAVE_WIN32_VT100 0 + +#ifdef _WIN32 + // Ignore whatever is set in mozilla-config.h wrt alloca because it is + // wrong when cross-compiling on Windows. + #undef HAVE_ALLOCA_H + /* Whether ssize_t is defined by stddef.h */ + #define HAVE_SSIZE_T 0 + /* Whether strcasecmp is defined by strings.h */ + #define HAVE_STRCASECMP 0 +#else + #define HAVE_SSIZE_T 1 + #define HAVE_STRCASECMP 1 +#endif + +#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define WABT_BIG_ENDIAN 0 +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define WABT_BIG_ENDIAN 1 +# else +# error "Can't handle mixed-endian architectures" +# endif +#else +# error "Don't know how to determine endianness" +#endif + +/* Use internal Pico-SHA. Never use OpenSSL */ +#define HAVE_OPENSSL_SHA_H 0 + +/* Whether snprintf is defined by stdio.h */ +#define HAVE_SNPRINTF 1 + +#if defined(_MSC_VER) + #define COMPILER_IS_GNU 0 + #define COMPILER_IS_CLANG 0 + #define COMPILER_IS_MSVC 1 +#elif defined(__GNUC__) + #if defined(__clang__) + #define COMPILER_IS_GNU 0 + #define COMPILER_IS_CLANG 1 + #define COMPILER_IS_MSVC 0 + #else + #define COMPILER_IS_GNU 1 + #define COMPILER_IS_CLANG 0 + #define COMPILER_IS_MSVC 0 + #endif +#else + #error "Unknown compiler" +#endif + +#define WITH_EXCEPTIONS 0 + +#if SIZE_MAX == 0xffffffffffffffff + #define SIZEOF_SIZE_T 8 +#elif SIZE_MAX == 0xffffffff + #define SIZEOF_SIZE_T 4 +#else + #error "Unknown size of size_t" +#endif +""" + + +def generate_config(output, config_h_in): + file_config_h_in = open(config_h_in, "r") + lines = file_config_h_in.readlines() + + # Remove the known cmake variables + for known_var in known_vars: + lines = [x for x in lines if not x.startswith(known_var)] + + # Do a sanity check to make sure there are no unknown variables + remaining_vars = [x for x in lines if x.startswith("#cmakedefine") or "@" in x] + if len(remaining_vars) > 0: + raise BaseException("Unknown cmake variables: " + str(remaining_vars)) + + pos = lines.index("#define WABT_CONFIG_H_\n") + skipped = itertools.takewhile( + lambda x: not (x.strip()) or x.startswith("#include "), lines[pos + 1 :] + ) + pos += len(list(skipped)) + pre_include_lines = lines[0:pos] + post_include_lines = lines[pos:] + output_str = ( + "".join(pre_include_lines) + + "\n" + + replaced_variables + + "\n" + + "".join(post_include_lines) + ) + output.write(output_str) diff --git a/config/external/zlib/moz.build b/config/external/zlib/moz.build new file mode 100644 index 0000000000..755400fa7f --- /dev/null +++ b/config/external/zlib/moz.build @@ -0,0 +1,21 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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("zlib") + +if CONFIG["MOZ_SYSTEM_ZLIB"]: + OS_LIBS += CONFIG["MOZ_ZLIB_LIBS"] +else: + if CONFIG["ZLIB_IN_MOZGLUE"]: + # Can't do this until mozglue is handled by moz.build instead of + # config/rules.mk. + # USE_LIBS += [ + # 'mozglue' + # ] + pass + DIRS += [ + "../../../modules/zlib", + ] |