Skip to content

Commit e42a9d0

Browse files
Revert "fix: sysroot property (conan-io#16011)"
This change breaks all our meson builds as when passing --sysroot meson will prefix every single include directory with the sysroot...
1 parent 817bcb7 commit e42a9d0

File tree

3 files changed

+6
-61
lines changed

3 files changed

+6
-61
lines changed

conan/tools/meson/toolchain.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,6 @@ def __init__(self, conanfile, backend=None, native=False):
264264
default_comp = "cl"
265265
default_comp_cpp = "cl"
266266

267-
# Read configuration for sys_root property (honoring existing conf)
268-
self._sys_root = self._conanfile_conf.get("tools.build:sysroot", check_type=str)
269-
if self._sys_root:
270-
self.properties["sys_root"] = self._sys_root
271-
272267
# Read configuration for compilers
273268
compilers_by_conf = self._conanfile_conf.get("tools.build:compiler_executables", default={},
274269
check_type=dict)
@@ -428,12 +423,11 @@ def _get_extra_flags(self):
428423
linker_scripts = self._conanfile_conf.get("tools.build:linker_scripts", default=[], check_type=list)
429424
linker_script_flags = ['-T"' + linker_script + '"' for linker_script in linker_scripts]
430425
defines = self._conanfile.conf.get("tools.build:defines", default=[], check_type=list)
431-
sys_root = [f"--sysroot={self._sys_root}"] if self._sys_root else [""]
432426
return {
433-
"cxxflags": cxxflags + sys_root + self.extra_cxxflags,
434-
"cflags": cflags + sys_root + self.extra_cflags,
427+
"cxxflags": cxxflags + self.extra_cxxflags,
428+
"cflags": cflags + self.extra_cflags,
435429
"ldflags": sharedlinkflags + exelinkflags + linker_script_flags
436-
+ sys_root + self.extra_ldflags,
430+
+ self.extra_ldflags,
437431
"defines": [f"-D{d}" for d in (defines + self.extra_defines)]
438432
}
439433

test/functional/toolchains/meson/test_meson.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
import pytest
88

9-
from conan.test.assets.sources import gen_function_cpp, gen_function_h
10-
from conan.test.utils.tools import TestClient
119
from conans.model.recipe_ref import RecipeReference
10+
from conan.test.assets.sources import gen_function_cpp, gen_function_h
1211
from test.functional.toolchains.meson._base import TestMesonBase
12+
from conan.test.utils.tools import TestClient
1313

1414

1515
class MesonToolchainTest(TestMesonBase):

test/integration/toolchains/meson/test_mesontoolchain.py

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import os
22
import platform
3-
import re
43
import textwrap
54

65
import pytest
76

87
from conan.test.assets.genconanfile import GenConanfile
9-
from conan.test.utils.tools import TestClient
108
from conan.tools.files import load
119
from conan.tools.meson import MesonToolchain
10+
from conan.test.utils.tools import TestClient
1211

1312

1413
def test_apple_meson_keep_user_custom_flags():
@@ -598,51 +597,3 @@ def test_compiler_path_with_spaces():
598597
conan_meson_native = client.load("conan_meson_native.ini")
599598
assert "c = 'c compiler path with spaces'" in conan_meson_native
600599
assert "cpp = 'cpp compiler path with spaces'" in conan_meson_native
601-
602-
603-
def test_meson_sysroot_app():
604-
"""Testing when users pass tools.build:sysroot on the profile with Meson
605-
606-
The generated conan_meson_cross.ini needs to contain both sys_root property to fill the
607-
PKG_CONFIG_PATH and the compiler flags with --sysroot.
608-
609-
When cross-building, Meson needs both compiler_executables in the config, otherwise it will fail
610-
when running setup.
611-
"""
612-
sysroot = "/my/new/sysroot/path"
613-
client = TestClient()
614-
profile = textwrap.dedent(f"""
615-
[settings]
616-
os = Macos
617-
arch = armv8
618-
compiler = apple-clang
619-
compiler.version = 13.0
620-
compiler.libcxx = libc++
621-
622-
[conf]
623-
tools.build:sysroot={sysroot}
624-
tools.build:verbosity=verbose
625-
tools.compilation:verbosity=verbose
626-
tools.apple:sdk_path=/my/sdk/path
627-
""")
628-
profile_build = textwrap.dedent(f"""
629-
[settings]
630-
os = Macos
631-
arch = x86_64
632-
compiler = apple-clang
633-
compiler.version = 13.0
634-
compiler.libcxx = libc++
635-
""")
636-
client.save({"conanfile.py": GenConanfile(name="hello", version="0.1")
637-
.with_settings("os", "arch", "compiler", "build_type")
638-
.with_generator("MesonToolchain"),
639-
"build": profile_build,
640-
"host": profile})
641-
client.run("install . -pr:h host -pr:b build")
642-
# Check the meson configuration file
643-
conan_meson = client.load(os.path.join(client.current_folder, "conan_meson_cross.ini"))
644-
assert f"sys_root = '{sysroot}'\n" in conan_meson
645-
assert re.search(r"c_args =.+--sysroot={}.+".format(sysroot), conan_meson)
646-
assert re.search(r"c_link_args =.+--sysroot={}.+".format(sysroot), conan_meson)
647-
assert re.search(r"cpp_args =.+--sysroot={}.+".format(sysroot), conan_meson)
648-
assert re.search(r"cpp_link_args =.+--sysroot={}.+".format(sysroot), conan_meson)

0 commit comments

Comments
 (0)