Skip to content

Commit

Permalink
Merge branch 'main' into rename-os-unknown-to-none
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot authored May 21, 2024
2 parents 8d45c32 + a7af57e commit bff70bf
Show file tree
Hide file tree
Showing 20 changed files with 126 additions and 56 deletions.
11 changes: 8 additions & 3 deletions .ci/azp-linux-test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
- name: b2_opts
type: string
default: ''

steps:
- bash: |
set -e
Expand Down Expand Up @@ -26,16 +31,16 @@ steps:
displayName: Test
- bash: |
set -e
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release address-model=32,64 toolset=${TOOLSET}
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
displayName: "No Warnings"
- bash: |
set -e
./bootstrap.sh ${TOOLSET}
./b2 --prefix=$HOME/temp/.b2 install toolset=${TOOLSET}
./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
rm ./b2
export PATH=$HOME/temp/.b2/bin:$PATH
cd $HOME
touch build.jam
b2 -v
b2 -n --debug-configuration toolset=${TOOLSET}
b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
displayName: Bootstrap
11 changes: 8 additions & 3 deletions .ci/azp-macos-test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
- name: b2_opts
type: string
default: ''

steps:
- bash: |
set -e
Expand All @@ -20,16 +25,16 @@ steps:
displayName: Test
- bash: |
set -e
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release address-model=32,64 ${TOOLSET:+toolset=$TOOLSET}
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
displayName: "No Warnings"
- bash: |
set -e
./bootstrap.sh ${TOOLSET}
./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET}
./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
rm ./b2
export PATH=$HOME/temp/.b2/bin:$PATH
cd $HOME
touch build.jam
b2 -v
b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET}
b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
displayName: Bootstrap
11 changes: 8 additions & 3 deletions .ci/azp-windows-test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
- name: b2_opts
type: string
default: ''

steps:
- powershell: |
Set-PSDebug -Trace 1
Expand All @@ -22,19 +27,19 @@ steps:
$env:HOME = $env:HOMEDRIVE + $env:HOMEPATH
$env:path += ';' + $env:CXX_PATH
echo "using" $env:TEST_TOOLSET ":" ":" $env:CXX ";" > ${env:HOME}/user-config.jam
./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on variant=debug,release toolset=$env:TEST_TOOLSET
./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on variant=debug,release toolset=$env:TEST_TOOLSET ${{ parameters.b2_opts }}
displayName: "No Warnings"
- powershell: |
Set-PSDebug -Trace 1
$env:HOME = $env:HOMEDRIVE + $env:HOMEPATH
$env:path += ';' + $env:CXX_PATH
echo "using" $env:TEST_TOOLSET ":" ":" $env:CXX ";" > ${env:HOME}/user-config.jam
./bootstrap.bat $env:TOOLSET
./b2.exe --debug-configuration --prefix=${env:HOME}/temp/.b2 install toolset=$env:TEST_TOOLSET
./b2.exe --debug-configuration --prefix=${env:HOME}/temp/.b2 install toolset=$env:TEST_TOOLSET ${{ parameters.b2_opts }}
Remove-Item ./b2.exe
$env:path += $env:HOME + '/temp/.b2' + ';' + $env:PATH
cd $env:HOME
echo $null >> build.jam
b2 -v
b2 -n --debug-configuration
b2 -n --debug-configuration toolset=$env:TEST_TOOLSET ${{ parameters.b2_opts }}
displayName: Bootstrap
4 changes: 2 additions & 2 deletions .github/workflows/installer_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
uses: actions/upload-artifact@main
with:
name: installer
path: "${{github.workspace}}\\b2-pkg\\stage\\*.msi*"
path: "./b2-pkg/stage/*.msi*"
- name: "Publish"
uses: softprops/action-gh-release@master
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
with:
files: "${{github.workspace}}\\b2-pkg\\stage\\*.msi*"
files: "./b2-pkg/stage/*.msi*"
2 changes: 1 addition & 1 deletion .github/workflows/release_archives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: "Upload"
uses: actions/upload-artifact@main
with:
name: archives-${{github.run_id}}
name: B2-${{matrix.name}}
path: "${{github.workspace}}/b2-*"

- name: "Publish"
Expand Down
2 changes: 1 addition & 1 deletion Jamroot.jam
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ exe b2
<toolset>clang-win:<find-static-library>advapi32
<toolset>clang-win:<find-static-library>user32
<target-os>windows,<toolset>gcc:<source>src/engine/res.rc
<target-os>windows,<toolset>clang:<source>src/engine/res.rc
<target-os>windows,<toolset>clang-linux:<source>src/engine/res.rc
<toolset>msvc:<embed-manifest-file>src/engine/b2.exe.manifest
<toolset>clang-win:<embed-manifest-file>src/engine/b2.exe.manifest
;
Expand Down
9 changes: 7 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ variables:
- { name: linux_latest_os, value: 'focal' }
- { name: windows_latest_vm, value: 'windows-2022' }
- { name: clang_latest, value: '17' }
- { name: clang_latest_libstdcxx, value: 9 }
- { name: gcc_latest, value: '13' }
- { name: vc_latest, value: 'vc143' }
- { name: vs_latest, value: '2022' }
Expand Down Expand Up @@ -91,12 +92,14 @@ stages:
- job: 'Linux_Latest'
strategy:
matrix:
GCC ${{variables.gcc_latest}}: {TOOLSET: "gcc-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"}
Clang ${{variables.clang_latest}}: {TOOLSET: "clang-${{variables.clang_latest}}", PACKAGES: "clang-${{variables.clang_latest}}", LLVM_OS: "${{variables.linux_latest_os}}", LLVM_VER: "${{variables.clang_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"}
GCC ${{variables.gcc_latest}}: {TOOLSET: "gcc-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}-multilib", VM_IMAGE: "${{variables.linux_latest_vm}}"}
Clang ${{variables.clang_latest}}: {TOOLSET: "clang-${{variables.clang_latest}}", PACKAGES: "clang-${{variables.clang_latest}} libstdc++-${{variables.clang_latest_libstdcxx}}-dev-i386-cross", LLVM_OS: "${{variables.linux_latest_os}}", LLVM_VER: "${{variables.clang_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"}
pool:
vmImage: $(VM_IMAGE)
steps:
- template: .ci/azp-linux-test.yml
parameters:
b2_opts: address-model=32,64

- job: 'Windows_Latest'
strategy:
Expand All @@ -108,6 +111,8 @@ stages:
continueOnError: 'true'
steps:
- template: .ci/azp-windows-test.yml
parameters:
b2_opts: address-model=32,64

- job: 'macOS'
strategy:
Expand Down
15 changes: 11 additions & 4 deletions src/engine/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ check_toolset ()
if test_toolset sunpro && test_compiler /opt/SUNWspro/bin/CC -std=c++11 ; then B2_TOOLSET=sunpro ; return ${TRUE} ; fi
# Generic (cxx)
if test_toolset cxx && test_compiler cxx ; then B2_TOOLSET=cxx ; return ${TRUE} ; fi
if test_toolset cxx && test_compiler cpp ; then B2_TOOLSET=cxx ; return ${TRUE} ; fi
if test_toolset cxx && test_compiler c++ ; then B2_TOOLSET=cxx ; return ${TRUE} ; fi
if test_toolset cxx && test_compiler CC ; then B2_TOOLSET=cxx ; return ${TRUE} ; fi

# Nothing found.
Expand Down Expand Up @@ -506,9 +506,16 @@ mod_version.cpp \
if test_true ${B2_DEBUG_OPT} ; then B2_CXXFLAGS="${B2_CXXFLAGS_DEBUG}"
else B2_CXXFLAGS="${B2_CXXFLAGS_RELEASE} -DNDEBUG"
fi
if [ -z "$B2_DONT_EMBED_MANIFEST" ] && [ -x "$(command -v windres)" ] ; then
B2_CXXFLAGS="${B2_CXXFLAGS} -Wl,res.o"
( B2_VERBOSE_OPT=${TRUE} echo_run windres --input res.rc --output res.o )
if [ -z "$B2_DONT_EMBED_MANIFEST" ] ; then
case "$(${B2_CXX} ${B2_CXXFLAGS} -dumpmachine 2>/dev/null)" in
*-windows*|*-mingw*|*-msys*|*-cygnus*|*-cygwin*)
WINDRES="$(${B2_CXX} ${B2_CXXFLAGS} -print-prog-name=windres 2>/dev/null)"
;;
esac
if [ -n "${WINDRES}" ] ; then
B2_CXXFLAGS="${B2_CXXFLAGS} -Wl,res.o"
( B2_VERBOSE_OPT=${TRUE} echo_run ${WINDRES} --input res.rc --output res.o )
fi
fi
( B2_VERBOSE_OPT=${TRUE} echo_run ${B2_CXX} ${B2_CXXFLAGS} ${B2_SOURCES} -o b2 )
}
Expand Down
5 changes: 3 additions & 2 deletions src/engine/config_toolset.bat
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ goto :eof

:Embed_Minafest_Via_Windres
if not defined B2_DONT_EMBED_MANIFEST (
where windres >NUL 2>NUL
if errorlevel 1 ( call; ) else ( set "B2_CXX=windres --input res.rc --output res.o && %B2_CXX% -Wl,res.o" )
for /f %%i in ('%B2_CXX% --print-prog-name=windres 2^>NUL') do (
set "B2_CXX="%%i" --input res.rc --output res.o && %B2_CXX% -Wl,res.o"
)
)
goto :eof
16 changes: 16 additions & 0 deletions src/tools/clang-linux.jam
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ toolset.inherit-generators clang-linux
<toolset>clang <toolset-clang:platform>linux : gcc
: gcc.mingw.link gcc.mingw.link.dll gcc.cygwin.link gcc.cygwin.link.dll ;

local all-os = [ feature.values <target-os> ] ;
local all-arch = [ feature.values <architecture> ] ;

toolset.inherit-rules clang-linux : gcc ;
toolset.inherit-flags clang-linux : gcc
: <inlining>full
<lto>on/<lto-mode>full
<lto>on/<lto-mode>fat
<target-os>$(all-os)/<address-model>32
<target-os>$(all-os)/<address-model>64
<target-os>$(all-os)/<architecture>$(all-arch)/<address-model>32
<target-os>$(all-os)/<architecture>$(all-arch)/<address-model>64
: INCLUDE-GCH
;

Expand Down Expand Up @@ -126,6 +133,12 @@ rule get-short-version ( command-string : single-digit-since ? )
return $(version[1]) ;
}

local rule compile-link-flags ( * )
{
toolset.flags clang-linux.compile OPTIONS $(1) : $(2) ;
toolset.flags clang-linux.link OPTIONS $(1) : $(2) ;
}

###############################################################################
# Flags

Expand All @@ -135,6 +148,9 @@ toolset.flags clang-linux.compile INCLUDE-PCH : -include-pch ;
# For clang, 'on' and 'full' are identical.
toolset.flags clang-linux.compile OPTIONS <inlining>full : -Wno-inline ;

compile-link-flags <address-model>32 : -m32 ;
compile-link-flags <address-model>64 : -m64 ;

# LTO
toolset.flags clang-linux.compile OPTIONS <lto>on/<lto-mode>thin : -flto=thin ;
toolset.flags clang-linux.link OPTIONS <lto>on/<lto-mode>thin : -flto=thin ;
Expand Down
16 changes: 14 additions & 2 deletions src/tools/clang-win.jam
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ rule init ( version ? : command * : options * )
}

toolset.flags clang-win.compile .CC $(cond) : $(compiler) --target=$(clang-arch)-pc-windows-msvc ;
toolset.flags clang-win.link .LD $(cond) : $(compiler) --target=$(clang-arch)-pc-windows-msvc ;
toolset.flags clang-win.link .LD $(cond) : $(compiler) --target=$(clang-arch)-pc-windows-msvc -fuse-ld=lld ;
toolset.flags clang-win.link LINKOPT $(cond) : /link ;
toolset.flags clang-win.link LINKFLAGS $(cond) : "/incremental:no" "/manifest" "/machine:$(linker-arch)" ;
toolset.flags clang-win.link LINKFLAGS $(cond) : "/incremental:no" "/machine:$(linker-arch)" ;
if $(arch) = x86
{
toolset.flags clang-win.compile .ASM $(cond) : $(assembler) -nologo -c -Zp4 -Cp -Cx ;
Expand All @@ -230,6 +230,18 @@ rule init ( version ? : command * : options * )
}
}

local conditions = [ feature.split $(condition) ] ;
if ! [ version.version-less [ SPLIT_BY_CHARACTERS $(version) : . ] : 15 ] {
toolset.add-defaults $(conditions:J=,)\:<embed-manifest-via>linker ;
}
else {
# Clang seems to not care about adding WinSDK to PATH.
# Both MSVC link and LLVM lld-link (until v15) will fail to embed manifest.
# LINK : fatal error LNK1158: cannot run 'rc.exe'
# lld-link: error: unable to find mt.exe in PATH: no such file or directory
toolset.add-requirements $(conditions:J=,)\:<embed-manifest-via>mt ;
}

toolset.flags clang-win.link LIBRARY_OPTION <toolset>clang-win : "" : unchecked ;

# Enable response file control
Expand Down
2 changes: 1 addition & 1 deletion src/tools/flags.jam
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ generators.register
generators.register
[ class.new flag-check-generator EXE : <toolset>msvc : "(LNK4044)" ] ;
generators.register
[ class.new flag-check-generator EXE : <toolset>clang : "(LNK4044)" ] ; # FIXME: <toolset>clang-win doesn't work but <toolset>clang does
[ class.new flag-check-generator EXE : <toolset>clang : "(LNK4044|ignoring unknown argument)" ] ;
generators.register
[ class.new flag-check-generator OBJ : <toolset>intel : "(#10006)" ] ;
generators.register
Expand Down
2 changes: 1 addition & 1 deletion src/tools/fop.jam
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rule init ( fop-command ? : java-home ? : java ? )
}
else
{
if ! ( $(1) && $(2) && $(3) )
if ! ( $(1) || $(2) || $(3) )
{
return ;
}
Expand Down
21 changes: 20 additions & 1 deletion src/tools/gcc.jam
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ rule init ( version ? : command * : options * : requirement * )
bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ;
root ?= $(bin:D) ;
}
local machine ;
local target-os ;
# Autodetect the version and flavor if not given.
if $(command)
{
local machine = [ MATCH "^([^ ]+)" :
machine = [ MATCH "^([^ ]+)" :
[ SHELL "$(command-string) -dumpmachine" ] ] ;
if ! $(version) { # ?= operator does not short-circuit
version ?= [ get-short-version $(command-string) ] ;
Expand All @@ -203,6 +204,8 @@ rule init ( version ? : command * : options * : requirement * )
case *mingw* : target-os ?= windows ;
case *cygwin* : target-os ?= cygwin ;
case *linux* : target-os ?= linux ;
case *aix* : target-os ?= aix ;
case *hpux* : target-os ?= hpux ;
# TODO: finish this list.
}
}
Expand Down Expand Up @@ -276,6 +279,20 @@ rule init ( version ? : command * : options * : requirement * )
toolset.flags gcc VERSION $(condition) : [ regex.split $(version) "[.]" ] ;

init-cxxstd-flags $(condition) : $(version) ;

if ! $(target-os) in aix hpux
{
if [ MATCH "^(i.86|x86|powerpc|ppc|sparc)" : $(machine:L) ]
{
compile-link-flags $(condition)/<architecture>/<address-model>32 : -m32 ;
compile-link-flags $(condition)/<architecture>/<address-model>64 : -m64 ;
}
if [ MATCH "^(s390)" : $(machine:L) ]
{
compile-link-flags $(condition)/<architecture>/<address-model>32 : -m31 ;
compile-link-flags $(condition)/<architecture>/<address-model>64 : -m64 ;
}
}
}

if [ os.name ] = NT
Expand Down Expand Up @@ -369,6 +386,8 @@ local rule compile-link-flags ( * )
compile-link-flags <target-os>hpux/<address-model>64 : -mlp64 ;

local generic-os = [ set.difference $(all-os) : aix hpux ] ;
compile-link-flags <target-os>$(generic-os)/<architecture>s390x/<address-model>32 : -m31 ;
compile-link-flags <target-os>$(generic-os)/<architecture>s390x/<address-model>64 : -m64 ;
local arch = power sparc x86 ;
compile-link-flags <target-os>$(generic-os)/<architecture>$(arch)/<address-model>32 : -m32 ;
compile-link-flags <target-os>$(generic-os)/<architecture>$(arch)/<address-model>64 : -m64 ;
Expand Down
22 changes: 9 additions & 13 deletions src/tools/msvc.jam
Original file line number Diff line number Diff line change
Expand Up @@ -602,21 +602,13 @@ rule configure-version-specific ( toolset : version : conditions )
toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-arm) : "/MACHINE:ARM" ;
toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-arm64) : "/MACHINE:ARM64" ;

if [ version.version-less [ SPLIT_BY_CHARACTERS [ MATCH "^([0123456789.]+)" : $(version) ] : . ] : 11 ]
{
# Make sure that manifest will be generated even if there is no
# dependencies to put there.
toolset.flags $(toolset).link LINKFLAGS $(conditions) : /MANIFEST ;
}
else
{
toolset.flags $(toolset).link LINKFLAGS $(conditions)/<embed-manifest-via>mt : /MANIFEST ;
toolset.flags $(toolset).link LINKFLAGS $(conditions)/<embed-manifest-via>linker/<embed-manifest>off : /MANIFEST ;
toolset.flags $(toolset).link LINKFLAGS $(conditions)/<embed-manifest-via>linker/<embed-manifest>on : "/MANIFEST:EMBED" ;

local conditionx = [ feature.split $(conditions) ] ;
local conditionx = [ feature.split $(conditions) ] ;
if ! [ version.version-less [ SPLIT_BY_CHARACTERS [ MATCH "^([0123456789.]+)" : $(version) ] : . ] : 11 ] {
toolset.add-defaults $(conditionx:J=,)\:<embed-manifest-via>linker ;
}
else {
toolset.add-requirements $(conditionx:J=,)\:<embed-manifest-via>mt ;
}
}

toolset.pop-checking-for-flags-module ;
Expand Down Expand Up @@ -2012,6 +2004,10 @@ local rule register-toolset-really ( )
toolset.flags msvc LINKFLAGS <user-interface>native : "/subsystem:native" ;
toolset.flags msvc LINKFLAGS <user-interface>auto : "/subsystem:posix" ;

toolset.flags msvc.link LINKFLAGS <embed-manifest-via>mt : /MANIFEST ;
toolset.flags msvc.link LINKFLAGS <embed-manifest-via>linker/<embed-manifest>off : /MANIFEST ;
toolset.flags msvc.link LINKFLAGS <embed-manifest-via>linker/<embed-manifest>on : "/MANIFEST:EMBED" ;

toolset.flags msvc.link LINKFLAGS <linkflags> ;
toolset.flags msvc.link LINKPATH <library-path> ;

Expand Down
2 changes: 1 addition & 1 deletion src/tools/pkg-config.jam
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ rule init ( config ? : command * : options * )
{
config = [ default-config ] ;
if ( $(config) in [ $(.configs).all ] )
&& ! ( $(command) && $(options) )
&& ! ( $(command) || $(options) )
{
return ;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/python.jam
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ rule init ( version ? : cmd-or-prefix ? : includes * : libraries ?
}
else
{
if ! ( $(1) && $(2) && $(3) && $(4) && $(5) && $(6) )
if ! ( $(1) || $(2) || $(3) || $(4) || $(5) || $(6) )
{
return ;
}
Expand Down
Loading

0 comments on commit bff70bf

Please sign in to comment.