Skip to content

Commit 903ea48

Browse files
committed
support building debug msi packages.
1 parent bc83c3a commit 903ea48

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

scripts/build/build-msi.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
CONF_WITH_SHIB = 'with_shib'
6161
CONF_BRAND = 'brand'
6262
CONF_CERTFILE = 'certfile'
63+
CONF_NO_STRIP = 'nostrip'
6364

6465
####################
6566
### Common helper functions
@@ -329,18 +330,21 @@ def __init__(self):
329330
ninja = find_in_path('ninja.exe')
330331
seafile_prefix = Seafile().prefix
331332
generator = 'Ninja' if ninja else 'MSYS Makefiles'
333+
build_type = 'Debug' if conf[CONF_DEBUG] else 'Release'
332334
flags = {
333335
'USE_QT5': 'ON' if conf[CONF_QT5] else 'OFF',
334336
'BUILD_SHIBBOLETH_SUPPORT': 'ON' if conf[CONF_WITH_SHIB] else 'OFF',
337+
'CMAKE_BUILD_TYPE': build_type,
338+
'CMAKE_INSTALL_PREFIX': to_mingw_path(self.prefix),
335339
# ninja invokes cmd.exe which doesn't support msys/mingw path
336340
# change the value but don't override CMAKE_EXE_LINKER_FLAGS,
337341
# which is in use
338-
'CMAKE_EXE_LINKER_FLAGS_RELEASE': '-L%s' % (os.path.join(seafile_prefix, 'lib') if ninja else to_mingw_path(os.path.join(seafile_prefix, 'lib'))),
342+
'CMAKE_EXE_LINKER_FLAGS_%s' % build_type.upper(): '-L%s' % (os.path.join(seafile_prefix, 'lib') if ninja else to_mingw_path(os.path.join(seafile_prefix, 'lib'))),
339343
}
340-
flags = ' '.join(['-D%s=%s' % (k, v) for k, v in flags.iteritems()])
344+
flags_str = ' '.join(['-D%s=%s' % (k, v) for k, v in flags.iteritems()])
341345
make = ninja or concurrent_make()
342346
self.build_commands = [
343-
'cmake -G "%s" %s -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%s .' % (generator, flags, to_mingw_path(self.prefix)),
347+
'cmake -G "%s" %s .' % (generator, flags_str),
344348
make,
345349
'%s install' % make,
346350
"bash extensions/build.sh",
@@ -419,6 +423,9 @@ def check_project_version(version):
419423
# [ no strip]
420424
debug = get_option(CONF_DEBUG)
421425

426+
# [ no strip]
427+
nostrip = get_option(CONF_NO_STRIP)
428+
422429
# [only chinese]
423430
onlychinese = get_option(CONF_ONLY_CHINESE)
424431

@@ -448,7 +455,8 @@ def check_qt_root(qt_root):
448455
conf[CONF_SRCDIR] = srcdir
449456
conf[CONF_OUTPUTDIR] = outputdir
450457
conf[CONF_KEEP] = True
451-
conf[CONF_DEBUG] = debug
458+
conf[CONF_DEBUG] = debug or nostrip
459+
conf[CONF_NO_STRIP] = debug or nostrip
452460
conf[CONF_ONLY_CHINESE] = onlychinese
453461
conf[CONF_QT_ROOT] = qt_root
454462
conf[CONF_QT5] = qt5
@@ -582,6 +590,11 @@ def long_opt(opt):
582590
dest=CONF_CERTFILE,
583591
help='''The cert for signing the executables and the installer.''')
584592

593+
parser.add_option(long_opt(CONF_NO_STRIP),
594+
dest=CONF_NO_STRIP,
595+
action='store_true',
596+
help='''do not strip the symbols.''')
597+
585598
usage = parser.format_help()
586599
options, remain = parser.parse_args()
587600
if remain:
@@ -885,7 +898,10 @@ def build_msi():
885898
prepare_msi()
886899
if breakpad_enabled():
887900
generate_breakpad_symbols()
888-
strip_symbols()
901+
if conf[CONF_DEBUG] or conf[CONF_NO_STRIP]:
902+
info('Would not strip exe/dll symbols since --debug or --nostrip is specified')
903+
else:
904+
strip_symbols()
889905

890906
# Only sign the exectuables after stripping symbols.
891907
if need_sign():

0 commit comments

Comments
 (0)