diff --git a/WINGs/wings-rs/Makefile.am b/WINGs/wings-rs/Makefile.am index 14eda0fe..f3fd5fc2 100644 --- a/WINGs/wings-rs/Makefile.am +++ b/WINGs/wings-rs/Makefile.am @@ -18,7 +18,7 @@ RUST_EXTRA = \ Cargo.lock \ Cargo.toml -src/WINGsP.rs: ../WINGs/WINGsP.h ../../wrlib/wraster.h ../WINGs/WINGs.h ../WINGs/WUtil.h Makefile patch_WINGsP.sh +src/WINGsP.rs: ../WINGs/WINGsP.h ../../wrlib/wraster.h ../WINGs/WINGs.h ../WINGs/WUtil.h Makefile patch_WINGsP.sed $(BINDGEN) ../WINGs/WINGsP.h \ --no-recursive-allowlist \ --allowlist-type "^W_.+|^WM(View|Array|DragOperationType|Point|Data|OpenPanel|SavePanel|HashTable|DraggingInfo|SelectionProcs|Rect|EventProc|Widget|Size|Pixmap|FilePanel|List|ListItem)" \ @@ -55,7 +55,8 @@ src/WINGsP.rs: ../WINGs/WINGsP.h ../../wrlib/wraster.h ../WINGs/WINGs.h ../WINGs -o src/WINGsP.rs -- \ @PANGO_CFLAGS@ \ -I../../wrlib \ - -I.. && ./patch_WINGsP.sh src/WINGsP.rs + -I.. \ + && sed -i -r -f patch_WINGsP.sed src/WINGsP.rs Cargo.lock: $(CARGO) build diff --git a/WINGs/wings-rs/patch_WINGsP.sed b/WINGs/wings-rs/patch_WINGsP.sed new file mode 100755 index 00000000..f765e13a --- /dev/null +++ b/WINGs/wings-rs/patch_WINGsP.sed @@ -0,0 +1,10 @@ +# This file provides ad-hoc fixups to the WINGsP bindings provided by bindgen: +# - Import Xlib symbols so that everything compiles. +# - Import FFI symbols from Rust bindings and rewrites. +# - The opaque type names _XftDraw and _XftFont are replaced with void*. +# - Pango bindings aren't yet pulled into our Rust code, so PangoLayout is also demoted to void*. + +1s/^/use wrlib_rs::ffi::*;\nuse wutil_rs::range::ffi::*;\nuse x11::xlib::*;\nuse crate::ffi::*;\n\n/ +s/_XftDraw/::std::ffi::c_void/g +s/_XftFont/::std::ffi::c_void/g +s/PangoLayout/::std::ffi::c_void/g diff --git a/WINGs/wings-rs/patch_WINGsP.sh b/WINGs/wings-rs/patch_WINGsP.sh deleted file mode 100755 index 966ed1ea..00000000 --- a/WINGs/wings-rs/patch_WINGsP.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# This file provides ad-hoc fixups to the WINGsP provided by bindgen: -# - Import Xlib symbols so that everything compiles. -# - The opaque type names _XftDraw and _XftFont are replaced with void*. -# - Pango bindings aren't yet pulled into our Rust code, so PangoLayout is also demoted to void*. - -set -e - -if [ "x$1" = "x" ]; then - echo "Usage: $(basename $0) " - exit 1 -fi - -FILE="$1" - -exec sed -i -r \ - -e "1s/^/use wrlib_rs::ffi::*;\nuse wutil_rs::range::ffi::*;\nuse x11::xlib::*;\nuse crate::ffi::*;\n\n/" \ - -e "s/_XftDraw/::std::ffi::c_void/g" \ - -e "s/_XftFont/::std::ffi::c_void/g" \ - -e "s/PangoLayout/::std::ffi::c_void/g" \ - "$1"