Last active
July 22, 2023 23:43
-
-
Save 0xallie/307d8f086c66bbb9ec051550768f9c58 to your computer and use it in GitHub Desktop.
Docker image to statically compile libimobiledevice suite binaries for Linux x86_64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine AS base | |
ENV CONF_ARGS="--disable-shared" \ | |
CMAKE_ARGS="-DBUILD_SHARED_LIBS=0" \ | |
CC="clang-15" \ | |
CXX="clang++-15" \ | |
LD="ld.lld" \ | |
LDFLAGS="-no-pie -static -static-libgcc -Wl,--no-dynamic-linker -Wl,-static" | |
RUN apk add --no-cache autoconf automake ca-certificates clang15 cmake eudev-dev gcc git gnupg libtool linux-headers make musl-dev ncurses-static ncurses-terminfo nghttp2-dev nghttp2-static openssl-dev openssl-libs-static pkgconf wget xz zlib-dev zlib-static | |
FROM base AS libplist | |
WORKDIR /tmp/build/libplist | |
RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libplist.git . && \ | |
./autogen.sh $CONF_ARGS --without-cython && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS libimobiledevice-glue | |
WORKDIR /tmp/build/libimobiledevice-glue | |
COPY --from=libplist /usr/local/ /usr/local/ | |
RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libimobiledevice-glue.git . && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS libusbmuxd | |
WORKDIR /tmp/build/libusbmuxd | |
COPY --from=libimobiledevice-glue /usr/local/ /usr/local/ | |
COPY --from=libplist /usr/local/ /usr/local/ | |
RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libusbmuxd.git . && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS libimobiledevice | |
WORKDIR /tmp/build/libimobiledevice | |
COPY --from=libimobiledevice-glue /usr/local/ /usr/local/ | |
COPY --from=libusbmuxd /usr/local/ /usr/local/ | |
RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libimobiledevice.git . && \ | |
./autogen.sh $CONF_ARGS --without-cython && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS libusb | |
WORKDIR /tmp/build/libusb | |
RUN git clone --single-branch --depth 1 https://github.com/libusb/libusb.git . && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS readline | |
WORKDIR /tmp/build/readline | |
RUN wget https://ftp.gnu.org/gnu/readline/readline-8.2.tar.gz && \ | |
tar -xvf readline-8.2.tar.gz && \ | |
cd readline-8.2 && \ | |
./configure $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS libirecovery | |
WORKDIR /tmp/build/libirecovery | |
ENV LDFLAGS="${LDFLAGS} -lncurses" | |
COPY --from=libimobiledevice-glue /usr/local/ /usr/local/ | |
COPY --from=libusb /usr/local/ /usr/local/ | |
COPY --from=readline /usr/local/ /usr/local/ | |
RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libirecovery.git . && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS libzip | |
WORKDIR /tmp/build/libzip | |
RUN git clone --single-branch --depth 1 https://github.com/nih-at/libzip.git . && \ | |
# force linking to static libs | |
rm /lib/libz.so /usr/lib/libcrypto.so && \ | |
cmake . $CMAKE_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS ideviceinstaller | |
WORKDIR /tmp/build/ideviceinstaller | |
COPY --from=libimobiledevice /usr/local/ /usr/local/ | |
COPY --from=libplist /usr/local/ /usr/local/ | |
COPY --from=libusbmuxd /usr/local/ /usr/local/ | |
COPY --from=libzip /usr/local/include/ /usr/local/include/ | |
COPY --from=libzip /usr/local/lib/ /usr/local/lib/ | |
ENV LDFLAGS="${LDFLAGS} -lz" | |
RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/ideviceinstaller.git . && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS curl | |
WORKDIR /tmp/build/curl | |
RUN wget https://curl.se/download/curl-7.86.0.tar.xz && \ | |
tar -xvf curl-7.86.0.tar.xz && \ | |
cd curl-7.86.0 && \ | |
autoreconf -i && \ | |
./configure $CONF_ARGS --without-brotli --with-openssl && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS idevicerestore | |
WORKDIR /tmp/build/idevicerestore | |
COPY --from=curl /usr/local/include/ /usr/local/include/ | |
COPY --from=curl /usr/local/lib/ /usr/local/lib/ | |
COPY --from=libimobiledevice /usr/local/ /usr/local/ | |
COPY --from=libirecovery /usr/local/ /usr/local/ | |
COPY --from=libzip /usr/local/include/ /usr/local/include/ | |
COPY --from=libzip /usr/local/lib/ /usr/local/lib/ | |
RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/idevicerestore.git . && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS output | |
COPY --from=ideviceinstaller /usr/local/ /usr/local/ | |
COPY --from=idevicerestore /usr/local/ /usr/local/ | |
COPY --from=libimobiledevice /usr/local/ /usr/local/ | |
COPY --from=libirecovery /usr/local/ /usr/local/ | |
COPY --from=libplist /usr/local/ /usr/local/ | |
COPY --from=libusbmuxd /usr/local/ /usr/local/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment