From 39d48aab92693ee3cdd6492fa24f2e88d0d545ff Mon Sep 17 00:00:00 2001 From: wangjunqiang Date: Sun, 12 Mar 2023 09:03:56 +0800 Subject: [PATCH] add riscv64 support (cherry picked from commit b2fc4c6d948eb27ba66280717f528d1a83a2e85f) --- Add-riscv64-support.patch | 148 ++++++++++++++++++++ modify-mode-rU-to-r.patch | 276 ++++++++++++++++++++++++++++++++++++++ mozjs78.spec | 20 ++- 3 files changed, 439 insertions(+), 5 deletions(-) create mode 100644 Add-riscv64-support.patch create mode 100644 modify-mode-rU-to-r.patch diff --git a/Add-riscv64-support.patch b/Add-riscv64-support.patch new file mode 100644 index 0000000..332aa17 --- /dev/null +++ b/Add-riscv64-support.patch @@ -0,0 +1,148 @@ +From: William Grant +Date: Tue, 14 Apr 2020 02:18:28 +0200 +Subject: Add riscv64 support + +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932893 +Bug-Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1661027 +--- + build/moz.configure/init.configure | 3 +++ + js/src/jit/AtomicOperations.h | 3 ++- + js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h | 5 +++++ + mfbt/tests/TestPoisonArea.cpp | 3 +++ + python/mozbuild/mozbuild/configure/constants.py | 2 ++ + third_party/rust/cc/.cargo-checksum.json | 2 +- + third_party/rust/cc/src/lib.rs | 14 +++++++++----- + 7 files changed, 25 insertions(+), 7 deletions(-) + +diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure +index 5e07418..0c81996 100644 +--- a/build/moz.configure/init.configure ++++ b/build/moz.configure/init.configure +@@ -744,6 +744,9 @@ def split_triplet(triplet, allow_msvc=False): + elif cpu == 'sh4': + canonical_cpu = 'sh4' + endianness = 'little' ++ elif cpu.startswith('riscv64'): ++ canonical_cpu = 'riscv64' ++ endianness = 'little' + else: + raise ValueError('Unknown CPU type: %s' % cpu) + +diff --git a/js/src/jit/AtomicOperations.h b/js/src/jit/AtomicOperations.h +index 0486cba..d00e276 100644 +--- a/js/src/jit/AtomicOperations.h ++++ b/js/src/jit/AtomicOperations.h +@@ -391,7 +391,8 @@ inline bool AtomicOperations::isLockfreeJS(int32_t size) { + #elif defined(__ppc__) || defined(__PPC__) || defined(__sparc__) || \ + defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \ + defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) || \ +- defined(__sh__) || defined(__s390__) || defined(__s390x__) ++ defined(__sh__) || defined(__s390__) || defined(__s390x__) || \ ++ defined(__riscv) + # include "jit/shared/AtomicOperations-feeling-lucky.h" + #else + # error "No AtomicOperations support provided for this platform" +diff --git a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h +index f002cd4..413591a 100644 +--- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h ++++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h +@@ -70,6 +70,11 @@ + # endif + #endif + ++#if defined(__riscv) && __riscv_xlen == 64 ++# define HAS_64BIT_ATOMICS ++# define HAS_64BIT_LOCKFREE ++#endif ++ + #ifdef JS_CODEGEN_NONE + # ifdef JS_64BIT + # define HAS_64BIT_ATOMICS +diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp +index fbd3364..0a67e8c 100644 +--- a/mfbt/tests/TestPoisonArea.cpp ++++ b/mfbt/tests/TestPoisonArea.cpp +@@ -169,6 +169,9 @@ static const ia64_instr _return_instr = { + # define RETURN_INSTR _return_instr + # define RETURN_INSTR_TYPE ia64_instr + ++#elif defined(__riscv) ++#define RETURN_INSTR 0x80828082 /* ret; ret */ ++ + #else + # error "Need return instruction for this architecture" + #endif +diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py +index 7542dcd..c9dd1bb 100644 +--- a/python/mozbuild/mozbuild/configure/constants.py ++++ b/python/mozbuild/mozbuild/configure/constants.py +@@ -49,6 +49,7 @@ CPU_bitness = { + 'mips64': 64, + 'ppc': 32, + 'ppc64': 64, ++ 'riscv64': 64, + 's390': 32, + 's390x': 64, + 'sh4': 32, +@@ -88,6 +89,7 @@ CPU_preprocessor_checks = OrderedDict(( + ('mips64', '__mips64'), + ('mips32', '__mips__'), + ('sh4', '__sh__'), ++ ('riscv64', '__riscv && __riscv_xlen == 64'), + )) + + assert sorted(CPU_preprocessor_checks.keys()) == sorted(CPU.POSSIBLE_VALUES) +diff --git a/third_party/rust/cc/.cargo-checksum.json b/third_party/rust/cc/.cargo-checksum.json +index 417fde7..9836fc6 100644 +--- a/third_party/rust/cc/.cargo-checksum.json ++++ b/third_party/rust/cc/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"Cargo.lock":"3aff5f8b0a7f4d72852b11b0526f0002e6bf55f19f1ebd6470d7f97fbd540e60","Cargo.toml":"6ab10d9b6a9c6f0909074e6698c90c6b6a7223661ec2e83174d2593117cbe7f2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"7184fbdf375a057e673257348f6d7584c0dd11b66318d98f3647f69eb610b097","src/bin/gcc-shim.rs":"b77907875029494b6288841c3aed2e4939ed40708c7f597fca5c9e2570490ca6","src/com.rs":"bcdaf1c28b71e6ef889c6b08d1ce9d7c0761344a677f523bc4c3cd297957f804","src/lib.rs":"4753929dbb7b676c19d7cfa06d0a47e37003554b80c536cbf2b892d591ef61c2","src/registry.rs":"3cc1b5a50879fa751572878ae1d0afbfc960c11665258492754b2c8bccb0ff5d","src/setup_config.rs":"7014103587d3382eac599cb76f016e2609b8140970861b2237982d1db24af265","src/winapi.rs":"ea8b7edbb9ff87957254f465c2334e714c5d6b3b19a8d757c48ea7ca0881c50c","src/windows_registry.rs":"388e79dcf3e84078ae0b086c6cdee9cf9eb7e3ffafdcbf3e2df26163661f5856","tests/cc_env.rs":"e02b3b0824ad039b47e4462c5ef6dbe6c824c28e7953af94a0f28f7b5158042e","tests/cflags.rs":"57f06eb5ce1557e5b4a032d0c4673e18fbe6f8d26c1deb153126e368b96b41b3","tests/cxxflags.rs":"c2c6c6d8a0d7146616fa1caed26876ee7bc9fcfffd525eb4743593cade5f3371","tests/support/mod.rs":"71620b178583b6e6e5e0d4cac14e2cef6afc62fb6841e0c72ed1784543abf8ac","tests/test.rs":"1605640c9b94a77f48fc92e1dc0485bdf1960da5626e2e00279e4703691656bc"},"package":"aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"} +\ No newline at end of file ++{"files":{"Cargo.lock":"3aff5f8b0a7f4d72852b11b0526f0002e6bf55f19f1ebd6470d7f97fbd540e60","Cargo.toml":"6ab10d9b6a9c6f0909074e6698c90c6b6a7223661ec2e83174d2593117cbe7f2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"7184fbdf375a057e673257348f6d7584c0dd11b66318d98f3647f69eb610b097","src/bin/gcc-shim.rs":"b77907875029494b6288841c3aed2e4939ed40708c7f597fca5c9e2570490ca6","src/com.rs":"bcdaf1c28b71e6ef889c6b08d1ce9d7c0761344a677f523bc4c3cd297957f804","src/lib.rs":"bbdfbab457b93c1f3fa58b97c99974a8cd61de38a9ea0a618ca73b0fb55c4d74","src/registry.rs":"3cc1b5a50879fa751572878ae1d0afbfc960c11665258492754b2c8bccb0ff5d","src/setup_config.rs":"7014103587d3382eac599cb76f016e2609b8140970861b2237982d1db24af265","src/winapi.rs":"ea8b7edbb9ff87957254f465c2334e714c5d6b3b19a8d757c48ea7ca0881c50c","src/windows_registry.rs":"388e79dcf3e84078ae0b086c6cdee9cf9eb7e3ffafdcbf3e2df26163661f5856","tests/cc_env.rs":"e02b3b0824ad039b47e4462c5ef6dbe6c824c28e7953af94a0f28f7b5158042e","tests/cflags.rs":"57f06eb5ce1557e5b4a032d0c4673e18fbe6f8d26c1deb153126e368b96b41b3","tests/cxxflags.rs":"c2c6c6d8a0d7146616fa1caed26876ee7bc9fcfffd525eb4743593cade5f3371","tests/support/mod.rs":"71620b178583b6e6e5e0d4cac14e2cef6afc62fb6841e0c72ed1784543abf8ac","tests/test.rs":"1605640c9b94a77f48fc92e1dc0485bdf1960da5626e2e00279e4703691656bc"},"package":"aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"} +diff --git a/third_party/rust/cc/src/lib.rs b/third_party/rust/cc/src/lib.rs +index 621d31d..968d03a 100644 +--- a/third_party/rust/cc/src/lib.rs ++++ b/third_party/rust/cc/src/lib.rs +@@ -1365,10 +1365,10 @@ impl Build { + cmd.push_cc_arg("-ffunction-sections".into()); + cmd.push_cc_arg("-fdata-sections".into()); + } +- // Disable generation of PIC on RISC-V for now: rust-lld doesn't support this yet ++ // Disable generation of PIC on bare-metal for now: rust-lld doesn't support this yet + if self + .pic +- .unwrap_or(!target.contains("windows-gnu") && !target.contains("riscv")) ++ .unwrap_or(!target.contains("windows") && !target.contains("-none-")) + { + cmd.push_cc_arg("-fPIC".into()); + // PLT only applies if code is compiled with PIC support, +@@ -1588,13 +1588,16 @@ impl Build { + if let Some(arch) = parts.next() { + let arch = &arch[5..]; + cmd.args.push(("-march=rv".to_owned() + arch).into()); +- // ABI is always soft-float right now, update this when this is no longer the +- // case: +- if arch.starts_with("64") { ++ if target.contains("linux") && arch.starts_with("64") { ++ cmd.args.push("-mabi=lp64d".into()); ++ } else if target.contains("linux") && arch.starts_with("32") { ++ cmd.args.push("-mabi=ilp32d".into()); ++ } else if arch.starts_with("64") { + cmd.args.push("-mabi=lp64".into()); + } else { + cmd.args.push("-mabi=ilp32".into()); + } ++ cmd.args.push("-mcmodel=medany".into()); + } + } + } +@@ -2024,6 +2027,7 @@ impl Build { + "riscv32imac-unknown-none-elf" => Some("riscv32-unknown-elf"), + "riscv32imc-unknown-none-elf" => Some("riscv32-unknown-elf"), + "riscv64gc-unknown-none-elf" => Some("riscv64-unknown-elf"), ++ "riscv64gc-unknown-linux-gnu" => Some("riscv64-linux-gnu"), + "riscv64imac-unknown-none-elf" => Some("riscv64-unknown-elf"), + "s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"), + "sparc-unknown-linux-gnu" => Some("sparc-linux-gnu"), + diff --git a/modify-mode-rU-to-r.patch b/modify-mode-rU-to-r.patch new file mode 100644 index 0000000..6d92be0 --- /dev/null +++ b/modify-mode-rU-to-r.patch @@ -0,0 +1,276 @@ +From bb32690d45fa08c00464c510d3b5dee100f0dd3a Mon Sep 17 00:00:00 2001 +From: zhanghan +Date: Mon, 21 Aug 2023 13:48:20 +0800 +Subject: [PATCH] modify mode rU to r + +--- + build/pymake/mkformat.py | 2 +- + build/pymake/mkparse.py | 2 +- + build/pymake/pymake/parser.py | 2 +- + build/pymake/tests/formattingtests.py | 2 +- + dom/base/usecounters.py | 2 +- + media/webrtc/trunk/webrtc/build/gyp_helper.py | 2 +- + python/mozbuild/mozbuild/action/process_define_files.py | 2 +- + python/mozbuild/mozbuild/backend/base.py | 2 +- + python/mozbuild/mozbuild/preprocessor.py | 6 +++--- + python/mozbuild/mozbuild/util.py | 2 +- + python/mozbuild/mozbuild/virtualenv.py | 2 +- + python/mozbuild/mozpack/files.py | 4 ++-- + .../tests/conformance-checkers/tools/build-svg-tests.py | 2 +- + .../tests/tools/third_party/py/py/_path/common.py | 2 +- + .../tests/tools/third_party/py/py/_path/svnurl.py | 2 +- + third_party/python/py/py/_path/common.py | 2 +- + third_party/python/py/py/_path/svnurl.py | 2 +- + 17 files changed, 20 insertions(+), 20 deletions(-) + +diff --git a/build/pymake/mkformat.py b/build/pymake/mkformat.py +index 41dd761b2f..d33151172c 100755 +--- a/build/pymake/mkformat.py ++++ b/build/pymake/mkformat.py +@@ -6,7 +6,7 @@ import pymake.parser + filename = sys.argv[1] + source = None + +-with open(filename, 'rU') as fh: ++with open(filename, 'r') as fh: + source = fh.read() + + statements = pymake.parser.parsestring(source, filename) +diff --git a/build/pymake/mkparse.py b/build/pymake/mkparse.py +index 253683948a..3ebbc089fe 100755 +--- a/build/pymake/mkparse.py ++++ b/build/pymake/mkparse.py +@@ -5,7 +5,7 @@ import pymake.parser + + for f in sys.argv[1:]: + print "Parsing %s" % f +- fd = open(f, 'rU') ++ fd = open(f, 'r') + s = fd.read() + fd.close() + stmts = pymake.parser.parsestring(s, f) +diff --git a/build/pymake/pymake/parser.py b/build/pymake/pymake/parser.py +index 4bff533688..3119a10a10 100644 +--- a/build/pymake/pymake/parser.py ++++ b/build/pymake/pymake/parser.py +@@ -347,7 +347,7 @@ _directivesre = re.compile(r'(%s)(?:$|\s+)' % '|'.join(_directivestokenlist)) + _varsettokens = (':=', '+=', '?=', '=') + + def _parsefile(pathname): +- fd = open(pathname, "rU") ++ fd = open(pathname, "r") + stmts = parsestring(fd.read(), pathname) + stmts.mtime = os.fstat(fd.fileno()).st_mtime + fd.close() +diff --git a/build/pymake/tests/formattingtests.py b/build/pymake/tests/formattingtests.py +index 7aad6d4cc1..282ef02414 100644 +--- a/build/pymake/tests/formattingtests.py ++++ b/build/pymake/tests/formattingtests.py +@@ -253,7 +253,7 @@ class MakefileCorupusTest(TestBase): + continue + + source = None +- with open(makefile, 'rU') as fh: ++ with open(makefile, 'r') as fh: + source = fh.read() + + try: +diff --git a/dom/base/usecounters.py b/dom/base/usecounters.py +index fdcd366232..026a647c51 100644 +--- a/dom/base/usecounters.py ++++ b/dom/base/usecounters.py +@@ -10,7 +10,7 @@ import sys + + def read_conf(conf_filename): + # Can't read/write from a single StringIO, so make a new one for reading. +- stream = open(conf_filename, 'rU') ++ stream = open(conf_filename, 'r') + + def parse_counters(stream): + for line_num, line in enumerate(stream): +diff --git a/media/webrtc/trunk/webrtc/build/gyp_helper.py b/media/webrtc/trunk/webrtc/build/gyp_helper.py +index c840f2d6dc..42f6400a91 100644 +--- a/media/webrtc/trunk/webrtc/build/gyp_helper.py ++++ b/media/webrtc/trunk/webrtc/build/gyp_helper.py +@@ -15,7 +15,7 @@ def apply_gyp_environment_from_file(file_path): + """Reads in a *.gyp_env file and applies the valid keys to os.environ.""" + if not os.path.exists(file_path): + return +- with open(file_path, 'rU') as f: ++ with open(file_path, 'r') as f: + file_contents = f.read() + try: + file_data = eval(file_contents, {'__builtins__': None}, None) +diff --git a/python/mozbuild/mozbuild/action/process_define_files.py b/python/mozbuild/mozbuild/action/process_define_files.py +index 6fff0d1d64..de2bcf4fc2 100644 +--- a/python/mozbuild/mozbuild/action/process_define_files.py ++++ b/python/mozbuild/mozbuild/action/process_define_files.py +@@ -36,7 +36,7 @@ def process_define_file(output, input): + not config.substs.get('JS_STANDALONE'): + config = PartialConfigEnvironment(mozpath.join(topobjdir, 'js', 'src')) + +- with open(path, 'rU') as input: ++ with open(path, 'r') as input: + r = re.compile('^\s*#\s*(?P[a-z]+)(?:\s+(?P\S+)(?:\s+(?P\S+))?)?', re.U) + for l in input: + m = r.match(l) +diff --git a/python/mozbuild/mozbuild/backend/base.py b/python/mozbuild/mozbuild/backend/base.py +index 367fe160bc..51cee16bd6 100644 +--- a/python/mozbuild/mozbuild/backend/base.py ++++ b/python/mozbuild/mozbuild/backend/base.py +@@ -265,7 +265,7 @@ class BuildBackend(LoggingMixin): + return status + + @contextmanager +- def _write_file(self, path=None, fh=None, readmode='rU'): ++ def _write_file(self, path=None, fh=None, readmode='r'): + """Context manager to write a file. + + This is a glorified wrapper around FileAvoidWrite with integration to +diff --git a/python/mozbuild/mozbuild/preprocessor.py b/python/mozbuild/mozbuild/preprocessor.py +index 0e3a750e73..66f5cf7254 100644 +--- a/python/mozbuild/mozbuild/preprocessor.py ++++ b/python/mozbuild/mozbuild/preprocessor.py +@@ -517,7 +517,7 @@ class Preprocessor: + + if args: + for f in args: +- with io.open(f, 'rU', encoding='utf-8') as input: ++ with io.open(f, 'r', encoding='utf-8') as input: + self.processFile(input=input, output=out) + if depfile: + mk = Makefile() +@@ -807,7 +807,7 @@ class Preprocessor: + args = self.applyFilters(args) + if not os.path.isabs(args): + args = os.path.join(self.curdir, args) +- args = io.open(args, 'rU', encoding='utf-8') ++ args = io.open(args, 'r', encoding='utf-8') + except Preprocessor.Error: + raise + except Exception: +@@ -862,7 +862,7 @@ def preprocess(includes=[sys.stdin], defines={}, + pp = Preprocessor(defines=defines, + marker=marker) + for f in includes: +- with io.open(f, 'rU', encoding='utf-8') as input: ++ with io.open(f, 'r', encoding='utf-8') as input: + pp.processFile(input=input, output=output) + return pp.includes + +diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py +index 98ed3ef521..535eda5c25 100644 +--- a/python/mozbuild/mozbuild/util.py ++++ b/python/mozbuild/mozbuild/util.py +@@ -220,7 +220,7 @@ class FileAvoidWrite(BytesIO): + still occur, as well as diff capture if requested. + """ + +- def __init__(self, filename, capture_diff=False, dry_run=False, readmode='rU'): ++ def __init__(self, filename, capture_diff=False, dry_run=False, readmode='r'): + BytesIO.__init__(self) + self.name = filename + assert type(capture_diff) == bool +diff --git a/python/mozbuild/mozbuild/virtualenv.py b/python/mozbuild/mozbuild/virtualenv.py +index f331c48554..e647375bb3 100644 +--- a/python/mozbuild/mozbuild/virtualenv.py ++++ b/python/mozbuild/mozbuild/virtualenv.py +@@ -257,7 +257,7 @@ class VirtualenvManager(object): + return self.virtualenv_root + + def packages(self): +- mode = 'rU' if PY2 else 'r' ++ mode = 'r' if PY2 else 'r' + with open(self.manifest_path, mode) as fh: + packages = [line.rstrip().split(':') + for line in fh] +diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py +index ad0f7c2aab..fa353e89f8 100644 +--- a/python/mozbuild/mozpack/files.py ++++ b/python/mozbuild/mozpack/files.py +@@ -558,7 +558,7 @@ class PreprocessedFile(BaseFile): + pp = Preprocessor(defines=self.defines, marker=self.marker) + pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings) + +- with _open(self.path, 'rU') as input: ++ with _open(self.path, 'r') as input: + with _open(os.devnull, 'w') as output: + pp.processFile(input=input, output=output) + +@@ -615,7 +615,7 @@ class PreprocessedFile(BaseFile): + pp = Preprocessor(defines=self.defines, marker=self.marker) + pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings) + +- with _open(self.path, 'rU') as input: ++ with _open(self.path, 'r') as input: + pp.processFile(input=input, output=dest, depfile=deps_out) + + dest.close() +diff --git a/testing/web-platform/tests/conformance-checkers/tools/build-svg-tests.py b/testing/web-platform/tests/conformance-checkers/tools/build-svg-tests.py +index dd3aa3844e..85bfbcff5d 100644 +--- a/testing/web-platform/tests/conformance-checkers/tools/build-svg-tests.py ++++ b/testing/web-platform/tests/conformance-checkers/tools/build-svg-tests.py +@@ -139,7 +139,7 @@ def build_html_test_file(filename, svgdirectory, htmldirectory): + logging.debug(htmlpathname) + + # read SVG data +- svgfile = open(svgpathname, "rU") ++ svgfile = open(svgpathname, "r") + svg = svgfile.read() + svgfile.close() + +diff --git a/testing/web-platform/tests/tools/third_party/py/py/_path/common.py b/testing/web-platform/tests/tools/third_party/py/py/_path/common.py +index 2d490b56a8..06ced4807a 100644 +--- a/testing/web-platform/tests/tools/third_party/py/py/_path/common.py ++++ b/testing/web-platform/tests/tools/third_party/py/py/_path/common.py +@@ -174,7 +174,7 @@ class PathBase(object): + """ read and return a list of lines from the path. if cr is False, the + newline will be removed from the end of each line. """ + if sys.version_info < (3, ): +- mode = 'rU' ++ mode = 'r' + else: # python 3 deprecates mode "U" in favor of "newline" option + mode = 'r' + +diff --git a/testing/web-platform/tests/tools/third_party/py/py/_path/svnurl.py b/testing/web-platform/tests/tools/third_party/py/py/_path/svnurl.py +index 6589a71d09..da49ff6ac0 100644 +--- a/testing/web-platform/tests/tools/third_party/py/py/_path/svnurl.py ++++ b/testing/web-platform/tests/tools/third_party/py/py/_path/svnurl.py +@@ -97,7 +97,7 @@ class SvnCommandPath(svncommon.SvnPathBase): + + def open(self, mode='r'): + """ return an opened file with the given mode. """ +- if mode not in ("r", "rU",): ++ if mode not in ("r", "r",): + raise ValueError("mode %r not supported" % (mode,)) + assert self.check(file=1) # svn cat returns an empty file otherwise + if self.rev is None: +diff --git a/third_party/python/py/py/_path/common.py b/third_party/python/py/py/_path/common.py +index 2d490b56a8..06ced4807a 100644 +--- a/third_party/python/py/py/_path/common.py ++++ b/third_party/python/py/py/_path/common.py +@@ -174,7 +174,7 @@ class PathBase(object): + """ read and return a list of lines from the path. if cr is False, the + newline will be removed from the end of each line. """ + if sys.version_info < (3, ): +- mode = 'rU' ++ mode = 'r' + else: # python 3 deprecates mode "U" in favor of "newline" option + mode = 'r' + +diff --git a/third_party/python/py/py/_path/svnurl.py b/third_party/python/py/py/_path/svnurl.py +index 6589a71d09..da49ff6ac0 100644 +--- a/third_party/python/py/py/_path/svnurl.py ++++ b/third_party/python/py/py/_path/svnurl.py +@@ -97,7 +97,7 @@ class SvnCommandPath(svncommon.SvnPathBase): + + def open(self, mode='r'): + """ return an opened file with the given mode. """ +- if mode not in ("r", "rU",): ++ if mode not in ("r", "r",): + raise ValueError("mode %r not supported" % (mode,)) + assert self.check(file=1) # svn cat returns an empty file otherwise + if self.rev is None: +-- +2.33.0 + diff --git a/mozjs78.spec b/mozjs78.spec index 111098b..d13f183 100644 --- a/mozjs78.spec +++ b/mozjs78.spec @@ -1,6 +1,10 @@ %global major 78 %global build_with_lto 1 +%ifnarch riscv64 %global require_tests 1 +%else +%global require_tests 0 +%endif %ifarch armv7hl %global require_tests 0 @@ -11,7 +15,7 @@ %define _lto_cflags %{nil} %endif -%ifarch ppc +%ifarch ppc riscv64 %global system_libatomic 1 %endif @@ -21,7 +25,7 @@ Name: mozjs%{major} Version: 78.15.0 -Release: 3 +Release: 4 Summary: SpiderMonkey JavaScript library License: MPLv2.0 and MPLv1.1 and BSD and GPLv2+ and GPLv3+ and LGPLv2+ and AFL and ASL 2.0 @@ -35,9 +39,11 @@ Source3: firefox-78.15.0esr.source.tar.xzac Patch01: fix-soname.patch Patch02: copy-headers.patch Patch03: tests-increase-timeout.patch +Patch04: Add-riscv64-support.patch Patch09: icu_sources_data.py-Decouple-from-Mozilla-build-system.patch Patch10: icu_sources_data-Write-command-output-to-our-stderr.patch -Patch12: emitter.patch +Patch11: emitter.patch +Patch12: modify-mode-rU-to-r.patch # Build fixes Patch13: Fixup-compatibility-of-mozbuild-with-Python-3.10.patch Patch14: init_patch.patch @@ -103,9 +109,10 @@ pushd ../.. %patch01 -p1 %patch02 -p1 %patch03 -p1 +%patch04 -p1 %patch09 -p1 %patch10 -p1 - +%patch11 -p1 %patch12 -p1 %patch13 -p1 %patch14 -p1 @@ -187,7 +194,7 @@ case `uname -i` in i386 | ppc | s390 | sparc ) wordsize="32" ;; - x86_64 | ppc64 | s390x | sparc64 ) + x86_64 | ppc64 | s390x | sparc64 | riscv64) wordsize="64" ;; *) @@ -258,6 +265,9 @@ PYTHONPATH=tests/lib %{__python3} jit-test/jit_test.py -s -t 1800 --no-progress %{_includedir}/mozjs-%{major}/ %changelog +* Fri Apr 5 2024 shafeipaozi - 78.15.0-4 +- add support riscv + * Wed Jul 20 2022 Wenlong Ding - 78.15.0-3 - Initial Packaging - Split SOURCE0 to 3 file. -- Gitee