示例#1
0
def set_environment_variables(msys, options):
    """Set the environment variables used by the scripts"""
    
    environ = msys.environ

    msys_root_wp = msys.msys_root
    prefix_wp = options.prefix
    if not prefix_wp:
        prefix_wp = environ.get('PREFIX', '')
    if prefix_wp:
        prefix_mp = msys.windows_to_msys(prefix_wp)
    else:
        prefix_mp = default_prefix_mp
        prefix_wp = msys.msys_to_windows(prefix_mp)
    include_mp = prefix_mp + '/include'
    lib_mp = prefix_mp + '/lib'
    subsystem = ''
    if not options.subsystem_noforce:
        subsystem = '-mwindows'
    resources_mp = ''

    environ['PREFIX'] = prefix_mp
    environ.pop('INCLUDE', None)  # INCLUDE causes problems with MIXER.
    environ['CPPFLAGS'] = merge_strings(as_preprocessor_header_path(include_mp),
                                        environ.get('CPPFLAGS', ''),
                                        sep=' ')
    # Need to make the resources object file an explicit linker option to
    # bypass libtool (freetype).
    environ['LDFLAGS'] = merge_strings(environ.get('LDFLAGS', ''),
                                       as_linker_lib_path(lib_mp),
                                       as_linker_option(resources_mp),
                                       subsystem,
                                       sep=' ')

    environ['BDCONF'] = as_flag(options.configure and
                                not options.clean_only)
    environ['BDCOMP'] = as_flag(options.compile and
                                not options.clean_only)
    environ['BDINST'] = as_flag(options.install and
                                options.compile and
                                not options.clean_only)
    environ['BDSTRIP'] = as_flag(options.compile and
                                 options.install and
                                 options.strip and
                                 not options.clean_only)
    environ['BDCLEAN'] = as_flag(options.clean or options.clean_only)
    environ['BDMSVCRT_VERSION'] = '%i' % (options.msvcrt_version,)
    environ['BDRESOURCES'] = resources_mp
def set_environment_variables(msys, options):
    """Set the environment variables used by the scripts"""
    
    environ = msys.environ
    msys_root_wp = msys.msys_root
    prefix_wp = options.prefix
    if not prefix_wp:
        prefix_wp = environ.get('PREFIX', '')
    if prefix_wp:
        prefix_mp = msys.windows_to_msys(prefix_wp)
    else:
        prefix_mp = default_prefix_mp
        prefix_wp = msys.msys_to_windows(prefix_mp)
    environ['PREFIX'] = prefix_mp
    environ['BDCONF'] = as_flag(options.configure and
                                not options.clean_only)
    environ['BDCOMP'] = as_flag(options.compile and
                                not options.clean_only)
    environ['BDINST'] = as_flag(options.install and
                                options.compile and
                                not options.clean_only)
    environ['BDSTRIP'] = as_flag(options.compile and
                                 options.install and
                                 options.strip and
                                 not options.clean_only)
    environ['BDCLEAN'] = as_flag(options.clean or options.clean_only)
    environ.pop('INCLUDE', None)  # INCLUDE causes problems with MIXER.
    lib_mp = prefix_mp + '/lib'
    msvcr71_mp = ''
    if options.msvcr71:
        # Hide the msvcrt.dll import libraries with those for msvcr71.dll.
        # Their subdirectory is in the same directory as the SDL library.
        msvcr71_mp = lib_mp + '/msvcr71'
        environ['DBMSVCR71'] = msvcr71_mp
    subsystem = ''
    if not options.subsystem_noforce:
        subsystem = '-mwindows'
    environ['LDFLAGS'] = merge_strings(environ.get('LDFLAGS', ''),
                                       as_linker_lib_path(lib_mp),
                                       as_linker_lib_path(msvcr71_mp),
                                       subsystem,
                                       sep=' ')

    # For dependency headers.
    include_wp = prefix_wp + '/include'
    environ['CPATH'] = merge_strings(include_wp, environ.get('CPATH', ''),
                                     sep=';')
示例#3
0
def summary(dependencies, msys, start_time, chosen_deps):
    """Display a summary report of new, existing and missing libraries"""

    import datetime

    print_("\n\n=== Summary ===")
    if start_time is not None:
        print_("  Elapse time:",
               datetime.timedelta(seconds=time.time()-start_time))
    print_()
    for dep in chosen_deps:
        if dep.path is None:
            print_("  ** No source directory found for", dep.name)
        elif dep.path:
            print_("  Source directory for", dep.name, ":", dep.path)
    print_()
    prefix = msys.msys_to_windows(msys.environ['PREFIX']).replace('/', os.sep)
    bin_dir = os.path.join(prefix, 'bin')
    lib_dir = os.path.join(prefix, 'lib')
    for d in dependencies:
        for lib in d.libs:
            if lib.endswith('.dll'):
                lib_path = os.path.join(bin_dir, lib)
                try:
                    mod_time = os.path.getmtime(lib_path)
                except:
                    msg = "No DLL"
                else:
                    if mod_time >= start_time:
                        msg = "Installed new DLL %s" % (lib_path,)
                    else:
                        msg = "-- (old DLL %s)" % (lib_path,)
            elif lib.endswith('.a'):
                lib_path = os.path.join(lib_dir, lib)
                try:
                    mod_time = os.path.getmtime(lib_path)
                except:
                    msg = "No static library"
                else:
                    if mod_time >= start_time:
                        msg = "Installed new static library %s" % (lib_path,)
                    else:
                        msg = "-- (old static library %s)" % (lib_path,)
            else:
                msg = "Internal error: unknown library type %s" % (lib,)
            print_("  %-10s: %s" % (d.name, msg))
示例#4
0
 def __init__(self, name, envname, exename, minver, msys, defaultlibs=None):
     if defaultlibs is None:
         defaultlibs = [dll.name_to_root(name)]
     self.name = name
     try:
         command = os.environ[envname]
     except KeyError:
         command = exename
     else:
         drv, pth = os.path.splitdrive(command)
         if drv:
             command = '/' + drv[0] + pth
     self.lib_dir = ''
     self.inc_dir = ''
     self.libs = []
     self.cflags = ''
     try:
         config = msys.run_shell_command(
             [command, '--version', '--cflags', '--libs'])
         ver, flags = config.split('\n', 1)
         self.ver = ver.strip()
         flags = flags.split()
         if minver and self.ver < minver:
             err = 'WARNING: requires %s version %s (%s found)' % (
                 self.name, self.ver, minver)
             raise ValueError, err
         self.found = 1
         self.cflags = ''
         for f in flags:
             if f[:2] in ('-I', '-L'):
                 self.cflags += f[:2] + msys.msys_to_windows(f[2:]) + ' '
             elif f[:2] in ('-l', '-D'):
                 self.cflags += f + ' '
             elif f[:3] == '-Wl':
                 self.cflags += '-Xlinker ' + f + ' '
     except:
         print_('WARNING: "%s" failed!' % command)
         self.found = 0
         self.ver = '0'
         self.libs = defaultlibs
示例#5
0
 def __init__(self, name, envname, exename, minver, msys, defaultlibs=None):
     if defaultlibs is None:
         defaultlibs = [dll.name_to_root(name)]
     self.name = name
     try:
         command = os.environ[envname]
     except KeyError:
         command = exename
     else:
         drv, pth = os.path.splitdrive(command)
         if drv:
             command = '/' + drv[0] + pth
     self.lib_dir = ''
     self.inc_dir = ''
     self.libs = []
     self.cflags = ''
     try:
         config = msys.run_shell_command([command, '--version', '--cflags', '--libs'])
         ver, flags = config.split('\n', 1)
         self.ver = ver.strip()
         flags = flags.split()
         if minver and self.ver < minver:
             err= 'WARNING: requires %s version %s (%s found)' % (self.name, self.ver, minver)
             raise ValueError(err)
         self.found = 1
         self.cflags = ''
         for f in flags:
             if f[:2] in ('-I', '-L'):
                 self.cflags += f[:2] + msys.msys_to_windows(f[2:]) + ' '
             elif f[:2] in ('-l', '-D'):
                 self.cflags += f + ' '
             elif f[:3] == '-Wl':
                 self.cflags += '-Xlinker ' + f + ' '
     except:
         print_('WARNING: "%s" failed!' % command)
         self.found = 0
         self.ver = '0'
         self.libs = defaultlibs