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.
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 \
$(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