diff mbox series

[3/4] support/docker: add tar 1.35

Message ID 20250206072321.677851-3-peter@korsgaard.com
State Accepted
Headers show
Series [1/4] support/docker: move to current bookworm (Debian 12) snapshot | expand

Commit Message

Peter Korsgaard Feb. 6, 2025, 7:23 a.m. UTC
Since commit b11956fb6690 ("support/dependencies: require tar >= 1.35"),
Buildroot will build host-tar if the host does not have >= 1.35 available,
so add it to the container to save build time.

Debian 12 only provides tar 1.34.  Tar 1.35 is available in testing - But
that then depends on a newer glibc, so instead build it from source using
the --disable-year2038 flag like we do for host-tar and install it into
/usr/local/bin so it shadows the Debian one.

This step runs as root (and needs to for make install), so add
FORCE_UNSAFE_CONFIGURE=1 as otherwise the configure script errors out.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 support/docker/Dockerfile | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/support/docker/Dockerfile b/support/docker/Dockerfile
index f6d3978f9b..e5e45d5a6f 100644
--- a/support/docker/Dockerfile
+++ b/support/docker/Dockerfile
@@ -12,6 +12,9 @@  LABEL maintainer="Buildroot mailing list <buildroot@buildroot.org>" \
       vendor="Buildroot" \
 description="Container with everything needed to run Buildroot"
 
+# We need tar >= 1.35
+ARG TAR_VERSION="1.35"
+
 # Setup environment
 ENV DEBIAN_FRONTEND noninteractive
 
@@ -56,6 +59,16 @@  RUN apt-get -o APT::Retries=3 install -y --no-install-recommends \
     apt-get -y autoremove && \
     apt-get -y clean
 
+# Build host-tar
+RUN curl -sfL https://ftpmirror.gnu.org/tar/tar-${TAR_VERSION}.tar.xz | \
+    tar -Jx -C /tmp && \
+    cd /tmp/tar-${TAR_VERSION} && \
+    FORCE_UNSAFE_CONFIGURE=1 ./configure \
+        --disable-year2028 && \
+    make && \
+    make install && \
+    rm -rf /tmp/tar-${TAR_VERSION}
+
 # To be able to generate a toolchain with locales, enable one UTF-8 locale
 RUN sed -i 's/# \(en_US.UTF-8\)/\1/' /etc/locale.gen && \
     /usr/sbin/locale-gen