rust: Improve Host/Install speed
authorJeffery To <jeffery.to@gmail.com>
Wed, 11 Oct 2023 04:56:20 +0000 (12:56 +0800)
committerJeffery To <jeffery.to@gmail.com>
Thu, 12 Oct 2023 05:59:44 +0000 (13:59 +0800)
* Compress dist archives with gzip instead of xz; gzip is faster to
  compress and decompress

* Use a for loop instead of calling find to extract archives

* Use libdeflate's gzip to decompress instead of gzip

* Limit search for install scripts to top level of extracted archives

This also runs the install scripts with bash instead of sh, in
accordance with the shebang lines inside the scripts.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
(cherry picked from commit 855623d8cce4db8655af58bed5d52c64d38608c5)

lang/rust/Makefile

index 37fe20aeb0215571869ff389d65f0405cc936d71..b27c2fc09e036ed66c4931355e37732aa2550d83 100644 (file)
@@ -65,7 +65,7 @@ HOST_CONFIGURE_ARGS = \
        --sysconfdir=$(CARGO_HOME)/etc \
        --datadir=$(CARGO_HOME)/share \
        --mandir=$(CARGO_HOME)/man \
-       --dist-compression-formats=xz \
+       --dist-compression-formats=gz \
        --enable-missing-tools \
        --disable-sanitizers \
        --release-channel=stable \
@@ -91,8 +91,11 @@ endef
 define Host/Install
        ( \
                cd $(HOST_BUILD_DIR)/build/dist ; \
-               find -iname "*.xz" -exec tar -xJf {} \; ; \
-               find ./* -type f -name install.sh -execdir sh {} --prefix=$(CARGO_HOME) --disable-ldconfig \; ; \
+               for targz in *.tar.gz; do \
+                       $(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc "$$$$targz" | tar -xf - ; \
+               done ; \
+               find . -mindepth 2 -maxdepth 2 -type f -name install.sh \
+                       -execdir bash '{}' --prefix=$(CARGO_HOME) --disable-ldconfig \; ; \
                \
                sed -e 's|@RUSTC_TARGET_ARCH@|$(RUSTC_TARGET_ARCH)|g' \
                    -e 's|@TARGET_CC_NOCACHE@|$(TARGET_CC_NOCACHE)|g' \