소스 검색

rust: Make it work on FreeBSD

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 3 년 전
부모
커밋
846f3d13c6
5개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 3
      bindings/rust/Makefile.am
  2. 1 0
      bindings/rust/tests/build.rs.in
  3. 0 1
      build-aux/rust-regen.sh
  4. 1 0
      build-aux/rust.mk
  5. 1 0
      include/corosync/cpg.h

+ 3 - 3
bindings/rust/Makefile.am

@@ -37,10 +37,10 @@ RUST_BUILT_SRCS		= \
 			  src/sys/cmap.rs
 
 src/sys/cpg.rs: ../../include/corosync/cpg.h
-	$(top_srcdir)/build-aux/rust-regen.sh $^ $@ CPG -- -I$(top_srcdir)/include
+	$(top_srcdir)/build-aux/rust-regen.sh $^ $@ CPG --blocklist-function=inet6.* --blocklist-function==.*etsourcefilter -- -I$(top_srcdir)/include
 
 src/sys/cfg.rs: ../../include/corosync/cfg.h
-	$(top_srcdir)/build-aux/rust-regen.sh $^ $@ CFG -- -I$(top_srcdir)/include
+	$(top_srcdir)/build-aux/rust-regen.sh $^ $@ CFG --blocklist-function=inet6.* --blocklist-function=.*etsourcefilter -- -I$(top_srcdir)/include
 
 src/sys/quorum.rs: ../../include/corosync/quorum.h
 	$(top_srcdir)/build-aux/rust-regen.sh $^ $@ QUORUM -- -I$(top_srcdir)/include
@@ -49,7 +49,7 @@ src/sys/votequorum.rs: ../../include/corosync/votequorum.h
 	$(top_srcdir)/build-aux/rust-regen.sh $^ $@ VOTEQUORUM -- -I$(top_srcdir)/include
 
 src/sys/cmap.rs: ../../include/corosync/cmap.h
-	$(top_srcdir)/build-aux/rust-regen.sh $^ $@ CMAP -- -I$(top_srcdir)/include
+	$(top_srcdir)/build-aux/rust-regen.sh $^ $@ CMAP -- -I$(top_srcdir)/include $(LIBQB_CFLAGS)
 
 all-local: cargo-tree-prep target/$(RUST_TARGET_DIR)/cpg.rlib \
 	target/$(RUST_TARGET_DIR)/cfg.rlib \

+ 1 - 0
bindings/rust/tests/build.rs.in

@@ -11,6 +11,7 @@ fn main() {
     // Tell the compiler to use the build-tree libs & headers for compiling
     println!("cargo:rustc-link-search=native=../../../lib/.libs/");
     println!("cargo:rustc-link-search=native=../../../common_lib/.libs/");
+    println!("cargo:rustc-flags=@LIBQBLIBS@");
     println!("cargo:rustc-link-lib=cpg");
     println!("cargo:rustc-link-lib=cfg");
     println!("cargo:rustc-link-lib=cmap");

+ 0 - 1
build-aux/rust-regen.sh

@@ -18,7 +18,6 @@ shift; shift; shift
 
 bindgen \
 	--size_t-is-usize \
-	--no-recursive-allowlist \
 	--no-prepend-enum-name \
 	--no-layout-tests \
 	--no-doc-comments \

+ 1 - 0
build-aux/rust.mk

@@ -22,6 +22,7 @@ build.rs: build.rs.in
 	cat $^ | sed \
 		-e 's#@ABSTOPLEVELSRC@#$(abs_top_srcdir)#g' \
 		-e 's#@ABSTOPLEVELBUILD@#$(abs_top_builddir)#g' \
+		-e 's#@LIBQBLIBS@#$(LIBQB_LIBS)#g' \
 		> $@-t
 	chmod a-w $@-t
 	mv $@-t $@

+ 1 - 0
include/corosync/cpg.h

@@ -36,6 +36,7 @@
 #define COROSYNC_CPG_H_DEFINED
 
 #include <netinet/in.h>
+#include <sys/socket.h>
 #include <corosync/corotypes.h>
 
 #ifdef __cplusplus