|
1 | 1 | FROM alpine:latest AS build |
2 | | -ARG SQUASHFS_TOOLS_VERSION=4.6.1 |
| 2 | +# We would be fine using 4.7 (latest) except for needing |
| 3 | +# https://github.com/plougher/squashfs-tools/pull/314 |
| 4 | +# for Alpine builds to work |
| 5 | +ARG SQUASHFS_TOOLS_VERSION=65362f488c8859db6612a1ed3630c7352fff2a7e |
3 | 6 | WORKDIR /usr/src |
4 | 7 |
|
5 | 8 | # build dependencies |
6 | | -RUN apk update && apk add build-base git zlib-dev zlib-static zstd-dev zstd-static lz4-dev lz4-static |
| 9 | +RUN apk update && apk add build-base cmake git sed |
| 10 | +# build zlib-ng in static lib/"zlib-compat" mode (alpine doesn't have a static/dev variant yet) |
| 11 | +ENV ZLIB_NG_VERSION=2.2.4 |
| 12 | +RUN git clone https://github.com/zlib-ng/zlib-ng.git && cd zlib-ng && git checkout $ZLIB_NG_VERSION |
| 13 | +WORKDIR /usr/src/zlib-ng |
| 14 | +RUN cmake . -DZLIB_COMPAT=1 |
| 15 | +RUN cmake --build . --config Release |
| 16 | +RUN cmake --build . --target install |
7 | 17 |
|
8 | 18 | # check out squashfs-tools sources |
| 19 | +WORKDIR /usr/src |
9 | 20 | ENV SQUASHFS_TOOLS_VERSION=${SQUASHFS_TOOLS_VERSION} |
10 | | -RUN git clone https://github.com/plougher/squashfs-tools && cd squashfs-tools && git checkout squashfs-tools-$SQUASHFS_TOOLS_VERSION |
| 21 | +RUN git clone https://github.com/plougher/squashfs-tools && cd squashfs-tools && git checkout $SQUASHFS_TOOLS_VERSION |
11 | 22 | WORKDIR /usr/src/squashfs-tools/squashfs-tools |
| 23 | +# We don't use most of these libs, so turn them off. |
| 24 | +RUN sed -i \ |
| 25 | + -e 's/LZO_SUPPORT = 1/LZO_SUPPORT = 0/' \ |
| 26 | + -e 's/XZ_SUPPORT = 1/XZ_SUPPORT = 0/' \ |
| 27 | + -e 's/ZSTD_SUPPORT = 1/ZSTD_SUPPORT = 0/' \ |
| 28 | + -e 's/LZ4_SUPPORT = 1/LZ4_SUPPORT = 0/' \ |
| 29 | + -e 's/USE_PREBUILT_MANPAGES = n/USE_PREBUILT_MANPAGES = y/' \ |
| 30 | + Makefile |
12 | 31 | ENV CFLAGS="-O2 -Wall -static" |
13 | 32 | ENV LDFLAGS="-static" |
| 33 | + |
14 | 34 | RUN make -j`nproc` && make install INSTALL_DIR=/usr/obj/usr/bin |
15 | 35 |
|
16 | 36 | ## copy final squashfs-tools into a scratch image |
|
0 commit comments