-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathcompile_generic.py
83 lines (68 loc) · 2.51 KB
/
compile_generic.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
# -*- coding: utf-8 -*-
'''
This Source Code Form is subject to the terms of the Mozilla
Public License, v. 2.0. If a copy of the MPL was not distributed
with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
'''
import os
import utils
class Compile():
def __init__(self,nm,lbl=None):
self._conf={}
self._name=nm
self._label=lbl
self._b32bit=False
def get_name(self):
if self._label is not None:
return self._name + " (" + self._label + ")";
else:
return self._name;
def get_os_config(self,osn):
None
def set_32bit(self):
self._b32bit=True
def get_path_tmp(self):
if self._b32bit:
return utils.PATHTMP+"32"
else:
return utils.PATHTMP
def get_path_native(self):
if self._b32bit:
return utils.PATHNATIVE+"32"
else:
return utils.PATHNATIVE
def before_copy_to_native(self,osn):
None
def run(self):
utils.info("BEGIN " + self.get_name())
#PREPARE CONF
self._conf["pathsrc"]=".." + os.sep + self._name + os.sep + "src"
self._conf["pathdst"]=self.get_path_tmp() + os.sep + self._name
osn=None
if utils.is_windows():
osn="windows"
elif utils.is_linux():
osn="linux"
elif utils.is_mac():
osn="mac"
if osn is not None:
appcnf=self.get_os_config(osn)
if appcnf is not None:
self._conf[osn]=appcnf
if self._b32bit and osn in self._conf:
if "linker_flags" not in self._conf[osn]:
self._conf[osn]["linker_flags"]="-m32"
else:
self._conf[osn]["linker_flags"]="-m32 " + self._conf[osn]["linker_flags"]
if "cpp_compiler_flags" not in self._conf[osn]:
self._conf[osn]["cpp_compiler_flags"]="-m32"
else:
self._conf[osn]["cpp_compiler_flags"]="-m32 " + self._conf[osn]["cpp_compiler_flags"]
#START COMPILE CONF
utils.make_tmppath(self.get_path_tmp())
utils.remove_from_native(self.get_path_native(), self._conf)
confos=utils.compile_lib(self._conf)
if confos is not None:
self.before_copy_to_native(osn)
utils.copy_to_native(self.get_path_native(),self._conf)
utils.info("END " + self.get_name())