Skip to content

Instantly share code, notes, and snippets.

@lunaynx
Created June 20, 2024 23:12
Show Gist options
  • Select an option

  • Save lunaynx/27b82f26fbabe7355ced33e5ea16d5c5 to your computer and use it in GitHub Desktop.

Select an option

Save lunaynx/27b82f26fbabe7355ced33e5ea16d5c5 to your computer and use it in GitHub Desktop.

Revisions

  1. lunaynx revised this gist Jul 22, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions libimobiledevice.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    FROM alpine AS base
    ENV CONF_ARGS="--disable-shared" \
    CMAKE_ARGS="-DBUILD_SHARED_LIBS=0" \
    CC="clang" \
    CXX="clang++" \
    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
  2. lunaynx revised this gist Jan 19, 2023. No changes.
  3. lunaynx revised this gist Dec 22, 2022. 1 changed file with 0 additions and 9 deletions.
    9 changes: 0 additions & 9 deletions libimobiledevice.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -74,17 +74,8 @@ RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libi
    make install && \
    rm -rf /tmp/build

    #FROM base AS zlib
    #WORKDIR /tmp/build/zlib
    #RUN git clone --single-branch --depth 1 https://github.com/madler/zlib.git . && \
    # ./configure --static && \
    # make -j$(nproc) && \
    # make install && \
    # rm -rf /tmp/build

    FROM base AS libzip
    WORKDIR /tmp/build/libzip
    #COPY --from=zlib /usr/local/ /usr/local/
    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 && \
  4. lunaynx revised this gist Dec 22, 2022. 1 changed file with 53 additions and 26 deletions.
    79 changes: 53 additions & 26 deletions libimobiledevice.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@ ENV CONF_ARGS="--disable-shared" \
    CC="clang" \
    CXX="clang++" \
    LD="ld.lld" \
    LDFLAGS="-no-pie -static -static-libgcc -Wl,-static -Wl,--no-dynamic-linker"
    RUN apk add --no-cache autoconf automake ca-certificates clang15 cmake curl-dev curl-static eudev-dev gcc git gnupg libtool linux-headers make musl-dev ncurses-static ncurses-terminfo openssl-dev openssl-libs-static pkgconf wget xz
    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
    @@ -38,7 +38,6 @@ FROM base AS libimobiledevice
    WORKDIR /tmp/build/libimobiledevice
    COPY --from=libimobiledevice-glue /usr/local/ /usr/local/
    COPY --from=libusbmuxd /usr/local/ /usr/local/
    #ENV CC="gcc"
    RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libimobiledevice.git . && \
    ./autogen.sh $CONF_ARGS --without-cython && \
    make -j$(nproc) && \
    @@ -65,7 +64,7 @@ RUN wget https://ftp.gnu.org/gnu/readline/readline-8.2.tar.gz && \

    FROM base AS libirecovery
    WORKDIR /tmp/build/libirecovery
    ENV LDFLAGS="$LDFLAGS -lncurses"
    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/
    @@ -75,39 +74,67 @@ RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libi
    make install && \
    rm -rf /tmp/build

    FROM base AS zlib
    WORKDIR /tmp/build/zlib
    RUN git clone --single-branch --depth 1 https://github.com/madler/zlib.git . && \
    ./configure --static && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build
    #FROM base AS zlib
    #WORKDIR /tmp/build/zlib
    #RUN git clone --single-branch --depth 1 https://github.com/madler/zlib.git . && \
    # ./configure --static && \
    # make -j$(nproc) && \
    # make install && \
    # rm -rf /tmp/build

    FROM base AS libzip
    WORKDIR /tmp/build/libzip
    COPY --from=zlib /usr/local/ /usr/local/
    #COPY --from=zlib /usr/local/ /usr/local/
    RUN git clone --single-branch --depth 1 https://github.com/nih-at/libzip.git . && \
    # force linking to libcrypto.a
    rm /usr/lib/libcrypto.so && \
    # 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 idevicerestore
    #WORKDIR /tmp/build/idevicerestore
    #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 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=idevicerestore /usr/local/ /usr/local/
    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/
  5. lunaynx revised this gist Dec 19, 2022. 1 changed file with 23 additions and 53 deletions.
    76 changes: 23 additions & 53 deletions libimobiledevice.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,11 @@
    FROM debian:buster AS base
    FROM alpine AS base
    ENV CONF_ARGS="--disable-shared" \
    CMAKE_ARGS="-DBUILD_SHARED_LIBS=0" \
    CC="clang" \
    CXX="clang++" \
    LD="ld.lld" \
    CFLAGS="-fPIC" \
    CXXFLAGS="-fPIC" \
    LDFLAGS="-Wl,--allow-multiple-definition -Wl,--no-as-needed"
    RUN apt-get -y update && \
    apt-get -y install --no-install-recommends ca-certificates gnupg wget && \
    echo 'deb http://apt.llvm.org/buster/ llvm-toolchain-buster main' > /etc/apt/sources.list.d/llvm.list && \
    wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
    apt-get -y update && \
    apt-get -y install --no-install-recommends autoconf automake clang cmake gcc git libncurses-dev libtool-bin libudev-dev make pkg-config xz-utils
    LDFLAGS="-no-pie -static -static-libgcc -Wl,-static -Wl,--no-dynamic-linker"
    RUN apk add --no-cache autoconf automake ca-certificates clang15 cmake curl-dev curl-static eudev-dev gcc git gnupg libtool linux-headers make musl-dev ncurses-static ncurses-terminfo openssl-dev openssl-libs-static pkgconf wget xz

    FROM base AS libplist
    WORKDIR /tmp/build/libplist
    @@ -41,44 +34,17 @@ RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libu
    make install && \
    rm -rf /tmp/build

    FROM base AS openssl
    WORKDIR /tmp/build/openssl
    RUN wget https://www.openssl.org/source/openssl-1.1.1s.tar.gz && \
    tar -xf openssl-1.1.1s.tar.gz && \
    cd openssl-1.1.1s && \
    ./config no-shared && \
    sed -i -r '1s/^/#include <string.h>\n/' test/v3ext.c && \
    make && \
    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/
    COPY --from=openssl /usr/local/include/ /usr/local/include/
    COPY --from=openssl /usr/local/lib/ /usr/local/lib/
    ENV CC="gcc" \
    LDFLAGS="-ldl -static-libgcc"
    #ENV CC="gcc"
    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 curl
    WORKDIR /tmp/build/curl
    COPY --from=openssl /usr/local/include/ /usr/local/include/
    COPY --from=openssl /usr/local/lib/ /usr/local/lib/
    ENV LDFLAGS="-ldl"
    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 && \
    cmake . $CMAKE_ARGS && \
    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 . && \
    @@ -99,7 +65,7 @@ RUN wget https://ftp.gnu.org/gnu/readline/readline-8.2.tar.gz && \

    FROM base AS libirecovery
    WORKDIR /tmp/build/libirecovery
    ENV LDFLAGS="-l:libtinfo.a"
    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/
    @@ -121,24 +87,28 @@ FROM base AS libzip
    WORKDIR /tmp/build/libzip
    COPY --from=zlib /usr/local/ /usr/local/
    RUN git clone --single-branch --depth 1 https://github.com/nih-at/libzip.git . && \
    # force linking to libcrypto.a
    rm /usr/lib/libcrypto.so && \
    cmake . $CMAKE_ARGS && \
    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/
    #FROM base AS idevicerestore
    #WORKDIR /tmp/build/idevicerestore
    #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=idevicerestore /usr/local/ /usr/local/
    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 . && \
    apt-get -y remove gcc g++ && \
    ./autogen.sh $CONF_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    RUN ldconfig
    COPY --from=libplist /usr/local/ /usr/local/
    COPY --from=libusbmuxd /usr/local/ /usr/local/
  6. lunaynx revised this gist Dec 17, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion libimobiledevice.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -141,4 +141,4 @@ RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/idev
    make install && \
    rm -rf /tmp/build

    RUN ldconfig
    RUN ldconfig
  7. lunaynx revised this gist Dec 17, 2022. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions libimobiledevice.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -99,7 +99,7 @@ RUN wget https://ftp.gnu.org/gnu/readline/readline-8.2.tar.gz && \

    FROM base AS libirecovery
    WORKDIR /tmp/build/libirecovery
    ENV LDFLAGS="-Wl,--allow-multiple-definition -Wl,--no-as-needed -l:libtinfo.a"
    ENV LDFLAGS="-l:libtinfo.a"
    COPY --from=libimobiledevice-glue /usr/local/ /usr/local/
    COPY --from=libusb /usr/local/ /usr/local/
    COPY --from=readline /usr/local/ /usr/local/
    @@ -134,7 +134,6 @@ 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/
    ENV LDFLAGS="-static-libgcc"
    RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/idevicerestore.git . && \
    apt-get -y remove gcc g++ && \
    ./autogen.sh $CONF_ARGS && \
  8. lunaynx revised this gist Dec 17, 2022. 1 changed file with 27 additions and 11 deletions.
    38 changes: 27 additions & 11 deletions libimobiledevice.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ RUN apt-get -y update && \
    echo 'deb http://apt.llvm.org/buster/ llvm-toolchain-buster main' > /etc/apt/sources.list.d/llvm.list && \
    wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
    apt-get -y update && \
    apt-get -y install --no-install-recommends autoconf automake clang cmake gcc git libreadline-dev libtool-bin libudev-dev make pkg-config xz-utils
    apt-get -y install --no-install-recommends autoconf automake clang cmake gcc git libncurses-dev libtool-bin libudev-dev make pkg-config xz-utils

    FROM base AS libplist
    WORKDIR /tmp/build/libplist
    @@ -43,9 +43,9 @@ RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libu

    FROM base AS openssl
    WORKDIR /tmp/build/openssl
    RUN wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz && \
    tar -xf openssl-1.1.1q.tar.gz && \
    cd openssl-1.1.1q && \
    RUN wget https://www.openssl.org/source/openssl-1.1.1s.tar.gz && \
    tar -xf openssl-1.1.1s.tar.gz && \
    cd openssl-1.1.1s && \
    ./config no-shared && \
    sed -i -r '1s/^/#include <string.h>\n/' test/v3ext.c && \
    make && \
    @@ -59,9 +59,9 @@ COPY --from=libusbmuxd /usr/local/ /usr/local/
    COPY --from=openssl /usr/local/include/ /usr/local/include/
    COPY --from=openssl /usr/local/lib/ /usr/local/lib/
    ENV CC="gcc" \
    CXX="g++"
    LDFLAGS="-ldl -static-libgcc"
    RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libimobiledevice.git . && \
    ./autogen.sh $CONF_ARGS --without-cython LDFLAGS=-ldl && \
    ./autogen.sh $CONF_ARGS --without-cython && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build
    @@ -70,10 +70,11 @@ FROM base AS curl
    WORKDIR /tmp/build/curl
    COPY --from=openssl /usr/local/include/ /usr/local/include/
    COPY --from=openssl /usr/local/lib/ /usr/local/lib/
    RUN wget https://curl.se/download/curl-7.85.0.tar.xz && \
    tar -xvf curl-7.85.0.tar.xz && \
    cd curl-7.85.0 && \
    LDFLAGS=-ldl cmake . $CMAKE_ARGS && \
    ENV LDFLAGS="-ldl"
    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 && \
    cmake . $CMAKE_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build
    @@ -86,10 +87,22 @@ RUN git clone --single-branch --depth 1 https://github.com/libusb/libusb.git . &
    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="-Wl,--allow-multiple-definition -Wl,--no-as-needed -l:libtinfo.a"
    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) && \
    @@ -99,7 +112,7 @@ RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libi
    FROM base AS zlib
    WORKDIR /tmp/build/zlib
    RUN git clone --single-branch --depth 1 https://github.com/madler/zlib.git . && \
    ./configure && \
    ./configure --static && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build
    @@ -121,9 +134,12 @@ 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/
    ENV LDFLAGS="-static-libgcc"
    RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/idevicerestore.git . && \
    apt-get -y remove gcc g++ && \
    ./autogen.sh $CONF_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    RUN ldconfig
  9. lunaynx revised this gist Dec 17, 2022. 1 changed file with 25 additions and 10 deletions.
    35 changes: 25 additions & 10 deletions libimobiledevice.Dockerfile
    Original file line number Diff line number Diff line change
    @@ -6,15 +6,14 @@ ENV CONF_ARGS="--disable-shared" \
    LD="ld.lld" \
    CFLAGS="-fPIC" \
    CXXFLAGS="-fPIC" \
    LDFLAGS="-Wl,--allow-multiple-definition"
    LDFLAGS="-Wl,--allow-multiple-definition -Wl,--no-as-needed"
    RUN apt-get -y update && \
    apt-get -y install --no-install-recommends ca-certificates gnupg wget && \
    echo 'deb http://apt.llvm.org/buster/ llvm-toolchain-buster main' > /etc/apt/sources.list.d/llvm.list && \
    wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
    apt-get -y update && \
    apt-get -y install --no-install-recommends autoconf automake clang cmake gcc git libreadline-dev libssl-dev libtool-bin libudev-dev make pkg-config
    apt-get -y install --no-install-recommends autoconf automake clang cmake gcc git libreadline-dev libtool-bin libudev-dev make pkg-config xz-utils

    # Build libimobiledevice
    FROM base AS libplist
    WORKDIR /tmp/build/libplist
    RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libplist.git . && \
    @@ -34,31 +33,47 @@ RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libi

    FROM base AS libusbmuxd
    WORKDIR /tmp/build/libusbmuxd
    COPY --from=libplist /usr/local/ /usr/local/
    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 openssl
    WORKDIR /tmp/build/openssl
    RUN wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz && \
    tar -xf openssl-1.1.1q.tar.gz && \
    cd openssl-1.1.1q && \
    ./config no-shared && \
    sed -i -r '1s/^/#include <string.h>\n/' test/v3ext.c && \
    make && \
    make install && \
    rm -rf /tmp/build

    FROM base AS libimobiledevice
    WORKDIR /tmp/build/libimobiledevice
    COPY --from=libusbmuxd /usr/local/ /usr/local/
    COPY --from=libimobiledevice-glue /usr/local/ /usr/local/
    COPY --from=libusbmuxd /usr/local/ /usr/local/
    COPY --from=openssl /usr/local/include/ /usr/local/include/
    COPY --from=openssl /usr/local/lib/ /usr/local/lib/
    ENV CC="gcc" \
    CXX="g++"
    RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libimobiledevice.git . && \
    ./autogen.sh $CONF_ARGS --without-cython && \
    ./autogen.sh $CONF_ARGS --without-cython LDFLAGS=-ldl && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    # Build libirecovery and idevicerestore
    FROM base AS curl
    WORKDIR /tmp/build/curl
    RUN git clone --single-branch --depth 1 https://github.com/curl/curl.git . && \
    cmake . $CMAKE_ARGS && \
    COPY --from=openssl /usr/local/include/ /usr/local/include/
    COPY --from=openssl /usr/local/lib/ /usr/local/lib/
    RUN wget https://curl.se/download/curl-7.85.0.tar.xz && \
    tar -xvf curl-7.85.0.tar.xz && \
    cd curl-7.85.0 && \
    LDFLAGS=-ldl cmake . $CMAKE_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build
    @@ -111,4 +126,4 @@ RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/idev
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build
    RUN ldconfig
    RUN ldconfig
  10. lunaynx renamed this gist Oct 5, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  11. lunaynx revised this gist Oct 2, 2022. 1 changed file with 28 additions and 12 deletions.
    40 changes: 28 additions & 12 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -17,16 +17,26 @@ RUN apt-get -y update && \
    # Build libimobiledevice
    FROM base AS libplist
    WORKDIR /tmp/build/libplist
    RUN git clone https://github.com/libimobiledevice/libplist.git . && \
    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=libplist /usr/local/ /usr/local/
    RUN git clone https://github.com/libimobiledevice/libusbmuxd.git . && \
    COPY --from=libimobiledevice-glue /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 && \
    @@ -35,7 +45,10 @@ RUN git clone https://github.com/libimobiledevice/libusbmuxd.git . && \
    FROM base AS libimobiledevice
    WORKDIR /tmp/build/libimobiledevice
    COPY --from=libusbmuxd /usr/local/ /usr/local/
    RUN git clone https://github.com/libimobiledevice/libimobiledevice.git . && \
    COPY --from=libimobiledevice-glue /usr/local/ /usr/local/
    ENV CC="gcc" \
    CXX="g++"
    RUN git clone --single-branch --depth 1 https://github.com/libimobiledevice/libimobiledevice.git . && \
    ./autogen.sh $CONF_ARGS --without-cython && \
    make -j$(nproc) && \
    make install && \
    @@ -44,32 +57,33 @@ RUN git clone https://github.com/libimobiledevice/libimobiledevice.git . && \
    # Build libirecovery and idevicerestore
    FROM base AS curl
    WORKDIR /tmp/build/curl
    RUN git clone https://github.com/curl/curl.git . && \
    RUN git clone --single-branch --depth 1 https://github.com/curl/curl.git . && \
    cmake . $CMAKE_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    FROM base AS libusb
    WORKDIR /tmp/build/libusb
    RUN git clone https://github.com/libusb/libusb.git . && \
    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
    rm -rf /tmp/build

    FROM base AS libirecovery
    WORKDIR /tmp/build/libirecovery
    COPY --from=libimobiledevice-glue /usr/local/ /usr/local/
    COPY --from=libusb /usr/local/ /usr/local/
    RUN git clone https://github.com/libimobiledevice/libirecovery.git . && \
    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 zlib
    WORKDIR /tmp/build/zlib
    RUN git clone https://github.com/madler/zlib.git . && \
    RUN git clone --single-branch --depth 1 https://github.com/madler/zlib.git . && \
    ./configure && \
    make -j$(nproc) && \
    make install && \
    @@ -78,19 +92,21 @@ RUN git clone https://github.com/madler/zlib.git . && \
    FROM base AS libzip
    WORKDIR /tmp/build/libzip
    COPY --from=zlib /usr/local/ /usr/local/
    RUN git clone https://github.com/nih-at/libzip.git . && \
    RUN git clone --single-branch --depth 1 https://github.com/nih-at/libzip.git . && \
    cmake . $CMAKE_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    FROM base AS idevicerestore
    WORKDIR /tmp/build/idevicerestore
    COPY --from=curl /usr/local/ /usr/local/
    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/ /usr/local/
    RUN git clone https://github.com/libimobiledevice/idevicerestore.git . && \
    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 && \
  12. lunaynx revised this gist Jul 29, 2021. No changes.
  13. lunaynx revised this gist Jul 29, 2021. No changes.
  14. lunaynx created this gist Jul 29, 2021.
    98 changes: 98 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,98 @@
    FROM debian:buster AS base
    ENV CONF_ARGS="--disable-shared" \
    CMAKE_ARGS="-DBUILD_SHARED_LIBS=0" \
    CC="clang" \
    CXX="clang++" \
    LD="ld.lld" \
    CFLAGS="-fPIC" \
    CXXFLAGS="-fPIC" \
    LDFLAGS="-Wl,--allow-multiple-definition"
    RUN apt-get -y update && \
    apt-get -y install --no-install-recommends ca-certificates gnupg wget && \
    echo 'deb http://apt.llvm.org/buster/ llvm-toolchain-buster main' > /etc/apt/sources.list.d/llvm.list && \
    wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
    apt-get -y update && \
    apt-get -y install --no-install-recommends autoconf automake clang cmake gcc git libreadline-dev libssl-dev libtool-bin libudev-dev make pkg-config

    # Build libimobiledevice
    FROM base AS libplist
    WORKDIR /tmp/build/libplist
    RUN git clone https://github.com/libimobiledevice/libplist.git . && \
    ./autogen.sh $CONF_ARGS --without-cython && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    FROM base AS libusbmuxd
    WORKDIR /tmp/build/libusbmuxd
    COPY --from=libplist /usr/local/ /usr/local/
    RUN git clone 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=libusbmuxd /usr/local/ /usr/local/
    RUN git clone https://github.com/libimobiledevice/libimobiledevice.git . && \
    ./autogen.sh $CONF_ARGS --without-cython && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    # Build libirecovery and idevicerestore
    FROM base AS curl
    WORKDIR /tmp/build/curl
    RUN git clone https://github.com/curl/curl.git . && \
    cmake . $CMAKE_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    FROM base AS libusb
    WORKDIR /tmp/build/libusb
    RUN git clone https://github.com/libusb/libusb.git . && \
    ./autogen.sh $CONF_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    FROM base AS libirecovery
    WORKDIR /tmp/build/libirecovery
    COPY --from=libusb /usr/local/ /usr/local/
    RUN git clone https://github.com/libimobiledevice/libirecovery.git . && \
    ./autogen.sh $CONF_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    FROM base AS zlib
    WORKDIR /tmp/build/zlib
    RUN git clone https://github.com/madler/zlib.git . && \
    ./configure && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    FROM base AS libzip
    WORKDIR /tmp/build/libzip
    COPY --from=zlib /usr/local/ /usr/local/
    RUN git clone https://github.com/nih-at/libzip.git . && \
    cmake . $CMAKE_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build

    FROM base AS idevicerestore
    WORKDIR /tmp/build/idevicerestore
    COPY --from=curl /usr/local/ /usr/local/
    COPY --from=libimobiledevice /usr/local/ /usr/local/
    COPY --from=libirecovery /usr/local/ /usr/local/
    COPY --from=libzip /usr/local/ /usr/local/
    RUN git clone https://github.com/libimobiledevice/idevicerestore.git . && \
    ./autogen.sh $CONF_ARGS && \
    make -j$(nproc) && \
    make install && \
    rm -rf /tmp/build
    RUN ldconfig