On 3/26/2025 7:42 AM, 'Anton Johansson' wrote:
On 25/03/25, Brian Cain wrote:
On 3/24/2025 8:53 PM, ltaylorsimp...@gmail.com wrote:
-----Original Message-----
From: Anton Johansson <a...@rev.ng>
Sent: Wednesday, March 12, 2025 2:46 PM
To: qemu-devel@nongnu.org
Cc: a...@rev.ng; ltaylorsimp...@gmail.com; brian.c...@oss.qualcomm.com;
phi...@linaro.org
Subject: [PATCH 2/2] target/hexagon: Drop `ident` postprocess step

The indent command is not available on a default mac osx setup with xcode
cli tools installed.  While it does make idef-parser generated code nicer
to
debug, it's not crucial and can be dropped.

Signed-off-by: Anton Johansson <a...@rev.ng>
---
   target/hexagon/meson.build | 21 ++-------------------
   1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/target/hexagon/meson.build b/target/hexagon/meson.build
index abcf00ca1f..246dc7b241 100644
--- a/target/hexagon/meson.build
+++ b/target/hexagon/meson.build
@@ -323,30 +323,13 @@ if idef_parser_enabled and 'hexagon-linux-user' in
target_dirs
           command: [idef_parser, '@INPUT@', '@OUTPUT0@', '@OUTPUT1@',
'@OUTPUT2@']
       )

-    indent = find_program('indent', required: false)
-    if indent.found()
-        idef_generated_tcg_c = custom_target(
-            'indent',
-            input: idef_generated_tcg[0],
-            output: 'idef-generated-emitter.indented.c',
-            command: [indent, '-linux', '@INPUT@', '-o', '@OUTPUT@']
-        )
-    else
-        idef_generated_tcg_c = custom_target(
-            'copy',
-            input: idef_generated_tcg[0],
-            output: 'idef-generated-emitter.indented.c',
-            command: ['cp', '@INPUT@', '@OUTPUT@']
-        )
-    endif
-
I prefer to have the indented version present.

Is the above check/fallback not sufficient on MacOS?  It works on a Linux
system where indent is not present.

Aside: could using "clang-format" be another approach?  I suppose it's just
exchanging one dependency for another, but maybe xcode comes w/this tool?
Then again, maybe it would be an inconvenient dependency on linux systems?



Thanks,
Taylor
Sorry, I misspoke in the commit message. The problem does not occur for a
default xcode commandline tools install, but when the user has installed
indent via homebrew or some other source. I don't have access to a mac
at this moment so I cannot verify, but I think `-linux` is not
supported.

If we want to handle this situation we can either expand `-linux` into
it's constituent flags or add a `host_os == 'linux'` condition.


I wouldn't bind this behavior to the hexagon-linux-user target, because it happens to be hosted on "!macos" if that's what you mean.  But "host_os == linux" seems reasonable.


OTOH if it's not easy to detect this condition, I think it's fine to remove it entirely.  Seems like -- if we as developers want to read the output we can indent it on demand (or use something like inotifywait + indent to automagically indent it after writing).


Nit: subject typo - s/ident/indent/



Reply via email to