Skip to content

Commit 9fc10a3

Browse files
committed
Containerised build environment
Create a Dockerfile to enable a portable build environment. The Dockerfile is based on Ubuntu 24.04, and uses multiple stages to produce a minimal final product, with the final image size sitting at about 75mb. This branch also incorporates the updates prepared by @cole-h to update to squashfs-tools 4.4 in devttys0#56. Finally, building on newer GCC highlights a dangling pointer error in LzmaEnc.c. I have separated the fix for this problem into a dedicated patch file for ease of review.
1 parent bd864a1 commit 9fc10a3

4 files changed

Lines changed: 4778 additions & 4503 deletions

File tree

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM ubuntu:24.04 AS builder
2+
3+
RUN --mount=type=cache,target=/var/cache/apt,id=builder-apt-cache \
4+
--mount=type=cache,target=/var/lib/apt,id=builder-apt-lib \
5+
apt-get update && \
6+
apt-get install -y --no-install-recommends \
7+
build-essential \
8+
git \
9+
liblzma-dev \
10+
liblzo2-dev \
11+
patch \
12+
zlib1g-dev \
13+
&& mkdir -p /sasquatch
14+
15+
WORKDIR /sasquatch
16+
17+
ADD https://downloads.sourceforge.net/project/squashfs/squashfs/squashfs4.4/squashfs4.4.tar.gz .
18+
RUN tar -zxvf squashfs4.4.tar.gz
19+
20+
COPY patches /sasquatch/patches
21+
RUN patch -d squashfs4.4 -p1 < patches/0_sasquatch_4.4.patch && \
22+
patch -d squashfs4.4 -p1 < patches/1_fix_dangling_pointer.patch && \
23+
cd squashfs4.4/squashfs-tools && \
24+
make
25+
26+
FROM ubuntu:24.04
27+
28+
RUN --mount=type=cache,target=/var/cache/apt,id=runtime-apt-cache \
29+
--mount=type=cache,target=/var/lib/apt,id=runtime-apt-lib \
30+
apt-get update && \
31+
apt-get install -y --no-install-recommends \
32+
liblzma5 \
33+
liblzo2-2 \
34+
zlib1g
35+
36+
COPY --from=builder /sasquatch/squashfs4.4/squashfs-tools/sasquatch /usr/local/bin/sasquatch
37+
38+
WORKDIR /work
39+
40+
ENTRYPOINT [ "/usr/local/bin/sasquatch" ]

build.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Script to download squashfs-tools v4.3, apply the patches, perform a clean build, and install.
2+
# Script to download squashfs-tools v4.4, apply the patches, perform a clean build, and install.
33

44
# If not root, perform 'make install' with sudo
55
if [ $UID -eq 0 ]
@@ -18,20 +18,20 @@ fi
1818
# Make sure we're working in the same directory as the build.sh script
1919
cd $(dirname `readlink -f $0`)
2020

21-
# Download squashfs4.3.tar.gz if it does not already exist
22-
if [ ! -e squashfs4.3.tar.gz ]
21+
# Download squashfs4.4.tar.gz if it does not already exist
22+
if [ ! -e squashfs4.4.tar.gz ]
2323
then
24-
wget https://downloads.sourceforge.net/project/squashfs/squashfs/squashfs4.3/squashfs4.3.tar.gz
24+
wget https://downloads.sourceforge.net/project/squashfs/squashfs/squashfs4.4/squashfs4.4.tar.gz
2525
fi
2626

27-
# Remove any previous squashfs4.3 directory to ensure a clean patch/build
28-
rm -rf squashfs4.3
27+
# Remove any previous squashfs4.4 directory to ensure a clean patch/build
28+
rm -rf squashfs4.4
2929

30-
# Extract squashfs4.3.tar.gz
31-
tar -zxvf squashfs4.3.tar.gz
30+
# Extract squashfs4.4.tar.gz
31+
tar -zxvf squashfs4.4.tar.gz
3232

3333
# Patch, build, and install the source
34-
cd squashfs4.3
35-
patch -p0 < ../patches/patch0.txt
34+
cd squashfs4.4
35+
patch -p1 < ../patches/*.patch
3636
cd squashfs-tools
3737
make && $SUDO make install

0 commit comments

Comments
 (0)