about summary refs log tree commit diff stats
path: root/setup.py
blob: 03adc92584739e7c2bdd3e67f4a9bae398ac757b (plain) (blame)
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
#! /usr/bin/env python

from distutils.core import setup,Extension

def buil_all():
    setup(
        name = 'Miasm',
        version = '0.1',
        packages=['miasm', 'miasm/tools',
                  'miasm/expression', 'miasm/graph', 'miasm/arch',
                  'miasm/core', 'miasm/tools/emul_lib' ],
        package_data = {'miasm':['tools/emul_lib/*.h']},
        # data_files = [('toto', ['miasm/tools/emul_lib/queue.h'])],
        ext_modules = [
            Extension("miasm.tools.emul_lib.libcodenat_interface",
                      ["miasm/tools/emul_lib/libcodenat_interface.c",
                       "miasm/tools/emul_lib/libcodenat.c"]),
            Extension("miasm.tools.emul_lib.libcodenat_tcc",
                      ["miasm/tools/emul_lib/libcodenat_tcc.c"],
                      libraries=["tcc"])
            ],
        # Metadata
        author = 'Fabrice Desclaux',
        author_email = 'serpilliere@droid-corp.org',
        description = 'Machine code manipulation library',
        license = 'GPLv2',
        # keywords = '',
        # url = '',
    )



def buil_no_tcc():
    setup(
        name = 'Miasm',
        version = '0.1',
        packages=['miasm', 'miasm/tools',
                  'miasm/expression', 'miasm/graph', 'miasm/arch',
                  'miasm/core', 'miasm/tools/emul_lib' ],
        package_data = {'miasm':['tools/emul_lib/*.h']},
        # data_files = [('toto', ['miasm/tools/emul_lib/queue.h'])],
        # Metadata
        author = 'Fabrice Desclaux',
        author_email = 'serpilliere@droid-corp.org',
        description = 'Machine code manipulation library',
        license = 'GPLv2',
        # keywords = '',
        # url = '',
    )


def try_build():
    try:
        buil_all()
        return
    except:
        print "WARNING cannot build with libtcc!, trying without it"
        print "Miasm will not be able to emulate code"
    buil_no_tcc()


try_build()