Skip to content

Commit

Permalink
fix(build): Support cross-compilation of Rust binaries (sile-typesett…
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque authored Nov 25, 2024
1 parent 960c748 commit 19c7c1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ CARGO_FEATURE_ARGS += --features variations
endif

rusile.so: $(rusile_so_SOURCES) $(bin_PROGRAMS)
$(CARGO_ENV) $(CARGO) build $(CARGO_VERBOSE) $(RUSILE_FEATURE_ARG) $(CARGO_RELEASE_ARGS) -p rusile
$(CARGO_ENV) $(CARGO) build $(CARGO_VERBOSE) --target $(CARGO_TARGET_TRIPLE) $(RUSILE_FEATURE_ARG) $(CARGO_RELEASE_ARGS) -p rusile
$(INSTALL) @builddir@/target/@RUST_TARGET_SUBDIR@/lib$@ $@

DEPDIR := .deps
Expand Down
4 changes: 2 additions & 2 deletions build-aux/que_rust_boilerplate.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ $(COMPLETIONS_OUT_DIR)/_$(TRANSFORMED_PACKAGE_NAME): $(CARGO_BIN) | $(COMPLETION
$(_RUST_OUT) $(CARGO_BIN): $(@PACKAGE_VAR@_SOURCES) $(nodist_@PACKAGE_VAR@_SOURCES) $(EXTRA_@PACKAGE_VAR@_SOURCES)
set -e
export AUTOTOOLS_DEPENDENCIES="$^"
$(CARGO_ENV) $(CARGO) build $(CARGO_VERBOSE) $(CARGO_FEATURE_ARGS) $(CARGO_RELEASE_ARGS)
$(CARGO_ENV) $(CARGO) build --quiet --message-format=json $(CARGO_FEATURE_ARGS) $(CARGO_RELEASE_ARGS) | \
$(CARGO_ENV) $(CARGO) build $(CARGO_VERBOSE) --target $(CARGO_TARGET_TRIPLE) $(CARGO_FEATURE_ARGS) $(CARGO_RELEASE_ARGS)
$(CARGO_ENV) $(CARGO) build --target $(CARGO_TARGET_TRIPLE) --quiet --message-format=json $(CARGO_FEATURE_ARGS) $(CARGO_RELEASE_ARGS) | \
$(JQ) -sr 'map(select(.reason == "build-script-executed")) | last | .out_dir' > $(_RUST_OUT)

RUST_DEVELOPER_TARGETS = cargo-test clippy rustfmt
Expand Down
8 changes: 6 additions & 2 deletions build-aux/que_rust_boilerplate.m4
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ AC_DEFUN_ONCE([QUE_RUST_BOILERPLATE], [
QUE_PROGVAR([rustfmt])
])
AC_ARG_VAR(CARGO_TARGET_TRIPLE, "Target triple for Rust compilations")
if test -z "$CARGO_TARGET_TRIPLE"; then
CARGO_TARGET_TRIPLE="$($RUSTC -vV | $SED -n 's/host: //p')"
fi
AC_MSG_CHECKING([whether to build Rust code with debugging information])
AM_COND_IF([DEBUG_RELEASE], [
AC_MSG_RESULT(yes)
RUST_TARGET_SUBDIR=debug
RUST_TARGET_SUBDIR=$CARGO_TARGET_TRIPLE/debug
], [
AC_MSG_RESULT(no)
RUST_TARGET_SUBDIR=release
RUST_TARGET_SUBDIR=$CARGO_TARGET_TRIPLE/release
])
AC_SUBST([RUST_TARGET_SUBDIR])
Expand Down

0 comments on commit 19c7c1d

Please sign in to comment.