[vlc-commits] [Git][videolan/vlc][3.0.x] 9 commits: extras/tools: bootstrap: Build zstd

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jul 18 08:07:21 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
b595131d by Matthias Dressel at 2026-07-18T06:53:04+00:00
extras/tools: bootstrap: Build zstd

When installing the library on macOS there is a race condition around
creating the `build/lib` directory which causes the install to sometimes
fail.
Fortunately, `bsdtar` calls the `zstd` binary directly so we don't
actually need to build the library.

(cherry picked from commit b8f52c7e7fe6f1606ea33afd791eb8503e735c17)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
55bb6c3e by Matthias Dressel at 2026-07-18T06:53:04+00:00
extras/tools: bootstrap: Check zstd version

zstd 1.2.0 introduced `--threads`

[1] https://github.com/facebook/zstd/releases/tag/v1.2.0

(cherry picked from commit 69bfc78c7b3a28c011744a7e33b26edd02c7b6e5)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
bcf167e2 by Matthias Dressel at 2026-07-18T06:53:04+00:00
extras/tools: bootstrap: Check for zstd support in tar

Checking for the typical error messages from GNU tar and bsdtar.

(cherry picked from commit 12a74ad1a62508cab6865a5837bc61278dddc711)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
0e1b996e by Matthias Dressel at 2026-07-18T06:53:04+00:00
extras/tools: bootstrap: Check tar for compression auto-detection

This checks both auto-compress in create mode based on archive suffix
and auto-detection in extract mode based on file magic.

I believe it's reasonable to assume that, if it works for gzip, it works
for all compression schemes.

GNU tar has supported auto-detecting since 1.15 [1] and auto-compress
since 1.20 [2].
bsdtar has supported auto-detecting since before their initial git
commit [3] and auto-compress since 3.1.0 [4].

[1] https://cgit.git.savannah.gnu.org/cgit/tar.git/commit/?id=4674867a23ed4b42b0a84102331d369f6fc7e467
[2] https://cgit.git.savannah.gnu.org/cgit/tar.git/commit/?id=620a136e74f211c2fb98b45fe44261d5d775f6a9
[3] https://github.com/libarchive/libarchive/blob/8f776fd9f7b07842fdb5801af7128808860cbe35/tar/bsdtar.1#L413
[4] https://github.com/libarchive/libarchive/commit/d06fc9e5e4a47d022188d4b10202873c5d995b6e

(cherry picked from commit e0a6f726a66ea369096919f3fd4a696a80cb71fd)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
5c86a467 by Matthias Dressel at 2026-07-18T06:53:04+00:00
contrib: Add ability to unpack zstd compressed tarballs

(cherry picked from commit 3b3952cefbeb161c457259710a894e7856f5b523)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
8065b97e by Matthias Dressel at 2026-07-18T06:53:04+00:00
contrib: Use tar's native change directory feature

Saves spawning a subshell.

(cherry picked from commit 5347d1fa43b22a3ba07577b7c219bec3ed4bd3c6)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
6d248b93 by Matthias Dressel at 2026-07-18T06:53:04+00:00
contrib: Create zstd compressed tarballs instead of bzip2

zstd is much faster and compresses smaller.

zstd level 12 is a good compromise between speed and size. [1]

Piping to `zstd` seems to be the most portable way to pass parameters to
the compression tool.

[1] https://www.arp242.net/cmp-compress.html

(cherry picked from commit 04a63aafc23fdfa3db3a3b08afca1cb1d1ba1aba)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
8dd71e09 by Matthias Dressel at 2026-07-18T06:53:04+00:00
extras/tools: Fix tar compilation

This has been broken since ee9ea36529e70199d5c81894e1e8dae6b7cd4446.

The first instruction in the recipe is `cd $<`.
"'$<' The name of the first prerequisite." [1]

Ref: videolan/vlc!5356
[1] https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html

(cherry picked from commit 98efd7a1cebf707c481557c33d597d89de7b6c0a)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
42ed9e5d by Matthias Dressel at 2026-07-18T06:53:04+00:00
extras/tools: Add ability to unpack zstd compressed tarballs

(cherry picked from commit 598edcb97f3fd525e23ac836e5d7c8c6b55bf318)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


6 changed files:

- contrib/src/main.mak
- extras/ci/gitlab-ci.yml
- extras/tools/SHA512SUMS
- extras/tools/bootstrap
- extras/tools/packages.mak
- extras/tools/tools.mak


Changes:

=====================================
contrib/src/main.mak
=====================================
@@ -407,6 +407,7 @@ UNPACK = $(RM) -R $@ \
 	$(foreach f,$(filter %.tar.gz %.tgz,$^), && tar $(TAR_VERBOSE)xzfo $(f)) \
 	$(foreach f,$(filter %.tar.bz2,$^), && tar $(TAR_VERBOSE)xjfo $(f)) \
 	$(foreach f,$(filter %.tar.xz,$^), && tar $(TAR_VERBOSE)xJfo $(f)) \
+	$(foreach f,$(filter %.tar.zst,$^), && tar $(TAR_VERBOSE)xfo $(f)) \
 	$(foreach f,$(filter %.zip,$^), && unzip $(ZIP_QUIET) $(f) $(UNZIP_PARAMS))
 UNPACK_DIR = $(patsubst %.tar,%,$(basename $(notdir $<)))
 APPLY = (cd $(UNPACK_DIR) && patch -fp1) <
@@ -575,12 +576,12 @@ distclean: clean
 	$(RM) config.mak
 	unlink Makefile
 
-PREBUILT_URL=http://download.videolan.org/pub/videolan/contrib/$(HOST)/vlc-contrib-$(HOST)-latest.tar.bz2
+PREBUILT_URL=http://download.videolan.org/pub/videolan/contrib/$(HOST)/vlc-contrib-$(HOST)-latest.tar.zst
 
-vlc-contrib-$(HOST)-latest.tar.bz2:
+vlc-contrib-$(HOST)-latest.tar.zst:
 	$(call download,$(PREBUILT_URL))
 
-prebuilt: vlc-contrib-$(HOST)-latest.tar.bz2
+prebuilt: vlc-contrib-$(HOST)-latest.tar.zst
 	$(RM) -r $(PREFIX)
 	-$(UNPACK)
 	mv $(HOST) $(PREFIX)
@@ -603,7 +604,7 @@ package: install
 ifneq ($(notdir $(PREFIX)),$(HOST))
 	(cd tmp && mv $(notdir $(PREFIX)) $(HOST))
 endif
-	(cd tmp && tar c $(HOST)/) | bzip2 -c > ../vlc-contrib-$(HOST)-$(DATE).tar.bz2
+	tar -c -C tmp $(HOST)/ | zstd --quiet --force --threads=0 -12 -o ../vlc-contrib-$(HOST)-$(DATE).tar.zst
 
 list:
 	@echo All packages:


=====================================
extras/ci/gitlab-ci.yml
=====================================
@@ -6,11 +6,11 @@ default:
     before_script:
         - set -x
         - export VLC_CONTRIB_SHA="$(extras/ci/get-contrib-sha.sh)"
-        - export VLC_PREBUILT_CONTRIBS_URL="https://artifacts.videolan.org/vlc-3.0/${CI_JOB_NAME##nightly-}/vlc-contrib-${TRIPLET}-${VLC_CONTRIB_SHA}.tar.bz2"
+        - export VLC_PREBUILT_CONTRIBS_URL="https://artifacts.videolan.org/vlc-3.0/${CI_JOB_NAME##nightly-}/vlc-contrib-${TRIPLET}-${VLC_CONTRIB_SHA}.tar.zst"
         - if ! extras/ci/check-url.sh "$VLC_PREBUILT_CONTRIBS_URL"; then unset VLC_PREBUILT_CONTRIBS_URL; fi
     after_script:
         - export VLC_CONTRIB_SHA="$(extras/ci/get-contrib-sha.sh)"
-        - mv contrib/vlc-contrib-*.tar.bz2 contrib/vlc-contrib-${TRIPLET}-${VLC_CONTRIB_SHA}.tar.bz2 2>/dev/null || true
+        - mv contrib/vlc-contrib-*.tar.zst contrib/vlc-contrib-${TRIPLET}-${VLC_CONTRIB_SHA}.tar.zst 2>/dev/null || true
     interruptible: true
 
 variables:
@@ -91,7 +91,7 @@ variables:
         - schedules
     artifacts:
         paths:
-            - contrib/vlc-contrib-${TRIPLET}-*.tar.bz2
+            - contrib/vlc-contrib-${TRIPLET}-*.tar.zst
 
 # Common rules for jobs using docker
 .docker-template:


=====================================
extras/tools/SHA512SUMS
=====================================
@@ -17,3 +17,4 @@ d24849b93de58b20f518c071687e7bfa653a96600382f36c4cf7fc1047656458f75f093b911b786b
 4e6ad56e18c7d5b244b94b99c7e42489b8d4e79634abb97607c3f277f74b0c3c1cb043ba48816f444d2960fe96dc38459c404207e415a1401f5fad7c6f5d60e5  meson-1.10.0.tar.gz
 27acef46d9eb67203d708b57d80b853f76fa4b9c2720ff36ec161e6cdf702249e7982214ddf60bae75511aa79bc7d92aa27e3eab7ef9c0f5c040e8e42e76a385  libtool-2.4.7.tar.gz
 e2a58dde1cae3e6b79c03e7ef3d888f7577c1f4cba283b3b0f31123ceea8c33d7c9700e83de57104644de23e5f5c374868caa0e091f9c45edbbe87b98ee51c04  gettext-0.22.tar.gz
+b4de208f179b68d4c6454139ca60d66ed3ef3893a560d6159a056640f83d3ee67cdf6ffb88971cdba35449dba4b597eaa8b4ae908127ef7fd58c89f40bf9a705  zstd-1.5.7.tar.gz


=====================================
extras/tools/bootstrap
=====================================
@@ -25,6 +25,7 @@ MIN_MESON=0.60.0
 MIN_NASM=2.15
 MIN_PROTOC=3.4.0
 MIN_NINJA=1.13.0
+MIN_ZSTD=1.2.0
 
 export LC_ALL=
 FOUND=
@@ -85,15 +86,60 @@ fi
 }
 
 check_tar() {
-if ! tar PcJ /dev/null >/dev/null 2>&1 && ! tar PcJf /dev/null /dev/null 2>&1
+if ! { check_tar_autocompress && check_tar_xz && check_tar_zstd ; }
 then
-    echo "tar doesn't support xz (J option)"
     NEEDED="$NEEDED tar"
 else
     FOUND="$FOUND tar"
 fi
 }
 
+check_tar_autocompress() {
+tmp="check_tar"
+ret=0
+echo "Hello Cone" > "$tmp"
+if ! ( tar -caf "$tmp.tar.gz" "$tmp" && tar xfo "$tmp.tar.gz" )
+then
+    echo "tar can't auto-detect compression"
+    ret=1
+fi
+rm -f "$tmp" "$tmp.tar.gz" 2>/dev/null
+return "$ret"
+}
+
+check_tar_xz() {
+if ! tar PcJ /dev/null >/dev/null 2>&1 && ! tar PcJf /dev/null /dev/null 2>&1
+then
+    echo "tar doesn't support xz (J option)"
+    return 1
+fi
+return 0
+}
+
+check_tar_zstd() {
+output="$(tar Pc --zstd /dev/null 2>&1 >/dev/null)"
+ret="$?"
+case "$output" in
+    *"unrecognized option"*|*"not supported"*)
+        echo "tar doesn't support zstd"
+        return 1
+        ;;
+    *"not found"*|*"Can't launch external program"*)
+        echo "tar is new enough but zstd not installed"
+        NEEDED="$NEEDED zstd"
+        return 0
+        ;;
+    *)
+        if [ "$ret" -gt 0 ]; then
+            echo "tar has some unspecific error with zstd"
+            return 1
+        else
+            return 0
+        fi
+        ;;
+esac
+}
+
 check_sed() {
 tmp="`pwd`/check_sed"
 trap "rm \"$tmp\" \"$tmp-e\" 2>/dev/null" EXIT
@@ -191,6 +237,7 @@ check help2man
 check meson $MIN_MESON
 check_ninja $MIN_NINJA
 check gettext
+check zstd $MIN_ZSTD
 
 DEPS_ONLY="help2man"
 


=====================================
extras/tools/packages.mak
=====================================
@@ -61,3 +61,6 @@ MESON_URL=https://github.com/mesonbuild/meson/releases/download/$(MESON_VERSION)
 NINJA_VERSION=1.11.1
 NINJA_BUILD_NAME=$(NINJA_VERSION).g95dee.kitware.jobserver-1
 NINJA_URL=https://github.com/Kitware/ninja/archive/refs/tags/v$(NINJA_BUILD_NAME).tar.gz
+
+ZSTD_VERSION=1.5.7
+ZSTD_URL=https://github.com/facebook/zstd/releases/download/v$(ZSTD_VERSION)/zstd-$(ZSTD_VERSION).tar.gz


=====================================
extras/tools/tools.mak
=====================================
@@ -47,6 +47,7 @@ UNPACK = $(RM) -R $@ \
     $(foreach f,$(filter %.tar.gz %.tgz,$^), && tar $(TAR_VERBOSE)xzfo $(f)) \
     $(foreach f,$(filter %.tar.bz2,$^), && tar $(TAR_VERBOSE)xjfo $(f)) \
     $(foreach f,$(filter %.tar.xz,$^), && tar $(TAR_VERBOSE)xJfo $(f)) \
+    $(foreach f,$(filter %.tar.zst,$^), && tar $(TAR_VERBOSE)xfo $(f)) \
     $(foreach f,$(filter %.zip,$^), && unzip $(f))
 
 UNPACK_DIR = $(patsubst %.tar,%,$(basename $(notdir $<)))
@@ -155,7 +156,7 @@ tar: tar-$(TAR_VERSION).tar.bz2
 	$(UNPACK)
 	$(MOVE)
 
-.buildtar: .xz tar
+.buildtar: tar .xz
 	cd $<; ./configure --prefix=$(PREFIX)
 	+$(MAKE) -C $<
 	+$(MAKE) -C $< install
@@ -186,6 +187,25 @@ CLEAN_PKG += xz
 DISTCLEAN_PKG += xz-$(XZ_VERSION).tar.bz2
 CLEAN_FILE += .buildxz
 
+# zstd
+
+zstd-$(ZSTD_VERSION).tar.gz:
+	$(call download_pkg,$(ZSTD_URL),zstd)
+
+.getzstd: zstd-$(ZSTD_VERSION).tar.gz
+zstd: zstd-$(ZSTD_VERSION).tar.gz
+	$(UNPACK)
+	$(MOVE)
+
+.buildzstd: zstd
+	+$(MAKE) -C $</programs
+	+$(MAKE) -C $</programs install prefix=$(PREFIX)
+	touch $@
+
+CLEAN_PKG += zstd
+DISTCLEAN_PKG += zstd-$(ZSTD_VERSION).tar.gz
+CLEAN_FILE += .buildzstd
+
 # autoconf
 
 autoconf-$(AUTOCONF_VERSION).tar.gz:



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4176daed86ca10acd1966ca37704b0df622b09d5...42ed9e5dc892e8fe6303cca4dc815998ab33f9a8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4176daed86ca10acd1966ca37704b0df622b09d5...42ed9e5dc892e8fe6303cca4dc815998ab33f9a8
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list