def build_syck(): from buildutil import wget_cached, unzip with cd(DEPS_DIR): dbgpostfix = '_d' if DEBUG else '' zip = 'pysyck_msvc2008_%s%s.zip' % (sys.version[:3].replace( '.', ''), dbgpostfix) wget_cached( zip, 42443, 'http://symbolsystem.nfshost.com/build/msvc2008/' + zip) unzip(zip)
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)
prefix = 'http://gnuwin32.sourceforge.net/downlinks/' zip_php = 'zip.php' types = {'b' : 'bin', 'd' : 'dep'} needed = { 'autoconf' : 'b', 'automake' : 'b', 'bison' : 'bd', 'flex' : 'b', 'gperf' : 'b', 'make' : 'bd', 'wget' : 'bd', 'grep' : 'bd', 'unzip' : 'b', 'which' : 'b', 'tar' : 'bd', 'unrar' : 'b', 'zip' : 'bd', 'coreutils' : 'bd', } # 'http://downloads.sourceforge.net/mingw/binutils-2.19.1-mingw32-bin.tar.gz' : None, #http://subversion.tigris.org/files/documents/15/45222/svn-win32-1.5.6.zip with cd('downloads'): for package, zips in needed.iteritems(): for letter in zips: kind = types[letter] name = package + '-' + kind + '-' + zip_php wget(prefix + name) unzip(name)
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)
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)
from buildutil import wget, cd, unzip prefix = 'http://gnuwin32.sourceforge.net/downlinks/' zip_php = 'zip.php' types = {'b': 'bin', 'd': 'dep'} needed = { 'autoconf': 'b', 'automake': 'b', 'bison': 'bd', 'flex': 'b', 'gperf': 'b', 'make': 'bd', 'wget': 'bd', 'grep': 'bd', 'unzip': 'b', 'which': 'b', 'tar': 'bd', 'unrar': 'b', 'zip': 'bd', 'coreutils': 'bd', } # 'http://downloads.sourceforge.net/mingw/binutils-2.19.1-mingw32-bin.tar.gz' : None, #http://subversion.tigris.org/files/documents/15/45222/svn-win32-1.5.6.zip with cd('downloads'): for package, zips in needed.iteritems(): for letter in zips: kind = types[letter] name = package + '-' + kind + '-' + zip_php wget(prefix + name) unzip(name)