[vlc-commits] [Git][videolan/vlc][master] 4 commits: contrib: rust: uniformize toolchain env var usage

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Feb 18 18:45:03 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
ad013c3e by Alaric Senat at 2023-02-18T17:56:43+00:00
contrib: rust: uniformize toolchain env var usage

The toolchain environment variables were missing from `CARGO_INSTALL`.
This patch also removes unecesary exports.

- - - - -
0c48cdef by Alaric Senat at 2023-02-18T17:56:43+00:00
contrib: rust: allow disabling optimizations

This is particularly useful in contrib debugging scenario.

- - - - -
24b99424 by Alaric Senat at 2023-02-18T17:56:43+00:00
contrib: rust: add verbose mode support

- - - - -
63bd2aa0 by Alaric Senat at 2023-02-18T17:56:43+00:00
contrib: rust: add RANLIB to the target toolchain

This was forgotten mainly because rav1e's build script do not use the
ranlib tool.

- - - - -


1 changed file:

- contrib/src/main-rust.mak


Changes:

=====================================
contrib/src/main-rust.mak
=====================================
@@ -53,10 +53,27 @@ endif
 RUSTUP_HOME= $(BUILDBINDIR)/.rustup
 CARGO_HOME = $(BUILDBINDIR)/.cargo
 
-CARGO = . $(CARGO_HOME)/env && RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) cargo
+RUSTFLAGS := -C panic=abort
+ifndef WITH_OPTIMIZATION
+CARGO_PROFILE := "dev"
+RUSTFLAGS += -C opt-level=1
+else
+CARGO_PROFILE := "release"
+RUSTFLAGS += -C opt-level=z
+endif
+
+CARGO_ENV = TARGET_CC="$(CC)" TARGET_AR="$(AR)" TARGET_RANLIB="$(RANLIB)" \
+	TARGET_CFLAGS="$(CFLAGS)" RUSTFLAGS="$(RUSTFLAGS)"
+
+CARGO = . $(CARGO_HOME)/env && \
+		RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) $(CARGO_ENV) cargo
 
 CARGO_INSTALL_ARGS = --target=$(RUST_TARGET) --prefix=$(PREFIX) \
-	--library-type staticlib --release
+	--library-type staticlib --profile=$(CARGO_PROFILE)
+
+ifeq ($(V),1)
+CARGO_INSTALL_ARGS += --verbose
+endif
 
 # Use the .cargo-vendor source if present, otherwise use crates.io
 CARGO_INSTALL_ARGS += \
@@ -64,10 +81,7 @@ CARGO_INSTALL_ARGS += \
 
 CARGO_INSTALL = $(CARGO) install $(CARGO_INSTALL_ARGS)
 
-CARGOC_INSTALL = export TARGET_CC="$(CC)" && export TARGET_AR="$(AR)" && \
-	export TARGET_CFLAGS="$(CFLAGS)" && \
-	export RUSTFLAGS="-C panic=abort -C opt-level=z" && \
-	$(CARGO) capi install $(CARGO_INSTALL_ARGS)
+CARGOC_INSTALL = $(CARGO) capi install $(CARGO_INSTALL_ARGS)
 
 download_vendor = \
 	$(call download,$(CONTRIB_VIDEOLAN)/$(2)/$(1)) || (\



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/999c545e1b0aedc7491c8d2510b7bfb74272f6e0...63bd2aa0f1494ff065277ce74663817935a12c1d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/999c545e1b0aedc7491c8d2510b7bfb74272f6e0...63bd2aa0f1494ff065277ce74663817935a12c1d
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