View | Details | Raw Unified | Return to bug 225279 | Differences between
and this patch

Collapse All | Expand All

(-)www/firefox/files/patch-build_moz.configure_rust.configure (+269 lines)
Line 0 Link Here
1
upstream version as of 20190907 (mainly for this patch https://bugzilla.mozilla.org/show_bug.cgi?id=1560700)
2
3
4
--- build/moz.configure/rust.configure	2019-08-27 03:31:51.000000000 +0200
5
+++ build/moz.configure/rust.configure	2019-09-07 17:17:45.964128000 +0200
6
@@ -41,7 +41,6 @@ def unwrap_rustup(prog, name):
7
     # "+stable" file. We'll examine the error output to try and distinguish
8
     # between failing rustup and failing rustc.
9
     @depends(prog, dependable(name))
10
-    @imports('subprocess')
11
     @imports(_from='__builtin__', _import='open')
12
     @imports('os')
13
     def unwrap(prog, name):
14
@@ -96,6 +95,7 @@ def rustc_info(rustc):
15
         version=Version(info.get('release', '0')),
16
         commit=info.get('commit-hash', 'unknown'),
17
         host=info['host'],
18
+        llvm_version=Version(info.get('LLVM version', '0')),
19
     )
20
 
21
 set_config('RUSTC_VERSION', depends(rustc_info)(lambda info: str(info.version)))
22
@@ -138,11 +138,10 @@ def rust_compiler(rustc_info, cargo_info, build_projec
23
         or by directly running the installer from https://rustup.rs/
24
         '''))
25
     if build_project == 'tools/crashreporter':
26
-        rustc_min_version = Version('1.22.0')
27
-        cargo_min_version = Version('0.23.0')
28
+        rustc_min_version = Version('1.31.0')
29
     else:
30
         rustc_min_version = Version('1.35.0')
31
-        cargo_min_version = rustc_min_version
32
+    cargo_min_version = rustc_min_version
33
 
34
     version = rustc_info.version
35
     if version < rustc_min_version:
36
@@ -185,41 +184,34 @@ def rust_compiler(rustc_info, cargo_info, build_projec
37
 
38
 
39
 @depends(rustc, when=rust_compiler)
40
+@imports(_from='__builtin__', _import='ValueError')
41
 def rust_supported_targets(rustc):
42
     out = check_cmd_output(rustc, '--print', 'target-list').splitlines()
43
-    # The os in the triplets used by rust may match the same OSes, in which
44
-    # case we need to check the raw_os instead.
45
-    per_os = {}
46
-    ambiguous = set()
47
-    per_raw_os = {}
48
+    data = {}
49
     for t in out:
50
-        t = split_triplet(t, allow_unknown=True)
51
-        endianness = t.endianness
52
-        if t.cpu.startswith('thumb') and endianness not in ('big', 'little'):
53
-            endianness = 'little'
54
-        key = (t.cpu, endianness, t.os)
55
-        if key in per_os:
56
-            previous = per_os[key]
57
-            per_raw_os[(previous.cpu, previous.endianness,
58
-                        previous.raw_os)] = previous
59
-            del per_os[key]
60
-            ambiguous.add(key)
61
-        if key in ambiguous:
62
-            raw_os = t.raw_os
63
-            # split_triplet will return a raw_os of 'androideabi' for
64
-            # rust targets in the form cpu-linux-androideabi, but what
65
-            # we get from the build system is linux-androideabi, so
66
-            # normalize.
67
-            if raw_os == 'androideabi':
68
-                raw_os = 'linux-androideabi'
69
-            per_raw_os[(t.cpu, endianness, raw_os)] = t
70
-        else:
71
-            per_os[key] = t
72
-    return namespace(per_os=per_os, per_raw_os=per_raw_os)
73
+        try:
74
+            info = split_triplet(t)
75
+        except ValueError:
76
+            if t.startswith('thumb'):
77
+                cpu, rest = t.split('-', 1)
78
+                retry = '-'.join(('arm', rest))
79
+            elif t.endswith('-windows-msvc'):
80
+                retry = t[:-len('windows-msvc')] + 'mingw32'
81
+            elif t.endswith('-windows-gnu'):
82
+                retry = t[:-len('windows-gnu')] + 'mingw32'
83
+            else:
84
+                continue
85
+            try:
86
+                info = split_triplet(retry)
87
+            except ValueError:
88
+                continue
89
+        key = (info.cpu, info.endianness, info.os)
90
+        data.setdefault(key, []).append(namespace(rust_target=t, target=info))
91
+    return data
92
 
93
 
94
 @template
95
-def rust_triple_alias(host_or_target):
96
+def rust_triple_alias(host_or_target, host_or_target_c_compiler):
97
     """Template defining the alias used for rustc's --target flag.
98
     `host_or_target` is either `host` or `target` (the @depends functions
99
     from init.configure).
100
@@ -228,11 +220,10 @@ def rust_triple_alias(host_or_target):
101
 
102
     host_or_target_str = {host: 'host', target: 'target'}[host_or_target]
103
 
104
-    @depends(rustc, host_or_target, c_compiler, rust_supported_targets,
105
-             arm_target, when=rust_compiler)
106
+    @depends(rustc, host_or_target, host_or_target_c_compiler,
107
+             rust_supported_targets, arm_target, when=rust_compiler)
108
     @checking('for rust %s triplet' % host_or_target_str)
109
     @imports('os')
110
-    @imports('subprocess')
111
     @imports(_from='mozbuild.configure.util', _import='LineIO')
112
     @imports(_from='mozbuild.shellutil', _import='quote')
113
     @imports(_from='tempfile', _import='mkstemp')
114
@@ -248,41 +239,104 @@ def rust_triple_alias(host_or_target):
115
         # munging to get the correct option to rustc.
116
         # We correlate the autoconf-derived targets with the list of targets
117
         # rustc gives us with --print target-list.
118
-        if host_or_target.kernel == 'WINNT':
119
-            if compiler_info.type in ('gcc', 'clang'):
120
-                host_or_target_os = 'windows-gnu'
121
-            else:
122
-                host_or_target_os = 'windows-msvc'
123
-            host_or_target_raw_os = host_or_target_os
124
-        else:
125
-            host_or_target_os = host_or_target.os
126
-            host_or_target_raw_os = host_or_target.raw_os
127
+        candidates = rust_supported_targets.get(
128
+            (host_or_target.cpu, host_or_target.endianness, host_or_target.os), [])
129
 
130
-        if host_or_target.cpu == 'arm' and arm_target.arm_arch == 7 and \
131
-                arm_target.fpu == 'neon' and arm_target.thumb2:
132
-            host_or_target_cpus = ('thumbv7neon', host_or_target.cpu)
133
-        else:
134
-            host_or_target_cpus = (host_or_target.cpu,)
135
+        def find_candidate(candidates):
136
+            if len(candidates) == 1:
137
+                return candidates[0].rust_target
138
+            elif not candidates:
139
+                return None
140
 
141
-        for host_or_target_cpu in host_or_target_cpus:
142
-            rustc_target = rust_supported_targets.per_os.get(
143
-                (host_or_target_cpu, host_or_target.endianness, host_or_target_os))
144
-            if rustc_target:
145
-                break
146
+            # We have multiple candidates. There are two cases where we can try to
147
+            # narrow further down using extra information from the build system.
148
+            # - For windows targets, correlate with the C compiler type
149
+            if host_or_target.kernel == 'WINNT':
150
+                if compiler_info.type in ('gcc', 'clang'):
151
+                    suffix = 'windows-gnu'
152
+                else:
153
+                    suffix = 'windows-msvc'
154
+                narrowed = [c for c in candidates if c.rust_target.endswith('-{}'.format(suffix))]
155
+                if len(narrowed) == 1:
156
+                    return narrowed[0].rust_target
157
+                elif narrowed:
158
+                    candidates = narrowed
159
 
160
-            rustc_target = rust_supported_targets.per_raw_os.get(
161
-                (host_or_target_cpu, host_or_target.endianness,
162
-                 host_or_target_raw_os))
163
-            if rustc_target:
164
-                break
165
+            # - For arm targets, correlate with arm_target
166
+            #   we could be more thorough with the supported rust targets, but they
167
+            #   don't support OSes that are supported to build Gecko anyways.
168
+            #   Also, sadly, the only interface to check the rust target cpu features
169
+            #   is --print target-spec-json, and it's unstable, so we have to rely on
170
+            #   our own knowledge of what each arm target means.
171
+            if host_or_target.cpu == 'arm' and host_or_target.endianness == 'little':
172
+                prefixes = []
173
+                if arm_target.arm_arch >= 7:
174
+                    if arm_target.thumb2 and arm_target.fpu == 'neon':
175
+                        prefixes.append('thumbv7neon')
176
+                    if arm_target.thumb2:
177
+                        prefixes.append('thumbv7a')
178
+                    prefixes.append('armv7')
179
+                if arm_target.arm_arch >= 6:
180
+                    prefixes.append('armv6')
181
+                    if host_or_target.os != 'Android':
182
+                        # arm-* rust targets are armv6... except arm-linux-androideabi
183
+                        prefixes.append('arm')
184
+                if arm_target.arm_arch >= 5:
185
+                    prefixes.append('armv5te')
186
+                    if host_or_target.os == 'Android':
187
+                        # arm-* rust targets are armv6... except arm-linux-androideabi
188
+                        prefixes.append('arm')
189
+                if arm_target.arm_arch >= 4:
190
+                    prefixes.append('armv4t')
191
+                # rust freebsd targets are the only ones that don't have a 'hf' suffix
192
+                # for hard-float. Technically, that means if the float abi ever is not
193
+                # hard-float, this will pick a wrong target, but since rust only
194
+                # supports hard-float, let's assume that means freebsd only support
195
+                # hard-float.
196
+                if arm_target.float_abi == 'hard' and host_or_target.os != 'FreeBSD':
197
+                    suffix = 'hf'
198
+                else:
199
+                    suffix = ''
200
+                for p in prefixes:
201
+                    for c in candidates:
202
+                        if c.rust_target.startswith('{}-'.format(p)) and \
203
+                                c.rust_target.endswith(suffix):
204
+                            return c.rust_target
205
 
206
+            # See if we can narrow down on the exact alias
207
+            narrowed = [c for c in candidates if c.target.alias == host_or_target.alias]
208
+            if len(narrowed) == 1:
209
+                return narrowed[0].rust_target
210
+            elif narrowed:
211
+                candidates = narrowed
212
+
213
+            # See if we can narrow down with the raw OS
214
+            narrowed = [c for c in candidates if c.target.raw_os == host_or_target.raw_os]
215
+            if len(narrowed) == 1:
216
+                return narrowed[0].rust_target
217
+            elif narrowed:
218
+                candidates = narrowed
219
+
220
+            # See if we can narrow down with the raw OS and raw CPU
221
+            narrowed = [
222
+                c for c in candidates
223
+                if c.target.raw_os == host_or_target.raw_os and
224
+                   c.target.raw_cpu == host_or_target.raw_cpu
225
+            ]
226
+            if len(narrowed) == 1:
227
+                return narrowed[0].rust_target
228
+
229
+            return None
230
+
231
+        rustc_target = find_candidate(candidates)
232
+
233
         if rustc_target is None:
234
             die("Don't know how to translate {} for rustc".format(
235
                 host_or_target.alias))
236
 
237
         # Check to see whether our rustc has a reasonably functional stdlib
238
         # for our chosen target.
239
-        target_arg = '--target=' + rustc_target.alias
240
+        target_arg = '--target=' + rustc_target
241
         in_fd, in_path = mkstemp(prefix='conftest', suffix='.rs')
242
         out_fd, out_path = mkstemp(prefix='conftest', suffix='.rlib')
243
         os.close(out_fd)
244
@@ -310,7 +364,7 @@ def rust_triple_alias(host_or_target):
245
                 a rust std library for that target installed. Try:
246
 
247
                   rustup target add {}
248
-                '''.format(host_or_target.alias, rustc, rustc_target.alias)))
249
+                '''.format(host_or_target.alias, rustc, rustc_target)))
250
             check_cmd_output(*cmd, onerror=failed)
251
             if not os.path.exists(out_path) or os.path.getsize(out_path) == 0:
252
                 failed()
253
@@ -319,13 +373,13 @@ def rust_triple_alias(host_or_target):
254
             os.remove(out_path)
255
 
256
         # This target is usable.
257
-        return rustc_target.alias
258
+        return rustc_target
259
 
260
     return rust_target
261
 
262
 
263
-rust_target_triple = rust_triple_alias(target)
264
-rust_host_triple = rust_triple_alias(host)
265
+rust_target_triple = rust_triple_alias(target, c_compiler)
266
+rust_host_triple = rust_triple_alias(host, host_c_compiler)
267
 
268
 
269
 @depends(host, rust_host_triple, rustc_info.host)
(-)www/firefox/files/patch-gfx_skia_skia_src_core_SkCpu.cpp (+17 lines)
Lines 27-29 Link Here
27
 #elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
27
 #elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
28
     #include <sys/auxv.h>
28
     #include <sys/auxv.h>
29
 
29
 
30
@@ -81,6 +95,16 @@
31
         uint32_t hwcaps = getauxval(AT_HWCAP);
32
         if (hwcaps & kHWCAP_CRC32  ) { features |= SkCpu::CRC32; }
33
         if (hwcaps & kHWCAP_ASIMDHP) { features |= SkCpu::ASIMDHP; }
34
+        return features;
35
+    }
36
+
37
+#elif defined(SK_CPU_ARM32) && defined(__FreeBSD__)
38
+
39
+    static uint32_t read_cpu_features() {
40
+        uint32_t features = 0;
41
+#if defined(__ARM_NEON__)
42
+        features |= SkCpu::NEON;
43
+#endif
44
         return features;
45
     }
46
 
(-)www/firefox/files/patch-media_libtheora_lib_arm_armcpu.c (+19 lines)
Line 0 Link Here
1
--- media/libtheora/lib/arm/armcpu.c.orig	2019-09-05 19:12:29.094444000 +0200
2
+++ media/libtheora/lib/arm/armcpu.c	2019-09-05 19:19:08.583855000 +0200
3
@@ -107,6 +107,16 @@ ogg_uint32_t oc_cpu_flags_get(void){
4
   return flags;
5
 }
6
 
7
+#elif defined(__FreeBSD__)
8
+ogg_uint32_t oc_cpu_flags_get(void){
9
+  ogg_uint32_t  flags;
10
+  flags = 0;
11
+#if defined(__ARM_NEON)
12
+  flags|=OC_CPU_ARM_NEON;
13
+#endif
14
+  return flags;
15
+}
16
+
17
 #else
18
 /*The feature registers which can tell us what the processor supports are
19
    accessible in priveleged modes only, so we can't have a general user-space
(-)www/firefox/files/patch-media_libtheora_moz.build (+9 lines)
Line 0 Link Here
1
--- media/libtheora/moz.build.orig	2019-09-06 16:51:42.932020000 +0200
2
+++ media/libtheora/moz.build	2019-09-06 15:22:01.650146000 +0200
3
@@ -110,4 +110,6 @@ if CONFIG['GNU_AS']:
4
         if CONFIG['CC_TYPE'] == 'clang':
5
             ASFLAGS += [
6
                 '-no-integrated-as',
7
+                '-Wa,-march=armv7-a',
8
+                '-Wa,-mfpu=neon',
9
             ]
(-)www/firefox/files/patch-media_libvpx_libvpx_vpx__ports_arm__cpudetect.c (+18 lines)
Line 0 Link Here
1
--- media/libvpx/libvpx/vpx_ports/arm_cpudetect.c.orig	2019-09-05 18:41:37.364158000 +0200
2
+++ media/libvpx/libvpx/vpx_ports/arm_cpudetect.c	2019-09-06 16:45:58.616157000 +0200
3
@@ -147,6 +147,15 @@ int arm_cpu_caps(void) {
4
   }
5
   return flags & mask;
6
 }
7
+#elif defined(__FreeBSD__) /* end __linux__ */
8
+
9
+int arm_cpu_caps(void) {
10
+  int flags = 0;
11
+#if HAVE_NEON || HAVE_NEON_ASM
12
+  flags |= HAS_NEON;
13
+#endif /* HAVE_NEON || HAVE_NEON_ASM */
14
+  return flags;
15
+}
16
 #else  /* end __linux__ */
17
 #error \
18
     "--enable-runtime-cpu-detect selected, but no CPU detection method " \
(-)www/firefox/files/patch-media_libvpx_moz.build (+17 lines)
Line 0 Link Here
1
--- media/libvpx/moz.build.orig	2019-09-05 21:18:38.360185000 +0200
2
+++ media/libvpx/moz.build	2019-09-06 17:21:26.592064000 +0200
3
@@ -71,10 +71,10 @@ elif CONFIG['CPU_ARCH'] == 'arm':
4
         LOCAL_INCLUDES += [
5
             '%%%s/sources/android/cpufeatures' % CONFIG['ANDROID_NDK'],
6
         ]
7
-    if CONFIG['CC_TYPE'] == 'clang':
8
-        ASFLAGS += [
9
-            '-no-integrated-as',
10
-        ]
11
+#    if CONFIG['CC_TYPE'] == 'clang':
12
+#        ASFLAGS += [
13
+#            '-no-integrated-as',
14
+#        ]
15
 elif CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['OS_TARGET'] == 'WINNT':
16
     EXPORTS.vpx += files['ARM64_EXPORTS']
17
     SOURCES += files['ARM64_SOURCES']
(-)www/firefox/files/patch-other-licenses_nsis_Contrib_CityHash_cityhash_city.cpp (+13 lines)
Line 0 Link Here
1
https://bugzilla.mozilla.org/show_bug.cgi?id=1540142
2
3
--- other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp.orig	2019-09-06 19:57:59.310749000 +0200
4
+++ other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp	2019-09-06 19:54:05.947831000 +0200
5
@@ -33,7 +33,7 @@
6
 
7
 using namespace std;
8
 
9
-#if __sparc__
10
+#if __arm__
11
 #include <string.h>
12
 static inline uint64 UNALIGNED_LOAD64(const char *p) {
13
   uint64 val;
(-)www/firefox/files/patch-toolkit_components_protobuf_src_google_protobuf_stubs_atomicops.h (+11 lines)
Line 0 Link Here
1
--- toolkit/components/protobuf/src/google/protobuf/stubs/atomicops.h.orig	2019-09-05 21:10:17.255917000 +0200
2
+++ toolkit/components/protobuf/src/google/protobuf/stubs/atomicops.h	2019-09-05 21:11:46.179632000 +0200
3
@@ -202,6 +202,8 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
4
 #elif defined(__GNUC__)
5
 #if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64)
6
 #include <google/protobuf/stubs/atomicops_internals_x86_gcc.h>
7
+#elif defined(GOOGLE_PROTOBUF_ARCH_ARM) && defined(__FreeBSD__)
8
+#include <google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h>
9
 #elif defined(GOOGLE_PROTOBUF_ARCH_ARM) && defined(__linux__)
10
 #if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
11
 #include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
(-)www/firefox/files/patch-xpcom_reflect_xptcall_md_unix_moz.build (+11 lines)
Line 0 Link Here
1
--- xpcom/reflect/xptcall/md/unix/moz.build.orig	2019-09-05 21:06:08.123136000 +0200
2
+++ xpcom/reflect/xptcall/md/unix/moz.build	2019-09-05 21:06:26.425272000 +0200
3
@@ -62,7 +62,7 @@ if CONFIG['CPU_ARCH'] == 'Alpha':
4
         ]
5
 
6
 if CONFIG['CPU_ARCH'] == 'arm':
7
-    if CONFIG['OS_ARCH'] == 'Linux':
8
+    if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD'):
9
         SOURCES += [
10
             'xptcinvoke_arm.cpp',
11
             'xptcstubs_arm.cpp'

Return to bug 225279