Debian Codegraph @

SCons/Config/hpc++

raw
1 print("Using hpc++ tools configuration")
2
3 Import('defenv')
4
5 ### flags
6
7 defenv['ENTRY_FLAG'] = lambda x,u: ''
8 defenv['MAP_FLAG'] = ''
9 defenv['EXCEPTION_FLAG'] = ''
10 defenv['NODEFLIBS_FLAG'] = ''
11 defenv['C_FLAG'] = ''
12 defenv['CPP_FLAG'] = ''
13 defenv['CPP_REQUIRES_STDLIB'] = 0
14 defenv['SUBSYS_CON'] = ''
15 defenv['SUBSYS_WIN'] = ''
16 defenv['MSVCRT_FLAG'] = ''
17 defenv['STDCALL'] = ''
18
19 ### defines
20
21 defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
22
23 ### unicode
24 tdefenv = defenv.Clone()
25 if tdefenv['UNICODE']:
26 tdefenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
27
28 ### stub environment
29
30 stub_env = defenv.Clone()
31 stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
32
33 stub_uenv = stub_env.Clone()
34 stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
35
36 ### makensis environment
37
38 makensis_env = tdefenv.Clone()
39
40 makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
41
42 ### use "$CXX -Ae" as the "$CC" compiler to build makensis
43
44 makensis_env['CC'] = makensis_env['CXX']
45 makensis_env.Append(CFLAGS = ['-Ae'])
46
47 ### required to build makensis
48
49 makensis_env.Append(LINKFLAGS = ['-AA'])
50 makensis_env.Append(LINKFLAGS = ['+DD32'])
51 makensis_env.Append(LINKFLAGS = ['-mt'])
52
53 makensis_env.Append(CXXFLAGS = ['-AA'])
54 makensis_env.Append(CCFLAGS = ['+DD32'])
55 makensis_env.Append(CCFLAGS = ['-mt'])
56
57 ### debug for makensis
58
59 if makensis_env['DEBUG']:
60 makensis_env.Append(CCFLAGS = ['-g'])
61 makensis_env.Append(LINKFLAGS = ['-g'])
62
63 ### strip for makensis
64
65 if not makensis_env['DEBUG'] and makensis_env['STRIP']:
66 makensis_env.Append(LINKFLAGS = ['-s'])
67
68 #
69 # aCC defines _BIG_ENDIAN, but we use __BIG_ENDIAN__ so check and define as
70 # needed (is there any HPUX that is NOT big endian?).
71 #
72
73 def check_big_endian(ctx):
74 ctx.Message('Checking for if this is a big endian host... ')
75 test = """
76 #define LITTLE_ENDIAN 0
77 #define BIG_ENDIAN 1
78 #define UNKNOWN 2
79 int main()
80 {
81 union {
82 short s;
83 char c[sizeof(short)];
84 } u;
85 u.s = 0x0102;
86 if (sizeof(short) == 2) {
87 if (u.c[0] == 1 && u.c[1] == 2)
88 return (BIG_ENDIAN);
89 else if (u.c[0] == 2 && u.c[1] == 1)
90 return (LITTLE_ENDIAN);
91 else
92 return(UNKNOWN);
93 } else {
94 return (sizeof(short));
95 }
96 }
97 """
98 result = not ctx.TryRun(test, '.c')[0]
99 ctx.Result(result)
100 return result
101
102 makensis_conf = makensis_env.Configure(custom_tests = { 'CheckBigEndian' : check_big_endian })
103
104 if makensis_conf.CheckBigEndian():
105 makensis_env.Append(CPPDEFINES = ['__BIG_ENDIAN__'])
106
107 if makensis_env['PLATFORM'] == 'hpux':
108 makensis_env.Append(CPPDEFINES = ['NSIS_HPUX_ALLOW_UNALIGNED_DATA_ACCESS'])
109 makensis_conf.CheckLib("unalign")
110 makensis_conf.CheckLib("hppa")
111
112 makensis_conf.Finish()
113
114 ### plugin environment
115
116 plugin_env = defenv.Clone(no_import_lib = 1)
117
118 plugin_uenv = plugin_env.Clone()
119 plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
120
121 ### util environment
122
123 util_env = tdefenv.Clone()
124
125 ### cross-platform util environment
126
127 cp_util_env = tdefenv.Clone()
128
129 cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
130
131 ### test environment
132
133 test_env = defenv.Clone()
134
135 test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
136
137 # return
138
139 Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_uenv plugin_uenv')