def build_icu(layout, debug, profile): # NOTE: We always build ICU in release mode since we don't usually need to debug it. os.chdir('source') if sys.platform == 'darwin': sdk.sh('chmod', '+x', 'configure', 'runConfigureICU') sdk.sh('bash', 'runConfigureICU', 'MacOSX', '--prefix=%s' % layout['root'], '--disable-debug', '--enable-release') sdk.sh('make') sdk.sh('make', 'install') elif sys.platform == 'linux2': sdk.sh('chmod', '+x', 'configure', 'runConfigureICU') sdk.sh('bash', 'runConfigureICU', 'Linux', '--prefix=%s' % layout['root'], '--disable-debug', '--enable-release') sdk.sh('make') sdk.sh('make', 'install') elif sys.platform == 'win32': # Convert native install_root path to one accepted by Cygwin (e.g.: /cygdrive/c/foo/bar) cy_install_root = layout['root'].replace('\\', '/') cy_install_root = cy_install_root.replace('C:/', '/cygdrive/c/') sdk.sh('bash', 'runConfigureICU', 'Cygwin/MSVC', '--prefix=%s' % cy_install_root, '--disable-debug', '--enable-release') sdk.sh('bash', '-c', 'make') # We have to use GNU make here, so no make() wrapper... sdk.sh('bash', '-c', 'make install') else: sdk.die('You have to rebuild ICU only on OS X or Windows')
def parse_command_line(): args_parser = argparse.ArgumentParser() def check_source_dir(glob_pattern): sdk.print_box("Sources discovery for %r..." % glob_pattern) sources_pattern = os.path.join(HERE, 'sources', glob_pattern) sources_pattern_platform = os.path.join(sdk.platform_root('sources'), glob_pattern) globs = glob.glob(sources_pattern) + glob.glob(sources_pattern_platform) candidates = [d for d in globs if os.path.isdir(d)] if len(candidates) == 1: return candidates[0] elif len(candidates) > 1: argparse.ArgumentTypeError( "Too many candidates for %s: %s" % (glob_pattern, ", ".join(candidates))) else: argparse.ArgumentTypeError("%r not found, provide an existing folder" % glob_pattern) args_parser.add_argument('-d', '--debug', action='store_true') args_parser.add_argument( '-k', '--shell', action='store_true', help="starts a shell just before starting the build") args_parser.add_argument( '-m', '--only-merge', action='store_true', help="Merge user provided files from ./merge") args_parser.add_argument('-n', '--only-scripts', action='store_true', help='Skip build step, update install scripts only') args_parser.add_argument( '-p', '--profile', type=sdk.maybe(sdk.ajson, {}), help="json config file for Qt build") args_parser.add_argument('-r', '--install-root', help="default: %(default)s", type=sdk.mkdir, default=os.path.join(HERE, '_out')) args_parser.add_argument('-c', '--with-icu-sources', type=sdk.adir) args_parser.add_argument('-t', '--with-pyqt-sources', type=sdk.adir) args_parser.add_argument('-q', '--with-qt-sources', type=sdk.adir) args_parser.add_argument('-s', '--with-sip-sources', type=sdk.adir) args_parser.add_argument('packages', metavar='PACKAGES', nargs='*', choices=['sip', 'qt', 'pyqt', 'icu', 'all'], default='all', help="Build only selected packages from {%(choices)s}, default: %(default)s") args = args_parser.parse_args() def has_package(pkg): return (pkg in args.packages or "all" in args.packages) if args.with_icu_sources is None: args.with_icu_sources = check_source_dir('icu*') if args.with_pyqt_sources is None: args.with_pyqt_sources = check_source_dir('PyQt-*') if args.with_qt_sources is None: args.with_qt_sources = check_source_dir('qt-everywhere-*') if args.with_sip_sources is None: args.with_sip_sources = check_source_dir('sip-*') if has_package("icu"): if sys.platform == 'win32': check_bash() # to rebuild Qt. if has_package("qt"): if not args.profile: sdk.die('I need a profile in to rebuild Qt!') return args
def main(): if is_setup_done(): sdk.die('SDK setup already done.') args = parse_args() setup(args.install_root, args.relocate) if args.command: sys.exit(subprocess.call(args.command)) elif args.shell: sdk.start_subshell()
def check_bash(): try: sdk.sh("bash", "--version") except: sdk.die("ERROR: unable to run 'bash', check your PATH")
def parse_command_line(): args_parser = argparse.ArgumentParser() def check_source_dir(glob_pattern): sdk.print_box("Sources discovery for %r..." % glob_pattern) sources_pattern = os.path.join(HERE, 'sources', glob_pattern) sources_pattern_platform = os.path.join(sdk.platform_root('sources'), glob_pattern) globs = glob.glob(sources_pattern) + glob.glob( sources_pattern_platform) candidates = [d for d in globs if os.path.isdir(d)] if len(candidates) == 1: return candidates[0] elif len(candidates) > 1: argparse.ArgumentTypeError("Too many candidates for %s: %s" % (glob_pattern, ", ".join(candidates))) else: argparse.ArgumentTypeError( "%r not found, provide an existing folder" % glob_pattern) args_parser.add_argument('-d', '--debug', action='store_true') args_parser.add_argument( '-k', '--shell', action='store_true', help="starts a shell just before starting the build") args_parser.add_argument('-m', '--only-merge', action='store_true', help="Merge user provided files from ./merge") args_parser.add_argument( '-n', '--only-scripts', action='store_true', help='Skip build step, update install scripts only') args_parser.add_argument('-p', '--profile', type=sdk.maybe(sdk.ajson, {}), help="json config file for Qt build") args_parser.add_argument('-r', '--install-root', help="default: %(default)s", type=sdk.mkdir, default=os.path.join(HERE, '_out')) args_parser.add_argument('-c', '--with-icu-sources', type=sdk.adir) args_parser.add_argument('-t', '--with-pyqt-sources', type=sdk.adir) args_parser.add_argument('-q', '--with-qt-sources', type=sdk.adir) args_parser.add_argument('-s', '--with-sip-sources', type=sdk.adir) args_parser.add_argument( 'packages', metavar='PACKAGES', nargs='*', choices=['sip', 'qt', 'pyqt', 'icu', 'all'], default='all', help= "Build only selected packages from {%(choices)s}, default: %(default)s" ) args = args_parser.parse_args() def has_package(pkg): return (pkg in args.packages or "all" in args.packages) if args.with_icu_sources is None: args.with_icu_sources = check_source_dir('icu*') if args.with_pyqt_sources is None: args.with_pyqt_sources = check_source_dir('PyQt-*') if args.with_qt_sources is None: args.with_qt_sources = check_source_dir('qt-everywhere-*') if args.with_sip_sources is None: args.with_sip_sources = check_source_dir('sip-*') if has_package("icu"): if sys.platform == 'win32': check_bash() # to rebuild Qt. if has_package("qt"): if not args.profile: sdk.die('I need a profile in to rebuild Qt!') return args