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.
pull/12653/head
Jason Ish 1 week ago committed by Victor Julien
parent 73ae6e997f
commit 4cdb879538

@ -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

Loading…
Cancel
Save