util/cutil: Allow relocatable install with prefix /
PATCH 1/1 util/cutil: Allow relocatable install with prefix /
When configuring QEMU with --prefix=/, the generated QEMU executables can't be relocated to other directories. Add an additional test logic in starts_with_prefix() to handle this.
Signed-off-by Bin Meng <[email protected]>
---
util/cutils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
util/cutils.c +2 -1
@@ -1021,7 +1021,8 @@ static inline bool starts_with_prefix(const char *dir)#pragma GCC diagnostic ignored "-Warray-bounds="#endif return !memcmp (dir,CONFIG_PREFIX , prefix_len) && - (!dir[prefix_len] ||G_IS_DIR_SEPARATOR (dir[prefix_len])); + (!dir[prefix_len] ||G_IS_DIR_SEPARATOR (dir[prefix_len]) || + !strcmp (CONFIG_PREFIX ,"/" ));#pragma GCC diagnostic pop }
Signature · 1 line
2.34.1
Quoted 3 lines · Bin Meng
When configuring QEMU with --prefix=/, the generated QEMU executables can't be relocated to other directories. Add an additional test logic in
starts_with_prefix()to handle this.
What about setting "" as CONFIG_PREFIX in Meson when --prefix=/ ?
CONFIG_PREFIX is expected not to have the ending slash. --prefix needs the ending slash for the root, but it is just a quirk of Meson, which is probably better to be handled in Meson, too.
Regards,
Akihiko Odaki