Skip to content

Commit 6ba5dc1

Browse files
committed
Removed the libbsd patch
We are now using a patched fork of libbsd with a view to merging the patch upstream.
1 parent e2ab89e commit 6ba5dc1

1 file changed

Lines changed: 6 additions & 27 deletions

File tree

pycheribuild/projects/cross/libbsd.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ class BuildLibbsd(CrossCompileAutotoolsProject):
4040
)
4141
_default_architecture = CompilationTargets.CHERI_LINUX_RISCV64_PURECAP_093
4242
make_kind = MakeCommandKind.GnuMake
43-
# `default_branch` is set because the build scripts assume that
44-
# a git tag is checked out. In more detail ./get-version returns an
45-
# empty string if main is checked out.
46-
repository = GitRepository("https://gitlab.freedesktop.org/libbsd/libbsd.git", default_branch="0.12.2")
43+
repository = GitRepository(
44+
"https://gitlab.freedesktop.org/libbsd/libbsd.git",
45+
temporary_url_override="https://gitlab.freedesktop.org/paul-metzger/libbsd-private-fork-pmetzger.git",
46+
default_branch="0_12_2_with_alignment_macro_fix",
47+
force_branch=True,
48+
)
4749

4850
@classproperty
4951
def default_install_dir(self):
@@ -54,28 +56,6 @@ def dependencies(cls, config) -> "tuple[str, ...]":
5456
ti = typing.cast(typing.Type[LinuxTargetInfoBase], cls.get_crosscompile_target().target_info_cls)
5557
return ti.musl_target, "libmd"
5658

57-
def _apply_patch(self) -> None:
58-
patch = """
59-
diff --git a/src/merge.c b/src/merge.c
60-
index 3f1b3fb..f8cb602 100644
61-
--- a/src/merge.c
62-
+++ b/src/merge.c
63-
@@ -84,8 +84,8 @@ static void insertionsort(unsigned char *, size_t, size_t,
64-
*/
65-
/* Assumption: PSIZE is a power of 2. */
66-
#define EVAL(p) (unsigned char **) \\
67-
- (((unsigned char *)p + PSIZE - 1 - \\
68-
- (unsigned char *)0) & ~(PSIZE - 1))
69-
+ __builtin_cheri_address_set(p, ((__builtin_cheri_address_get(p) + PSIZE - 1 - \\
70-
+ 0) & ~(PSIZE - 1)))
71-
72-
/*
73-
* Arguments are as for qsort.
74-
"""
75-
self.write_file(self.source_dir / "merge.patch", patch, overwrite=True)
76-
self.run_cmd("git", "restore", ".", cwd=self.source_dir)
77-
self.run_cmd("git", "apply", "merge.patch", cwd=self.source_dir)
78-
7959
def setup(self) -> None:
8060
super().setup()
8161
# Remove dependency on libgcc_eh
@@ -89,7 +69,6 @@ def configure(self, **kwargs):
8969
super().configure(**kwargs)
9070

9171
def compile(self, **kwargs):
92-
self._apply_patch()
9372
self.run_make()
9473
super().compile()
9574

0 commit comments

Comments
 (0)