Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
From John Doe:
- Whatever John Doe did.

From Vassili Tchersky:
Comment thread
vassilit marked this conversation as resolved.
- Add 'bsd' platform definition.
- The default tool search order now prefers the LLVM/clang toolchain
over GCC on FreeBSD and OpenBSD (PR #4887).

From Cornelii Sandberg:
- Fix Variables() not reading a saved-variables file (e.g. custom.py)
from the source directory when building in a separate variant
Expand Down
2 changes: 2 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY
- List modifications to existing features, where the previous behavior
wouldn't actually be considered a bug

- The tool search order now prefers clang over gcc on FreeBSD and OpenBSD.

FIXES
-----

Expand Down
2 changes: 2 additions & 0 deletions SCons/Platform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def platform_default():
return 'aix'
elif 'darwin' in sys.platform:
return 'darwin'
elif sys.platform.startswith(('freebsd', 'openbsd')):
return 'bsd'
else:
return 'posix'
elif os.name == 'os2':
Expand Down
35 changes: 35 additions & 0 deletions SCons/Platform/bsd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# MIT License
#
# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

"""Platform-specific initialisation for BSD flavours whose base system
ships an LLVM toolchain.

There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""

from . import posix

def generate(env) -> None:
posix.generate(env)
8 changes: 8 additions & 0 deletions SCons/Tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,14 @@ def tool_list(platform, env):
assemblers = ['gas', 'nasm', 'masm']
fortran_compilers = ['gfortran', 'g77', 'ifort', 'ifl', 'f95', 'f90', 'f77']
ars = ['ar', 'mslib']
elif str(platform) == 'bsd':
"prefer Clang tools on the BSDs whose base toolchain is LLVM"
linkers = ['gnulink', 'ilink']
c_compilers = ['clang', 'gcc', 'intelc', 'icc', 'cc']
cxx_compilers = ['clang++', 'g++', 'intelc', 'icc', 'cxx']
assemblers = ['gas', 'nasm', 'masm']
fortran_compilers = ['gfortran', 'g77', 'ifort', 'ifl', 'f95', 'f90', 'f77']
ars = ['ar', ]
else:
"prefer GNU tools on all other platforms"
linkers = ['gnulink', 'ilink']
Expand Down
12 changes: 12 additions & 0 deletions SCons/Tool/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ It also selects all found from the list
<!-- TODO &t-link-rpm; --> rpm.
</para>

<para>
On the BSD systems whose base compiler is LLVM/clang
(FreeBSD and OpenBSD), the default tools list matches
the Linux one except that the C compiler is selected
(first-found) from
&t-link-clang;, &t-link-gcc;, &t-link-intelc;, &t-link-icc;,
&t-link-cc;
and the C++ compiler from
&t-link-clangxx;, &t-link-gXX;, &t-link-intelc;, &t-link-icc;,
&t-link-cXX;.
</para>

<para>
Default lists for other platforms can be found by
examining the &scons;
Expand Down
6 changes: 6 additions & 0 deletions doc/man/scons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,12 @@ On SGI IRIX, IBM AIX, Hewlett Packard HP-UX, and Oracle Solaris systems,
searches for the native compiler tools
(MIPSpro, Visual Age, aCC, and Forte tools respectively)
and the GCC tool chain.
On FreeBSD and OpenBSD,
&scons;
searches in order
for the LLVM/clang tools,
the GCC tool chain,
and the Intel compiler tools.
On all other platforms,
including POSIX (Linux and UNIX) and macOS platforms,
&scons;
Expand Down
Loading