Skip to content

Commit

Permalink
Use self contained rust toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl committed May 2, 2023
1 parent 177f5b2 commit 13fc2a2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,9 @@ AC_SUBST(HAVE_O_CLOEXEC)
AC_SUBST(HAVE_BUILTIN_PREFETCH)
AC_SUBST(HAVE_MM_PREFETCH)
AC_SUBST(HAVE_STRONG_GETAUXVAL)
AC_SUBST(RUSTUP_HOME,[$RUSTUP_HOME])
AC_SUBST(CARGO_HOME,[$CARGO_HOME])
AC_SUBST(CARGO,[$CARGO])

case $host in
x86_64-pc-linux-gnu)
Expand Down Expand Up @@ -1508,4 +1511,9 @@ echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_CFLAGS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
echo " ARFLAGS = $ARFLAGS"
echo " RUSTUP_HOME = $RUSTUP_HOME"
echo " CARGO = $CARGO"
echo " CARGO_HOME = $CARGO_HOME"
echo " RUST_DEBUG = $RUST_DEBUG"
echo " RUST_TARGET = $RUST_TARGET"
echo
8 changes: 8 additions & 0 deletions depends/config.site.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,11 @@ fi
if test -n "@LDFLAGS@"; then
LDFLAGS="@LDFLAGS@ $LDFLAGS"
fi

# TODO: Should we pick these up from configure as the source
# and use that during depends?
# Is it overridable with local defaults?

CARGO=$depends_prefix/bin/cargo
CARGO_HOME=$depends_prefix/
RUSTUP_HOME=$depends_prefix/.rustup
16 changes: 11 additions & 5 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# TODO: Refine these vars with graceful swichover to local and
# ensure it works without them set as well as with them set
CARGO_HOME ?=
RUSTUP_HOME ?=
CARGO ?= cargo
CARGO_HOME ?= $(CARGO_HOME)
RUSTUP_HOME ?= $(RUSTUP_HOME)

# RUST_TARGET is set from configure
TARGET ?= $(RUST_TARGET)
TARGET ?= x86_64-unknown-linux-gnu
TARGET = $(if $(RUST_TARGET),$(RUST_TARGET),x86_64-unknown-linux-gnu)

# This is set from configure
RUST_DEBUG ?=
Expand All @@ -21,7 +22,10 @@ CARGO_MANIFEST_PATH = $(abs_srcdir)/Cargo.toml

.PHONY:
all:
DESTDIR= TARGET_DIR=$(TARGET_DIR) $(CARGO) build \
DESTDIR= TARGET_DIR=$(TARGET_DIR) \
RUSTUP_HOME=$(RUSTUP_HOME) \
CARGO_HOME=$(CARGO_HOME) \
$(CARGO) build \
--manifest-path "$(CARGO_MANIFEST_PATH)" \
--target-dir "$(TARGET_DIR)" \
$(if $(DEBUG),,--release) \
Expand All @@ -30,6 +34,8 @@ all:

.PHONY:
clean-local:
RUSTUP_HOME=$(RUSTUP_HOME) \
CARGO_HOME=$(CARGO_HOME) \
$(CARGO) clean \
--manifest-path "$(CARGO_MANIFEST_PATH)" \
--target-dir "$(TARGET_DIR)" && \
Expand Down

0 comments on commit 13fc2a2

Please sign in to comment.