Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cross compilation in rust-related Makefile parts #1360

Merged
merged 1 commit into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,32 @@ AC_PROG_INSTALL
AC_PROG_RANLIB
AM_PROG_AR
AC_PROG_LN_S
AC_PROG_GREP
AC_PROG_MAKE_SET

AC_PATH_PROG(BASH, [bash])
AC_PATH_PROG(CARGO_CMD, [cargo])
AC_PATH_PROG(RUSTC_CMD, [rustc])
if test x"$RUSTC_CMD" == x""; then
RUSTC_PLATFORM=no
else
# for example, rustc expects x86_64-unknown-linux-gnu instead of x86_64-pc-linux-gnu
# and armv7-unknown-linux-gnueabihf instead of armv7l-unknown-linux-gnueabihf
AC_MSG_CHECKING([rustc --target argument])
if "$RUSTC_CMD" --print target-list | $GREP "$host" > /dev/null; then
RUSTC_PLATFORM="$host"
else
candidate=`echo "$host_cpu"-unknown-"$host_os" | sed -e 's/armv\(.\)l-/armv\1-/'`
if "$RUSTC_CMD" --print target-list | $GREP "$candidate" > /dev/null; then
RUSTC_PLATFORM="$candidate"
else
AC_MSG_ERROR("$RUSTC_CMD knows neither $host nor $candidate")
fi
AC_MSG_RESULT(["$RUSTC_PLATFORM"])
fi
fi
AC_SUBST(RUSTC_PLATFORM)

AC_PATH_PROG(BZIP2_CMD, [bzip2])
AC_PATH_PROG(RE2C_CMD, [re2c])
AM_CONDITIONAL(HAVE_RE2C, test x"$RE2C_CMD" != x"")
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ AM_CXXFLAGS = $(CODE_COVERAGE_CXXFLAGS) $(USER_CXXFLAGS)
if HAVE_CARGO
RUST_DEPS_CPPFLAGS = -DHAVE_RUST_DEPS=1
PRQLC_DIR = third-party/prqlc-c/target
RUST_DEPS_LIBS = $(PRQLC_DIR)/release/libprqlc_c.a
RUST_DEPS_LIBS = $(PRQLC_DIR)/$(RUSTC_PLATFORM)/release/libprqlc_c.a

$(RUST_DEPS_LIBS): $(srcdir)/third-party/prqlc-c/src/lib.rs $(srcdir)/third-party/prqlc-c/Cargo.toml
mkdir -p $(PRQLC_DIR)
env CARGO_TARGET_DIR=third-party/prqlc-c/target $(CARGO_CMD) build --manifest-path \
env CARGO_TARGET_DIR=third-party/prqlc-c/target $(CARGO_CMD) build --target $(RUSTC_PLATFORM) --manifest-path \
$(srcdir)/third-party/prqlc-c/Cargo.toml --package prqlc-c --release

else
Expand Down