From a5e14258f92e3feed56127366ab2973d8e4aafd3 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. (cherry picked from commit f3c59ef8a64f576c8784ab99a125b270f7b9c680) --- configure.ac | 8 +++++--- rust/Makefile.am | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1b586eca4d..bf18f6c02d 100644 --- a/configure.ac +++ b/configure.ac @@ -293,7 +293,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) @@ -2406,10 +2405,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/c-headers" @@ -2592,6 +2592,8 @@ AC_SUBST(CONFIGURE_SYSCONDIR) 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 747a59fb05..6f3b42590f 100644 --- a/rust/Makefile.am +++ b/rust/Makefile.am @@ -39,6 +39,10 @@ else $(CARGO) build $(RELEASE) \ --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 clean-local: -rm -rf target gen -- 2.47.2