|
60 | 60 | CONF_WITH_SHIB = 'with_shib' |
61 | 61 | CONF_BRAND = 'brand' |
62 | 62 | CONF_CERTFILE = 'certfile' |
| 63 | +CONF_NO_STRIP = 'nostrip' |
63 | 64 |
|
64 | 65 | #################### |
65 | 66 | ### Common helper functions |
@@ -329,18 +330,21 @@ def __init__(self): |
329 | 330 | ninja = find_in_path('ninja.exe') |
330 | 331 | seafile_prefix = Seafile().prefix |
331 | 332 | generator = 'Ninja' if ninja else 'MSYS Makefiles' |
| 333 | + build_type = 'Debug' if conf[CONF_DEBUG] else 'Release' |
332 | 334 | flags = { |
333 | 335 | 'USE_QT5': 'ON' if conf[CONF_QT5] else 'OFF', |
334 | 336 | '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), |
335 | 339 | # ninja invokes cmd.exe which doesn't support msys/mingw path |
336 | 340 | # change the value but don't override CMAKE_EXE_LINKER_FLAGS, |
337 | 341 | # 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'))), |
339 | 343 | } |
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()]) |
341 | 345 | make = ninja or concurrent_make() |
342 | 346 | 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), |
344 | 348 | make, |
345 | 349 | '%s install' % make, |
346 | 350 | "bash extensions/build.sh", |
@@ -419,6 +423,9 @@ def check_project_version(version): |
419 | 423 | # [ no strip] |
420 | 424 | debug = get_option(CONF_DEBUG) |
421 | 425 |
|
| 426 | + # [ no strip] |
| 427 | + nostrip = get_option(CONF_NO_STRIP) |
| 428 | + |
422 | 429 | # [only chinese] |
423 | 430 | onlychinese = get_option(CONF_ONLY_CHINESE) |
424 | 431 |
|
@@ -448,7 +455,8 @@ def check_qt_root(qt_root): |
448 | 455 | conf[CONF_SRCDIR] = srcdir |
449 | 456 | conf[CONF_OUTPUTDIR] = outputdir |
450 | 457 | conf[CONF_KEEP] = True |
451 | | - conf[CONF_DEBUG] = debug |
| 458 | + conf[CONF_DEBUG] = debug or nostrip |
| 459 | + conf[CONF_NO_STRIP] = debug or nostrip |
452 | 460 | conf[CONF_ONLY_CHINESE] = onlychinese |
453 | 461 | conf[CONF_QT_ROOT] = qt_root |
454 | 462 | conf[CONF_QT5] = qt5 |
@@ -582,6 +590,11 @@ def long_opt(opt): |
582 | 590 | dest=CONF_CERTFILE, |
583 | 591 | help='''The cert for signing the executables and the installer.''') |
584 | 592 |
|
| 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 | + |
585 | 598 | usage = parser.format_help() |
586 | 599 | options, remain = parser.parse_args() |
587 | 600 | if remain: |
@@ -885,7 +898,10 @@ def build_msi(): |
885 | 898 | prepare_msi() |
886 | 899 | if breakpad_enabled(): |
887 | 900 | 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() |
889 | 905 |
|
890 | 906 | # Only sign the exectuables after stripping symbols. |
891 | 907 | if need_sign(): |
|
0 commit comments