forked from cea-sec/miasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·131 lines (127 loc) · 4.92 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#! /usr/bin/env python
from distutils.core import setup, Extension
from distutils.util import get_platform
import shutil
import os, sys
def buil_all():
packages=['miasm2',
'miasm2/arch',
'miasm2/arch/x86',
'miasm2/arch/arm',
'miasm2/arch/aarch64',
'miasm2/arch/msp430',
'miasm2/arch/mep',
'miasm2/arch/sh4',
'miasm2/arch/mips32',
'miasm2/arch/ppc',
'miasm2/core',
'miasm2/expression',
'miasm2/ir',
'miasm2/ir/translators',
'miasm2/analysis',
'miasm2/os_dep',
'miasm2/os_dep/linux',
'miasm2/jitter',
'miasm2/jitter/arch',
'miasm2/jitter/loader',
]
ext_modules_all = [
Extension("miasm2.jitter.VmMngr",
["miasm2/jitter/vm_mngr.c",
"miasm2/jitter/vm_mngr_py.c",
"miasm2/jitter/bn.c",
]),
Extension("miasm2.jitter.arch.JitCore_x86",
["miasm2/jitter/JitCore.c",
"miasm2/jitter/vm_mngr.c",
"miasm2/jitter/op_semantics.c",
"miasm2/jitter/bn.c",
"miasm2/jitter/arch/JitCore_x86.c"]),
Extension("miasm2.jitter.arch.JitCore_arm",
["miasm2/jitter/JitCore.c",
"miasm2/jitter/vm_mngr.c",
"miasm2/jitter/op_semantics.c",
"miasm2/jitter/bn.c",
"miasm2/jitter/arch/JitCore_arm.c"]),
Extension("miasm2.jitter.arch.JitCore_aarch64",
["miasm2/jitter/JitCore.c",
"miasm2/jitter/vm_mngr.c",
"miasm2/jitter/op_semantics.c",
"miasm2/jitter/bn.c",
"miasm2/jitter/arch/JitCore_aarch64.c"]),
Extension("miasm2.jitter.arch.JitCore_msp430",
["miasm2/jitter/JitCore.c",
"miasm2/jitter/vm_mngr.c",
"miasm2/jitter/op_semantics.c",
"miasm2/jitter/bn.c",
"miasm2/jitter/arch/JitCore_msp430.c"]),
Extension("miasm2.jitter.arch.JitCore_mep",
["miasm2/jitter/JitCore.c",
"miasm2/jitter/vm_mngr.c",
"miasm2/jitter/bn.c",
"miasm2/jitter/arch/JitCore_mep.c"]),
Extension("miasm2.jitter.arch.JitCore_mips32",
["miasm2/jitter/JitCore.c",
"miasm2/jitter/vm_mngr.c",
"miasm2/jitter/op_semantics.c",
"miasm2/jitter/bn.c",
"miasm2/jitter/arch/JitCore_mips32.c"]),
Extension("miasm2.jitter.arch.JitCore_ppc32",
["miasm2/jitter/JitCore.c",
"miasm2/jitter/vm_mngr.c",
"miasm2/jitter/op_semantics.c",
"miasm2/jitter/bn.c",
"miasm2/jitter/arch/JitCore_ppc32.c"],
depends=["miasm2/jitter/arch/JitCore_ppc32.h",
"miasm2/jitter/arch/JitCore_ppc32_regs.h",
"miasm2/jitter/bn.h",
]),
Extension("miasm2.jitter.Jitllvm",
["miasm2/jitter/Jitllvm.c",
"miasm2/jitter/bn.c",
]),
Extension("miasm2.jitter.Jitgcc",
["miasm2/jitter/Jitgcc.c",
"miasm2/jitter/bn.c",
]),
]
print 'building'
build_ok = False
for name, ext_modules in [('all', ext_modules_all),
]:
print 'build with', repr(name)
try:
s = setup(
name = 'Miasm',
version = '2.0',
packages = packages,
package_data = {'miasm2':['jitter/*.h',
'jitter/arch/*.h',]},
ext_modules = ext_modules,
# Metadata
author = 'Fabrice Desclaux',
author_email = 'serpilliere@droid-corp.org',
description = 'Machine code manipulation library',
license = 'GPLv2',
# keywords = '',
# url = '',
)
except SystemExit, e:
print repr(e)
continue
build_ok = True
break
if not build_ok:
raise ValueError('Unable to build Miasm!')
print 'build', name
# we copy libraries from build dir to current miasm directory
build_base = None
if 'build' in s.command_options:
if 'build_base' in s.command_options['build']:
build_base = s.command_options['build']['build_base']
if build_base is None:
build_base = "build"
plat_specifier = ".%s-%s" % (get_platform(), sys.version[0:3])
build_base = os.path.join('build','lib' + plat_specifier)
print build_base
buil_all()