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>
This commit is contained in:
Robert Günzler 2022-12-13 23:01:20 +01:00 коммит произвёл GitHub
Родитель 425f1ffa98
Коммит ab890fb8c3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 20 добавлений и 19 удалений

Просмотреть файл

@ -4,11 +4,11 @@ import argparse
import os import os
import sys import sys
from lib.config import LINUX_BINARIES, PLATFORM from lib.config import PLATFORM
from lib.util import execute, get_out_dir from lib.util import execute, get_linux_binaries, get_out_dir
def add_debug_link_into_binaries(directory, target_cpu, debug_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) binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path): if os.path.isfile(binary_path):
add_debug_link_into_binary(binary_path, target_cpu, debug_dir) add_debug_link_into_binary(binary_path, target_cpu, debug_dir)

Просмотреть файл

@ -4,12 +4,12 @@ import argparse
import os import os
import sys import sys
from lib.config import LINUX_BINARIES, PLATFORM from lib.config import PLATFORM
from lib.util import execute, get_out_dir, safe_mkdir from lib.util import execute, get_linux_binaries, get_out_dir, safe_mkdir
# It has to be done before stripping the binaries. # It has to be done before stripping the binaries.
def copy_debug_from_binaries(directory, out_dir, target_cpu, compress): 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) binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path): if os.path.isfile(binary_path):
copy_debug_from_binary(binary_path, out_dir, target_cpu, compress) copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)

Просмотреть файл

@ -13,16 +13,6 @@ PLATFORM = {
'win32': 'win32', 'win32': 'win32',
}[sys.platform] }[sys.platform]
LINUX_BINARIES = [
'chrome-sandbox',
'chrome_crashpad_handler',
'electron',
'libEGL.so',
'libGLESv2.so',
'libffmpeg.so',
'libvk_swiftshader.so',
]
verbose_mode = False verbose_mode = False

Просмотреть файл

@ -215,3 +215,14 @@ def get_buildtools_executable(name):
if sys.platform == 'win32': if sys.platform == 'win32':
path += '.exe' path += '.exe'
return path 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',
]

Просмотреть файл

@ -4,11 +4,11 @@ import argparse
import os import os
import sys import sys
from lib.config import LINUX_BINARIES, enable_verbose_mode from lib.config import enable_verbose_mode
from lib.util import execute, get_out_dir from lib.util import execute, get_linux_binaries, get_out_dir
def strip_binaries(directory, target_cpu): def strip_binaries(directory, target_cpu):
for binary in LINUX_BINARIES: for binary in get_linux_binaries():
binary_path = os.path.join(directory, binary) binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path): if os.path.isfile(binary_path):
strip_binary(binary_path, target_cpu) strip_binary(binary_path, target_cpu)