Make cargo run when srcdir != builddir

Thanks to Jeff Waugh and Hubert Figuière for the trick.
parent f0c11315
......@@ -88,20 +88,22 @@ RUST_SOURCES = \
rust/src/state.rs \
rust/src/strtod.rs
RUST_LIB = rust/target/debug/librsvg_internals.a
RUST_EXTRA = \
rust/Cargo.lock
RUST_LIB = @abs_top_builddir@/target/debug/librsvg_internals.a
check-local:
cd $(srcdir)/rust && \
cargo test
CARGO_TARGET_DIR=@abs_top_builddir@/target cargo test
clean-local:
cd $(srcdir)/rust && \
cargo clean
cd $(top_srcdir)/rust && \
CARGO_TARGET_DIR=@abs_top_builddir@/target cargo clean
.PHONY: $(RUST_LIB)
$(RUST_LIB):
cd $(srcdir)/rust && \
cargo build --verbose
$(RUST_LIB): $(RUST_SOURCES)
cd $(top_srcdir)/rust && \
CARGO_TARGET_DIR=@abs_top_builddir@/target cargo build --verbose
librsvg_@RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
-I$(top_srcdir) \
......@@ -190,6 +192,7 @@ endif # OS_WIN32
EXTRA_DIST = \
$(RUST_SOURCES) \
$(RUST_EXTRA) \
librsvg.doap \
AUTHORS \
NEWS \
......
......@@ -187,6 +187,8 @@ AC_SUBST([gdk_pixbuf_cache_file])
AM_CONDITIONAL([ENABLE_PIXBUF_LOADER],[test "$enable_pixbuf_loader" = "yes"])
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
##########################################################
# Check for -Bsymbolic-functions linker flag used to avoid
# intra-library PLT jumps, if available.
......
......@@ -51,10 +51,31 @@ EXTRA_rsvg_loader_DEPENDENCIES = libpixbufloader-svg.la gdk-pixbuf-loaders
gdk-pixbuf-loaders: Makefile
$(AM_V_GEN) ( $(GDK_PIXBUF_QUERYLOADERS) ./libpixbufloader-svg.la && $(GDK_PIXBUF_QUERYLOADERS)) > gdk-pixbuf.loaders 2>/dev/null
if CROSS_COMPILING
RUN_QUERY_LOADER_TEST=false
else
RUN_QUERY_LOADER_TEST=test -z "$(DESTDIR)"
endif
# The following bit is stolen from gdk-pixbuf/gdk-pixbuf/Makefile.am:
#
# Running this if cross compiling or if DESTDIR is set is going to
# not work at all, so skip it
# We use install-data-hook here to workaround a bug in automake and/or libtool
# that makes the install target for the loader libraries a dependency on
# install-data-am, and not install-exec-am. We need to ensure this gets run
# after the libraries are installed in their final locations.
install-data-hook:
if test -z "$(DESTDIR)"; then \
@if $(RUN_QUERY_LOADER_TEST) ; then \
$(mkinstalldirs) $(DESTDIR)$(gdk_pixbuf_binarydir) ; \
$(GDK_PIXBUF_QUERYLOADERS) > $(DESTDIR)$(gdk_pixbuf_cache_file) ; \
else \
echo "***" ; \
echo "*** Warning: loaders.cache not built" ; \
echo "***" ; \
echo "*** Generate this file manually on host" ; \
echo "*** system using gdk-pixbuf-query-loaders" ; \
echo "***" ; \
fi
CLEANFILES = \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment