summaryrefslogtreecommitdiff
blob: 9360646ff6813b8bbdda5e222c8d1cc6826c20fe (plain)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
From 0352e8df546c58b85e79714f77c616832c8c72ac Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <elvis@magic.io>
Date: Fri, 28 Apr 2017 17:22:38 -0400
Subject: [PATCH] Gentoo build fixes

---
 chromiumcontent/BUILD.gn      |  9 +++------
 chromiumcontent/build_libs.py |  2 +-
 script/create-dist            | 39 ++++++++++++++++++++++++++-------------
 script/lib/config.py          |  2 +-
 4 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/chromiumcontent/BUILD.gn b/chromiumcontent/BUILD.gn
index e4e4166..f88fab3 100644
--- a/chromiumcontent/BUILD.gn
+++ b/chromiumcontent/BUILD.gn
@@ -343,12 +343,9 @@ if (is_electron_build && !is_component_build) {
     }
   }
 
-  static_library("v8") {
-    complete_static_lib = true
-    sources = []
-    if (defined(obj_v8)) {
-      sources += obj_v8
-    }
+  shared_library("v8") {
+    deps = [ "//v8:v8", "//v8:v8_libplatform" ]
+    ldflags = [ "-Wl,-rpath=\$ORIGIN/" ]
   }
 
 } else {
diff --git a/chromiumcontent/build_libs.py b/chromiumcontent/build_libs.py
index e10f320..716c5f2 100644
--- a/chromiumcontent/build_libs.py
+++ b/chromiumcontent/build_libs.py
@@ -82,7 +82,7 @@ with open(args.out, 'w') as out:
             "third_party/usrsctp",
             "third_party/woff2",
             "third_party/zlib",
-            "tools",
+            "tools/battor_agent",
             "ui",
             "url",
         ])
diff --git a/script/create-dist b/script/create-dist
index aec75e5..cf2f62c 100755
--- a/script/create-dist
+++ b/script/create-dist
@@ -45,7 +45,6 @@ COMPONENTS = ['static_library', 'shared_library']
 BINARIES = {
   'all': [
     'content_shell.pak',
-    'icudtl.dat',
     'natives_blob.bin',
     'snapshot_blob.bin',
     os.path.join('gen', 'blink', 'public', 'resources', 'blink_image_resources_200_percent.pak'),
@@ -59,7 +58,6 @@ BINARIES = {
     'libffmpeg.dylib',
   ],
   'linux': [
-    'libffmpeg.so',
   ],
   'win32': [
     'd3dcompiler_47.dll',
@@ -308,12 +306,11 @@ def main():
 
   for component in COMPONENTS:
     if args.component == 'all' or args.component == component:
-      copy_binaries(target_arch, component, create_debug_archive)
+      copy_binaries(target_arch, component, create_debug_archive,
+                    args.system_icu)
       copy_generated_sources(target_arch, component)
       copy_locales(target_arch, component)
 
-  copy_ffmpeg(target_arch)
-  copy_sources()
   generate_licenses()
   if not args.no_zip:
     create_zip(create_debug_archive)
@@ -331,6 +328,8 @@ def parse_args():
                       help='static_library or shared_library or all')
   parser.add_argument('--no_zip', action='store_true',
                       help='Do not create zip distribution')
+  parser.add_argument('--system-icu', action='store_true', dest='system_icu',
+                      help='Use system icu.')
   return parser.parse_args()
 
 
@@ -355,15 +354,17 @@ def check_create_debug_archive(target_arch):
 def copy_with_blacklist(target_arch, src, dest):
   if os.path.basename(src) in ARCH_BLACKLIST[target_arch]:
     return
-  shutil.copy2(src, dest)
+  link_or_copy(src, dest)
 
 
-def copy_binaries(target_arch, component, create_debug_archive):
+def copy_binaries(target_arch, component, create_debug_archive, system_icu):
   output_dir = get_output_dir(SOURCE_ROOT, target_arch, component)
   target_dir = os.path.join(MAIN_DIR, component)
   mkdir_p(target_dir)
 
   binaries = BINARIES['all'] + BINARIES[TARGET_PLATFORM]
+  if not system_icu:
+    binaries.append('icudtl.dat')
   if component == 'shared_library':
     binaries += BINARIES_SHARED_LIBRARY[TARGET_PLATFORM]
   for binary in binaries:
@@ -371,7 +372,7 @@ def copy_binaries(target_arch, component, create_debug_archive):
 
   # Copy all static libraries from chromiumcontent
   for library in glob.glob(os.path.join(output_dir, 'obj', 'chromiumcontent', '*.' + STATIC_LIBRARY_SUFFIX)):
-    shutil.copy2(library, target_dir)
+    link_or_copy(library, target_dir)
 
   if component == 'shared_library':
     match = '*.{0}'.format(SHARED_LIBRARY_SUFFIX)
@@ -396,7 +397,7 @@ def copy_binaries(target_arch, component, create_debug_archive):
       for root, _, filenames in os.walk(output_dir):
         for pdb in filenames:
           if pdb.endswith('.pdb'):
-            shutil.copy2(os.path.join(root, pdb), target_dir)
+            link_or_copy(os.path.join(root, pdb), target_dir)
 
   if TARGET_PLATFORM == 'linux':
     if component == 'shared_library':
@@ -433,7 +434,7 @@ def copy_binaries(target_arch, component, create_debug_archive):
 
     ffmpeg_output_dir = get_output_dir(SOURCE_ROOT, target_arch, 'ffmpeg')
     for binary in binaries:
-      shutil.copy2(os.path.join(ffmpeg_output_dir, binary), target_dir)
+      link_or_copy(os.path.join(ffmpeg_output_dir, binary), target_dir)
 
 
 def copy_generated_sources(target_arch, component):
@@ -452,7 +453,7 @@ def copy_locales(target_arch, component):
   for src_file in glob.glob(os.path.join(src_dir, 'content_strings_*.pak')):
     filename = os.path.basename(src_file)
     new_name = re.sub('content_strings_', '', filename)
-    shutil.copy2(src_file, os.path.join(target_dir, new_name))
+    link_or_copy(src_file, os.path.join(target_dir, new_name))
 
 def copy_sources():
   for include_path in INCLUDE_DIRS:
@@ -477,7 +478,7 @@ def copy_ffmpeg(target_arch):
 
   target_dir = os.path.join(MAIN_DIR, 'ffmpeg')
   mkdir_p(target_dir)
-  shutil.copy2(os.path.join(output_dir, binary), target_dir)
+  link_or_copy(os.path.join(output_dir, binary), target_dir)
 
 
 
@@ -494,7 +495,7 @@ def copy_source_file(absolute_path, relative_to, destination):
   relative_path = os.path.relpath(absolute_path, start=relative_to)
   final_path = os.path.join(destination, relative_path)
   mkdir_p(os.path.dirname(final_path))
-  shutil.copy2(absolute_path, final_path)
+  link_or_copy(absolute_path, final_path)
 
 
 def copy_dir(relative_path, relative_to, destination):
@@ -531,6 +532,7 @@ def link_binary_to_debug_file(objcopy, binfile, symfile, dirname):
 def run_strip(target_arch, filename, create_debug_archive):
   # Static libraries are not stripped because it would remove
   # all the symbols in it.
+  return
   if filename.endswith('.a'):
     return
 
@@ -620,6 +622,17 @@ def rm_rf(path):
       raise
 
 
+def link_or_copy(src, dst):
+  if os.path.isfile(src):
+    if os.path.isdir(dst):
+      dst = os.path.join(dst, os.path.basename(src))
+    try:
+      os.link(src, dst)
+    except OSError:
+      shutil.copy2(src, dst)
+  else:
+    shutil.copy2(src, dst)
+
 def safe_unlink(path):
   try:
     os.unlink(path)
diff --git a/script/lib/config.py b/script/lib/config.py
index 3455161..195b2a1 100644
--- a/script/lib/config.py
+++ b/script/lib/config.py
@@ -4,4 +4,4 @@ import os
 
 
 def get_output_dir(source_root, target_arch, component):
-  return os.path.join(source_root, 'src', 'out-' + target_arch, component)
+  return os.environ.get('CHROMIUM_BUILD_DIR')
-- 
2.13.6