From: Jason Ish Date: Wed, 19 Feb 2025 21:31:31 +0000 (-0600) Subject: rust/bindgen: use temp file to generating bindings X-Git-Tag: suricata-8.0.0-beta1~385 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cdb87953859d03f6108826bb168c00b88d135f8;p=thirdparty%2Fsuricata.git rust/bindgen: use temp file to generating bindings Prefixing a file with sed doesn't appear to be portable. Instead, make use of a temporary file. Fixes generating the bindings on FreeBSD and Mac. --- diff --git a/rust/Makefile.am b/rust/Makefile.am index a751bb85a3..a258003a8a 100644 --- a/rust/Makefile.am +++ b/rust/Makefile.am @@ -108,7 +108,7 @@ vendor: update-bindings: if HAVE_BINDGEN $(BINDGEN) \ - -o sys/src/sys.rs \ + -o sys/src/sys.rs.tmp \ --rust-target 1.68 \ --no-layout-tests \ --disable-header-comment \ @@ -120,7 +120,9 @@ if HAVE_BINDGEN $(abs_top_srcdir)/src/bindgen.h \ -- \ -DHAVE_CONFIG_H -I../src -I../rust/gen $(CPPFLAGS) - sed -i '1i\// This file is automatically generated. Do not edit.\n' sys/src/sys.rs + printf "// This file is automatically generated. Do not edit.\n\n" > sys/src/sys.rs + cat sys/src/sys.rs.tmp >> sys/src/sys.rs + rm -f sys/src/sys.rs.tmp else @echo "error: bindgen not installed, can't update bindings" exit 1