From 200848ed9e449521d35c4311bf1c64829f3324fd Mon Sep 17 00:00:00 2001 From: Phoebe <20694052+PhoebeHui@users.noreply.github.com> Date: Wed, 30 Dec 2020 22:41:25 -0800 Subject: [boost-build] Fix cflags and c++flags for msvc (#15385) --- ports/boost-build/CONTROL | 1 + ports/boost-build/fix_options.patch | 236 ++++++++++++++++++++++++++++++++++++ ports/boost-build/portfile.cmake | 2 + 3 files changed, 239 insertions(+) create mode 100644 ports/boost-build/fix_options.patch diff --git a/ports/boost-build/CONTROL b/ports/boost-build/CONTROL index 324efe22d..373f9f7e2 100644 --- a/ports/boost-build/CONTROL +++ b/ports/boost-build/CONTROL @@ -1,5 +1,6 @@ Source: boost-build Version: 1.75.0.beta1 +Port-Version: 1 Homepage: https://github.com/boostorg/build Description: Boost.Build Build-Depends: boost-uninstall \ No newline at end of file diff --git a/ports/boost-build/fix_options.patch b/ports/boost-build/fix_options.patch new file mode 100644 index 000000000..b63641b9e --- /dev/null +++ b/ports/boost-build/fix_options.patch @@ -0,0 +1,236 @@ +diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam +index bf07a93..cf04eba 100644 +--- a/src/tools/msvc.jam ++++ b/src/tools/msvc.jam +@@ -450,19 +450,19 @@ rule configure-version-specific ( toolset : version : conditions ) + # version 7.* explicitly or if we auto-detected the version ourselves. + if ! [ MATCH ^(6\\.) : $(version) ] + { +- toolset.flags $(toolset).compile CFLAGS $(conditions) : "/Zc:forScope" "/Zc:wchar_t" ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions) : "/Zc:forScope" "/Zc:wchar_t" ; + toolset.flags $(toolset).compile.c++ C++FLAGS $(conditions) : /wd4675 ; + + # Explicitly disable the 'function is deprecated' warning. Some msvc + # versions have a bug, causing them to emit the deprecation warning even + # with /W0. +- toolset.flags $(toolset).compile CFLAGS $(conditions)/off : /wd4996 ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/off : /wd4996 ; + + if [ MATCH "^([78]\\.)" : $(version) ] + { + # 64-bit compatibility warning deprecated since 9.0, see + # http://msdn.microsoft.com/en-us/library/yt4xw8fh.aspx +- toolset.flags $(toolset).compile CFLAGS $(conditions)/all : /Wp64 ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/all : /Wp64 ; + } + } + +@@ -471,17 +471,17 @@ rule configure-version-specific ( toolset : version : conditions ) + # variables and functions that have internal linkage + if ! [ version.version-less [ SPLIT_BY_CHARACTERS [ MATCH "^([0123456789.]+)" : $(version) ] : . ] : 12 ] + { +- toolset.flags $(toolset).compile CFLAGS $(conditions) : "/Zc:inline" ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions) : "/Zc:inline" ; + + # /Gy analog for variables: https://devblogs.microsoft.com/cppblog/introducing-gw-compiler-switch/ +- toolset.flags $(toolset).compile CFLAGS $(conditions)/speed $(conditions)/space : /Gw ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/speed $(conditions)/space : /Gw ; + } + + # 14.0 introduced /Zc:throwingNew opt-in flag that disables a workaround + # for not throwing operator new in VC up to 6.0 + if ! [ version.version-less [ SPLIT_BY_CHARACTERS [ MATCH "^([0123456789.]+)" : $(version) ] : . ] : 14 ] + { +- toolset.flags $(toolset).compile CFLAGS $(conditions) : "/Zc:throwingNew" ; ++ toolset.flags $(toolset).compile C++FLAGS $(conditions) : "/Zc:throwingNew" ; + } + + # +@@ -491,34 +491,34 @@ rule configure-version-specific ( toolset : version : conditions ) + if [ MATCH "^([67])" : $(version) ] + { + # 8.0 deprecates some of the options. +- toolset.flags $(toolset).compile CFLAGS $(conditions)/speed $(conditions)/space : /Ogiy /Gs ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/speed : /Ot ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/space : /Os ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/speed $(conditions)/space : /Ogiy /Gs ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/speed : /Ot ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/space : /Os ; + +- toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/ : /GB ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/i486 : /G4 ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g5) : /G5 ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g6) : /G6 ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g7) : /G7 ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/$(.cpu-arch-i386)/ : /GB ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/$(.cpu-arch-i386)/i486 : /G4 ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g5) : /G5 ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g6) : /G6 ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g7) : /G7 ; + + # Improve floating-point accuracy. Otherwise, some of C++ Boost's "math" + # tests will fail. +- toolset.flags $(toolset).compile CFLAGS $(conditions) : /Op ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions) : /Op ; + + # 7.1 and below have single-threaded static RTL. +- toolset.flags $(toolset).compile CFLAGS $(conditions)/off/static/single : /ML ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/on/static/single : /MLd ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/off/static/single : /ML ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/on/static/single : /MLd ; + } + else + { + # 8.0 and above adds some more options. +- toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-amd64)/ : "/favor:blend" ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-amd64)/$(.cpu-type-em64t) : "/favor:EM64T" ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-amd64)/$(.cpu-type-amd64) : "/favor:AMD64" ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/$(.cpu-arch-amd64)/ : "/favor:blend" ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/$(.cpu-arch-amd64)/$(.cpu-type-em64t) : "/favor:EM64T" ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/$(.cpu-arch-amd64)/$(.cpu-type-amd64) : "/favor:AMD64" ; + + # 8.0 and above only has multi-threaded static RTL. +- toolset.flags $(toolset).compile CFLAGS $(conditions)/off/static/single : /MT ; +- toolset.flags $(toolset).compile CFLAGS $(conditions)/on/static/single : /MTd ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/off/static/single : /MT ; ++ toolset.flags $(toolset).compile OPTIONS $(conditions)/on/static/single : /MTd ; + + # Specify target machine type so the linker will not need to guess. + toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-amd64) : "/MACHINE:X64" ; +@@ -614,7 +614,7 @@ rule compile.c ( targets + : sources * : properties * ) + { + set-setup-command $(targets) : $(properties) ; + C++FLAGS on $(targets[1]) = ; +- get-rspline $(targets) : -TC ; ++ get-rspline $(targets) : -TC CFLAGS ; + compile-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ; + } + +@@ -623,7 +623,7 @@ rule compile.c.preprocess ( targets + : sources * : properties * ) + { + set-setup-command $(targets) : $(properties) ; + C++FLAGS on $(targets[1]) = ; +- get-rspline $(targets) : -TC ; ++ get-rspline $(targets) : -TC CFLAGS ; + preprocess-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ; + } + +@@ -632,8 +632,8 @@ rule compile.c.pch ( targets + : sources * : properties * ) + { + set-setup-command $(targets) : $(properties) ; + C++FLAGS on $(targets[1]) = ; +- get-rspline $(targets[1]) : -TC ; +- get-rspline $(targets[2]) : -TC ; ++ get-rspline $(targets[1]) : -TC CFLAGS ; ++ get-rspline $(targets[2]) : -TC CFLAGS ; + local pch-source = [ on $(<) return $(PCH_SOURCE) ] ; + if $(pch-source) + { +@@ -716,14 +716,14 @@ actions compile-c-c++-pch-s + rule compile.c++ ( targets + : sources * : properties * ) + { + set-setup-command $(targets) : $(properties) ; +- get-rspline $(targets) : -TP ; ++ get-rspline $(targets) : -TP C++FLAGS ; + compile-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ; + } + + rule compile.c++.preprocess ( targets + : sources * : properties * ) + { + set-setup-command $(targets) : $(properties) ; +- get-rspline $(targets) : -TP ; ++ get-rspline $(targets) : -TP C++FLAGS ; + preprocess-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ; + } + +@@ -731,8 +731,8 @@ rule compile.c++.preprocess ( targets + : sources * : properties * ) + rule compile.c++.pch ( targets + : sources * : properties * ) + { + set-setup-command $(targets) : $(properties) ; +- get-rspline $(targets[1]) : -TP ; +- get-rspline $(targets[2]) : -TP ; ++ get-rspline $(targets[1]) : -TP C++FLAGS ; ++ get-rspline $(targets[2]) : -TP C++FLAGS ; + local pch-source = [ on $(<) return $(PCH_SOURCE) ] ; + if $(pch-source) + { +@@ -1691,10 +1691,10 @@ local rule default-path ( version ) + + + +-rule get-rspline ( target : lang-opt ) ++rule get-rspline ( target : lang-opt lang-flags ) + { + CC_RSPLINE on $(target) = [ on $(target) return $(lang-opt) -U$(UNDEFS) +- $(CFLAGS) $(C++FLAGS) $(OPTIONS) -c $(.nl)-D$(DEFINES) ++ $($(lang-flags)) $(OPTIONS) -c $(.nl)-D$(DEFINES) + $(.nl)\"-I$(INCLUDES:W)\" $(.nl)\"-FI$(FORCE_INCLUDES:W)\" ] ; + } + +@@ -1830,25 +1830,25 @@ local rule register-toolset-really ( ) + # Declare flags for compilation. + # + +- toolset.flags msvc.compile CFLAGS speed : /O2 ; +- toolset.flags msvc.compile CFLAGS space : /O1 ; ++ toolset.flags msvc.compile OPTIONS speed : /O2 ; ++ toolset.flags msvc.compile OPTIONS space : /O1 ; + +- toolset.flags msvc.compile CFLAGS $(.cpu-arch-ia64)/$(.cpu-type-itanium) : /G1 ; +- toolset.flags msvc.compile CFLAGS $(.cpu-arch-ia64)/$(.cpu-type-itanium2) : /G2 ; ++ toolset.flags msvc.compile OPTIONS $(.cpu-arch-ia64)/$(.cpu-type-itanium) : /G1 ; ++ toolset.flags msvc.compile OPTIONS $(.cpu-arch-ia64)/$(.cpu-type-itanium2) : /G2 ; + +- toolset.flags msvc.compile CFLAGS on/object : /Z7 ; +- toolset.flags msvc.compile CFLAGS on/database : /Zi ; +- toolset.flags msvc.compile CFLAGS off : /Od ; +- toolset.flags msvc.compile CFLAGS off : /Ob0 ; +- toolset.flags msvc.compile CFLAGS on : /Ob1 ; +- toolset.flags msvc.compile CFLAGS full : /Ob2 ; ++ toolset.flags msvc.compile OPTIONS on/object : /Z7 ; ++ toolset.flags msvc.compile OPTIONS on/database : /Zi ; ++ toolset.flags msvc.compile OPTIONS off : /Od ; ++ toolset.flags msvc.compile OPTIONS off : /Ob0 ; ++ toolset.flags msvc.compile OPTIONS on : /Ob1 ; ++ toolset.flags msvc.compile OPTIONS full : /Ob2 ; + +- toolset.flags msvc.compile CFLAGS on : /W3 ; +- toolset.flags msvc.compile CFLAGS off : /W0 ; +- toolset.flags msvc.compile CFLAGS all : /W4 ; +- toolset.flags msvc.compile CFLAGS extra : /W4 ; +- toolset.flags msvc.compile CFLAGS pedantic : /W4 ; +- toolset.flags msvc.compile CFLAGS on : /WX ; ++ toolset.flags msvc.compile OPTIONS on : /W3 ; ++ toolset.flags msvc.compile OPTIONS off : /W0 ; ++ toolset.flags msvc.compile OPTIONS all : /W4 ; ++ toolset.flags msvc.compile OPTIONS extra : /W4 ; ++ toolset.flags msvc.compile OPTIONS pedantic : /W4 ; ++ toolset.flags msvc.compile OPTIONS on : /WX ; + + toolset.flags msvc.compile C++FLAGS on/off/off : /EHs ; + toolset.flags msvc.compile C++FLAGS on/off/on : /EHsc ; +@@ -1862,16 +1862,16 @@ local rule register-toolset-really ( ) + # By default 8.0 enables rtti support while prior versions disabled it. We + # simply enable or disable it explicitly so we do not have to depend on this + # default behaviour. +- toolset.flags msvc.compile CFLAGS on : /GR ; +- toolset.flags msvc.compile CFLAGS off : /GR- ; +- toolset.flags msvc.compile CFLAGS off/shared : /MD ; +- toolset.flags msvc.compile CFLAGS on/shared : /MDd ; ++ toolset.flags msvc.compile C++FLAGS on : /GR ; ++ toolset.flags msvc.compile C++FLAGS off : /GR- ; ++ toolset.flags msvc.compile OPTIONS off/shared : /MD ; ++ toolset.flags msvc.compile OPTIONS on/shared : /MDd ; + +- toolset.flags msvc.compile CFLAGS off/static/multi : /MT ; +- toolset.flags msvc.compile CFLAGS on/static/multi : /MTd ; ++ toolset.flags msvc.compile OPTIONS off/static/multi : /MT ; ++ toolset.flags msvc.compile OPTIONS on/static/multi : /MTd ; + +- toolset.flags msvc.compile OPTIONS : ; +- toolset.flags msvc.compile.c++ OPTIONS : ; ++ toolset.flags msvc.compile CFLAGS : ; ++ toolset.flags msvc.compile.c++ C++FLAGS : ; + + toolset.flags msvc.compile PDB_CFLAG on/database : /Fd ; + diff --git a/ports/boost-build/portfile.cmake b/ports/boost-build/portfile.cmake index def5c5cd0..791e15a1c 100644 --- a/ports/boost-build/portfile.cmake +++ b/ports/boost-build/portfile.cmake @@ -12,6 +12,8 @@ vcpkg_from_github( REF boost-${BOOST_VERSION} SHA512 e5dd73ef41d341e2bce25677389502d22ca7f328e7fdbb91d95aac415f7b490008d75ff0a63f8e4bd9427215f863c161ec9573c29b663b727df4b60e25a3aac2 HEAD_REF master + PATCHES + fix_options.patch ) vcpkg_download_distfile(ARCHIVE -- cgit v1.2.3