Created
December 22, 2022 22:27
-
-
Save itsnebulalol/0f25382273ac23189e2aa9fd0edbadf6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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" \ | |
CFLAGS="-fPIC" \ | |
CXX="clang++" \ | |
CXXFLAGS="-fPIC" \ | |
LD="ld.lld" \ | |
LDFLAGS="-fuse-ld=/usr/bin/ld.lld -static -static-libgcc -Wl,--allow-multiple-definition -Wl,--no-dynamic-linker -Wl,-static" | |
RUN apk add --no-cache autoconf automake bash clang15 cmake coreutils gcc g++ git libtool lld m4 make musl musl-dev openssl-dev openssl-libs-static pkgconf && \ | |
ln -sf /bin/bash /bin/sh | |
FROM base AS libgeneral | |
WORKDIR /tmp/build/libgeneral | |
RUN git clone --single-branch https://github.com/tihmstar/libgeneral . && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS libinsn | |
WORKDIR /tmp/build/libinsn | |
COPY --from=libgeneral /usr/local/ /usr/local/ | |
RUN git clone --single-branch https://github.com/tihmstar/libinsn . && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS cctools | |
WORKDIR /tmp/build/cctools | |
RUN wget https://opensource.apple.com/tarballs/cctools/cctools-927.0.2.tar.gz && \ | |
tar -xvzf cctools-927.0.2.tar.gz && \ | |
sed -i 's_#include_//_g' cctools-cctools-927.0.2/include/mach-o/loader.h && \ | |
sed -i -e 's=<stdint.h>=\n#include <stdint.h>\ntypedef int integer_t;\ntypedef integer_t cpu_type_t;\ntypedef integer_t cpu_subtype_t;\ntypedef integer_t cpu_threadtype_t;\ntypedef int vm_prot_t;=g' cctools-cctools-927.0.2/include/mach-o/loader.h && \ | |
mkdir -p /usr/local/include && \ | |
cp -r cctools-cctools-927.0.2/include/* /usr/local/include/ && \ | |
rm -rf tmp cctools-927.0.2.tar.gz | |
FROM base AS liboffsetfinder64 | |
WORKDIR /tmp/build/liboffsetfinder64 | |
COPY --from=cctools /usr/local/ /usr/local/ | |
COPY --from=libgeneral /usr/local/ /usr/local/ | |
COPY --from=libinsn /usr/local/ /usr/local/ | |
RUN git clone --single-branch https://github.com/palera1n/liboffsetfinder64 . && \ | |
cmake . $CMAKE_ARGS && \ | |
sed -i -r 's/_entrypoint\(NULL\)/_entrypoint(0)/' src/patchfinder64.cpp && \ | |
sed -i -r 's/_base\(NULL\)/_base(0)/' src/patchfinder64.cpp && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS lzfse | |
WORKDIR /tmp/build/lzfse | |
RUN git clone --depth=1 https://github.com/lzfse/lzfse . && \ | |
cmake . $CMAKE_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS libplist | |
WORKDIR /tmp/build/libplist | |
RUN git clone --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 img4tool | |
WORKDIR /tmp/build/img4tool | |
COPY --from=libgeneral /usr/local/ /usr/local/ | |
COPY --from=libplist /usr/local/include/ /usr/local/include/ | |
COPY --from=libplist /usr/local/lib/ /usr/local/lib/ | |
COPY --from=lzfse /usr/local/include/ /usr/local/include/ | |
COPY --from=lzfse /usr/local/lib/ /usr/local/lib/ | |
ENV LDFLAGS="${LDFLAGS} -L/usr/local/lib" | |
RUN git clone --single-branch https://github.com/tihmstar/img4tool . && \ | |
ls -l /usr/local/include/ /usr/local/lib/ && \ | |
./autogen.sh $CONF_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
rm -rf /tmp/build | |
FROM base AS iboot64patcher | |
WORKDIR /tmp/build/iboot64patcher | |
COPY --from=img4tool /usr/local/include/ /usr/local/include/ | |
COPY --from=img4tool /usr/local/lib/ /usr/local/lib/ | |
COPY --from=libgeneral /usr/local/ /usr/local/ | |
COPY --from=libinsn /usr/local/ /usr/local/ | |
COPY --from=libgeneral /usr/local/ /usr/local/ | |
COPY --from=libinsn /usr/local/ /usr/local/ | |
COPY --from=liboffsetfinder64 /usr/local/ /usr/local/ | |
RUN git clone --depth=1 https://github.com/palera1n/iBoot64Patcher . && \ | |
sed -i 's/futurerestore/iBoot64Patcher/g' CMakeLists.txt && \ | |
cmake . $CMAKE_ARGS && \ | |
make -j$(nproc) && \ | |
make install && \ | |
mv /usr/local/iBoot64Patcher /usr/local/bin/ && \ | |
rm -rf /tmp/build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment