From f3c59ef8a64f576c8784ab99a125b270f7b9c680 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 30 Nov 2020 15:11:57 -0600 Subject: [PATCH] rust: handle windows naming change from .lib to .a Prior to Rust 1.44, Cargo would name static libs with the .lib extension. 1.44 changes this extension to .a when running under a GNU environment on Windows like msys to make it more similar to other unix environments. Now assume static library name to be the same on Windows and unix, but rename the .lib if found to still support older versions of Rust on Windows. --- configure.ac | 7 ++++--- rust/Makefile.am | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 51f57b0440..6b156b60c0 100644 --- a/configure.ac +++ b/configure.ac @@ -306,7 +306,6 @@ WINDOWS_PATH="yes" PCAP_LIB_NAME="wpcap" AC_DEFINE([HAVE_NON_POSIX_MKDIR], [1], [mkdir is not POSIX compliant: single arg]) - RUST_SURICATA_LIBNAME="suricata.lib" RUST_LDADD=" -lws2_32 -liphlpapi -lwbemuuid -lOle32 -lOleAut32 -lUuid -luserenv -lshell32 -ladvapi32 -lgcc_eh" ;; *-*-cygwin) @@ -2500,10 +2499,11 @@ fi fi if test "x$enable_debug" = "xyes"; then - RUST_SURICATA_LIB="../rust/target/${RUST_SURICATA_LIB_XC_DIR}debug/${RUST_SURICATA_LIBNAME}" + RUST_SURICATA_LIBDIR="../rust/target/${RUST_SURICATA_LIB_XC_DIR}debug" else - RUST_SURICATA_LIB="../rust/target/${RUST_SURICATA_LIB_XC_DIR}release/${RUST_SURICATA_LIBNAME}" + RUST_SURICATA_LIBDIR="../rust/target/${RUST_SURICATA_LIB_XC_DIR}release" fi + RUST_SURICATA_LIB="${RUST_SURICATA_LIBDIR}/${RUST_SURICATA_LIBNAME}" RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}" CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen -I\${srcdir}/../rust/dist" @@ -2780,6 +2780,7 @@ AC_SUBST(CONFIGURE_LOCALSTATEDIR) AC_SUBST(CONFIGURE_DATAROOTDIR) AC_SUBST(PACKAGE_VERSION) AC_SUBST(RUST_FEATURES) +AC_SUBST(RUST_SURICATA_LIBDIR) AC_CONFIG_FILES(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/.cargo/config) AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile) diff --git a/rust/Makefile.am b/rust/Makefile.am index 4f6ee0718b..9247012656 100644 --- a/rust/Makefile.am +++ b/rust/Makefile.am @@ -45,6 +45,10 @@ else $(CARGO) build $(RELEASE) $(NIGHTLY_ARGS) \ --features "$(RUST_FEATURES)" $(RUST_TARGET) endif + if test -e $(RUST_SURICATA_LIBDIR)/suricata.lib; then \ + cp $(RUST_SURICATA_LIBDIR)/suricata.lib \ + $(RUST_SURICATA_LIBDIR)/libsuricata.a; \ + fi $(MAKE) gen/rust-bindings.h clean-local: -- 2.47.2