Bug 1904869 - Move HOST_CFLAGS from old-configure to moz.configure r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D214986
This commit is contained in:
serge-sans-paille 2024-07-03 19:50:05 +00:00
Родитель ece43b04e7
Коммит 4be9c3acc0
5 изменённых файлов: 33 добавлений и 52 удалений

Просмотреть файл

@ -542,7 +542,7 @@ set_config("OS_COMPILE_CMFLAGS", compilation_flags.cmflags)
set_config("OS_COMPILE_CMMFLAGS", compilation_flags.cmmflags)
# Default host optimization flags
# Final flags settings
# ---------------------------------
@depends(host_c_compiler)
def host_optimize_flags(compiler):
@ -554,6 +554,26 @@ def host_optimize_flags(compiler):
set_config("HOST_OPTIMIZE_FLAGS", host_optimize_flags)
@depends("HOST_CFLAGS", compilation_flags, host, host_c_compiler)
@imports(_from="mozbuild.shellutil", _import="split")
def host_cflags(base_cflags, compilation_flags, host, compiler):
flags = list(compilation_flags.host_cflags)
flags += split(base_cflags[0])
if host.kernel == "WINNT":
if compiler.type != "clang-cl":
flags += ["-mwindows"]
flags += ["-DXP_WIN", "-DWIN32", "-D_WIN32", "-D_CRT_SECURE_NO_WARNINGS"]
if host.cpu == "x86_64":
flags += ["-D_AMD64_"]
elif host.kernel == "Darwin":
flags += ["-DXP_UNIX", "-DXP_MACOSX"]
else:
flags += ["-DXP_UNIX"]
return flags
# Please keep these last in this file.
add_old_configure_assignment("_COMPILATION_ASFLAGS", asm_flags.asflags)
add_old_configure_assignment("_COMPILATION_HOST_ASFLAGS", asm_flags.host_asflags)
@ -565,9 +585,9 @@ add_old_configure_assignment("_COMPILATION_HOST_LDFLAGS", linker_flags.host_ldfl
add_old_configure_assignment("_COMPILATION_CFLAGS", compilation_flags.cflags)
add_old_configure_assignment("_COMPILATION_CXXFLAGS", compilation_flags.cxxflags)
add_old_configure_assignment("_COMPILATION_HOST_CFLAGS", compilation_flags.host_cflags)
add_old_configure_assignment(
"_COMPILATION_HOST_CXXFLAGS", compilation_flags.host_cxxflags
)
set_config("HOST_CFLAGS", host_cflags)
set_config("DSO_LDOPTS", dso_flags.ldopts)

Просмотреть файл

@ -4,6 +4,16 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Environment variables that impact the compilation step
# ==============================================================
option(
env="HOST_CFLAGS",
help="Extra flags for compiling host C sources.",
nargs=1,
default="",
)
# Code optimization
# ==============================================================

Просмотреть файл

@ -11,6 +11,7 @@ unset CC
unset CXX
unset HOST_CC
unset HOST_CXX
unset HOST_CFLAGS
unset LINKER
unset RUSTFLAGS
unset TOOLCHAIN_PREFIX

Просмотреть файл

@ -22,7 +22,6 @@ CFLAGS="${CFLAGS=}"
CPPFLAGS="${CPPFLAGS=}"
CXXFLAGS="${CXXFLAGS=}"
LDFLAGS="${LDFLAGS=}"
HOST_CFLAGS="${HOST_CFLAGS=}"
HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
HOST_LDFLAGS="${HOST_LDFLAGS=}"
@ -160,12 +159,6 @@ dnl System overrides of the defaults for host
dnl ========================================================
case "$host" in
*mingw*)
if test "$HOST_CC_TYPE" = clang-cl; then
HOST_CFLAGS="$HOST_CFLAGS"
else
HOST_CFLAGS="$HOST_CFLAGS -mwindows"
fi
HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
HOST_BIN_SUFFIX=.exe
case "${host_cpu}" in
@ -178,22 +171,9 @@ case "$host" in
if test "$HOST_CC_TYPE" = clang-cl; then
HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
fi
HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
;;
esac
;;
*-darwin*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
;;
*-linux*|*-kfreebsd*-gnu|*-gnu*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
;;
*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
;;
esac
dnl ========================================================
@ -401,10 +381,6 @@ ASFLAGS=`echo \
$_COMPILATION_ASFLAGS \
$ASFLAGS`
HOST_CFLAGS=`echo \
$_COMPILATION_HOST_CFLAGS \
$HOST_CFLAGS`
HOST_CXXFLAGS=`echo \
$_COMPILATION_HOST_CXXFLAGS \
$HOST_CXXFLAGS`
@ -428,7 +404,6 @@ AC_SUBST_LIST(OS_LDFLAGS)
AC_SUBST(HOST_CC)
AC_SUBST(HOST_CXX)
AC_SUBST_LIST(HOST_CFLAGS)
AC_SUBST_LIST(HOST_CPPFLAGS)
AC_SUBST_LIST(HOST_CXXFLAGS)
AC_SUBST(HOST_LDFLAGS)

Просмотреть файл

@ -22,7 +22,6 @@ CFLAGS="${CFLAGS=}"
CPPFLAGS="${CPPFLAGS=}"
CXXFLAGS="${CXXFLAGS=}"
LDFLAGS="${LDFLAGS=}"
HOST_CFLAGS="${HOST_CFLAGS=}"
HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
HOST_LDFLAGS="${HOST_LDFLAGS=}"
@ -164,12 +163,6 @@ dnl System overrides of the defaults for host
dnl ========================================================
case "$host" in
*mingw*)
if test "$HOST_CC_TYPE" = clang-cl; then
HOST_CFLAGS="$HOST_CFLAGS"
else
HOST_CFLAGS="$HOST_CFLAGS -mwindows"
fi
HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
HOST_BIN_SUFFIX=.exe
case "${host_cpu}" in
@ -182,22 +175,9 @@ case "$host" in
if test "$HOST_CC_TYPE" = clang-cl; then
HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
fi
HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
;;
esac
;;
*-darwin*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
;;
*-linux*|*-kfreebsd*-gnu|*-gnu*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
;;
*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
;;
esac
dnl ========================================================
@ -554,10 +534,6 @@ ASFLAGS=`echo \
$_COMPILATION_ASFLAGS \
$ASFLAGS`
HOST_CFLAGS=`echo \
$_COMPILATION_HOST_CFLAGS \
$HOST_CFLAGS`
HOST_CXXFLAGS=`echo \
$_COMPILATION_HOST_CXXFLAGS \
$HOST_CXXFLAGS`
@ -581,7 +557,6 @@ AC_SUBST_LIST(OS_LDFLAGS)
AC_SUBST(HOST_CC)
AC_SUBST(HOST_CXX)
AC_SUBST_LIST(HOST_CFLAGS)
AC_SUBST_LIST(HOST_CPPFLAGS)
AC_SUBST_LIST(HOST_CXXFLAGS)
AC_SUBST(HOST_LDFLAGS)