Skip to content

Commit

Permalink
fix: strip branded binaries (#36641)
Browse files Browse the repository at this point in the history
When creating branded release builds and using scripts/strip-binaries.py
on Linux, the final artifacts end up unstripped due to the static set of
binaries considered for stripping.
With this patch the name of the electron binary is taken from the
BRANDING.json `project_name` key.

Signed-off-by: Robert Günzler <r@gnzler.io>

Signed-off-by: Robert Günzler <r@gnzler.io>
  • Loading branch information
robertgzr committed Dec 13, 2022
1 parent 425f1ff commit ab890fb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions script/add-debug-link.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import os
import sys

from lib.config import LINUX_BINARIES, PLATFORM
from lib.util import execute, get_out_dir
from lib.config import PLATFORM
from lib.util import execute, get_linux_binaries, get_out_dir

def add_debug_link_into_binaries(directory, target_cpu, debug_dir):
for binary in LINUX_BINARIES:
for binary in get_linux_binaries():
binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path):
add_debug_link_into_binary(binary_path, target_cpu, debug_dir)
Expand Down
6 changes: 3 additions & 3 deletions script/copy-debug-symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import os
import sys

from lib.config import LINUX_BINARIES, PLATFORM
from lib.util import execute, get_out_dir, safe_mkdir
from lib.config import PLATFORM
from lib.util import execute, get_linux_binaries, get_out_dir, safe_mkdir

# It has to be done before stripping the binaries.
def copy_debug_from_binaries(directory, out_dir, target_cpu, compress):
for binary in LINUX_BINARIES:
for binary in get_linux_binaries():
binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path):
copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)
Expand Down
10 changes: 0 additions & 10 deletions script/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
'win32': 'win32',
}[sys.platform]

LINUX_BINARIES = [
'chrome-sandbox',
'chrome_crashpad_handler',
'electron',
'libEGL.so',
'libGLESv2.so',
'libffmpeg.so',
'libvk_swiftshader.so',
]

verbose_mode = False


Expand Down
11 changes: 11 additions & 0 deletions script/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,14 @@ def get_buildtools_executable(name):
if sys.platform == 'win32':
path += '.exe'
return path

def get_linux_binaries():
return [
'chrome-sandbox',
'chrome_crashpad_handler',
get_electron_branding()['project_name'],
'libEGL.so',
'libGLESv2.so',
'libffmpeg.so',
'libvk_swiftshader.so',
]
6 changes: 3 additions & 3 deletions script/strip-binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import os
import sys

from lib.config import LINUX_BINARIES, enable_verbose_mode
from lib.util import execute, get_out_dir
from lib.config import enable_verbose_mode
from lib.util import execute, get_linux_binaries, get_out_dir

def strip_binaries(directory, target_cpu):
for binary in LINUX_BINARIES:
for binary in get_linux_binaries():
binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path):
strip_binary(binary_path, target_cpu)
Expand Down

0 comments on commit ab890fb

Please sign in to comment.