Files
brave-core/script/sign_binaries.py
T
mkarolin fd84014ead [Windows] chrome_child.dll is no longer being built.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/d09e3068c8a4b2d3db6c4cf2759dc0d95f46758d

commit d09e3068c8a4b2d3db6c4cf2759dc0d95f46758d
Author: Chris Davis <chrdavis@microsoft.com>
Date:   Mon Oct 21 23:52:53 2019 +0000

    Reland "Set is_multi_dll_chrome to false by default"

    This is a reland of e0dffd8408545588cd11f68568be26be1e2ad551.
    706934 fixed the compile issue with headless code and the
    issues with the delayloads_unittests have been resolved.

    Original change's description:
    > Set is_multi_dll_chrome to false by default
    >
    > This change sets is_multi_dll_chrome to false by default thus merging
    > chrome.dll and chrome_child.dll to a single dll.  This saves disk space
    > and improves startup performance.  It is also consistent with all other
    > platforms (windows was the only platform the split was enabled by
    > default).
    >
    > Bug: 726150
    > Change-Id: Iade2c7f1bbe696d45ebac7483072f7e2e7e84ab4
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1850272
    > Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
    > Reviewed-by: Will Harris <wfh@chromium.org>
    > Reviewed-by: Nico Weber <thakis@chromium.org>
    > Commit-Queue: Nico Weber <thakis@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#705667}

    Bug: 726150
2020-01-29 07:44:00 -05:00

73 lines
2.0 KiB
Python

import optparse
import os
import subprocess
import sys
cert = os.environ.get('CERT')
signtool_args = (os.environ.get('SIGNTOOL_ARGS') or
'sign /t http://timestamp.digicert.com /sm '
'/fd sha256')
assert (cert or signtool_args), 'One or both of the CERT or SIGNTOOL_ARGS '
'must be set. CERT by default is the name in the //CurrentUser/My windows '
'certificate store. `SIGNTOOL_ARGS` can be used in combination `CERT` or '
'by it self.'
def get_sign_cmd(file):
# https://docs.microsoft.com/en-us/dotnet/framework/tools/signtool-exe
# signtool should be in the path if it was set up correctly by gn through
# src/build/vs_toolchain.py
cmd = 'signtool {}'.format(signtool_args)
if cert:
cmd = cmd + ' /n "' + cert + '"'
return (cmd + ' "' + file + '"')
def run_cmd(cmd):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
for line in p.stdout:
print line
p.wait()
assert p.returncode == 0, "Error signing"
def sign_binaries(base_dir, endswidth=('.exe', '.dll')):
matches = []
for root, dirnames, filenames in os.walk(base_dir):
for filename in filenames:
if filename.endswith(endswidth):
matches.append(os.path.join(root, filename))
for binary in matches:
sign_binary(binary)
def sign_binary(binary):
cmd = get_sign_cmd(binary)
run_cmd(cmd)
def _ParseOptions():
parser = optparse.OptionParser()
parser.add_option(
'-b', '--build_dir',
help='Build directory. The paths in input_file are relative to this.')
options, _ = parser.parse_args()
if not options.build_dir:
parser.error('You must provide a build dir.')
options.build_dir = os.path.normpath(options.build_dir)
return options
def main(options):
sign_binaries(options.build_dir, ('brave.exe', 'chrome.dll'))
if '__main__' == __name__:
options = _ParseOptions()
sys.exit(main(options))