Exemplo n.º 1
0
 def copylibs():
     for f in ('''python%(dbg)s.exe python%(dbg)s.pdb
                  pythonw%(dbg)s.exe pythonw%(dbg)s.pdb
                  python%(ver)s%(dbg)s.dll python%(ver)s%(dbg)s.pdb
                  sqlite3%(dbg)s.dll sqlite3%(dbg)s.pdb''' %
               dict(dbg=DEBUG_POSTFIX, ver=PYTHON_VER)).split():
         copy_different(f, pydir)
Exemplo n.º 2
0
def install_stdlib():
    'Copies all the .py files in python/Lib'

    from buildutil import copy_different

    with cd(PYTHON_DIR):
        exclude = '.xcopy.exclude'  # have to specify xcopy excludes in a file

        with open(exclude, 'w') as fout:
            fout.write('\n'.join(['.pyc', '.pyo', '.svn']))

        try:
            run([
                'xcopy', 'Lib',
                r'%s\lib' % DPYTHON_DIR,
                '/EXCLUDE:%s' % exclude, '/I', '/E', '/D', '/Y'
            ])
            run([
                'xcopy', 'Include',
                r'%s\Include' % DPYTHON_DIR,
                '/EXCLUDE:%s' % exclude, '/I', '/E', '/D', '/Y'
            ])
            if not os.path.isdir(r'%s\libs' % DPYTHON_DIR):
                os.makedirs(r'%s\libs' % DPYTHON_DIR)
            for f in os.listdir(r'PCBuild'):
                if f.endswith('.lib'):
                    copy_different(os.path.join('PCBuild', f),
                                   os.path.join(r'%s\libs' % DPYTHON_DIR, f))
        finally:
            os.remove(exclude)
Exemplo n.º 3
0
def build():
    project_dir = os.path.join(buddylist_root, 'msvc2008')
    solution_file = os.path.normpath(os.path.abspath(os.path.join(project_dir, 'BuddyListSort.sln')))

    config_name = 'Debug' if DEBUG else 'Release'
    configuration = '%s|Win32' % config_name

    # the MSVC project files use the DIGSBY_PYTHON environment variable to find
    # Python.h and python2x.lib
    env = dict(os.environ)

    SIP_INCLUDE = os.path.normpath(os.path.abspath('../../build/msw/sip/siplib'))
    SIP_BIN = os.path.normpath(os.path.abspath('../../build/msw/sip/sipgen/sip.exe'))

    assert os.path.isdir(SIP_INCLUDE), 'expected a siplib directory at ' + SIP_BIN
    assert os.path.isfile(SIP_BIN), 'expected a sip binary at ' + SIP_BIN

    env.update(
        SIP_INCLUDE=SIP_INCLUDE,
        SIP_BIN=SIP_BIN,
        DIGSBY_PYTHON=os.path.dirname(distutils.sysconfig.get_python_inc()))

    # Invoke vcbuild
    ret = call(['vcbuild', '/nologo', solution_file, configuration], env=env)
    if ret: sys.exit(ret)

    # Install to DEPS_DIR
    binaries = 'blist{d}.pyd blist{d}.pdb buddylist{d}.dll buddylist{d}.pdb'
    for f in binaries.format(d='_d' if DEBUG else '').split():
        binary = os.path.join(project_dir, config_name, f)
        copy_different(binary, DEPS_DIR)
Exemplo n.º 4
0
def build_freetype_msw():
    # get/build freetype
    with cd('msw'):
        ftype_dir = freetype_tar.get()
        with cd(ftype_dir, 'builds', 'win32', 'visualc'):

            # use /upgrade to upgrade old VC6 build scripts
            with open('freetype.dsw') as f:
                needs_upgrade = 'Format Version 6.00' in f.read()

            run(['vcbuild', '/nologo', '/time'] +
                (['/upgrade'] if needs_upgrade else []) + [
                    'freetype.sln',
                    '%s Multithreaded|Win32' %
                    ('Debug' if DEBUG else 'Release')
                ])

        with cd(ftype_dir, 'objs'):
            # copy the lib to a name PIL is looking for
            from buildutil import copy_different
            copy_different(freetype_win_lib, 'freetype.lib')

        freetype = (abspath(pathjoin(ftype_dir, 'objs')),
                    abspath(pathjoin(ftype_dir, 'include')))

    return freetype
Exemplo n.º 5
0
def build():
    project_dir = os.path.join(buddylist_root, 'msvc2008')
    solution_file = os.path.normpath(
        os.path.abspath(os.path.join(project_dir, 'BuddyListSort.sln')))

    config_name = 'Debug' if DEBUG else 'Release'
    configuration = '%s|Win32' % config_name

    # the MSVC project files use the DIGSBY_PYTHON environment variable to find
    # Python.h and python2x.lib
    env = dict(os.environ)

    SIP_INCLUDE = os.path.normpath(
        os.path.abspath('../../build/msw/sip/siplib'))
    SIP_BIN = os.path.normpath(
        os.path.abspath('../../build/msw/sip/sipgen/sip.exe'))

    assert os.path.isdir(
        SIP_INCLUDE), 'expected a siplib directory at ' + SIP_BIN
    assert os.path.isfile(SIP_BIN), 'expected a sip binary at ' + SIP_BIN

    env.update(SIP_INCLUDE=SIP_INCLUDE,
               SIP_BIN=SIP_BIN,
               DIGSBY_PYTHON=os.path.dirname(
                   distutils.sysconfig.get_python_inc()))

    # Invoke vcbuild
    ret = call(['vcbuild', '/nologo', solution_file, configuration], env=env)
    if ret: sys.exit(ret)

    # Install to DEPS_DIR
    binaries = 'blist{d}.pyd blist{d}.pdb buddylist{d}.dll buddylist{d}.pdb'
    for f in binaries.format(d='_d' if DEBUG else '').split():
        binary = os.path.join(project_dir, config_name, f)
        copy_different(binary, DEPS_DIR)
Exemplo n.º 6
0
 def copylibs():
     for f in ('''python%(dbg)s.exe python%(dbg)s.pdb
                  pythonw%(dbg)s.exe pythonw%(dbg)s.pdb
                  python%(ver)s%(dbg)s.dll python%(ver)s%(dbg)s.pdb
                  sqlite3%(dbg)s.dll sqlite3%(dbg)s.pdb''' % dict(dbg=DEBUG_POSTFIX,
                                                                              ver=PYTHON_VER)).split():
         copy_different(f, pydir)
Exemplo n.º 7
0
def sip():
    sip_path_parent, sip_dir = os.path.split(os.path.abspath(sip_path))

    # Get SIP
    needs_build = True
    with cd(sip_path_parent):
        if not isdir(sip_dir):
            inform('Could not find SIP directory at %r, downloading...' %
                   sip_path)
            git.run(['clone', SIP_GIT_REPO, sip_dir])

            if SIP_GIT_BRANCH != 'master':
                with cd(sip_dir):
                    git.run([
                        'checkout', '-b', SIP_GIT_BRANCH,
                        SIP_GIT_REMOTE + '/' + SIP_GIT_BRANCH
                    ])
        else:
            pass


#            inform('SIP found at %r, updating...' % sip_path)
#            with cd(sip_dir):
#                git.run(['pull'])
#                if not git.sha_changed() and isfile(sip_exe) and isfile(sip_pyd):
#                    inform('skipping SIP build')
#                    needs_build = False

# Build SIP
    if needs_build and 'nosip' not in sys.argv:
        with cd(sip_path):
            if not sys.platform.startswith("win"):
                dpy([
                    'configure.py', '-b', 'sipgen', '-d', 'siplib', '-e',
                    'siplib', '-v', 'siplib'
                ])
                # sip sets CC and CXX directly to cc and c++ rather than pulling the values
                # from the environment, which we don't want if we're forcing a 32-bit build
                # by using gcc 4.0.
                env = os.environ
                run([
                    'make',
                    'CC=%s' % env['CC'],
                    'CXX=%s' % env['CXX'],
                    'LINK=%s' % env['CXX']
                ])

            else:
                dpy(['setup.py', 'build'])

    assert isfile(sip_exe), "setup.py did not create %s" % sip_exe

    if sys.platform.startswith("win"):
        from buildutil import copy_different, DEPS_DIR
        copy_different(sip_pyd, DEPS_DIR)
        copy_different(sip_pdb, DEPS_DIR)
Exemplo n.º 8
0
def _setup_icu():
    # ICU
    icudir = icu.get()

    # copy icu binaries into DEPS_DIR
    icu_bindir = os.path.join(icudir, 'bin')
    for f in os.listdir(icu_bindir):
        copy_different(os.path.join(icu_bindir, f), DEPS_DIR)

    return icudir
Exemplo n.º 9
0
def _setup_icu():
    # ICU
    icudir = icu.get()

    # copy icu binaries into DEPS_DIR
    icu_bindir = os.path.join(icudir, 'bin')
    for f in os.listdir(icu_bindir):
        copy_different(os.path.join(icu_bindir, f), DEPS_DIR)

    return icudir
Exemplo n.º 10
0
def build(force_bakefile=False):
    abs_wxdir = abspath(WXDIR)

    os.environ.update(
        WXWIN=abspath(WXDIR),
        WXDIR=abspath(WXDIR),
        #CAIRO_ROOT = abspath(pathjoin(WXDIR, 'external', 'cairo-dev')),
    )

    copy_setup_h()
    check_bakefile()

    msw_makefile = pathjoin(WXDIR, 'build', 'msw', 'makefile.vc')

    do_bakefile = False
    if force_bakefile:
        inform('forcing bakefile_gen')
        do_bakefile = True
    elif not isfile(msw_makefile):
        inform('makefile.vc missing, running bakefile')
        do_bakefile = True

    if do_bakefile:
        bakefile()
        assert isfile(
            msw_makefile
        ), "running bakefile_gen did not create %s" % msw_makefile

    make_cmd = ['nmake', '-f', 'makefile.vc'] + stropts(WX_MAKEFILE_ARGS)

    # build WX main libraries
    with cd(WXDIR, 'build', 'msw'):
        run(make_cmd)

    # build contribs
    if CONTRIB['STC']:
        with cd(WXDIR, 'contrib', 'build', 'stc'):
            run(make_cmd)

    inform('wxWidgets built successfully in %s' % abspath(WXDIR))

    # install
    from buildutil import copy_different, DEPS_DIR

    bindir = pathjoin(abspath(WXDIR), 'lib', 'vc_dll')

    for dll in ('base28%s_net_vc base28%s_vc msw28%s_adv_vc '
                'msw28%s_core_vc msw28%s_stc_vc').split():

        dll = dll % ('u' + WX_MAKEFILE_ARGS['WXDEBUGFLAG'])
        for ext in ('.dll', '.pdb'):
            src, dest = pathjoin(bindir, 'wx' + dll + ext), DEPS_DIR
            copy_different(src, dest)
Exemplo n.º 11
0
def build(force_bakefile = False):
    abs_wxdir = abspath(WXDIR)

    os.environ.update(
        WXWIN = abspath(WXDIR),
        WXDIR = abspath(WXDIR),
        #CAIRO_ROOT = abspath(pathjoin(WXDIR, 'external', 'cairo-dev')),
    )

    copy_setup_h()
    check_bakefile()

    msw_makefile = pathjoin(WXDIR, 'build', 'msw', 'makefile.vc')

    do_bakefile = False
    if force_bakefile:
        inform('forcing bakefile_gen')
        do_bakefile = True
    elif not isfile(msw_makefile):
        inform('makefile.vc missing, running bakefile')
        do_bakefile = True

    if do_bakefile:
        bakefile()
        assert isfile(msw_makefile), "running bakefile_gen did not create %s" % msw_makefile

    make_cmd = ['nmake', '-f', 'makefile.vc'] + stropts(WX_MAKEFILE_ARGS)

    # build WX main libraries
    with cd(WXDIR, 'build', 'msw'):
        run(make_cmd)

    # build contribs
    if CONTRIB['STC']:
        with cd(WXDIR, 'contrib', 'build', 'stc'):
            run(make_cmd)

    inform('wxWidgets built successfully in %s' % abspath(WXDIR))

    # install
    from buildutil import copy_different, DEPS_DIR

    bindir = pathjoin(abspath(WXDIR), 'lib', 'vc_dll')

    for dll in ('base28%s_net_vc base28%s_vc msw28%s_adv_vc '
                'msw28%s_core_vc msw28%s_stc_vc').split():

        dll = dll % ('u' + WX_MAKEFILE_ARGS['WXDEBUGFLAG'])
        for ext in ('.dll', '.pdb'):
            src, dest = pathjoin(bindir, 'wx' + dll + ext), DEPS_DIR
            copy_different(src, dest)
Exemplo n.º 12
0
def build():
    with cd(thisdir):
        lzma_dir = lzma_sdk.get()

        if not isdir(ppmd7_dir):
            git.run(['clone', ppmd7_git_url])
            assert isdir(ppmd7_dir)

        with cd(ppmd7_dir):
            libname = 'ppmd7'
            config = 'Release' if not DEBUG else 'Debug'
            run(['vcbuild', 'libppmd7.sln', '%s|Win32' % config])
            for ext in ('.dll', '.pdb'):
                copy_different(os.path.join(config, libname + ext), DEPS_DIR)
Exemplo n.º 13
0
def build():
    with cd(thisdir):
        lzma_dir = lzma_sdk.get()

        if not isdir(ppmd7_dir):
            git.run(["clone", ppmd7_git_url])
            assert isdir(ppmd7_dir)

        with cd(ppmd7_dir):
            libname = "ppmd7"
            config = "Release" if not DEBUG else "Debug"
            run(["vcbuild", "libppmd7.sln", "%s|Win32" % config])
            for ext in (".dll", ".pdb"):
                copy_different(os.path.join(config, libname + ext), DEPS_DIR)
Exemplo n.º 14
0
def build_curl():
    # relies on openssl-0.9.8g being in msw/ (should be there from
    # building Python)

    new = not os.path.exists(curl.dirname)

    with cd(curl.get()):
        if os.name == 'nt' and new:
            # after pulling a fresh tarball, apply the patch pointed to by curl_patch.
            # see the note above for an explanation.
            run([patch_cmd, '-p0', '-i', '../' + curl_patch])

        filerepl('lib/Makefile.vc6', '/O2 /DNDEBUG',
                 '/Zi /Ox /GL /GS- /GR- /DNDEBUG')

        filerepl('lib/Makefile.vc6',
                 'LFLAGS     = /nologo /machine:$(MACHINE)',
                 'LFLAGS     = /DEBUG /nologo /machine:$(MACHINE)')

        openssl_includes = "../../../../../digsby-venv"

        # point at includes
        filerepl(
            'lib/Makefile.vc6', '/DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32"',
            '/DUSE_SSLEAY /I "%s/PC" /I "%s/PC/openssl" /I "$(OPENSSL_PATH)/inc32"'
            % (openssl_includes, openssl_includes))

        # point at .libs
        filerepl('lib/Makefile.vc6',
                 'LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"',
                 'LFLAGSSSL = "/LIBPATH:%s/libs"' % openssl_includes)

        with cd('lib'):
            run([
                'nmake', '/nologo', '/E', '/f', 'Makefile.vc6',
                'cfg=%s-dll-ssl-dll-zlib-dll' %
                ('debug' if DEBUG else 'release'),
                'ZLIBLIBSDLL=zlib1%s.lib' % ('d' if DEBUG else ''),
                'IMPLIB_NAME=libcurl', 'IMPLIB_NAME_DEBUG=libcurld'
            ])

            # copy libcurl.dll to digsby/build/msw/dependencies
            from buildutil import copy_different, DEPS_DIR

            copy_different('libcurl%s.dll' % curl_pfix, DEPS_DIR)
            copy_different('libcurl%s.pdb' % curl_pfix, DEPS_DIR)
Exemplo n.º 15
0
def build_curl():
    # relies on openssl-0.9.8g being in msw/ (should be there from
    # building Python)

    new = not os.path.exists(curl.dirname)

    with cd(curl.get()):
        if os.name == 'nt' and new:
            # after pulling a fresh tarball, apply the patch pointed to by curl_patch.
            # see the note above for an explanation.
            run([patch_cmd, '-p0', '-i', '../' + curl_patch])

        filerepl('lib/Makefile.vc6',
                 '/O2 /DNDEBUG',
                 '/Zi /Ox /GL /GS- /GR- /DNDEBUG')

        filerepl('lib/Makefile.vc6',
                 'LFLAGS     = /nologo /machine:$(MACHINE)',
                 'LFLAGS     = /DEBUG /nologo /machine:$(MACHINE)')

        openssl_includes = "../../../../../digsby-venv"

        # point at includes
        filerepl('lib/Makefile.vc6',
                 '/DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32"',
                 '/DUSE_SSLEAY /I "%s/PC" /I "%s/PC/openssl" /I "$(OPENSSL_PATH)/inc32"' % (openssl_includes, openssl_includes))

        # point at .libs
        filerepl('lib/Makefile.vc6',
            'LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"',
            'LFLAGSSSL = "/LIBPATH:%s/libs"' % openssl_includes)

        with cd('lib'):
            run(['nmake', '/nologo', '/E', '/f', 'Makefile.vc6', 'cfg=%s-dll-ssl-dll-zlib-dll' % ('debug' if DEBUG else 'release'),
                 'ZLIBLIBSDLL=zlib1%s.lib'  % ('d' if DEBUG else ''),
                 'IMPLIB_NAME=libcurl',
                 'IMPLIB_NAME_DEBUG=libcurld']
            )

            # copy libcurl.dll to digsby/build/msw/dependencies
            from buildutil import copy_different, DEPS_DIR

            copy_different('libcurl%s.dll' % curl_pfix, DEPS_DIR)
            copy_different('libcurl%s.pdb' % curl_pfix, DEPS_DIR)
Exemplo n.º 16
0
def sip():
    sip_path_parent, sip_dir = os.path.split(os.path.abspath(sip_path))

    # Get SIP
    needs_build = True
    with cd(sip_path_parent):
        if not isdir(sip_dir):
            inform('Could not find SIP directory at %r, downloading...' % sip_path)
            git.run(['clone', SIP_GIT_REPO, sip_dir])

            if SIP_GIT_BRANCH != 'master':
                with cd(sip_dir):
                    git.run(['checkout', '-b', SIP_GIT_BRANCH, SIP_GIT_REMOTE + '/' + SIP_GIT_BRANCH])
        else:
            pass
#            inform('SIP found at %r, updating...' % sip_path)
#            with cd(sip_dir):
#                git.run(['pull'])
#                if not git.sha_changed() and isfile(sip_exe) and isfile(sip_pyd):
#                    inform('skipping SIP build')
#                    needs_build = False

    # Build SIP
    if needs_build and 'nosip' not in sys.argv:
        with cd(sip_path):
            if not sys.platform.startswith("win"):
                dpy(['configure.py', '-b', 'sipgen', '-d', 'siplib', '-e', 'siplib', '-v', 'siplib'])
                # sip sets CC and CXX directly to cc and c++ rather than pulling the values
                # from the environment, which we don't want if we're forcing a 32-bit build
                # by using gcc 4.0.
                env = os.environ
                run(['make', 'CC=%s' % env['CC'],
                             'CXX=%s' % env['CXX'],
                             'LINK=%s' % env['CXX']])

            else:
                dpy(['setup.py', 'build'])

    assert isfile(sip_exe), "setup.py did not create %s" % sip_exe

    if sys.platform.startswith("win"):
        from buildutil import copy_different, DEPS_DIR
        copy_different(sip_pyd, DEPS_DIR)
        copy_different(sip_pdb, DEPS_DIR)
Exemplo n.º 17
0
def install_stdlib():
    'Copies all the .py files in python/Lib'

    from buildutil import copy_different

    with cd(PYTHON_DIR):
        exclude = '.xcopy.exclude' # have to specify xcopy excludes in a file

        with open(exclude, 'w') as fout:
            fout.write('\n'.join(['.pyc', '.pyo', '.svn']))

        try:
            run(['xcopy', 'Lib', r'%s\lib' % DPYTHON_DIR, '/EXCLUDE:%s' % exclude, '/I','/E','/D','/Y'])
            run(['xcopy', 'Include', r'%s\Include' % DPYTHON_DIR, '/EXCLUDE:%s' % exclude, '/I','/E','/D','/Y'])
            if not os.path.isdir(r'%s\libs' % DPYTHON_DIR):
                os.makedirs(r'%s\libs' % DPYTHON_DIR)
            for f in os.listdir(r'PCBuild'):
                if f.endswith('.lib'):
                    copy_different(os.path.join('PCBuild', f), os.path.join(r'%s\libs' % DPYTHON_DIR, f))
        finally:
            os.remove(exclude)
Exemplo n.º 18
0
def fix_build_ssl_py():
    # Python's build files aren't quite up to linking against OpenSSL
    # dynamically, but a few string substitutions are enough to do the
    # trick.

    dllbin, staticbin = '$(opensslDir)\\out32dll\\', '$(opensslDir)\\out32\\'

    hashlib = '_hashlib.vcproj'

    build_repl = lambda *a: filerepl('build_ssl.py', *a)
    vcproj_repl = lambda *a: filerepl('_ssl.vcproj', *a)

    if USE_OPENSSL_DLL:
        build_repl('nt.mak', 'ntdll.mak')
        vcproj_repl(staticbin, dllbin)

        if os.path.isfile(hashlib):
            filerepl(hashlib, staticbin, dllbin)
    else:
        build_repl('ntdll.mak', 'nt.mak')
        vcproj_repl(dllbin, staticbin)
        if os.path.isfile(hashlib):  # 2.6
            filerepl(hashlib, dllbin, staticbin)

    conf_flags = ['VC-WIN32']
    # fix idea compilation problems
    conf_flags.append('disable-idea')
    conf_flags.extend(['no-idea', 'no-mdc2', 'no-rc5'])

    build_repl('configure = "VC-WIN32"',
               'configure = "%s"' % ' '.join(conf_flags))
    build_repl(
        'if not os.path.isfile(makefile) or os.path.getsize(makefile)==0:',
        'if True:')

    if PYTHON_VER == '25':
        from buildutil import copy_different
        copy_different('../../_ssl.mak.25.2008', '_ssl.mak')
    else:
        print >> sys.stderr, 'WARNING: _ssl.pyd will be built without debugging symbols'
Exemplo n.º 19
0
def fix_build_ssl_py():
    # Python's build files aren't quite up to linking against OpenSSL
    # dynamically, but a few string substitutions are enough to do the
    # trick.

    dllbin, staticbin = '$(opensslDir)\\out32dll\\', '$(opensslDir)\\out32\\'

    hashlib = '_hashlib.vcproj'

    build_repl  = lambda *a: filerepl('build_ssl.py', *a)
    vcproj_repl = lambda *a: filerepl('_ssl.vcproj', *a)

    if USE_OPENSSL_DLL:
        build_repl('nt.mak', 'ntdll.mak')
        vcproj_repl(staticbin, dllbin)

        if os.path.isfile(hashlib):
            filerepl(hashlib, staticbin, dllbin)
    else:
        build_repl('ntdll.mak', 'nt.mak')
        vcproj_repl(dllbin, staticbin)
        if os.path.isfile(hashlib): # 2.6
            filerepl(hashlib, dllbin, staticbin)

    conf_flags = ['VC-WIN32']
    # fix idea compilation problems
    conf_flags.append('disable-idea')
    conf_flags.extend(['no-idea', 'no-mdc2', 'no-rc5'])

    build_repl('configure = "VC-WIN32"', 'configure = "%s"' % ' '.join(conf_flags))
    build_repl('if not os.path.isfile(makefile) or os.path.getsize(makefile)==0:', 'if True:')

    if PYTHON_VER == '25':
        from buildutil import copy_different
        copy_different('../../_ssl.mak.25.2008', '_ssl.mak')
    else:
        print >> sys.stderr, 'WARNING: _ssl.pyd will be built without debugging symbols'
Exemplo n.º 20
0
def build_zlib():
    copy_different('../../../builddeps/msvc2008/' + zlib.filename, '.')
    unzip(zlib.filename)

    with cd('zlib-1.2.3'):
        lib_dest_path = os.getcwd()
        with cd('projects/visualc9-x86'):
            configname = 'DLL ASM %s' % ('Debug' if DEBUG else 'Release')
            run(['vcbuild', 'zlib.vcproj', configname])

            # install the ZLIB dll and pdb
            print 'DEPS_DIR here', DEPS_DIR
            with cd('Win32/' + configname):
                debug_flag = 'd' if DEBUG else ''

                for dest in (DEPS_DIR, lib_dest_path):
                    copy_different('zlib1%s.dll' % debug_flag, dest)
                    copy_different('zlib1%s.pdb' % debug_flag, dest)
                    copy_different('zlib1%s.lib' % debug_flag, dest)
Exemplo n.º 21
0
def install(cfg):
    'Installs all necessary binaries.'

    if False:
        copy_different('openssl-0.9.8g/out32dll/libeay32.dll', DEPS_DIR)
        copy_different('openssl-0.9.8g/out32dll/ssleay32.dll', DEPS_DIR)

    bindir = pathjoin(WEBKITDIR, 'WebKitBuild', 'Release' if cfg == 'release' else 'Debug')

    for dll in 'wxwebkit'.split():
        for ext in ('.pdb', '.dll'):
            src, dest = pathjoin(bindir, dll + ext), DEPS_DIR
            if ext == '.pdb' and not isfile(src):
                continue
            copy_different(src, dest)

    copy_different(pathjoin(WEBKITDIR, 'WebKitLibraries/win/lib', 'pthreadVC2.dll'), DEPS_DIR)

    print 'wxwebkit.dll is %.2fMB' % (os.path.getsize(pathjoin(bindir, 'wxwebkit.dll')) / 1024.0 / 1024.0)
Exemplo n.º 22
0
def build_zlib():
    copy_different('../../../builddeps/msvc2008/' + zlib.filename, '.')
    unzip(zlib.filename)

    with cd('zlib-1.2.3'):
        lib_dest_path = os.getcwd()
        with cd('projects/visualc9-x86'):
            configname = 'DLL ASM %s' % ('Debug' if DEBUG else 'Release')
            run(['vcbuild', 'zlib.vcproj', configname])

            # install the ZLIB dll and pdb
            print 'DEPS_DIR here', DEPS_DIR
            with cd('Win32/' + configname):
                debug_flag = 'd' if DEBUG else ''

                for dest in (DEPS_DIR, lib_dest_path):
                    copy_different('zlib1%s.dll' % debug_flag, dest)
                    copy_different('zlib1%s.pdb' % debug_flag, dest)
                    copy_different('zlib1%s.lib' % debug_flag, dest)
Exemplo n.º 23
0
def install(cfg):
    'Installs all necessary binaries.'

    if False:
        copy_different('openssl-0.9.8g/out32dll/libeay32.dll', DEPS_DIR)
        copy_different('openssl-0.9.8g/out32dll/ssleay32.dll', DEPS_DIR)

    bindir = pathjoin(WEBKITDIR, 'WebKitBuild',
                      'Release' if cfg == 'release' else 'Debug')

    for dll in 'wxwebkit'.split():
        for ext in ('.pdb', '.dll'):
            src, dest = pathjoin(bindir, dll + ext), DEPS_DIR
            if ext == '.pdb' and not isfile(src):
                continue
            copy_different(src, dest)

    copy_different(
        pathjoin(WEBKITDIR, 'WebKitLibraries/win/lib', 'pthreadVC2.dll'),
        DEPS_DIR)

    print 'wxwebkit.dll is %.2fMB' % (
        os.path.getsize(pathjoin(bindir, 'wxwebkit.dll')) / 1024.0 / 1024.0)
Exemplo n.º 24
0
def post_build():
    # copy pyconfig.h from PC/ to /Include and Python26.lib to make scripts
    # using distutils work with our PGO build without modification
    with cd(PYTHON_DIR):
        from buildutil import copy_different
        copy_different('PC/pyconfig.h', 'Include/pyconfig.h')

    install_stdlib()

    with cd(PYTHON_DIR):

        # install python executables
        with cd(PYTHON_LIBDIR):
            pydir = DPYTHON_DIR
            assert os.path.isdir(pydir), pydir

            def copylibs():
                for f in ('''python%(dbg)s.exe python%(dbg)s.pdb
                             pythonw%(dbg)s.exe pythonw%(dbg)s.pdb
                             python%(ver)s%(dbg)s.dll python%(ver)s%(dbg)s.pdb
                             sqlite3%(dbg)s.dll sqlite3%(dbg)s.pdb''' %
                          dict(dbg=DEBUG_POSTFIX, ver=PYTHON_VER)).split():
                    copy_different(f, pydir)

            if not DEBUG and getattr(getattr(sys, 'opts', None), 'pgo', None):
                with cd(PYTHON_PGO_DIR):
                    copylibs()
            else:
                copylibs()

            dlls_dir = os.path.join(pydir, 'DLLs')
            if not os.path.isdir(dlls_dir):
                os.mkdir(dlls_dir)

            libs = '''_ctypes _elementtree _hashlib _socket _sqlite3
                      _ssl bz2 pyexpat select unicodedata winsound'''.split()

            if int(PYTHON_VER) >= 26:
                libs.append('_multiprocessing')

            for f in libs:
                f += DEBUG_POSTFIX
                copy_different(f + '.pyd', dlls_dir)
                try:
                    copy_different(f + '.pdb', dlls_dir)
                except Exception:
                    print 'WARNING: could not copy %s.pdb' % f
Exemplo n.º 25
0
def post_build():
    # copy pyconfig.h from PC/ to /Include and Python26.lib to make scripts
    # using distutils work with our PGO build without modification
    with cd(PYTHON_DIR):
        from buildutil import copy_different
        copy_different('PC/pyconfig.h', 'Include/pyconfig.h')


    install_stdlib()

    with cd(PYTHON_DIR):

        # install python executables
        with cd(PYTHON_LIBDIR):
            pydir = DPYTHON_DIR
            assert os.path.isdir(pydir), pydir

            def copylibs():
                for f in ('''python%(dbg)s.exe python%(dbg)s.pdb
                             pythonw%(dbg)s.exe pythonw%(dbg)s.pdb
                             python%(ver)s%(dbg)s.dll python%(ver)s%(dbg)s.pdb
                             sqlite3%(dbg)s.dll sqlite3%(dbg)s.pdb''' % dict(dbg=DEBUG_POSTFIX,
                                                                                         ver=PYTHON_VER)).split():
                    copy_different(f, pydir)
            if not DEBUG and getattr(getattr(sys, 'opts', None), 'pgo', None):
                with cd(PYTHON_PGO_DIR):
                    copylibs()
            else:
                copylibs()

            dlls_dir = os.path.join(pydir, 'DLLs')
            if not os.path.isdir(dlls_dir):
                os.mkdir(dlls_dir)

            libs = '''_ctypes _elementtree _hashlib _socket _sqlite3
                      _ssl bz2 pyexpat select unicodedata winsound'''.split()

            if int(PYTHON_VER) >= 26:
                libs.append('_multiprocessing')

            for f in libs:
                f += DEBUG_POSTFIX
                copy_different(f + '.pyd', dlls_dir)
                try:
                    copy_different(f + '.pdb', dlls_dir)
                except Exception:
                    print 'WARNING: could not copy %s.pdb' % f
Exemplo n.º 26
0
def build_libxml2():
    from compiledeps import libxml2_dirname
    new = not os.path.exists(libxml2_dirname)
    libxml2_dir = download_libxml2()

    with cd(libxml2_dir):
        if os.name == 'nt' and new:
            # after pulling a fresh tarball, apply the patch pointed to by lxml_patch.
            print os.getcwd()
            run([
                patch_cmd, '--ignore-whitespace', '-p0', '-i',
                os.path.abspath(os.path.join('..', libxml2_patch))
            ])

    inform(banner='libiconv')
    if not isdir(iconv_dirname):
        # has a .lib compiled statically to msvcrt.dll
        wget_cached(iconv_zipfile, iconv_zipfile_size, iconv_url)
        unzip(iconv_zipfile)
    else:
        inform('libiconv directory already exists')

    patch_libxml2_h(libxml2_dir, 'include')

    iconv = abspath(iconv_dirname)

    inform(banner='libxml2')

    print 'passing libiconv path to configure.js as %r' % iconv

    # copy the fixed setup.py.in
    print 'copying libxml2.setup.py.msvc2008', pathjoin(libxml2_dir, 'python')
    patched_setup = 'libxml2.setup.py.msvc2008'
    assert os.path.exists(patched_setup)
    copy_different(patched_setup, pathjoin(libxml2_dir, 'python',
                                           'setup.py.in'))

    with cd(libxml2_dir, 'win32'):
        debug_flag = ['debug=yes'] if DEBUG else []
        run([
            'cscript', 'configure.js', '//E:JavaScript', 'vcmanifest=yes',
            'python=yes'
        ] + debug_flag + [
            'include=%s' % pathjoin(iconv, 'include'),
            'lib=%s' % pathjoin(iconv, 'lib')
        ])

        makefile = 'Makefile.msvc'

        # customize the Makefile...
        with open(makefile) as f:
            lines = []
            for line in f:
                # 1) optimize a bit more than just /O2
                line = line.replace('/O2', '/Os /GS- /GL /Zi')
                line = line.replace(
                    '/nologo /VERSION',
                    '/nologo /OPT:REF /OPT:ICF /DEBUG /VERSION')

                lines.append(line)

        with open(makefile, 'w') as f:
            f.write(''.join(lines))

    with cd(libxml2_dir, 'win32'):
        run(['nmake', '-f', makefile] + (['clean'] if CLEAN else []))

    # All finished files go to DEPS_DIR:
    mkdirs(DEPS_DIR)
    deps = os.path.abspath(DEPS_DIR)

    inform(banner='libxml2 python bindings')
    with cd(libxml2_dir, 'python'):
        # installs libxml2 python files to deps directory'
        #post commit hook test line, git failed to catch the last one.
        dpy(['setup.py', 'build_ext'] + (['--debug'] if DEBUG else []) +
            ['install', '--install-lib', deps])

    # but we still need libxml2.dll
    libxml2_bindir = pathjoin(libxml2_dir, 'win32', 'bin.msvc')
    copy_different(pathjoin(libxml2_bindir, 'libxml2.dll'), deps)
    copy_different(pathjoin(libxml2_bindir, 'libxml2.pdb'), deps)

    # and iconv.dll
    copy_different(os.path.join(iconv, 'iconv.dll'), deps)

    # show which Python was used to build the PYD
    dpy([
        '-c',
        "import sys; print 'libxml2 python bindings built with %s' % sys.executable"
    ])

    with cd(DEPS_DIR):
        dpy(['-c', "import libxml2"])

    # build and install libxslt
    libxslt_dir = build_libxslt()
    copy_different(
        os.path.join(libxslt_dir, 'win32', 'bin.msvc', 'libxslt.dll'), deps)
    copy_different(
        os.path.join(libxslt_dir, 'win32', 'bin.msvc', 'libexslt.dll'), deps)
Exemplo n.º 27
0
def build_libxml2():
    from compiledeps import libxml2_dirname
    new = not os.path.exists(libxml2_dirname)
    libxml2_dir = download_libxml2()

    with cd(libxml2_dir):
        if os.name == 'nt' and new:
            # after pulling a fresh tarball, apply the patch pointed to by lxml_patch.
            print os.getcwd()
            run([patch_cmd, '--ignore-whitespace', '-p0', '-i', os.path.abspath(os.path.join('..', libxml2_patch))])

    inform(banner = 'libiconv')
    if not isdir(iconv_dirname):
        # has a .lib compiled statically to msvcrt.dll
        wget_cached(iconv_zipfile, iconv_zipfile_size, iconv_url)
        unzip(iconv_zipfile)
    else:
        inform('libiconv directory already exists')

    patch_libxml2_h(libxml2_dir, 'include')

    iconv = abspath(iconv_dirname)

    inform(banner = 'libxml2')

    print 'passing libiconv path to configure.js as %r' % iconv

    # copy the fixed setup.py.in
    print 'copying libxml2.setup.py.msvc2008', pathjoin(libxml2_dir, 'python')
    patched_setup = 'libxml2.setup.py.msvc2008'
    assert os.path.exists(patched_setup)
    copy_different(patched_setup, pathjoin(libxml2_dir, 'python', 'setup.py.in'))

    with cd(libxml2_dir, 'win32'):
        debug_flag = ['debug=yes'] if DEBUG else []
        run(['cscript', 'configure.js', '//E:JavaScript', 'vcmanifest=yes', 'python=yes'] + debug_flag + [
             'include=%s' % pathjoin(iconv, 'include'),
             'lib=%s' % pathjoin(iconv, 'lib')])

        makefile = 'Makefile.msvc'

        # customize the Makefile...
        with open(makefile) as f:
            lines = []
            for line in f:
                # 1) optimize a bit more than just /O2
                line = line.replace('/O2', '/Os /GS- /GL /Zi')
                line = line.replace('/nologo /VERSION', '/nologo /OPT:REF /OPT:ICF /DEBUG /VERSION')

                lines.append(line)

        with open(makefile, 'w') as f:
            f.write(''.join(lines))


    with cd(libxml2_dir, 'win32'):
        run(['nmake', '-f', makefile] + (['clean'] if CLEAN else []))

    # All finished files go to DEPS_DIR:
    mkdirs(DEPS_DIR)
    deps = os.path.abspath(DEPS_DIR)

    inform(banner='libxml2 python bindings')
    with cd(libxml2_dir, 'python'):
        # installs libxml2 python files to deps directory'
        #post commit hook test line, git failed to catch the last one.
        dpy(['setup.py', 'build_ext'] + (['--debug'] if DEBUG else []) +
            ['install', '--install-lib', deps])

    # but we still need libxml2.dll
    libxml2_bindir = pathjoin(libxml2_dir, 'win32', 'bin.msvc')
    copy_different(pathjoin(libxml2_bindir, 'libxml2.dll'), deps)
    copy_different(pathjoin(libxml2_bindir, 'libxml2.pdb'), deps)

    # and iconv.dll
    copy_different(os.path.join(iconv, 'iconv.dll'), deps)

    # show which Python was used to build the PYD
    dpy(['-c', "import sys; print 'libxml2 python bindings built with %s' % sys.executable"])

    with cd(DEPS_DIR):
        dpy(['-c', "import libxml2"])

    # build and install libxslt
    libxslt_dir = build_libxslt()
    copy_different(os.path.join(libxslt_dir, 'win32', 'bin.msvc', 'libxslt.dll'), deps)
    copy_different(os.path.join(libxslt_dir, 'win32', 'bin.msvc', 'libexslt.dll'), deps)
Exemplo n.º 28
0
def build_m2crypto():
    banner('M2Crypto')

    if not exists(m2crypto_dir):
        run(['svn', 'co', m2crypto_svn_url, m2crypto_dir])

        with cd(m2crypto_dir):
            from buildutil import common
            run([
                patch_cmd, '-p0', '-i',
                os.path.join(compiledeps_dir,
                             'm2crypto-ssl-wanterrors-zero-return.diff')
            ])

    if os.name == 'nt':
        openssl = abspath(r'C:\OpenSSL-Win32')
        assert exists(openssl), 'cannot find openssl'

        # svn puts "link PATH" for symlinks...
        fix_symlinks(openssl)

        # copy a fixed setup.py
        from buildutil import copy_different
        dbg_ext = '.debug' if DEBUG else ''
        copy_different(pathjoin('msw', 'm2crypto.setup.py.msvc2008' + dbg_ext),
                       pathjoin(m2crypto_dir, 'setup.py'))

    with cd(m2crypto_dir):
        # Fix M2Crypto so that it doesn't monkeypatch urllib.
        # do it before running setup.py because that creates an egg now
        # so it's a lot easier to patch before it's eggified
        f = os.path.join('M2Crypto', 'm2urllib.py')
        assert os.path.isfile(f), f

        lines = []
        with open(f) as infile:
            for line in infile.readlines():
                if line == 'URLopener.open_https = open_https\n':
                    line = '# ' + line
                lines.append(line)

        with open(f, 'w') as out:
            out.writelines(lines)

        if os.name == 'nt':
            libdirs = pathjoin(openssl, 'lib')
            debug_build_flag = ['--debug'] if DEBUG else []
            dpy(['setup.py', 'build_ext', '-o', openssl, '-L' + libdirs] +
                debug_build_flag)

            dpy(['setup.py', 'install', '--install-lib', get_python_lib()])
        else:
            if sys.platform.startswith('darwin'):
                os.environ['CFLAGS'] = sdkcflags
                os.environ['LDFLAGS'] = sdkldflags
            dpy([
                'setup.py', '--verbose', 'build_ext', 'install', '-O2',
                '--install-lib', DEPS_DIR
            ],
                platlib=True)

            if sys.platform.startswith('darwin'):
                os.environ['CFLAGS'] = ''
                os.environ['LDFLAGS'] = ''