Skip to content

Commit

Permalink
gdb: Depend on mpfr as well as gmp
Browse files Browse the repository at this point in the history
GDB 14 requires mpfr.  Previously it was an optional dependency.
  • Loading branch information
bsdjhb committed Jan 30, 2024
1 parent 8156303 commit b203a54
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pycheribuild/projects/cross/gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
MakeCommandKind,
)
from .gmp import BuildGmp
from .mpfr import BuildMpfr
from ..project import ComputedDefaultValue
from ...utils import OSInfo

Expand Down Expand Up @@ -75,7 +76,7 @@ def dependencies(cls, config: CheriConfig) -> "tuple[str, ...]":
deps = super().dependencies(config)
# For the native and native-hybrid builds gmp must be installed via ports.
if not cls.get_crosscompile_target().is_native():
deps += ("gmp",)
deps += ("gmp", "mpfr")
return deps

@classmethod
Expand All @@ -93,6 +94,7 @@ def check_system_dependencies(self) -> None:
self.check_required_system_tool("makeinfo", default="texinfo")
if self.compiling_for_host() and self.target_info.is_cheribsd():
self.check_required_pkg_config("gmp", freebsd="gmp")
self.check_required_pkg_config("mpfr", freebsd="mpfr")
self.check_required_pkg_config("expat", freebsd="expat")

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -169,6 +171,7 @@ def setup(self) -> None:
MAKEINFO="/bin/false",
)
self.configure_args.append("--with-gmp=" + str(BuildGmp.get_install_dir(self)))
self.configure_args.append("--with-mpfr=" + str(BuildMpfr.get_install_dir(self)))
# GDB > 12 only uses --with-gmp
self.configure_args.append("--with-libgmp-prefix=" + str(BuildGmp.get_install_dir(self)))
# Autoconf stupidly decides which to use based on file existence
Expand Down
1 change: 1 addition & 0 deletions tests/test_argument_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def test_skip_update():
"llvm-native",
"cheribsd-riscv64-purecap",
"gmp-riscv64-hybrid-for-purecap-rootfs",
"mpfr-riscv64-hybrid-for-purecap-rootfs",
"gdb-riscv64-hybrid-for-purecap-rootfs",
"bbl-baremetal-riscv64-purecap",
"disk-image-riscv64-purecap",
Expand Down
12 changes: 10 additions & 2 deletions tests/test_target_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def test_build_and_run(target_name: str, expected_list: "list[str]"):
"morello-llvm-native",
"cheribsd-morello-hybrid",
"gmp-morello-hybrid",
"mpfr-morello-hybrid",
"gdb-morello-hybrid",
"disk-image-morello-hybrid",
],
Expand All @@ -199,6 +200,7 @@ def test_build_and_run(target_name: str, expected_list: "list[str]"):
"morello-llvm-native",
"cheribsd-morello-purecap",
"gmp-morello-hybrid-for-purecap-rootfs",
"mpfr-morello-hybrid-for-purecap-rootfs",
"gdb-morello-hybrid-for-purecap-rootfs",
"disk-image-morello-purecap",
],
Expand All @@ -216,6 +218,7 @@ def test_build_and_run(target_name: str, expected_list: "list[str]"):
"llvm-native",
"cheribsd-riscv64-hybrid",
"gmp-riscv64-hybrid",
"mpfr-riscv64-hybrid",
"gdb-riscv64-hybrid",
"bbl-baremetal-riscv64-purecap",
"disk-image-riscv64-hybrid",
Expand All @@ -229,6 +232,7 @@ def test_build_and_run(target_name: str, expected_list: "list[str]"):
"llvm-native",
"cheribsd-riscv64-purecap",
"gmp-riscv64-hybrid-for-purecap-rootfs",
"mpfr-riscv64-hybrid-for-purecap-rootfs",
"gdb-riscv64-hybrid-for-purecap-rootfs",
"bbl-baremetal-riscv64-purecap",
"disk-image-riscv64-purecap",
Expand All @@ -237,12 +241,12 @@ def test_build_and_run(target_name: str, expected_list: "list[str]"):
pytest.param(
"run-aarch64",
True,
["qemu", "llvm-native", "cheribsd-aarch64", "gmp-aarch64", "gdb-aarch64", "disk-image-aarch64"],
["qemu", "llvm-native", "cheribsd-aarch64", "gmp-aarch64", "mpfr-aarch64", "gdb-aarch64", "disk-image-aarch64"],
),
pytest.param(
"run-amd64",
True,
["qemu", "llvm-native", "cheribsd-amd64", "gmp-amd64", "gdb-amd64", "disk-image-amd64"],
["qemu", "llvm-native", "cheribsd-amd64", "gmp-amd64", "mpfr-amd64", "gdb-amd64", "disk-image-amd64"],
),
# Morello code won't run on QEMU (yet)
pytest.param(
Expand All @@ -253,6 +257,7 @@ def test_build_and_run(target_name: str, expected_list: "list[str]"):
"morello-llvm-native",
"cheribsd-morello-hybrid",
"gmp-morello-hybrid",
"mpfr-morello-hybrid",
"gdb-morello-hybrid",
"morello-firmware",
"disk-image-morello-hybrid",
Expand All @@ -266,6 +271,7 @@ def test_build_and_run(target_name: str, expected_list: "list[str]"):
"morello-llvm-native",
"cheribsd-morello-purecap",
"gmp-morello-hybrid-for-purecap-rootfs",
"mpfr-morello-hybrid-for-purecap-rootfs",
"gdb-morello-hybrid-for-purecap-rootfs",
"morello-firmware",
"disk-image-morello-purecap",
Expand Down Expand Up @@ -532,6 +538,7 @@ def test_riscv():
"llvm-native",
"cheribsd-riscv64",
"gmp-riscv64",
"mpfr-riscv64",
"gdb-riscv64",
"disk-image-riscv64",
]
Expand All @@ -540,6 +547,7 @@ def test_riscv():
"llvm-native",
"cheribsd-riscv64",
"gmp-riscv64",
"mpfr-riscv64",
"gdb-riscv64",
"disk-image-riscv64",
"run-riscv64",
Expand Down

0 comments on commit b203a54

Please sign in to comment.