Build option to not strip the generated linux/os x binaries

This commit is contained in:
Kovid Goyal 2014-07-13 21:26:32 +05:30
parent f50d4ae176
commit 4ba3255dd1
4 changed files with 24 additions and 6 deletions

View File

@ -109,6 +109,9 @@ class VMInstaller(Command):
if not parser.has_option('--dont-shutdown'): if not parser.has_option('--dont-shutdown'):
parser.add_option('-s', '--dont-shutdown', default=False, parser.add_option('-s', '--dont-shutdown', default=False,
action='store_true', help='Dont shutdown the VM after building') action='store_true', help='Dont shutdown the VM after building')
if not parser.has_option('--dont-strip'):
parser.add_option('-x', '--dont-strip', default=False,
action='store_true', help='Dont strip the generated binaries')
def get_build_script(self): def get_build_script(self):
rs = ['export RSYNC_PASSWORD=%s'%get_rsync_pw()] rs = ['export RSYNC_PASSWORD=%s'%get_rsync_pw()]
@ -156,6 +159,8 @@ class VMInstaller(Command):
return installer_name(self.INSTALLER_EXT, self.IS_64_BIT) return installer_name(self.INSTALLER_EXT, self.IS_64_BIT)
def run(self, opts): def run(self, opts):
if opts.dont_strip:
self.FREEZE_COMMAND += ' --dont-strip'
subprocess.call(['chmod', '-R', '+r', 'recipes']) subprocess.call(['chmod', '-R', '+r', 'recipes'])
start_time = time.time() start_time = time.time()
self.start_vm() self.start_vm()

View File

@ -155,6 +155,11 @@ def strip_files(files, argv_max=(256 * 1024)):
class LinuxFreeze(Command): class LinuxFreeze(Command):
def add_options(self, parser):
if not parser.has_option('--dont-strip'):
parser.add_option('-x', '--dont-strip', default=False,
action='store_true', help='Dont strip the generated binaries')
def run(self, opts): def run(self, opts):
self.drop_privileges() self.drop_privileges()
self.opts = opts self.opts = opts
@ -167,7 +172,8 @@ class LinuxFreeze(Command):
self.copy_libs() self.copy_libs()
self.copy_python() self.copy_python()
self.build_launchers() self.build_launchers()
self.strip_files() if not self.opts.dont_strip:
self.strip_files()
self.create_tarfile() self.create_tarfile()
def initbase(self): def initbase(self):

View File

@ -38,11 +38,14 @@ class OSX32_Freeze(Command):
parser.add_option('--test-launchers', default=False, parser.add_option('--test-launchers', default=False,
action='store_true', action='store_true',
help='Only build launchers') help='Only build launchers')
if not parser.has_option('--dont-strip'):
parser.add_option('-x', '--dont-strip', default=False,
action='store_true', help='Dont strip the generated binaries')
def run(self, opts): def run(self, opts):
global info, warn global info, warn
info, warn = self.info, self.warn info, warn = self.info, self.warn
main(opts.test_launchers) main(opts.test_launchers, opts.dont_strip)
def compile_launcher_lib(contents_dir, gcc, base): def compile_launcher_lib(contents_dir, gcc, base):
info('\tCompiling calibre_launcher.dylib') info('\tCompiling calibre_launcher.dylib')
@ -147,8 +150,9 @@ class Py2App(object):
FID = '@executable_path/../Frameworks' FID = '@executable_path/../Frameworks'
def __init__(self, build_dir, test_launchers=False): def __init__(self, build_dir, test_launchers=False, dont_strip=False):
self.build_dir = build_dir self.build_dir = build_dir
self.dont_strip = dont_strip
self.contents_dir = join(self.build_dir, 'Contents') self.contents_dir = join(self.build_dir, 'Contents')
self.resources_dir = join(self.contents_dir, 'Resources') self.resources_dir = join(self.contents_dir, 'Resources')
self.frameworks_dir = join(self.contents_dir, 'Frameworks') self.frameworks_dir = join(self.contents_dir, 'Frameworks')
@ -192,7 +196,7 @@ class Py2App(object):
self.copy_site() self.copy_site()
self.create_exe() self.create_exe()
if not test_launchers: if not test_launchers and not self.dont_strip:
self.strip_files() self.strip_files()
ret = self.makedmg(self.build_dir, APPNAME+'-'+VERSION) ret = self.makedmg(self.build_dir, APPNAME+'-'+VERSION)
@ -671,11 +675,11 @@ def test_exe():
return 0 return 0
def main(test=False): def main(test=False, dont_strip=False):
if 'test_exe' in sys.argv: if 'test_exe' in sys.argv:
return test_exe() return test_exe()
build_dir = abspath(join(os.path.dirname(SRC), 'build', APPNAME+'.app')) build_dir = abspath(join(os.path.dirname(SRC), 'build', APPNAME+'.app'))
Py2App(build_dir, test_launchers=test) Py2App(build_dir, test_launchers=test, dont_strip=dont_strip)
return 0 return 0

View File

@ -109,6 +109,9 @@ class Win32Freeze(Command, WixMixIn):
help='Keep human readable site.py') help='Keep human readable site.py')
parser.add_option('--verbose', default=0, action="count", parser.add_option('--verbose', default=0, action="count",
help="Be more verbose") help="Be more verbose")
if not parser.has_option('--dont-strip'):
parser.add_option('-x', '--dont-strip', default=False,
action='store_true', help='Dont strip the generated binaries (no-op on windows)')
def run(self, opts): def run(self, opts):
self.SW = SW self.SW = SW