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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
$NetBSD: patch-SConstruct,v 1.4 2021/08/17 04:09:48 mrg Exp $
Add support for NetBSD/Dragonfly.
Add support for aarch64 big-endian.
Fix locations.
Don't compile with debug info.
Don't mess with the linker.
Respect LDFLAGS and CXXFLAGS
--- SConstruct.orig 2020-01-08 08:30:41.000000000 -0800
+++ SConstruct 2021-04-24 20:15:17.493198495 -0700
@@ -30,7 +30,7 @@
def print_build_failures():
from SCons.Script import GetBuildFailures
for bf in GetBuildFailures():
- print "%s failed: %s" % (bf.node, bf.errstr)
+ print("%s failed: %s" % (bf.node, bf.errstr))
atexit.register(print_build_failures)
def versiontuple(v):
@@ -49,8 +49,12 @@
running_os = os.sys.platform
if running_os.startswith('linux'):
running_os = 'linux'
+ elif running_os.startswith('dragonfly'):
+ running_os = 'dragonfly'
elif running_os.startswith('freebsd'):
running_os = 'freebsd'
+ elif running_os.startswith('netbsd'):
+ running_os = 'netbsd'
elif running_os.startswith('openbsd'):
running_os = 'openbsd'
elif running_os == 'sunos5':
@@ -68,7 +72,7 @@
def is_os_raw(target_os, os_list_to_check):
okay = False
- posix_os_list = [ 'linux', 'openbsd', 'freebsd', 'osx', 'solaris' ]
+ posix_os_list = [ 'linux', 'openbsd', 'freebsd', 'osx', 'solaris', 'dragonfly', 'netbsd' ]
for p in os_list_to_check:
if p == 'posix' and target_os in posix_os_list:
@@ -511,7 +515,7 @@
version_data = json.load(version_fp)
if 'version' not in version_data:
- print "version.json does not contain a version string"
+ print("version.json does not contain a version string")
Exit(1)
if 'githash' not in version_data:
version_data['githash'] = utils.getGitVersion()
@@ -519,7 +523,7 @@
except IOError as e:
# If the file error wasn't because the file is missing, error out
if e.errno != errno.ENOENT:
- print "Error opening version.json: {0}".format(e.strerror)
+ print("Error opening version.json: {0}".format(e.strerror))
Exit(1)
version_data = {
@@ -528,7 +532,7 @@
}
except ValueError as e:
- print "Error decoding version.json: {0}".format(e)
+ print("Error decoding version.json: {0}".format(e))
Exit(1)
# Setup the command-line variables
@@ -598,7 +602,7 @@
variables_files = variable_shlex_converter(get_option('variables-files'))
for file in variables_files:
- print "Using variable customization file %s" % file
+ print("Using variable customization file %s" % file)
env_vars = Variables(
files=variables_files,
@@ -899,6 +903,7 @@
INSTALL_DIR=installDir,
CONFIG_HEADER_DEFINES={},
LIBDEPS_TAG_EXPANSIONS=[],
+ ENV = os.environ,
)
env = Environment(variables=env_vars, **envDict)
@@ -908,12 +913,12 @@
env.AddMethod(env_get_os_name_wrapper, 'GetTargetOSName')
def fatal_error(env, msg, *args):
- print msg.format(*args)
+ print(msg.format(*args))
Exit(1)
def conf_error(env, msg, *args):
- print msg.format(*args)
- print "See {0} for details".format(env['CONFIGURELOG'].abspath)
+ print(msg.format(*args))
+ print("See {0} for details".format(env['CONFIGURELOG'].abspath))
Exit(1)
@@ -933,7 +938,7 @@
env.AddMethod(lambda env: env['VERBOSE'], 'Verbose')
if has_option('variables-help'):
- print env_vars.GenerateHelpText(env)
+ print(env_vars.GenerateHelpText(env))
Exit(0)
unknown_vars = env_vars.UnknownVariables()
@@ -993,6 +998,7 @@
processor_macros = {
'arm' : { 'endian': 'little', 'defines': ('__arm__',) },
'aarch64' : { 'endian': 'little', 'defines': ('__arm64__', '__aarch64__')},
+ 'aarch64eb' : { 'endian': 'big', 'defines': ('__arm64__', '__aarch64__')},
'i386' : { 'endian': 'little', 'defines': ('__i386', '_M_IX86')},
'ppc64le' : { 'endian': 'little', 'defines': ('__powerpc64__',)},
's390x' : { 'endian': 'big', 'defines': ('__s390x__',)},
@@ -1036,7 +1042,9 @@
os_macros = {
"windows": "_WIN32",
"solaris": "__sun",
+ "dragonfly": "__DragonFly__",
"freebsd": "__FreeBSD__",
+ "netbsd": "__NetBSD__",
"openbsd": "__OpenBSD__",
"osx": "__APPLE__",
"linux": "__linux__",
@@ -1131,7 +1139,7 @@
env['TARGET_ARCH'] = detected_processor
if env['TARGET_OS'] not in os_macros:
- print "No special config for [{0}] which probably means it won't work".format(env['TARGET_OS'])
+ print("No special config for [{0}] which probably means it won't work".format(env['TARGET_OS']))
elif not detectConf.CheckForOS(env['TARGET_OS']):
env.ConfError("TARGET_OS ({0}) is not supported by compiler", env['TARGET_OS'])
@@ -1367,7 +1375,7 @@
libdeps.setup_environment(env, emitting_shared=(link_model.startswith("dynamic")))
-if env.TargetOSIs('linux', 'freebsd', 'openbsd'):
+if env.TargetOSIs('linux', 'dragonfly', 'freebsd', 'netbsd', 'openbsd'):
env['LINK_LIBGROUP_START'] = '-Wl,--start-group'
env['LINK_LIBGROUP_END'] = '-Wl,--end-group'
env['LINK_WHOLE_ARCHIVE_START'] = '-Wl,--whole-archive'
@@ -1395,10 +1403,24 @@
elif env.TargetOSIs('solaris'):
env.Append( LIBS=["socket","resolv","lgrp"] )
+elif os.sys.platform.startswith( "dragonfly" ):
+ env.Append( CPPPATH=[ "/dist/pkg/include" ] )
+ env.Append( LIBPATH=[ "/dist/pkg/lib" ] )
+ env.Append( LIBS=[ "m" ] )
+ env.Append( LIBS=[ "kvm" ] )
+ env.Append( CPPDEFINES=[ "__dragonfly__" ] )
+
elif env.TargetOSIs('freebsd'):
env.Append( LIBS=[ "kvm" ] )
env.Append( CCFLAGS=[ "-fno-omit-frame-pointer" ] )
+elif os.sys.platform.startswith( "netbsd" ):
+ env.Append( CPPPATH=[ "/dist/pkg/include" ] )
+ env.Append( LIBPATH=[ "/dist/pkg/lib" ] )
+ env.Append( LIBS=[ "m" ] )
+ env.Append( LIBS=[ "kvm" ] )
+ env.Append( CPPDEFINES=[ "__netbsd__" ] )
+
elif env.TargetOSIs('openbsd'):
env.Append( LIBS=[ "kvm" ] )
@@ -1564,7 +1586,6 @@
# -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used.
env.Append( CCFLAGS=["-fno-omit-frame-pointer",
"-fno-strict-aliasing",
- "-ggdb",
"-pthread",
"-Wall",
"-Wsign-compare",
@@ -2174,9 +2195,9 @@
if usingLibStdCxx:
def CheckModernLibStdCxx(context):
test_body = """
- #if !__has_include(<experimental/filesystem>)
- #error "libstdc++ from GCC 5.3.0 or newer is required"
- #endif
+ //#if !__has_include(<experimental/filesystem>)
+ //#error "libstdc++ from GCC 5.3.0 or newer is required"
+ //#endif
"""
context.Message('Checking for libstdc++ 5.3.0 or better... ')
@@ -2384,7 +2405,7 @@
#
myenv.Append( CCFLAGS=["/Zc:inline"])
- if myenv.ToolchainIs('gcc', 'clang'):
+ if myenv.ToolchainIs('gcc', 'clang') and get_option('runtime-hardening') == "on":
# This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker
# because it is much faster.
AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=gold')
@@ -2809,6 +2830,7 @@
"BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD",
"BOOST_SYSTEM_NO_DEPRECATED",
"BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS",
+ "BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE",
]
)
@@ -2875,7 +2897,7 @@
myenv.ConfError("Couldn't find SASL header/libraries")
# requires ports devel/libexecinfo to be installed
- if env.TargetOSIs('freebsd', 'openbsd'):
+ if env.TargetOSIs('dragonfly', 'freebsd', 'netbsd', 'openbsd'):
if not conf.CheckLib("execinfo"):
myenv.ConfError("Cannot find libexecinfo, please install devel/libexecinfo.")
|