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 rust2 #1363

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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])
RUSTC_PLATFORM=no
if test x"$RUSTC_CMD" != x""; then
# 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
# and x86_64-apple-darwin instead of x86_64-apple-darwin22.6.0
AC_MSG_CHECKING([rustc --target argument])
candidate1=`echo "$host" | sed -e 's/armv\(@<:@0-9@:>@\)l-/armv\1-/' | sed -e 's/-darwin@<:@0-9.@:>@*/-darwin/'`
candidate2=`echo "$host_cpu"-unknown-"$host_os" | sed -e 's/armv\(@<:@0-9@:>@\)l-/armv\1-/' | sed -e 's/-darwin@<:@0-9.@:>@*/-darwin/'`
for candidate in $host $candidate1 $candidate2; do
if "$RUSTC_CMD" --print target-list | $GREP "^$candidate"'$' > /dev/null; then
RUSTC_PLATFORM="$candidate"
fi
done
if test x"$RUSTC_PLATFORM" = x"no"; then
AC_MSG_ERROR("$RUSTC_CMD knows none of $host $candidate1 $candidate2")
fi
AC_MSG_RESULT(["$RUSTC_PLATFORM"])
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 @@ -126,11 +126,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
Loading