From 8e6b39d80e9f8db8389bd2a8106d0f64b91c19e9 Mon Sep 17 00:00:00 2001 From: Axel Souchet <0vercl0k@tuxfamily.org> Date: Sun, 9 Sep 2018 06:11:00 -0700 Subject: Adds Windows support and AppVeyor CI (#835) * Get miasm to work on Windows, also add AppVeyor CI * Fix gcc jitter on Linux * Make the dse_crackme tests work on Windows * calling build and then install is less confusing than install twice * fix os.rename race condition on Windows * clean it up * Clean up after the unused cl.exe's artifacts * Use is_win instead of an additional check * Fix issue on Windows where 'w' and 'wb' modes are different * Address review feedback * setuptools is actually not required, so reverting --- miasm2/jitter/jitcore_cc_base.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'miasm2/jitter/jitcore_cc_base.py') diff --git a/miasm2/jitter/jitcore_cc_base.py b/miasm2/jitter/jitcore_cc_base.py index 81a5d009..7853816a 100644 --- a/miasm2/jitter/jitcore_cc_base.py +++ b/miasm2/jitter/jitcore_cc_base.py @@ -2,11 +2,13 @@ import os import tempfile +import platform from distutils.sysconfig import get_python_inc from miasm2.jitter.jitcore import JitCore from miasm2.core.utils import keydefaultdict +is_win = platform.system() == "Windows" def gen_core(arch, attrib): lib_dir = os.path.dirname(os.path.realpath(__file__)) @@ -70,9 +72,9 @@ class JitCore_Cc_Base(JitCore): def load(self): lib_dir = os.path.dirname(os.path.realpath(__file__)) - libs = [os.path.join(lib_dir, 'VmMngr.so'), - os.path.join(lib_dir, - 'arch/JitCore_%s.so' % (self.ir_arch.arch.name))] + ext = ".so" if not is_win else ".lib" + libs = [os.path.join(lib_dir, "VmMngr" + ext), + os.path.join(lib_dir, "arch", "JitCore_%s%s" % (self.ir_arch.arch.name, ext))] include_files = [os.path.dirname(__file__), get_python_inc()] @@ -91,7 +93,7 @@ class JitCore_Cc_Base(JitCore): Return the C code corresponding to the @irblocks @irblocks: list of irblocks """ - f_declaration = 'int %s(block_id * BlockDst, JitCpu* jitcpu)' % self.FUNCNAME + f_declaration = '_MIASM_EXPORT int %s(block_id * BlockDst, JitCpu* jitcpu)' % self.FUNCNAME out = self.codegen.gen_c(block, log_mn=self.log_mn, log_regs=self.log_regs) out = [f_declaration + '{'] + out + ['}\n'] c_code = out -- cgit 1.4.1