[vlc-commits] [Git][videolan/vlc][master] 6 commits: contrib: rust: don't download the (cross) compiler if they are missing
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Aug 8 15:43:37 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
b1d1ac04 by Steve Lhomme at 2024-08-08T14:24:24+00:00
contrib: rust: don't download the (cross) compiler if they are missing
Only rely on the environment having the proper Rust toolchain
available.
- - - - -
cb76da31 by Steve Lhomme at 2024-08-08T14:24:24+00:00
contrib: rust: only build rust code if the (cross) compiler is supported
It's currently neither mandatory nor configurable to compile Rust contribs.
- - - - -
ef3f0fb2 by Steve Lhomme at 2024-08-08T14:24:24+00:00
Revert "configure: use CARGO_HOME from contribs if it's not set"
This reverts commit b7e7305e92eba8e40ca624b1817938bdcfce0bb5.
- - - - -
45615bbf by Steve Lhomme at 2024-08-08T14:24:24+00:00
Revert "configure: detect RUSTUP_HOME when cross compiling Rust"
This reverts commit 004e198006c0b96513e5bc5bb1ce94c3c0f73c6f.
- - - - -
0968451f by Steve Lhomme at 2024-08-08T14:24:24+00:00
Revert "rust: use the RUST_ENV to call cargo for building"
This reverts commit bfe0a6e77f8849ed84e98d9ecaa950bacdedb10e.
- - - - -
a3d8ad98 by Steve Lhomme at 2024-08-08T14:24:24+00:00
Revert "configure: detect rustc can compile for our target"
This reverts commit 1a50809cefd0adb54cfb7248a1f5973539a58d43.
- - - - -
9 changed files:
- configure.ac
- contrib/cargo-vendor-archive.sh
- contrib/src/cargo-c/rules.mak
- contrib/src/main-rust.mak
- contrib/src/rav1e/rules.mak
- − contrib/src/rustc/rules.mak
- − contrib/src/rustup/SHA512SUMS
- − contrib/src/rustup/rules.mak
- src/rust/Makefile.am
Changes:
=====================================
configure.ac
=====================================
@@ -1931,19 +1931,7 @@ AS_IF([test "${enable_rust}" = "yes"],[
AC_MSG_ERROR([Unsupported Rust target for ${host}])
])
- AS_IF([test -z "${CARGO_HOME}" -a "${host}" != "${build}"],[
- AC_MSG_CHECKING([CARGO_HOME from contribs])
- AS_IF([test -d "${CONTRIB_DIR}/../bin/.cargo"],[
- CARGO_HOME=$(cd "${CONTRIB_DIR}/../bin/.cargo" && pwd -P)
- AC_MSG_RESULT([${CARGO_HOME}])
- ],[
- AC_MSG_RESULT([not found])
- ])
- ])
-
- RUST_ENV=
AS_IF([test -n "${CARGO_HOME}"],[
- RUST_ENV="${RUST_ENV} CARGO_HOME=\"${CARGO_HOME}\""
AS_IF([test -x "${CARGO_HOME}/bin/cargo"],[
ac_cv_prog_CARGO="${CARGO_HOME}/bin/cargo"
])
@@ -1952,43 +1940,25 @@ AS_IF([test "${enable_rust}" = "yes"],[
])
])
- AS_IF([test "${host}" != "${build}"],[
- dnl RUSTUP_HOME is needed to cross-compile Rust
- AS_IF([test -z "${RUSTUP_HOME}"],[
- AC_MSG_CHECKING([RUSTUP_HOME from contribs])
- AS_IF([test -d "${CONTRIB_DIR}/../bin/.rustup"],[
- RUSTUP_HOME=$(cd "${CONTRIB_DIR}/../bin/.rustup" && pwd -P)
- AC_MSG_RESULT([${RUSTUP_HOME}])
- ],[
- AC_MSG_RESULT([not found])
- ])
- ])
- ])
-
- AS_IF([test -n "${RUSTUP_HOME}"],[
- RUST_ENV="${RUST_ENV} RUSTUP_HOME=\"${RUSTUP_HOME}\""
- ])
-
AC_CHECK_PROGS(RUSTC, [rustc], [no])
AS_IF([test "$RUSTC" = "no"],[
AC_MSG_ERROR([rustc not found but required to build Rust modules])
])
AC_MSG_CHECKING([Rust compiler supports ${rust_target}])
- ac_try="echo 'fn main() {}' | ${RUST_ENV} \"${RUSTC}\" --target=${rust_target} --emit=dep-info - -o -"
+ ac_try="echo 'fn main() {}' | \"${RUSTC}\" --target=${rust_target} --emit=dep-info - -o -"
(eval "$ac_try") 2>&5
ac_status=$?
AS_IF([test $ac_status = 0],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
- AC_MSG_ERROR([Required target ${rust_target} missing (using ${RUST_ENV})])
+ AC_MSG_ERROR([Required target ${rust_target} missing])
])
AC_CHECK_PROGS(CARGO, [cargo], [no])
AS_IF([test "$CARGO" = "no"],[
AC_MSG_ERROR([cargo not found. cargo is required to build Rust modules])
])
- AC_SUBST([RUST_ENV])
AC_DEFINE(ENABLE_RUST, 1, [Define to 1 for building rust modules.])
])
AM_CONDITIONAL([HAVE_RUST], [test "${enable_rust}" = "yes"])
=====================================
contrib/cargo-vendor-archive.sh
=====================================
@@ -17,13 +17,7 @@ if [ "x$1" = "x" ]; then
fi
# Setup cargo path
-CARGO=
-if [ -d "$(dirname $0)/bin/.cargo" ];then
- CARGO_HOME=$(cd $(dirname $0)/bin/.cargo && pwd)
- CARGO="CARGO_HOME=\"${CARGO_HOME}\" \"${CARGO_HOME}/bin/cargo\""
-else
- CARGO=cargo
-fi
+CARGO=cargo
# Extract archive into a tmp dir
TMP_DIR=.tmp-$(basename $1)
=====================================
contrib/src/cargo-c/rules.mak
=====================================
@@ -11,8 +11,6 @@ endif
endif
-DEPS_cargo-c = rustc $(DEPS_rustc)
-
.sum-cargo-c:
touch $@
=====================================
contrib/src/main-rust.mak
=====================================
@@ -49,14 +49,11 @@ ifneq ($(RUST_HOST),FAIL)
# Supporting a Tier 3 platform means building an untested rust toolchain.
# TODO Let's hope tvOS move from Tier 3 to Tier 2 before the VLC 4.0 release.
ifneq ($(RUST_TARGET),FAIL)
+ifeq ($(call system_tool_matches_min, echo 'fn main() {}' | rustc --target=$(RUST_TARGET) --emit=dep-info - -o /dev/null 2>/dev/null && rustc --version,$(RUST_VERSION_MIN)),)
BUILD_RUST="1"
endif
endif
-
-RUSTUP_HOME?= $(BUILDBINDIR)/.rustup
-CARGO_HOME ?= $(BUILDBINDIR)/.cargo
-
-RUST_ENV = RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME)
+endif
RUSTFLAGS := -C panic=abort
ifndef WITH_OPTIMIZATION
@@ -76,15 +73,8 @@ CARGO_ENV = TARGET_CC="$(CC)" TARGET_AR="$(AR)" TARGET_RANLIB="$(RANLIB)" \
CARGO_ENV_NATIVE = TARGET_CC="$(BUILDCC)" TARGET_AR="$(BUILDAR)" TARGET_RANLIB="$(BUILDRANLIB)" \
TARGET_CFLAGS="$(BUILDCFLAGS)"
-ifneq ($(call system_tool_majmin, cargo --version),)
-CARGO = $(RUST_ENV) $(CARGO_ENV) cargo
-CARGO_NATIVE = $(RUST_ENV) $(CARGO_ENV_NATIVE) cargo
-else
-CARGO = . $(CARGO_HOME)/env && \
- $(RUST_ENV) $(CARGO_ENV) cargo
-CARGO_NATIVE = . $(CARGO_HOME)/env && \
- $(RUST_ENV) $(CARGO_ENV_NATIVE) cargo
-endif
+CARGO = $(CARGO_ENV) cargo
+CARGO_NATIVE = $(CARGO_ENV_NATIVE) cargo
CARGO_INSTALL_ARGS = --target=$(RUST_TARGET) --prefix=$(PREFIX) \
--library-type staticlib --profile=$(CARGO_PROFILE)
=====================================
contrib/src/rav1e/rules.mak
=====================================
@@ -21,20 +21,10 @@ $(TARBALLS)/rav1e-$(RAV1E_VERSION).tar.gz:
RAV1E_FEATURES=--features=asm
-# we may not need cargo if the tarball is downloaded, but it will be needed by rav1e anyway
-ifdef HAVE_CROSS_COMPILE
-DEPS_rav1e = rustc-cross $(DEPS_rustc-cross)
-else
-DEPS_rav1e = rustc $(DEPS_rustc)
-endif
-DEPS_vendor-rav1e = rustc $(DEPS_rustc)
-DEPS_rav1e += vendor-rav1e $(DEPS_vendor-rav1e) cargo-c $(DEPS_cargo-c)
+DEPS_rav1e = vendor-rav1e $(DEPS_vendor-rav1e) cargo-c $(DEPS_cargo-c)
# vendor-rav1e
-ifneq ($(call system_tool_matches_min, rustc --version,$(RUST_VERSION_MIN)),)
-$(TARBALLS)/rav1e-$(RAV1E_VERSION)-vendor.tar.bz2: .rustc
-endif
$(TARBALLS)/rav1e-$(RAV1E_VERSION)-vendor.tar.bz2: .sum-rav1e
$(call download_vendor,rav1e-$(RAV1E_VERSION)-vendor.tar.bz2,rav1e,rav1e-$(RAV1E_VERSION).tar.gz)
=====================================
contrib/src/rustc/rules.mak deleted
=====================================
@@ -1,54 +0,0 @@
-# rustc+cargo installation via rustup
-
-RUST_VERSION=1.79.0
-
-ifdef BUILD_RUST
-PKGS_TOOLS += rustc
-
-ifdef HAVE_CROSS_COMPILE
-PKGS_TOOLS += rustc-cross
-PKGS_ALL += rustc-cross
-endif
-
-ifneq ($(call system_tool_version, rustup --version, cat),)
-RUSTUP = $(RUST_ENV) rustup
-else
-RUSTUP = . $(CARGO_HOME)/env && \
- $(RUST_ENV) rustup
-endif
-
-ifeq ($(call system_tool_matches_min, echo 'fn main() {}' | rustc --target=$(RUST_HOST) --emit=dep-info - -o /dev/null 2>/dev/null && rustc --version,$(RUST_VERSION_MIN)),)
-PKGS_FOUND += rustc
-ifndef HAVE_CROSS_COMPILE
-RUST_ENV=
-endif
-else
-DEPS_rustc = rustup $(DEPS_rustup)
-endif
-ifeq ($(call system_tool_matches_min, echo 'fn main() {}' | rustc --target=$(RUST_TARGET) --emit=dep-info - -o /dev/null 2>/dev/null && rustc --version,$(RUST_VERSION_MIN)),)
-PKGS_FOUND += rustc-cross
-ifdef HAVE_CROSS_COMPILE
-RUST_ENV=
-endif
-endif
-
-endif
-
-DEPS_rustc-cross = rustc $(DEPS_rustc) rustup $(DEPS_rustup)
-
-.sum-rustc:
- touch $@
-
-.sum-rustc-cross:
- touch $@
-
-.rustc:
- +$(RUSTUP) set profile minimal
- +$(RUSTUP) default $(RUST_VERSION)
- touch $@
-
-.rustc-cross:
- +$(RUSTUP) set profile minimal
- +$(RUSTUP) default $(RUST_VERSION)
- +$(RUSTUP) target add --toolchain $(RUST_VERSION) $(RUST_TARGET)
- touch $@
=====================================
contrib/src/rustup/SHA512SUMS deleted
=====================================
@@ -1 +0,0 @@
-e0494678b7117464665c2aa88165e13baf2dcfb2a33c57dc78f669533111f773724d227ee05967de427845f8633e56fdf8159c7a5b96638413710beacb115075 rustup-1.27.1.tar.gz
=====================================
contrib/src/rustup/rules.mak deleted
=====================================
@@ -1,38 +0,0 @@
-# rustup
-
-RUSTUP_VERSION := 1.27.1
-RUSTUP_URL := $(GITHUB)/rust-lang/rustup/archive/refs/tags/$(RUSTUP_VERSION).tar.gz
-
-ifdef BUILD_RUST
-PKGS_TOOLS += rustup
-
-ifneq ($(call system_tool_version, rustup --version, cat),)
-PKGS_FOUND += rustup
-endif
-
-endif
-
-$(TARBALLS)/rustup-$(RUSTUP_VERSION).tar.gz:
- $(call download_pkg,$(RUSTUP_URL),rustup)
-
-.sum-rustup: rustup-$(RUSTUP_VERSION).tar.gz
-
-rustup: rustup-$(RUSTUP_VERSION).tar.gz .sum-rustup
- $(UNPACK)
- $(MOVE)
-
-# Test if we can use the host libssl library
-ifeq ($(shell unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH; \
- pkg-config "openssl >= 1.0.1" 2>/dev/null || \
- pkg-config "libssl >= 2.5" 2>/dev/null || echo FAIL),)
-CARGOC_FEATURES=
-else
-# Otherwise, let cargo build and statically link its own openssl
-CARGOC_FEATURES=--features=cargo/vendored-openssl
-endif
-
-.rustup: rustup
- cd $< && RUSTUP_INIT_SKIP_PATH_CHECK=yes \
- $(RUST_ENV) \
- ./rustup-init.sh --no-modify-path -y --default-toolchain none
- touch $@
=====================================
src/rust/Makefile.am
=====================================
@@ -8,7 +8,7 @@ vlcrs-messages.cargo:
vlcrs-plugin.cargo:
vlcrs-utils.cargo:
(cd $(top_srcdir)/src/rust/$(@:.cargo=) && env top_builddir="${abs_top_builddir}" \
- $(RUST_ENV) $(CARGO) build --target=$(RUST_TARGET))
+ $(CARGO) build --target=$(RUST_TARGET))
if HAVE_RUST
TESTS += \
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e8d326ee01295ae13e28751be0a8e5d88f9171dc...a3d8ad981901d8b17365ecdb55e3509bc33b49a3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e8d326ee01295ae13e28751be0a8e5d88f9171dc...a3d8ad981901d8b17365ecdb55e3509bc33b49a3
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list