[vlc-commits] [Git][videolan/vlc][master] 13 commits: contrib: cargo: add the internal rustup target to PKGS_TOOLS

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jul 3 09:03:38 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
38030bc0 by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: cargo: add the internal rustup target to PKGS_TOOLS

It's a native tool installed in BUILDBINDIR.

- - - - -
e504c4f6 by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: cargo: update rustup to 1.27.1

- - - - -
55562e3a by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: don't keep a bogus vendor tarball

It breaks further dependencies.

- - - - -
4acf03af by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: rav1e-vendor: remove hash for a file we don't use anymore

- - - - -
32c2ec5c by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: rav1e: use proper dependencies between packages

- - - - -
243e0bd3 by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: rav1e: use the vendor directory in the right place

Now it's in rav1e-vendor/vendor.

- - - - -
00ff465b by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: rav1e-vendor: build locally if not downloaded

If the tarball is not there, it will be built in a temporary directory and
put the the tarballs folder for future use.

We don't generate/keep the sha512sum since we build it locally, we just trust
it. Once that tarball is uploaded to the videolan contribs we can add a hash
to verify that download.

Rebuilding depends on .sum-rav1e so that we are using only a rav1e package with
the proper checksum.

Once we have the tarball we extract it so it has a rav1e-vendor/vendor
directory hierarchy.

- - - - -
07438785 by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: rav1e: move the vendor package in the rav1e makefile

There is no guarantee that RAV1E_VERSION will be defined when rav1e-vendor is included.

- - - - -
4b9cab55 by Steve Lhomme at 2024-07-03T08:19:50+00:00
Revert "contrib: rust: skip if clang on win32/64"

This reverts commit 223174d9a58d550527e990b73b086ee0ae604994.

- - - - -
a8576732 by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: cargo: extract rustup in cargo folder to match the job name

- - - - -
05a629c1 by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: cargo: install the minimum required to build Rust code

We don't need IDE or debugger support.

- - - - -
a29dc004 by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: rav1e: delete vendor build folder if building is needed

If there was a previous build left, we should not reuse it.
We do it outside of the target otherwise it's considered the target is already built and won't be rebuilt.

- - - - -
32512308 by Steve Lhomme at 2024-07-03T08:19:50+00:00
contrib: rav1e: do the vendoring untar/build during the build phase

It should not be done during the "make fetch" phase.
For example the "cargo" dependency of DEPS_rav1e-vendor is not taken in account
during the fetch phase.

- - - - -


6 changed files:

- contrib/src/cargo/SHA512SUMS
- contrib/src/cargo/rules.mak
- contrib/src/main-rust.mak
- − contrib/src/rav1e-vendor/SHA512SUMS
- − contrib/src/rav1e-vendor/rules.mak
- contrib/src/rav1e/rules.mak


Changes:

=====================================
contrib/src/cargo/SHA512SUMS
=====================================
@@ -1 +1 @@
-a77cb34ba0c2e7577c8acbd474197aabaa84e3b64b3c42f1d0c328df55c6accbe412aba9a787f0ea2f0654f085475455c9c488b2b6de34ad8889a2716d1e8d0c  rustup-1.25.1.tar.gz
+e0494678b7117464665c2aa88165e13baf2dcfb2a33c57dc78f669533111f773724d227ee05967de427845f8633e56fdf8159c7a5b96638413710beacb115075  rustup-1.27.1.tar.gz


=====================================
contrib/src/cargo/rules.mak
=====================================
@@ -2,18 +2,20 @@
 
 RUST_VERSION=1.75.0
 CARGOC_VERSION=0.9.29
-RUSTUP_VERSION=1.25.1
-RUSTUP_URL=$(GITHUB)/rust-lang/rustup/archive/$(RUSTUP_VERSION).tar.gz
+RUSTUP_VERSION := 1.27.1
+RUSTUP_URL := $(GITHUB)/rust-lang/rustup/archive/refs/tags/$(RUSTUP_VERSION).tar.gz
+
+PKGS_TOOLS += cargo
 
 RUSTUP = . $(CARGO_HOME)/env && \
 	RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) rustup
 
 $(TARBALLS)/rustup-$(RUSTUP_VERSION).tar.gz:
-	$(call download_pkg,$(RUSTUP_URL),rustup)
+	$(call download_pkg,$(RUSTUP_URL),cargo)
 
 .sum-cargo: rustup-$(RUSTUP_VERSION).tar.gz
 
-rustup: rustup-$(RUSTUP_VERSION).tar.gz .sum-cargo
+cargo: rustup-$(RUSTUP_VERSION).tar.gz .sum-cargo
 	$(UNPACK)
 	$(MOVE)
 
@@ -29,10 +31,10 @@ endif
 
 # When needed (when we have a Rust dependency not using cargo-c), the cargo-c
 # installation should go in a different package
-.cargo: rustup
+.cargo: cargo
 	cd $< && RUSTUP_INIT_SKIP_PATH_CHECK=yes \
 	  RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) \
-	  ./rustup-init.sh --no-modify-path -y --default-toolchain $(RUST_VERSION)
+	  ./rustup-init.sh --no-modify-path -y --default-toolchain $(RUST_VERSION) --profile minimal
 	+$(RUSTUP) default $(RUST_VERSION)
 	+$(RUSTUP) target add $(RUST_TARGET)
 	+unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH CFLAGS CPPFLAGS LDFLAGS; \


=====================================
contrib/src/main-rust.mak
=====================================
@@ -5,7 +5,6 @@
 
 ifdef HAVE_WIN32
 ifndef HAVE_WINSTORE
-ifndef HAVE_CLANG # FIXME: this could be refined to only skip if LLVM linker is < 15
 ifeq ($(HOST),i686-w64-mingw32)
 RUST_TARGET = i686-pc-windows-gnu # ARCH is i386
 else ifeq ($(HOST),x86_64-w64-mingw32)
@@ -14,7 +13,6 @@ else
 # Not supported on armv7/aarch64 yet
 endif
 endif
-endif
 else ifdef HAVE_ANDROID
 RUST_TARGET = $(HOST)
 else ifdef HAVE_IOS
@@ -96,7 +94,7 @@ download_vendor = \
                echo "" && \
                echo "WARNING: cargo vendor archive for $(1) not found" && \
                echo "" && \
-               touch $@);
+               rm $@);
 
 # Extract and move the vendor archive if the checksum is valid. Succeed even in
 # case of error (download or checksum failed). In that case, the cargo-vendor
@@ -108,12 +106,10 @@ download_vendor = \
 		  mv $(patsubst %.tar.bz2,%,$(notdir $(f))) $(patsubst .%,%,$@))
 	touch $@
 
-CARGO_VENDOR_SETUP = \
-	if test -d $@-vendor; then \
-		mkdir -p $(UNPACK_DIR)/.cargo; \
-		echo "[source.crates-io]" > $(UNPACK_DIR)/.cargo/config.toml; \
-		echo "replace-with = \"vendored-sources\"" >> $(UNPACK_DIR)/.cargo/config.toml; \
-		echo "[source.vendored-sources]" >> $(UNPACK_DIR)/.cargo/config.toml; \
-		echo "directory = \"../$@-vendor\"" >> $(UNPACK_DIR)/.cargo/config.toml; \
-		echo "Using cargo vendor archive for $(UNPACK_DIR)"; \
-	fi;
+cargo_vendor_setup = \
+	mkdir -p $1/.cargo; \
+	echo "[source.crates-io]" > $1/.cargo/config.toml; \
+	echo "replace-with = \"vendored-sources\"" >> $1/.cargo/config.toml; \
+	echo "[source.vendored-sources]" >> $1/.cargo/config.toml; \
+	echo "directory = \"../$2-vendor\"" >> $1/.cargo/config.toml; \
+	echo "Using cargo vendor archive for $2";


=====================================
contrib/src/rav1e-vendor/SHA512SUMS deleted
=====================================
@@ -1 +0,0 @@
-33527a381fe402fc7372ad853d0fb3a15c9ea0be45ff288c41621a979f97967d187f3694f2e2cb2f84af774bbf444ae2d2e22ce3237d76e427b746b03602afc8  rav1e-0.3.4-vendor.tar.bz2


=====================================
contrib/src/rav1e-vendor/rules.mak deleted
=====================================
@@ -1,6 +0,0 @@
-# rav1e-vendor
-
-$(TARBALLS)/rav1e-$(RAV1E_VERSION)-vendor.tar.bz2:
-	$(call download_vendor,rav1e-$(RAV1E_VERSION)-vendor.tar.bz2,rav1e)
-
-.rav1e-vendor: rav1e-$(RAV1E_VERSION)-vendor.tar.bz2


=====================================
contrib/src/rav1e/rules.mak
=====================================
@@ -8,6 +8,7 @@ ifdef BUILD_ENCODERS
 # Rav1e is not linking correctly on iOS arm64
 ifndef HAVE_IOS
 PKGS += rav1e
+PKGS_ALL += rav1e-vendor
 endif
 endif
 endif
@@ -23,17 +24,54 @@ $(TARBALLS)/rav1e-$(RAV1E_VERSION).tar.gz:
 
 RAV1E_FEATURES=--features=asm
 
-rav1e: rav1e-$(RAV1E_VERSION).tar.gz .sum-rav1e .rav1e-vendor
+# we may not need cargo if the tarball is downloaded, but it will be needed by rav1e anyway
+DEPS_rav1e-vendor = cargo $(DEPS_cargo)
+DEPS_rav1e = rav1e-vendor $(DEPS_rav1e-vendor) cargo $(DEPS_cargo)
+
+# rav1e-vendor
+
+rav1e-vendor-build: .sum-rav1e
+	mkdir -p $@
+	tar xzfo $(TARBALLS)/rav1e-$(RAV1E_VERSION).tar.gz -C $@ --strip-components=1
+	cd $@ && $(CARGO) vendor --locked rav1e-$(RAV1E_VERSION)-vendor
+	cd $@ && tar -jcf rav1e-$(RAV1E_VERSION)-vendor.tar.bz2 rav1e-$(RAV1E_VERSION)-vendor
+	install $@/rav1e-$(RAV1E_VERSION)-vendor.tar.bz2 "$(TARBALLS)"
+	# cd $@ && sha512sum rav1e-$(RAV1E_VERSION)-vendor.tar.bz2 > SHA512SUMS
+	# install $@/SHA512SUMS $(SRC)/rav1e-vendor/SHA512SUMS
+	$(RM) -R $@
+
+$(TARBALLS)/rav1e-$(RAV1E_VERSION)-vendor.tar.bz2:
+	-$(call download_vendor,rav1e-$(RAV1E_VERSION)-vendor.tar.bz2,rav1e)
+
+.sum-rav1e-vendor: rav1e-$(RAV1E_VERSION)-vendor.tar.bz2
+	touch $@
+
+rav1e-vendor: rav1e-$(RAV1E_VERSION)-vendor.tar.bz2 .sum-rav1e-vendor
+	$(UNPACK)
+	$(MOVE)
+
+.rav1e-vendor: $(if $(shell test -s "$(TARBALLS)/rav1e-$(RAV1E_VERSION)-vendor.tar.bz2"), rav1e-vendor)
+	# if the vendor tarball doesn't exist yet, we build it and extract it
+	if test ! -s "$(TARBALLS)/rav1e-$(RAV1E_VERSION)-vendor.tar.bz2"; then \
+		$(RM) -R rav1e-vendor-build; \
+		$(MAKE) rav1e-vendor-build; \
+		$(MAKE) rav1e-vendor; \
+	fi
+	touch $@
+
+# rav1e
+
+rav1e: rav1e-$(RAV1E_VERSION).tar.gz .sum-rav1e
 	$(UNPACK)
 ifdef HAVE_WIN32
 ifndef HAVE_WIN64
 	$(APPLY) $(SRC)/rav1e/unwind-resume-stub.patch
 endif
 endif
-	$(CARGO_VENDOR_SETUP)
+	$(call cargo_vendor_setup,$(UNPACK_DIR),$@)
 	$(MOVE)
 
-.rav1e: rav1e .cargo
+.rav1e: rav1e
 	+cd $< && $(CARGOC_INSTALL) --no-default-features $(RAV1E_FEATURES)
 # No gcc in Android NDK25
 ifdef HAVE_ANDROID



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2c6d9de9f66aefb639ac8f00af7b030760cce294...325123084b2529634bb5e203416712e21f91bf25

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2c6d9de9f66aefb639ac8f00af7b030760cce294...325123084b2529634bb5e203416712e21f91bf25
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