summaryrefslogtreecommitdiff
path: root/www/ungoogled-chromium/files/patch-third__party_ffmpeg_chromium_scripts_build__ffmpeg.py
blob: a07a8a242d01ed56614619641440e215386bc47d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--- third_party/ffmpeg/chromium/scripts/build_ffmpeg.py.orig	2023-12-23 12:33:28 UTC
+++ third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
@@ -32,7 +32,7 @@ NDK_ROOT_DIR = os.path.abspath(
 SUCCESS_TOKEN = 'THIS_BUILD_WORKED'
 
 sys.path.append(os.path.join(CHROMIUM_ROOT_DIR, 'build'))
-import gn_helpers
+#import gn_helpers
 
 BRANDINGS = [
     'Chrome',
@@ -45,6 +45,8 @@ ARCH_MAP = {
     'linux': [
         'ia32', 'x64', 'noasm-x64', 'arm', 'arm-neon', 'arm64'
     ],
+    'openbsd': ['x64', 'arm64', 'ia32'],
+    'freebsd': ['x64', 'arm64', 'ia32'],
     'mac': ['x64', 'arm64'],
     'win': ['ia32', 'x64', 'arm64'],
 }
@@ -54,6 +56,8 @@ USAGE_END = """
 Valid combinations are android     [%(android)s]
                        linux       [%(linux)s]
                        mac         [%(mac)s]
+                       openbsd     [%(openbsd)s]
+                       freebsd     [%(freebsd)s]
                        win         [%(win)s]
 
 If no target architecture is specified all will be built.
@@ -126,6 +130,10 @@ def PrintAndCheckCall(argv, *args, **kwargs):
 def DetermineHostOsAndArch():
   if platform.system() == 'Linux':
     host_os = 'linux'
+  if platform.system() == 'OpenBSD':
+    host_os = 'openbsd'
+  elif platform.system() == 'FreeBSD':
+    host_os = 'freebsd'
   elif platform.system() == 'Darwin':
     host_os = 'mac'
   elif platform.system() == 'Windows' or 'CYGWIN_NT' in platform.system():
@@ -135,7 +143,7 @@ def DetermineHostOsAndArch():
 
   if re.match(r'i.86', platform.machine()):
     host_arch = 'ia32'
-  elif platform.machine() == 'x86_64' or platform.machine() == 'AMD64':
+  elif platform.machine() == 'x86_64' or platform.machine() == 'AMD64' or platform.machine() == 'amd64':
     host_arch = 'x64'
   elif platform.machine() == 'aarch64':
     host_arch = 'arm64'
@@ -152,7 +160,7 @@ def DetermineHostOsAndArch():
 
 
 def GetDsoName(target_os, dso_name, dso_version):
-  if target_os in ('linux', 'linux-noasm', 'android'):
+  if target_os in ('linux', 'linux-noasm', 'android', 'openbsd', 'freebsd'):
     return 'lib%s.so.%s' % (dso_name, dso_version)
   elif target_os == 'mac':
     return 'lib%s.%s.dylib' % (dso_name, dso_version)
@@ -495,7 +503,7 @@ def BuildFFmpeg(target_os, target_arch, host_os, host_
   # removing <sys/sysctl.h> soon, so this is needed to silence a deprecation
   # #warning which will be converted to an error via -Werror.
   # There is also no prctl.h
-  if target_os in ['linux', 'linux-noasm']:
+  if target_os in ['linux', 'linux-noasm', 'openbsd', 'freebsd']:
     pre_make_rewrites += [
         (r'(#define HAVE_SYSCTL [01])',
          r'#define HAVE_SYSCTL 0 /* \1 -- forced to 0 for Fuchsia */'),
@@ -622,7 +630,7 @@ def main(argv):
   configure_args = args[2:]
 
 
-  if target_os not in ('android', 'linux', 'linux-noasm', 'mac', 'win', 'all'):
+  if target_os not in ('android', 'linux', 'linux-noasm', 'mac', 'win', 'all', 'openbsd', 'freebsd'):
     parser.print_help()
     return 1
 
@@ -742,7 +750,7 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
         '--enable-parser=vp3,vp8',
     ])
 
-  if target_os in ('linux', 'linux-noasm', 'android'):
+  if target_os in ('linux', 'linux-noasm', 'android', 'openbsd', 'freebsd'):
     if target_arch == 'x64':
       if target_os == 'android':
         configure_flags['Common'].extend([
@@ -752,7 +760,7 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
         configure_flags['Common'].extend([
           '--enable-lto',
           '--arch=x86_64',
-          '--target-os=linux',
+          '--target-os=' + target_os,
         ])
 
         if host_arch != 'x64':
@@ -843,7 +851,7 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
               '--extra-cflags=-mfpu=vfpv3-d16',
           ])
     elif target_arch == 'arm64':
-      if target_os != 'android':
+      if target_os != 'android' and target_os != 'openbsd' and target_os != 'freebsd':
         if host_arch != 'arm64':
           configure_flags['Common'].extend([
             '--enable-cross-compile',
@@ -908,7 +916,7 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
             '--disable-mips64r2',
             '--enable-msa',
         ])
-      if target_os == 'linux':
+      if target_os == 'Linux':
         configure_flags['Common'].extend([
             '--enable-cross-compile',
             '--target-os=linux',
@@ -1059,7 +1067,7 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
         'Chrome', configure_flags['Common'] + configure_flags['ChromeAndroid'] +
         configure_args)
 
-  if target_os in ['linux', 'linux-noasm']:
+  if target_os in ['linux', 'linux-noasm', 'openbsd', 'freebsd']:
     # ChromeOS enables MPEG4 which requires error resilience :(
     chrome_os_flags = (
         configure_flags['Common'] + configure_flags['Chrome'] +