def install(self, environ, version, strict=False, locally=True): if not self.found: if locally or not 'darwin' in platform.system().lower(): here = os.path.abspath(os.getcwd()) if locally: prefix = os.path.abspath(options.target_build_dir) if not prefix in options.local_search_paths: options.add_local_search_path(prefix) else: prefix = options.global_prefix ## MinGW shell strips backslashes prefix = convert2unixpath(prefix) src_dir = self.download(environ, version, strict) oper_sys = 'linux' if 'windows' in platform.system().lower(): oper_sys = 'mingw' elif 'darwin' in platform.system().lower(): oper_sys = 'macosx' build_dir = os.path.join(options.target_build_dir, src_dir) os.chdir(build_dir) log = open('build.log', 'w') if 'windows' in platform.system().lower(): try: ## ncurses prerequisite check_call(['mingw-get', 'install', 'pdcurses']) check_call(['mingw-get', 'install', 'libpdcurses']) except subprocess.CalledProcessError: pass mingw_check_call(environ, ['make', 'OS=mingw', 'ENV=gnu', 'all'], stdout=log, stderr=log) mingw_check_call(environ, ['make', 'INSTALLDIR=' + prefix, 'install'], stdout=log, stderr=log) else: check_call(['make', 'OS=' + oper_sys, 'ENV=gnu', 'all'], stdout=log, stderr=log) if locally: check_call(['make', 'INSTALLDIR=' + prefix, 'install'], stdout=log, stderr=log) else: admin_check_call(['make', 'INSTALLDIR=' + prefix, 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: global_install('CDF', None, brew='cdf', port='cdf') if not self.is_installed(environ, version, strict): raise Exception('CDF installation failed.')
def install(self, environ, version, strict=False, locally=True): if not self.found: if locally or 'windows' in platform.system().lower(): ## NB: broken on Windows! src_dir = self.download(environ, version, strict) here = os.path.abspath(os.getcwd()) if locally: prefix = os.path.abspath(options.target_build_dir) if not prefix in options.local_search_paths: options.add_local_search_path(prefix) else: prefix = options.global_prefix prefix = convert2unixpath(prefix) ## MinGW shell strips backslashes build_dir = os.path.join(options.target_build_dir, src_dir, '_build') mkdir(build_dir) os.chdir(build_dir) log = open('build.log', 'w') if 'windows' in platform.system().lower(): # Assumes MinGW present, detected, and loaded in environment mingw_check_call(environ, ['../configure', '--prefix="' + prefix + '"', '--shared', #'-O ', '-b 32', '-Si nocygin 1'], stdout=log, stderr=log) mingw_check_call(environ, ['make'], stdout=log, stderr=log) mingw_check_call(environ, ['make', 'install'], stdout=log, stderr=log) else: check_call(['../configure', '--prefix=' + prefix, '--shared'], stdout=log, stderr=log) check_call(['make'], stdout=log, stderr=log) if locally: check_call(['make', 'install'], stdout=log, stderr=log) else: admin_check_call(['make', 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: global_install('ATLAS', None, ## part of XCode deb='libatlas-dev', rpm='atlas-devel') if not self.is_installed(environ, version, strict): raise Exception('ATLAS installation failed.')
def install(self, environ, version, strict=False, locally=True): if not self.found: if 'windows' in platform.system().lower(): here = os.path.abspath(os.getcwd()) if locally: prefix = os.path.abspath(options.target_build_dir) if not prefix in options.local_search_paths: options.add_local_search_path(prefix) else: prefix = options.global_prefix ## MinGW shell strips backslashes prefix = convert2unixpath(prefix) website = ('http://dlfcn-win32.googlecode.com/files/',) if version is None: version = 'r19' src_dir = 'dlfcn-win32-' + str(version) archive = src_dir + '.tar.bz2' fetch(''.join(website), archive, archive) unarchive(archive, src_dir) build_dir = os.path.join(options.target_build_dir, src_dir) os.chdir(build_dir) log = open('build.log', 'w') patch_c_only_header('dlfcn.h') mingw_check_call(environ, ['./configure', '--prefix="' + prefix + '"', '--libdir="' + prefix + '/lib"', '--incdir="' + prefix + '/include"', '--enable-shared'], stdout=log, stderr=log) mingw_check_call(environ, ['make'], stdout=log, stderr=log) mingw_check_call(environ, ['make', 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: raise Exception('Non-Windows platform with missing libdl.') if not self.is_installed(environ, version, strict): raise Exception('libdl installation failed.')
def install(self, environ, version, strict=False, locally=True): if not self.found: if locally or ('darwin' in platform.system().lower() and system_uses_homebrew()): here = os.path.abspath(os.getcwd()) if locally: prefix = os.path.abspath(options.target_build_dir) if not prefix in options.local_search_paths: options.add_local_search_path(prefix) else: prefix = options.global_prefix ## MinGW shell strips backslashes prefix = convert2unixpath(prefix) src_dir = 'gccxml' if not os.path.exists(os.path.join(here, options.download_dir, src_dir)): os.chdir(options.download_dir) gitsite = 'https://github.com/gccxml/gccxml.git' check_call([environ['GIT'], 'clone', gitsite, src_dir]) os.chdir(here) build_dir = os.path.join(options.download_dir, src_dir, '_build') mkdir(build_dir) os.chdir(build_dir) log = open('build.log', 'w') if 'windows' in platform.system().lower(): if 'MSVC' in environ: config_cmd = [environ['CMAKE'], '..', '-G', '"NMake Makefiles"', '-DCMAKE_INSTALL_PREFIX=' + prefix] #TODO test msvc cmake build; probably wrong check_call([environ['MSVC_VARS']], stdout=log, stderr=log) check_call(config_cmd, stdout=log, stderr=log) check_call([environ['NMAKE']], stdout=log, stderr=log) check_call([environ['NMAKE'], 'install'], stdout=log, stderr=log) else: ## MinGW config_cmd = [environ['CMAKE'], '..', '-G', '"MSYS Makefiles"', '-DCMAKE_INSTALL_PREFIX=' + prefix, '-DCMAKE_MAKE_PROGRAM=/bin/make.exe'] mingw_check_call(environ, config_cmd, stdout=log, stderr=log) mingw_check_call(environ, ['make'], stdout=log, stderr=log) mingw_check_call(environ, ['make', 'install'], stdout=log, stderr=log) else: config_cmd = [environ['CMAKE'], '..', '-G', 'Unix Makefiles', '-DCMAKE_INSTALL_PREFIX=' + prefix] check_call(config_cmd, stdout=log, stderr=log) check_call(['make'], stdout=log, stderr=log) if locally: check_call(['make', 'install'], stdout=log, stderr=log) else: admin_check_call(['make', 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: if version is None: version = '0.6.0' website = ('http://www.gccxml.org/', 'files/v' + major_minor_version(version) + '/') global_install('GCCXML', website, winstaller='gccxml-' + str(version) + '-win32.exe', brew=None, port='gccxml-devel', deb='gccxml', rpm='gccxml') if not self.is_installed(environ, version, strict): raise Exception('GCC-XML installation failed.')