ci: strip linux binaries for release builds (#14991)
This commit is contained in:
parent
d678d9ee75
commit
1cf00274ab
4 changed files with 97 additions and 37 deletions
|
@ -62,14 +62,8 @@ async function circleCIcall (buildUrl, targetBranch, job, options) {
|
|||
}
|
||||
}
|
||||
|
||||
if (options.ghRelease) {
|
||||
buildRequest.build_parameters.ELECTRON_RELEASE = 1
|
||||
} else {
|
||||
buildRequest.build_parameters.RUN_RELEASE_BUILD = 'true'
|
||||
}
|
||||
|
||||
if (options.automaticRelease) {
|
||||
buildRequest.build_parameters.AUTO_RELEASE = 'true'
|
||||
if (!options.ghRelease) {
|
||||
buildRequest.build_parameters.UPLOAD_TO_S3 = 1
|
||||
}
|
||||
|
||||
const circleResponse = await makeRequest({
|
||||
|
@ -237,13 +231,13 @@ module.exports = runRelease
|
|||
|
||||
if (require.main === module) {
|
||||
const args = require('minimist')(process.argv.slice(2), {
|
||||
boolean: ['ghRelease', 'automaticRelease', 'armTest']
|
||||
boolean: ['ghRelease', 'armTest']
|
||||
})
|
||||
const targetBranch = args._[0]
|
||||
if (args._.length < 1) {
|
||||
console.log(`Trigger CI to build release builds of electron.
|
||||
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--ci=CircleCI|AppVeyor|VSTS]
|
||||
[--ghRelease] [--automaticRelease] [--armTest] [--circleBuildNum=xxx] TARGET_BRANCH
|
||||
[--ghRelease] [--armTest] [--circleBuildNum=xxx] TARGET_BRANCH
|
||||
`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
|
60
script/strip-binaries.py
Executable file
60
script/strip-binaries.py
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env python
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from lib.util import execute, get_out_dir
|
||||
|
||||
LINUX_BINARIES_TO_STRIP = [
|
||||
'electron',
|
||||
'libffmpeg.so',
|
||||
'libGLESv2.so',
|
||||
'libEGL.so'
|
||||
]
|
||||
|
||||
def strip_binaries(directory, target_cpu):
|
||||
for binary in LINUX_BINARIES_TO_STRIP:
|
||||
binary_path = os.path.join(directory, binary)
|
||||
if os.path.isfile(binary_path):
|
||||
strip_binary(binary_path, target_cpu)
|
||||
|
||||
def strip_binary(binary_path, target_cpu):
|
||||
if target_cpu == 'arm':
|
||||
strip = 'arm-linux-gnueabihf-strip'
|
||||
elif target_cpu == 'arm64':
|
||||
strip = 'aarch64-linux-gnu-strip'
|
||||
elif target_cpu == 'mips64el':
|
||||
strip = 'mips64el-redhat-linux-strip'
|
||||
else:
|
||||
strip = 'strip'
|
||||
execute([strip, binary_path])
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
print args
|
||||
if args.file:
|
||||
strip_binary(args.file, args.target_cpu)
|
||||
else:
|
||||
strip_binaries(args.directory, args.target_cpu)
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Strip linux binaries')
|
||||
parser.add_argument('-d', '--directory',
|
||||
help='Path to the dir that contains files to strip.',
|
||||
default=get_out_dir(),
|
||||
required=False)
|
||||
parser.add_argument('-f', '--file',
|
||||
help='Path to a specific file to strip.',
|
||||
required=False)
|
||||
parser.add_argument('-v', '--verbose',
|
||||
action='store_true',
|
||||
help='Prints the output of the subprocesses')
|
||||
parser.add_argument('--target-cpu',
|
||||
default='',
|
||||
required=False,
|
||||
help='Target cpu of binaries to strip')
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
Loading…
Add table
Add a link
Reference in a new issue