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.
pull/5618/head
Jason Ish 4 years ago committed by Victor Julien
parent 10f639e9d1
commit f3c59ef8a6

@ -306,7 +306,6 @@
WINDOWS_PATH="yes" WINDOWS_PATH="yes"
PCAP_LIB_NAME="wpcap" PCAP_LIB_NAME="wpcap"
AC_DEFINE([HAVE_NON_POSIX_MKDIR], [1], [mkdir is not POSIX compliant: single arg]) 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" RUST_LDADD=" -lws2_32 -liphlpapi -lwbemuuid -lOle32 -lOleAut32 -lUuid -luserenv -lshell32 -ladvapi32 -lgcc_eh"
;; ;;
*-*-cygwin) *-*-cygwin)
@ -2500,10 +2499,11 @@ fi
fi fi
if test "x$enable_debug" = "xyes"; then 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 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 fi
RUST_SURICATA_LIB="${RUST_SURICATA_LIBDIR}/${RUST_SURICATA_LIBNAME}"
RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}" RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}"
CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen -I\${srcdir}/../rust/dist" CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen -I\${srcdir}/../rust/dist"
@ -2780,6 +2780,7 @@ AC_SUBST(CONFIGURE_LOCALSTATEDIR)
AC_SUBST(CONFIGURE_DATAROOTDIR) AC_SUBST(CONFIGURE_DATAROOTDIR)
AC_SUBST(PACKAGE_VERSION) AC_SUBST(PACKAGE_VERSION)
AC_SUBST(RUST_FEATURES) 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(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/.cargo/config)
AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile) AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile)

@ -45,6 +45,10 @@ else
$(CARGO) build $(RELEASE) $(NIGHTLY_ARGS) \ $(CARGO) build $(RELEASE) $(NIGHTLY_ARGS) \
--features "$(RUST_FEATURES)" $(RUST_TARGET) --features "$(RUST_FEATURES)" $(RUST_TARGET)
endif 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 $(MAKE) gen/rust-bindings.h
clean-local: clean-local:

Loading…
Cancel
Save