def _clone_linux_qemu(): # grab the linux tarball if not os.path.exists(QEMU_REPO_PATH_LINUX): TRACER_QEMU_REPO_LINUX = "https://github.com/qemu/qemu.git" if subprocess.call([ 'git', 'clone', '--branch', 'v2.3.0', '--depth=1', TRACER_QEMU_REPO_LINUX, QEMU_REPO_PATH_LINUX ]) != 0: raise LibError("Unable to retrieve qemu repository \"%s\"" % TRACER_QEMU_REPO_LINUX) if subprocess.call([ 'git', '-C', QEMU_REPO_PATH_LINUX, 'apply', QEMU_LINUX_TRACER_PATCH ]) != 0: raise LibError("Unable to apply tracer patch to qemu") if subprocess.call([ 'git', '-C', QEMU_REPO_PATH_LINUX, 'apply', QEMU_LINUX_UPDATE_PATCH ]) != 0: raise LibError("Unable to apply ucontext_t update patch to qemu") if subprocess.call([ 'git', '-C', QEMU_REPO_PATH_LINUX, 'apply', QEMU_LINUX_COREDUMP_PATCH ]) != 0: raise LibError( "Unable to apply coredump update patch to qemu-linux") if subprocess.call([ 'git', '-C', QEMU_REPO_PATH_CGC_BASE, 'apply', QEMU_CGC_COREDUMP_PATCH ]) != 0: raise LibError( "Unable to apply coredump update patch to qemu-cgc-base")
def _setup_cgc(): if not os.path.exists(AFL_CGC_INSTALL_PATH): AFL_CGC_REPO = "https://github.com/shellphish/driller-afl.git" if subprocess.call( ['git', 'clone', AFL_CGC_REPO, AFL_CGC_INSTALL_PATH]) != 0: raise LibError("Unable to retrieve afl-cgc") if subprocess.call(['make', '-j'], cwd=AFL_CGC_INSTALL_PATH) != 0: raise LibError("Unable to make afl-cgc") if subprocess.call(['./build_qemu_support.sh'], cwd=os.path.join(AFL_CGC_INSTALL_PATH, "qemu_mode")) != 0: raise LibError("Unable to build afl-cgc-qemu") if not os.path.exists(AFL_MULTI_CGC_INSTALL_PATH): AFL_MULTI_CGC_REPO = "https://github.com/mechaphish/multiafl.git" if subprocess.call([ 'git', 'clone', AFL_MULTI_CGC_REPO, AFL_MULTI_CGC_INSTALL_PATH ]) != 0: raise LibError("Unable to retrieve afl-multi-cgc") if subprocess.call(['make', '-j'], cwd=AFL_MULTI_CGC_INSTALL_PATH) != 0: raise LibError("Unable to make afl-multi-cgc")
def _setup_other_arch(): # revisiting the afl mirrorer repo if not os.path.exists(AFL_UNIX_INSTALL_PATH): AFL_UNIX_REPO = "https://github.com/mirrorer/afl" if subprocess.call([ 'git', 'clone', '--depth=1', AFL_UNIX_REPO, AFL_UNIX_INSTALL_PATH ]) != 0: raise LibError("Unable to retrieve afl-unix") with open(BUILD_QEMU_PATCH_FILE, "rb") as f: if subprocess.check_call( ['patch', '-p0'], stdin=f, cwd=AFL_UNIX_INSTALL_PATH) != 0: raise LibError("Unable to apply patches to qemu build") if subprocess.call(['cp', AFL_UNIX_GEN, AFL_UNIX_INSTALL_PATH]) != 0: raise LibError("Build file doesn't exist") # patch for qemu to work with ubuntu 18.04 and above if subprocess.check_call(['cp', QEMU_PATCH, AFL_QEMU_MODE_PATCH]) != 0: raise LibError('Patch to work Qemu with Ubuntu 18 not found') if subprocess.check_call(['./build.sh'] + SUPPORTED_ARCHES, cwd=AFL_UNIX_INSTALL_PATH) != 0: raise LibError("Unable to build afl-other-arch")
def _clone_cgc_qemu(): # grab the CGC repo if not os.path.exists(QEMU_REPO_PATH_CGC_BASE) \ or not os.path.exists(QEMU_REPO_PATH_CGC_BASE): TRACER_QEMU_REPO_CGC = "https://github.com/mechaphish/qemu-cgc" # since we're cloning from gitlab we'll need to try a couple times, since gitlab # has a cap on the number of ssh workers retrieved = False for _ in range(10): if subprocess.call([ 'git', 'clone', '--branch', 'base_cgc', '--depth=1', TRACER_QEMU_REPO_CGC, QEMU_REPO_PATH_CGC_BASE ]) == 0: retrieved = True break else: time.sleep(random.randint(0, 10)) if not retrieved: raise LibError("Unable to retrieve tracer qemu") # update tracer qemu for cgc if subprocess.call(['git', 'pull'], cwd=QEMU_REPO_PATH_CGC_BASE) != 0: raise LibError("Unable to retrieve cgc base qemu")
def _build_native(): try: import unicorn import pyvex except ImportError: raise LibError("You must install unicorn and pyvex before building angr") env = os.environ.copy() env_data = (('UNICORN_INCLUDE_PATH', 'unicorn', 'include'), ('UNICORN_LIB_PATH', 'unicorn', 'lib'), ('UNICORN_LIB_FILE', 'unicorn', 'lib\\unicorn.lib'), ('PYVEX_INCLUDE_PATH', 'pyvex', 'include'), ('PYVEX_LIB_PATH', 'pyvex', 'lib'), ('PYVEX_LIB_FILE', 'pyvex', 'lib\\pyvex.lib')) for var, pkg, fnm in env_data: try: env[var] = pkg_resources.resource_filename(pkg, fnm) except KeyError: pass cmd1 = ['nmake', '/f', 'Makefile-win'] cmd2 = ['make'] for cmd in (cmd1, cmd2): try: if subprocess.call(cmd, cwd='native', env=env) != 0: raise LibError('Unable to build angr_native') break except OSError: continue else: raise LibError('Unable to build angr_native') shutil.rmtree('angr/lib', ignore_errors=True) os.mkdir('angr/lib') shutil.copy(os.path.join('native', library_file), 'angr/lib')
def _build_z3(): if sys.platform == 'win32': if subprocess.call(['nmake'], env=build_env, cwd=BUILD_DIR) != 0: raise LibError("Unable to build Z3.") else: # linux and macOS if subprocess.call(['make', '-j', str(multiprocessing.cpu_count())], env=build_env, cwd=BUILD_DIR) != 0: raise LibError("Unable to build Z3.")
def _build_standard_qemu(): if not os.path.exists(BIN_PATH): try: os.makedirs(BIN_PATH) except OSError: raise LibError("Unable to create bin directory") print("Folder created") print("Configuring Linux qemu...") if subprocess.call(['./tracer-config'], cwd=QEMU_REPO_PATH_LINUX) != 0: raise LibError("Unable to configure shellphish-qemu-linux") print("Building Linux qemu...") if subprocess.call(['make', '-j4'], cwd=QEMU_REPO_PATH_LINUX) != 0: raise LibError("Unable to build shellphish-qemu-linux") shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "i386-linux-user", "qemu-i386"), QEMU_PATH_LINUX_I386) shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "x86_64-linux-user", "qemu-x86_64"), QEMU_PATH_LINUX_X86_64) shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "mipsel-linux-user", "qemu-mipsel"), QEMU_PATH_LINUX_MIPSEL) shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "mips-linux-user", "qemu-mips"), QEMU_PATH_LINUX_MIPS) shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "mips64-linux-user", "qemu-mips64"), QEMU_PATH_LINUX_MIPS64) shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "ppc-linux-user", "qemu-ppc"), QEMU_PATH_LINUX_PPC) shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "ppc64-linux-user", "qemu-ppc64"), QEMU_PATH_LINUX_PPC64) shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "arm-linux-user", "qemu-arm"), QEMU_PATH_LINUX_ARM) shutil.copyfile( os.path.join(QEMU_REPO_PATH_LINUX, "aarch64-linux-user", "qemu-aarch64"), QEMU_PATH_LINUX_AARCH64) os.chmod(QEMU_PATH_LINUX_I386, 0o755) os.chmod(QEMU_PATH_LINUX_X86_64, 0o755) os.chmod(QEMU_PATH_LINUX_MIPSEL, 0o755) os.chmod(QEMU_PATH_LINUX_MIPS, 0o755) os.chmod(QEMU_PATH_LINUX_MIPS64, 0o755) os.chmod(QEMU_PATH_LINUX_PPC, 0o755) os.chmod(QEMU_PATH_LINUX_PPC64, 0o755) os.chmod(QEMU_PATH_LINUX_ARM, 0o755) os.chmod(QEMU_PATH_LINUX_AARCH64, 0o755)
def _setup_other_arch(): # grab the afl-other-arch repo if not os.path.exists(AFL_UNIX_INSTALL_PATH): AFL_UNIX_REPO = "https://github.com/shellphish/afl-other-arch" if subprocess.call(['git', 'clone', AFL_UNIX_REPO, AFL_UNIX_INSTALL_PATH]) != 0: raise LibError("Unable to retrieve afl-unix") # apply the afl arm patch with open(AFL_UNIX_PATCH_FILE, "rb") as f: if subprocess.call(['patch', '-p0'], stdin=f, cwd=AFL_UNIX_INSTALL_PATH) != 0: raise LibError("Unable to apply AFL patch") if subprocess.call(['./build.sh'] + SUPPORTED_ARCHES, cwd=AFL_UNIX_INSTALL_PATH) != 0: raise LibError("Unable to build afl-other-arch")
def create_static_lib(self, objects, output_libname, output_dir=None, debug=0, target_lang=None): objects, output_dir = self._fix_object_args(objects, output_dir) output_filename = \ self.library_filename(output_libname, output_dir=output_dir) if self._need_link(objects, output_filename): self.mkpath(os.path.dirname(output_filename)) self.spawn(self.archiver + [output_filename] + objects + self.objects) # Not many Unices required ranlib anymore -- SunOS 4.x is, I # think the only major Unix that does. Maybe we need some # platform intelligence here to skip ranlib if it's not # needed -- or maybe Python's configure script took care of # it for us, hence the check for leading colon. if self.ranlib: try: # iOS: since clang is not available, we send a nicer error message: if (sys.platform == 'darwin' and os.uname().machine.startswith('iP')): raise DistutilsExecError("There are no static linkers available on iOS, sorry.") # self.spawn(self.ranlib + [output_filename]) except DistutilsExecError as msg: raise LibError(msg) else: log.debug("skipping %s (up-to-date)", output_filename)
def _build_vex(): cmd = ['nmake', '/f', 'Makefile-win', 'all' ] if sys.platform == 'win32' else [ 'make', '-j', str(multiprocessing.cpu_count()) ] if subprocess.call(cmd, cwd=VEX_PATH) != 0: raise LibError("Unable to build libVEX.")
def create_static_lib(self, objects, output_libname, output_dir=None, debug=0, target_lang=None): objects, output_dir = self._fix_object_args(objects, output_dir) output_filename = \ self.library_filename(output_libname, output_dir=output_dir) if self._need_link(objects, output_filename): self.mkpath(os.path.dirname(output_filename)) self.spawn(self.archiver + [output_filename] + objects + self.objects) # Not many Unices required ranlib anymore -- SunOS 4.x is, I # think the only major Unix that does. Maybe we need some # platform intelligence here to skip ranlib if it's not # needed -- or maybe Python's configure script took care of # it for us, hence the check for leading colon. if self.ranlib: try: self.spawn(self.ranlib + [output_filename]) except DistutilsExecError as msg: raise LibError(msg) else: log.debug("skipping %s (up-to-date)", output_filename)
def _clone_linux_qemu(): # grab the linux tarball if not os.path.exists(QEMU_REPO_PATH_LINUX): TRACER_QEMU_REPO_LINUX = "https://github.com/qemu/qemu.git" if subprocess.call([ 'git', 'clone', '--branch', 'v2.3.0', '--depth=1', TRACER_QEMU_REPO_LINUX, QEMU_REPO_PATH_LINUX ]) != 0: raise LibError("Unable to retrieve qemu repository \"%s\"" % TRACER_QEMU_REPO_LINUX) #if subprocess.call(['git', '-C', QEMU_REPO_PATH_LINUX, 'checkout', 'tags/v2.3.0']) != 0: # raise LibError("Unable to checkout version 2.3.0 of qemu") if subprocess.call([ 'git', '-C', QEMU_REPO_PATH_LINUX, 'apply', QEMU_LINUX_TRACER_PATCH ]) != 0: raise LibError("Unable to apply tracer patch to qemu")
def _build_vex(): cmd1 = ['nmake', '/f', 'Makefile-win', 'all'] cmd2 = ['make', '-j', str(multiprocessing.cpu_count()), 'all'] for cmd in (cmd1, cmd2): try: if subprocess.call(cmd, cwd=VEX_PATH) == 0: break except OSError: continue else: raise LibError("Unable to build libVEX.")
def precompile_api_library(self, fem_api_ext): """ Precompile the external FEM API library. """ log.info("Pre-compiling FEM API library") # If BOOST_ROOT set in environment, set up so we can pass into Makefile if 'BOOST_ROOT' in os.environ: self.boost_root = os.environ['BOOST_ROOT'] else: log.warn( "BOOST_ROOT is not set in environment - library compilation may be affected" ) self.boost_root = None # Set and create object compile path self.build_temp_obj_path = os.path.abspath( os.path.join(self.build_temp, 'fem_api', 'obj')) self.makedir(self.build_temp_obj_path) # Set and create the library output path self.build_temp_lib_path = os.path.abspath( os.path.join(self.build_temp, 'fem_api', 'lib')) self.makedir(self.build_temp_lib_path) # Build a make query command and run it make_query_cmd = self.build_make_cmd('-q') make_needed = subprocess.call(shlex.split(make_query_cmd), cwd=fem_api_path) # Build the make command make_cmd = self.build_make_cmd() # Run the make command make_rc = subprocess.call(shlex.split(make_cmd), cwd=fem_api_path) if make_rc != 0: raise LibError("Pre-compilation of API library failed") # Inject the appropriate paths and libraries into the Extension configuration fem_api_ext.library_dirs.append(self.build_temp_lib_path) if self.boost_root: fem_api_ext.library_dirs.append( os.path.join(self.boost_root, 'lib')) fem_api_ext.runtime_library_dirs.append( os.path.join(self.boost_root, 'lib')) fem_api_ext.libraries.extend( ['fem_api', 'boost_thread', 'boost_system']) api_library_precompiled = (make_needed > 0) and (make_rc == 0) return api_library_precompiled
def _configure_z3(): # bail out early if we don't need to do this - it forces a rebuild every time otherwise if os.path.exists(BUILD_DIR): return args = [sys.executable, os.path.join(SRC_DIR, 'scripts', 'mk_make.py')] if sys.platform == 'win32' and platform.architecture()[0] == '64bit': args += ['-x'] if subprocess.call(args, env=build_env, cwd=SRC_DIR) != 0: raise LibError("Unable to configure Z3.")
def _clone_linux_qemu(): # grab the linux tarball if not os.path.exists(QEMU_REPO_PATH_LINUX): if subprocess.call([ 'git', 'clone', '--branch', 'v2.3.0', '--depth=1', TRACER_QEMU_REPO_LINUX, QEMU_REPO_PATH_LINUX ]) != 0: raise LibError("Unable to retrieve qemu repository \"%s\"" % TRACER_QEMU_REPO_LINUX) if subprocess.call([ 'git', '-C', QEMU_REPO_PATH_LINUX, 'apply', QEMU_LINUX_TRACER_PATCH ]) != 0: raise LibError("Unable to apply tracer patch to qemu") if subprocess.call([ 'git', '-C', QEMU_REPO_PATH_LINUX, 'apply', QEMU_LINUX_UPDATE_PATCH ]) != 0: raise LibError("Unable to apply ucontext_t update patch to qemu") _build_standard_qemu()
def _build_pyvex(): e = os.environ.copy() e['VEX_PATH'] = os.path.join('..', VEX_PATH) cmd = [ 'cl', '-LD', '-O2', '-I' + os.path.join('..', VEX_PATH, 'pub'), 'pyvex.c', 'logging.c', os.path.join('..', VEX_PATH, 'libvex.lib'), '/link', '/DEF:pyvex.def' ] if sys.platform == 'win32' else [ 'make', '-j', str(multiprocessing.cpu_count()) ] if subprocess.call(cmd, cwd='pyvex_c', env=e) != 0: raise LibError("Unable to build libpyvex.")
def _build_sim_unicorn(): try: import unicorn import pyvex except ImportError: raise LibError( "You must install unicorn and pyvex before building simuvex") env = os.environ.copy() env['UNICORN_LIB_PATH'] = pkg_resources.resource_filename('unicorn', 'lib') env['UNICORN_INCLUDE_PATH'] = pkg_resources.resource_filename( 'unicorn', 'include') env['PYVEX_LIB_PATH'] = pkg_resources.resource_filename('pyvex', 'lib') env['PYVEX_INCLUDE_PATH'] = pkg_resources.resource_filename( 'pyvex', 'include') if subprocess.call(['make'], cwd='simuvex_c', env=env) != 0: raise LibError('Unable to build sim_unicorn') shutil.rmtree('simuvex/lib', ignore_errors=True) os.mkdir('simuvex/lib') shutil.copy(os.path.join('simuvex_c', library_file), 'simuvex/lib')
def _setup(): # revisiting the afl mirrorer repo if not os.path.exists(AFL_UNIX_INSTALL_PATH): AFL_UNIX_REPO = "https://github.com/AFLplusplus/AFLplusplus.git" if subprocess.call([ 'git', 'clone', '--branch', '2.64c', AFL_UNIX_REPO, AFL_UNIX_INSTALL_PATH ]) != 0: raise LibError("Unable to retrieve afl-unix") with open(QEMU_BUILD_SUPPORT_PATCH_FILE, "rb") as f: if subprocess.check_call( ['git', 'apply'], stdin=f, cwd=AFL_UNIX_INSTALL_PATH) != 0: raise LibError("Unable to apply qemu build multiarch patch") with open(QEMU_EXIT_DOUBLE_READ_PATCH_FILE, "rb") as f: if subprocess.check_call( ['git', 'apply'], stdin=f, cwd=AFL_UNIX_INSTALL_PATH) != 0: raise LibError("Unable to apply qemu exit double read patch") with open(AFL_UPDATE_INTERVAL_PATCH_FILE, "rb") as f: if subprocess.check_call( ['git', 'apply'], stdin=f, cwd=AFL_UNIX_INSTALL_PATH) != 0: raise LibError("Unable to apply afl update interval patch") if subprocess.call(['cp', AFL_UNIX_GEN, AFL_UNIX_INSTALL_PATH]) != 0: raise LibError("Build file doesn't exist") if subprocess.check_call(['./build.sh'], cwd=AFL_UNIX_INSTALL_PATH) != 0: raise LibError("Unable to build afl-other-arch")
def _build_dreal(): if sys.version_info.major == 2: FORCE_PYTHON = 'py2' else: FORCE_PYTHON = 'py3' if subprocess.call([ 'bazel', 'build', '//...', '--python_path={}'.format(sys.executable), '--force_python={}'.format(FORCE_PYTHON), ]) != 0: raise LibError("Unable to build dReal.")
def _build_vex(): e = os.environ.copy() e['MULTIARCH'] = '1' e['DEBUG'] = '1' cmd1 = ['./build.sh'] for cmd in (cmd1): try: if subprocess.call(cmd, cwd=VEX_PATH, env=e) == 0: break except OSError: continue else: raise LibError("Unable to build libtcg.")
def _build_dreal(): new_env = os.environ.copy() new_env["PYTHON_BIN_PATH"] = sys.executable if subprocess.call([ 'bazel', 'build', '//dreal:_dreal_py.so', '--cxxopt=-DDREAL_CHECK_INTERRUPT', '--python_path={}'.format(sys.executable), ], env=new_env) != 0: raise LibError("Unable to build dReal.\n" + "Please visit https://pypi.org/project/dreal and " + "follow the instructions to install the prerequisites.")
def create_static_lib(self, objects, output_libname, output_dir=None, debug=0, target_lang=None): if not self.initialized: self.initialize() objects, output_dir = self._fix_object_args(objects, output_dir) output_filename = self.library_filename(output_libname, output_dir=output_dir) if self._need_link(objects, output_filename): lib_args = objects + ['/OUT:' + output_filename] if debug: pass try: self.spawn([self.lib] + lib_args) except DistutilsExecError as msg: raise LibError(msg) else: log.debug('skipping %s (up-to-date)', output_filename)
def _copy_bins(): shutil.copy(os.path.join(SRC_DIR, 'bazel-bin', 'dreal', '_dreal_py.so'), os.path.join(ROOT_DIR, 'dreal')) os.chmod(os.path.join(ROOT_DIR, 'dreal', '_dreal_py.so'), 436) shutil.copy(os.path.join(SRC_DIR, 'bazel-bin', 'libdreal.so'), os.path.join(ROOT_DIR, 'dreal')) os.chmod(os.path.join(ROOT_DIR, 'dreal', 'libdreal.so'), 436) if sys.platform == 'darwin': if subprocess.call([ '/usr/bin/install_name_tool', '-change', '@rpath/libdreal.so', '@loader_path/libdreal.so', os.path.join(ROOT_DIR, 'dreal', '_dreal_py.so'), ]) != 0: raise LibError("Unable to use install_name_tool.")
def _build_vex(): e = os.environ.copy() e['MULTIARCH'] = '1' e['DEBUG'] = '1' cmd1 = ['nmake', '/f', 'Makefile-msvc', 'all'] cmd2 = ['make', '-f', 'Makefile-gcc', '-j', str(multiprocessing.cpu_count()), 'all'] cmd3 = ['gmake', '-f', 'Makefile-gcc', '-j', str(multiprocessing.cpu_count()), 'all'] for cmd in (cmd1, cmd2, cmd3): try: if subprocess.call(cmd, cwd=VEX_PATH, env=e) == 0: break except OSError: continue else: raise LibError("Unable to build libVEX.")
def _build_pyvex(): e = os.environ.copy() e['VEX_LIB_PATH'] = os.path.join('..', VEX_PATH) e['VEX_INCLUDE_PATH'] = os.path.join('..', VEX_PATH, 'pub') e['VEX_LIB_FILE'] = os.path.join('..', VEX_PATH, 'libvex.lib') cmd1 = ['nmake', '/f', 'Makefile-msvc'] cmd2 = ['make', '-j', str(multiprocessing.cpu_count())] for cmd in (cmd1, cmd2): try: if subprocess.call(cmd, cwd='pyvex_c', env=e) == 0: break except OSError as err: continue else: raise LibError("Unable to build libpyvex.")
def create_static_lib( self, objects, output_libname, output_dir=None, debug=0, target_lang=None ): (objects, output_dir) = self._fix_object_args(objects, output_dir) output_filename = self.library_filename(output_libname, output_dir=output_dir) if self._need_link(objects, output_filename): lib_args = [output_filename, '/u'] + objects if debug: pass # XXX what goes here? try: self.spawn([self.lib] + lib_args) except DistutilsExecError as msg: raise LibError(msg) else: log.debug("skipping %s (up-to-date)", output_filename)
def _build_dreal(): if sys.version_info.major == 2: PYTHON_VERSION = 'PY2' else: PYTHON_VERSION = 'PY3' new_env = os.environ.copy() new_env["PYTHON_BIN_PATH"] = sys.executable if subprocess.call([ 'bazel', 'build', '//:libdreal.so', '//dreal:_dreal_py.so', '--cxxopt=-DDREAL_CHECK_INTERRUPT', '--python_path={}'.format( sys.executable), '--python_version={}'.format(PYTHON_VERSION), '--incompatible_allow_python_version_transitions=false', '--incompatible_py3_is_default=false' ], env=new_env) != 0: raise LibError("Unable to build dReal.\n" + "Please visit https://pypi.org/project/dreal and " + "follow the instructions to install the prerequsites.")
def create_static_lib( self, objects, output_libname, output_dir=None, debug=0, target_lang=None ): if not self.initialized: self.initialize() objects, output_dir = self._fix_object_args(objects, output_dir) output_filename = self.library_filename(output_libname, output_dir=output_dir) if self._need_link(objects, output_filename): lib_args = objects + ["/OUT:" + output_filename] if debug: pass # XXX what goes here? try: log.debug('Executing "%s" %s', self.lib, " ".join(lib_args)) self.spawn([self.lib] + lib_args) except DistutilsExecError as msg: raise LibError(msg) else: log.debug("skipping %s (up-to-date)", output_filename)
def create_static_lib(self, objects, output_libname, output_dir=None, debug=0, target_lang=None): objects, output_dir = self._fix_object_args(objects, output_dir) output_filename = self.library_filename(output_libname, output_dir=output_dir) if self._need_link(objects, output_filename): self.mkpath(os.path.dirname(output_filename)) self.spawn(self.archiver + [output_filename] + objects + self.objects) if self.ranlib: try: self.spawn(self.ranlib + [output_filename]) except DistutilsExecError as msg: raise LibError(msg) else: log.debug('skipping %s (up-to-date)', output_filename)