mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 09:47:01 +02:00
907 lines
45 KiB
YAML
907 lines
45 KiB
YAML
name: Build palera1n
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'src/**'
|
|
- 'docs/**'
|
|
- 'patches/**'
|
|
- 'include/**'
|
|
- 'Makefile'
|
|
- 'CMakeLists.txt'
|
|
- '.github/workflows/build.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'src/**'
|
|
- 'docs/**'
|
|
- 'patches/**'
|
|
- 'include/**'
|
|
- 'Makefile'
|
|
- 'CMakeLists.txt'
|
|
- '.github/workflows/build.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-docs:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install dependencies (packages)
|
|
run: |
|
|
sudo apt-get -y update
|
|
sudo apt-get -y install mandoc make
|
|
|
|
- name: Build Documentation
|
|
run: |
|
|
make -j$(nproc) docs
|
|
mkdir -p ready/docs
|
|
cp docs/*.html docs/mandoc.css docs/palera1n.1 ready/docs
|
|
|
|
- name: Get branch name
|
|
id: branch-name
|
|
uses: tj-actions/branch-names@v7
|
|
|
|
- name: Upload artifact
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: wangyucode/[email protected]
|
|
with:
|
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
|
username: palera1n
|
|
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
|
forceUpload: true
|
|
dryRun: false
|
|
localDir: 'ready/'
|
|
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
|
|
|
build-darwin:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: x86_64
|
|
gnu_triple: x86_64-apple-darwin
|
|
os: macosx
|
|
minos: 10.8
|
|
- arch: arm64
|
|
gnu_triple: aarch64-apple-darwin
|
|
os: macosx
|
|
minos: 11.0
|
|
- arch: arm64
|
|
gnu_triple: aarch64-apple-darwin
|
|
os: iphoneos
|
|
minos: 7.0
|
|
runs-on: macos-15
|
|
env:
|
|
MBEDTLS_VERSION: 3.5.2
|
|
READLINE_VERSION: 8.2
|
|
LIBIMOBILEDEVICE_COMMIT: ed0d66d0341562731bb19928dfe48155509fa7a7
|
|
LIBIRECOVERY_COMMIT: 7ce02c347b7c26e59498e6af31c9da51018d0fa1
|
|
LIBIMOBILEDEVICE_GLUE_COMMIT: 362f7848ac89b74d9dd113b38b51ecb601f76094
|
|
LIBPLIST_COMMIT: 2117b8fdb6b4096455bd2041a63e59a028120136
|
|
LIBUSBMUXD_COMMIT: a7f0543fb1ecb20ac7121c0fd77297200e0e43fc
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install dependencies (packages)
|
|
run: |
|
|
sudo /usr/local/bin/pip3 install jsonschema jinja2
|
|
brew install make autoconf automake pkg-config gnu-sed gettext libtool
|
|
sudo rm -rf /usr/local/Frameworks/Python*
|
|
curl -LO https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus7/ldid_macosx_x86_64
|
|
sudo install -m755 ldid_macosx_x86_64 /usr/local/bin/ldid
|
|
|
|
- name: Download dependencies (embedded binaries)
|
|
run: |
|
|
echo "SDK=$(xcrun -sdk ${{ matrix.os }} --show-sdk-path)" >> $GITHUB_ENV
|
|
|
|
- name: Select correct Xcode
|
|
run: |
|
|
sudo xcode-select -s /Applications/Xcode_16.2.app
|
|
|
|
- name: Setup environment
|
|
run: |
|
|
mkdir sysroot
|
|
echo "DESTDIR=$(pwd)/sysroot" >> $GITHUB_ENV
|
|
echo "PREFIX=/usr/local" >> $GITHUB_ENV
|
|
echo "PKG_CONFIG_PATH=$(pwd)/sysroot/usr/local/lib/pkgconfig" >> $GITHUB_ENV
|
|
echo "CONFIGURE_ARGS=--prefix=/usr/local --disable-shared --enable-static --build=x86_64-apple-darwin --host=${{ matrix.gnu_triple }}" >> $GITHUB_ENV
|
|
echo "CC=$(xcrun --find cc)" >> $GITHUB_ENV
|
|
echo "CXX=$(xcrun --find c++)" >> $GITHUB_ENV
|
|
echo "CPP=$(xcrun --find cc) -E" >> $GITHUB_ENV
|
|
echo "CFLAGS=-g -Os -I$(TARGET_SYSROOT)/usr/include/c++/v1 -I$(pwd)/sysroot/local/include/c++/v1 -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isysroot ${{ env.SDK }} -isystem $(pwd)/sysroot/usr/local/include -Os -g -flto=full -Wl,-object_path_lto,lto.o -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
|
|
echo "CPPFLAGS=-g -Os -I$(TARGET_SYSROOT)/usr/include/c++/v1 -I$(pwd)/sysroot/local/include/c++/v1 -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isysroot ${{ env.SDK }} -isystem $(pwd)/sysroot/usr/local/include -Wno-error-implicit-function-declaration -Os -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
|
|
echo "CXXFLAGS=-stdlib=libc++ -g -Os -isystem$(TARGET_SYSROOT)/usr/include/c++/v1 -isysroot ${{ env.SDK }} -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isystem $(pwd)/sysroot/usr/local/include -Os -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
|
|
echo "LDFLAGS=-g -Wl,-dead_strip -arch ${{ matrix.arch }} -isysroot ${{ env.SDK }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -L$(pwd)/sysroot/usr/local/lib" >> $GITHUB_ENV
|
|
echo "CFLAGS_FOR_BUILD=-arch $(uname -m) -isysroot $(xcrun -sdk macosx --show-sdk-path) -Os" >> $GITHUB_ENV
|
|
echo "CXXFLAGS_FOR_BUILD=-stdlib=libc++ -arch $(uname -m) -isysroot $(xcrun -sdk macosx --show-sdk-path) -Os" >> $GITHUB_ENV
|
|
echo "CPPFLAGS_FOR_BUILD=-arch $(uname -m) -isysroot $(xcrun -sdk macosx --show-sdk-path) -Wno-error-implicit-function-declaration -Os" >> $GITHUB_ENV
|
|
echo "LDFLAGS_FOR_BUILD=-Wl,-dead_strip" >> $GITHUB_ENV
|
|
|
|
- name: Prepare iPhoneOS environment
|
|
if: matrix.os == 'iphoneos'
|
|
run: |
|
|
echo "FAKE_PLATFORM=2" >> $GITHUB_ENV
|
|
echo "FAKE_SDK=7.0" >> $GITHUB_ENV
|
|
echo "FAKE_MINOS=7.0" >> $GITHUB_ENV
|
|
|
|
- name: Prepare headers
|
|
if: matrix.os != 'macosx'
|
|
run: |
|
|
mkdir -p sysroot/{{,System}/Library/Frameworks,/usr/{local/include/{bsm,objc,os/internal,sys,firehose,CoreFoundation,FSEvents,IOKit/kext,libkern,kern,arm,{mach/,}machine,CommonCrypto,Security,CoreSymbolication,Kernel/{kern,IOKit,libkern},rpc,rpcsvc,xpc/private,ktrace,mach-o,dispatch},lib/pkgconfig,/local/lib}}
|
|
MACOSX_SYSROOT=$(xcrun -sdk macosx --show-sdk-path)
|
|
TARGET_SYSROOT=$(xcrun -sdk ${{ matrix.os }} --show-sdk-path)
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/{arpa,bsm,hfs,net,xpc,netinet,servers,timeconv.h,launch.h} sysroot/usr/local/include
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/objc/objc-runtime.h sysroot/usr/local/include/objc
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/libkern/{OSDebug.h,OSKextLib.h,OSReturn.h,OSThermalNotification.h,OSTypes.h,machine} sysroot/usr/local/include/libkern
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/kern sysroot/usr/local/include
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/sys/{tty*,ptrace,kern*,random,reboot,user,vnode,disk,vmmeter,conf}.h sysroot/usr/local/include/sys
|
|
cp -af ${MACOSX_SYSROOT}/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/sys/disklabel.h sysroot/usr/local/include/sys
|
|
cp -af ${MACOSX_SYSROOT}/System/Library/Frameworks/IOKit.framework/Headers/{AppleConvergedIPCKeys.h,IOBSD.h,IOCFBundle.h,IOCFPlugIn.h,IOCFURLAccess.h,IOKitServer.h,IORPC.h,IOSharedLock.h,IOUserServer.h,audio,avc,firewire,graphics,hid,hidsystem,i2c,iokitmig.h,kext,ndrvsupport,network,ps,pwr_mgt,sbp2,scsi,serial,storage,stream,usb,video} sysroot/usr/local/include/IOKit
|
|
cp -af ${MACOSX_SYSROOT}/System/Library/Frameworks/Security.framework/Headers/{mds_schema,oidsalg,SecKeychainSearch,certextensions,Authorization,eisl,SecDigestTransform,SecKeychainItem,oidscrl,cssmcspi,CSCommon,cssmaci,SecCode,CMSDecoder,oidscert,SecRequirement,AuthSession,SecReadTransform,oids,cssmconfig,cssmkrapi,SecPolicySearch,SecAccess,cssmtpi,SecACL,SecEncryptTransform,cssmapi,cssmcli,mds,x509defs,oidsbase,SecSignVerifyTransform,cssmspi,cssmkrspi,SecTask,cssmdli,SecAsn1Coder,cssm,SecTrustedApplication,SecCodeHost,SecCustomTransform,oidsattr,SecIdentitySearch,cssmtype,SecAsn1Types,emmtype,SecTransform,SecTrustSettings,SecStaticCode,emmspi,SecTransformReadTransform,SecKeychain,SecDecodeTransform,CodeSigning,AuthorizationPlugin,cssmerr,AuthorizationTags,CMSEncoder,SecEncodeTransform,SecureDownload,SecAsn1Templates,AuthorizationDB,SecCertificateOIDs,cssmapple}.h sysroot/usr/local/include/Security
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/{ar,bootstrap,launch,libc,libcharset,localcharset,nlist,NSSystemDirectories,tzfile,vproc}.h sysroot/usr/local/include
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/mach/{*.defs,{mach_vm,shared_region}.h} sysroot/usr/local/include/mach
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/mach/machine/*.defs sysroot/usr/local/include/mach/machine
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/rpc/pmap_clnt.h sysroot/usr/local/include/rpc
|
|
cp -af ${MACOSX_SYSROOT}/usr/include/rpcsvc/yp{_prot,clnt}.h sysroot/usr/local/include/rpcsvc
|
|
cp -af ${TARGET_SYSROOT}/usr/include/mach/machine/thread_state.h sysroot/usr/local/include/mach/machine
|
|
cp -af ${TARGET_SYSROOT}/usr/include/mach/arm sysroot/usr/local/include/mach
|
|
cp -af ${MACOSX_SYSROOT}/System/Library/Frameworks/IOKit.framework/Headers/* sysroot/usr/local/include/IOKit
|
|
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/stdlib.h > sysroot/usr/local/include/stdlib.h
|
|
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/time.h > sysroot/usr/local/include/time.h
|
|
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/unistd.h > sysroot/usr/local/include/unistd.h
|
|
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/mach/task.h > sysroot/usr/local/include/mach/task.h
|
|
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/mach/mach_host.h > sysroot/usr/local/include/mach/mach_host.h
|
|
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/ucontext.h > sysroot/usr/local/include/ucontext.h
|
|
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/signal.h > sysroot/usr/local/include/signal.h
|
|
gsed -E /'__API_UNAVAILABLE'/d < ${TARGET_SYSROOT}/usr/include/pthread.h > sysroot/usr/local/include/pthread.h
|
|
gsed -i -E s/'__API_UNAVAILABLE\(.*\)'// sysroot/usr/local/include/IOKit/IOKitLib.h
|
|
|
|
- name: Check dependencies cache
|
|
run: |
|
|
echo "target: ${{ matrix.os }}-${{ matrix.arch }}" > cache.txt
|
|
echo "mbedtls ${{ env.MBEDTLS_VERSION }}" >> cache.txt
|
|
echo "readline: ${{ env.READLINE_VERSION }}" >> cache.txt
|
|
echo "libimobiledevice: ${{ env.LIBIMOBILEDEVICE_COMMIT }}" >> cache.txt
|
|
echo "libirecovery: ${{ env.LIBIRECOVERY_COMMIT }}" >> cache.txt
|
|
echo "libimobiledevice-glue: ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }}" >> cache.txt
|
|
echo "libplist: ${{ env.LIBPLIST_COMMIT }}" >> cache.txt
|
|
echo "libusbmuxd: ${{ env.LIBUSBMUXD_COMMIT }}" >> cache.txt
|
|
echo "cc: $($(xcrun --find cc) --version)" >> cache.txt
|
|
echo "CACHE_TXT_CHECKSUM=sysroot-$(shasum -a 512 cache.txt | cut -d' ' -f1)" >> $GITHUB_ENV
|
|
|
|
- name: Download cached sysroot
|
|
id: sysroot_cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz
|
|
key: sysroot-${{ env.CACHE_TXT_CHECKSUM }}
|
|
|
|
- name: Extract cached sysroot
|
|
if: steps.sysroot_cache.outputs.cache-hit == 'true'
|
|
run: |
|
|
xz -dcT0 sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz | tar -x
|
|
|
|
- name: Setup sysroot
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
mkdir -p $(pwd)/sysroot/usr/local/lib
|
|
ln -sf $(pwd)/sysroot/usr/local/lib{,64}
|
|
|
|
- name: Download dependencies (source code)
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
curl -LOOOOOO \
|
|
https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${{ env.MBEDTLS_VERSION }}.tar.gz \
|
|
https://mirror-hk.koddos.net/gnu/readline/readline-${{ env.READLINE_VERSION }}.tar.gz
|
|
|
|
tar -xf v${{ env.MBEDTLS_VERSION }}.tar.gz
|
|
tar -xf readline-${{ env.READLINE_VERSION }}.tar.gz
|
|
git clone --depth=1 https://github.com/libimobiledevice/libplist
|
|
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice-glue
|
|
git clone --depth=1 https://github.com/libimobiledevice/libirecovery
|
|
git clone --depth=1 https://github.com/libimobiledevice/libusbmuxd
|
|
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice
|
|
cd libplist && git fetch origin ${{ env.LIBPLIST_COMMIT }} && git reset --hard ${{ env.LIBPLIST_COMMIT }} && cd ..
|
|
cd libirecovery && git fetch origin ${{ env.LIBIRECOVERY_COMMIT }} && git reset --hard ${{ env.LIBIRECOVERY_COMMIT }} && cd ..
|
|
cd libimobiledevice-glue && git fetch origin ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }} && git reset --hard ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }} && cd ..
|
|
cd libimobiledevice && git fetch origin ${{ env.LIBIMOBILEDEVICE_COMMIT }} && git reset --hard ${{ env.LIBIMOBILEDEVICE_COMMIT }} && cd ..
|
|
cd libusbmuxd && git fetch origin ${{ env.LIBUSBMUXD_COMMIT }} && git reset --hard ${{ env.LIBUSBMUXD_COMMIT }} && cd ..
|
|
|
|
- name: Build Mbed TLS
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd mbedtls-${{ env.MBEDTLS_VERSION }}
|
|
cat ../patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch | patch -sN -d . -p1
|
|
mkdir build
|
|
cd build
|
|
SDKROOT="${{ env.SDK }}" cmake .. \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_CROSSCOMPILING=true \
|
|
-DCMAKE_SYSTEM_NAME=Darwin \
|
|
-DCMAKE_C_COMPILER="${{ env.CC }}" \
|
|
-DCMAKE_C_FLAGS='${{ env.CFLAGS }}' \
|
|
-DCMAKE_FIND_ROOT_PATH="${{ env.DESTDIR }}" \
|
|
-DCMAKE_INSTALL_PREFIX="${{ env.PREFIX }}" \
|
|
-DMBEDTLS_PYTHON_EXECUTABLE="/usr/local/bin/python3" \
|
|
-DENABLE_TESTING=OFF \
|
|
-DENABLE_PROGRAMS=OFF \
|
|
-DMBEDTLS_FATAL_WARNINGS=OFF \
|
|
-DCMAKE_INSTALL_SYSCONFDIR="/etc"
|
|
gmake -j$(sysctl -n hw.ncpu) \
|
|
SDKROOT="${{ env.SDK }}"
|
|
gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build readline
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd readline-${{ env.READLINE_VERSION }}
|
|
CC=clang CXX=clang++ ./configure ${{ env.CONFIGURE_ARGS }} ac_cv_type_sig_atomic_t=no
|
|
gmake -j$(sysctl -n hw.ncpu)
|
|
gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libplist
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libplist
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }} --without-cython
|
|
gmake -j$(sysctl -n hw.ncpu)
|
|
gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libimobiledevice-glue
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libimobiledevice-glue
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }}
|
|
gmake -j$(sysctl -n hw.ncpu)
|
|
gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libirecovery
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
sudo cp -a sysroot/usr/local/* /usr/local
|
|
cd libirecovery
|
|
autoreconf -fiv
|
|
if [ "${{ matrix.os }}" != "macosx" ]; then
|
|
gsed -i '/case kIOUSBTransactionTimeout/d' src/libirecovery.c
|
|
fi
|
|
./configure ${{ env.CONFIGURE_ARGS }}
|
|
echo -e 'all:\ninstall:' > tools/Makefile
|
|
make -j$(sysctl -n hw.ncpu) LIBS="-lncurses"
|
|
make -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
|
|
install -m644 src/.libs/libirecovery-1.0.a ${{ env.DESTDIR }}${{ env.PREFIX }}/lib
|
|
cd ..
|
|
|
|
- name: Build libusbmuxd
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libusbmuxd
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }}
|
|
gmake -j$(sysctl -n hw.ncpu)
|
|
gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libimobiledevice
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libimobiledevice
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }} --with-mbedtls --disable-debug --disable-wireless-pairing
|
|
echo -e 'all:\ninstall:' > tools/Makefile
|
|
gmake -j$(sysctl -n hw.ncpu)
|
|
gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build palera1n
|
|
run: |
|
|
cp -a sysroot/${{ env.PREFIX }}/{include,lib} dep_root
|
|
find dep_root -name '*.dylib' -delete
|
|
find dep_root -name '*.la' -delete
|
|
gmake -j$(sysctl -n hw.ncpu) ROOTFUL=1
|
|
cp src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
|
dsymutil palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
|
strip palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
|
|
|
- name: Build palera1n (Development)
|
|
run: |
|
|
gmake -j$(sysctl -n hw.ncpu) clean
|
|
gmake -j$(sysctl -n hw.ncpu) DEV_BUILD=1 TUI=1 ROOTFUL=1
|
|
cp src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
|
|
|
|
- name: Prepare artifact
|
|
run: |
|
|
mkdir -p ready/build_depends
|
|
tar -zcf ready/build_depends/dep_root-${{ matrix.os }}-${{ matrix.arch }}.tgz dep_root
|
|
if [ "${{ matrix.os }}" == "macosx" ]; then
|
|
ldid -S palera1n-${{ matrix.os }}-${{ matrix.arch }}{,.development}
|
|
else
|
|
ldid -Ssrc/usb.xml palera1n-${{ matrix.os }}-${{ matrix.arch }}{,.development}
|
|
fi
|
|
|
|
- name: Get branch name
|
|
id: branch-name
|
|
uses: tj-actions/branch-names@v7
|
|
|
|
- name: Upload artifact
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: wangyucode/[email protected]
|
|
with:
|
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
|
username: palera1n
|
|
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
|
forceUpload: true
|
|
dryRun: false
|
|
localDir: 'ready/'
|
|
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
|
|
|
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} build
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
|
path: palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
|
retention-days: 1
|
|
|
|
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} build (Development)
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
|
|
path: palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
|
|
retention-days: 1
|
|
|
|
|
|
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} debug symbols
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: palera1n-${{ matrix.os }}-${{ matrix.arch }}.dSYM
|
|
path: palera1n-${{ matrix.os }}-${{ matrix.arch }}.dSYM
|
|
retention-days: 1
|
|
|
|
- name: Generate cached sysroot archive
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
tar -c sysroot | xz -zce9T 0 > sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz
|
|
|
|
darwin-dist:
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
runs-on: macos-latest
|
|
needs: build-darwin
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Procursus
|
|
uses: beerpiss/[email protected]
|
|
with:
|
|
packages: sed coreutils
|
|
cache: true
|
|
mirror: 'https://apt.procurs.us/'
|
|
|
|
- name: Download all Darwin artifacts
|
|
uses: actions/download-artifact@v3
|
|
|
|
- name: Prepare artifact
|
|
run: |
|
|
lipo -create -arch arm64 ./palera1n-macosx-arm64/palera1n-macosx-arm64 -arch x86_64 ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 -output palera1n-macos
|
|
lipo -create -arch arm64 ./palera1n-macosx-arm64.development/palera1n-macosx-arm64.development -arch x86_64 ./palera1n-macosx-x86_64.development/palera1n-macosx-x86_64.development -output palera1n-macos.development
|
|
mkdir -p palera1n-macos.dSYM/Contents/Resources/DWARF
|
|
cp ./palera1n-macosx-x86_64.dSYM/Contents/Info.plist palera1n-macos.dSYM/Contents
|
|
lipo -create -arch arm64 palera1n-macosx-arm64.dSYM/Contents/Resources/DWARF/palera1n-macosx-arm64 -arch x86_64 palera1n-macosx-x86_64.dSYM/Contents/Resources/DWARF/palera1n-macosx-x86_64 -output palera1n-macos.dSYM/Contents/Resources/DWARF/palera1n-macos
|
|
mkdir -p ready/{debian,binaries,debug_symbols,binaries_development}
|
|
cp palera1n-macos.development ready/binaries_development/palera1n-macos-universal.development
|
|
cp palera1n-macos ready/binaries/palera1n-macos-universal
|
|
cp ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 ready/binaries/palera1n-macos-x86_64
|
|
cp ./palera1n-macosx-arm64/palera1n-macosx-arm64 ready/binaries/palera1n-macos-arm64
|
|
cp ./palera1n-iphoneos-arm64/palera1n-iphoneos-arm64 ready/binaries/palera1n-iphoneos-arm64
|
|
cp ./palera1n-macosx-x86_64.development/palera1n-macosx-x86_64.development ready/binaries_development/palera1n-macos-x86_64.development
|
|
cp ./palera1n-macosx-arm64.development/palera1n-macosx-arm64.development ready/binaries_development/palera1n-macos-arm64.development
|
|
cp ./palera1n-iphoneos-arm64.development/palera1n-iphoneos-arm64.development ready/binaries_development/palera1n-iphoneos-arm64.development
|
|
zip -r9 ready/debug_symbols/palera1n-iphoneos-arm64.dSYM.zip palera1n-iphoneos-arm64.dSYM
|
|
zip -r9 ready/debug_symbols/palera1n-macosx-arm64.dSYM.zip palera1n-macosx-arm64.dSYM
|
|
zip -r9 ready/debug_symbols/palera1n-macosx-x86_64.dSYM.zip palera1n-macosx-x86_64.dSYM
|
|
zip -r9 ready/debug_symbols/palera1n-macos.dSYM.zip palera1n-macos.dSYM
|
|
|
|
- name: Build debs
|
|
run: |
|
|
make -j$(sysctl -n hw.ncpu) docs
|
|
version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||' | sed 's|-beta|~beta|')
|
|
|
|
# Darwin x86_64
|
|
mkdir -p stage/DEBIAN
|
|
mkdir -p stage/opt/procursus/bin
|
|
mkdir -p stage/opt/procursus/usr/share/man/man1
|
|
cp packaging/control.macosx stage/DEBIAN/control
|
|
|
|
gsed 's|@DEB_ARCH@|darwin-amd64|g' -i stage/DEBIAN/control
|
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
|
|
|
ginstall -Dm644 ready/binaries/palera1n-macos-x86_64 stage/opt/procursus/bin/palera1n
|
|
zstd -c19 docs/palera1n.1 > stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
|
|
chmod 644 stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
|
|
chmod 755 stage/opt/procursus/bin/palera1n
|
|
|
|
dpkg-deb --root-owner-group -Zzstd -b stage palera1n_darwin-amd64.deb
|
|
rm -rf stage
|
|
|
|
# Darwin arm64
|
|
mkdir -p stage/DEBIAN
|
|
mkdir -p stage/opt/procursus/bin
|
|
mkdir -p stage/opt/procursus/usr/share/man/man1
|
|
cp packaging/control.macosx stage/DEBIAN/control
|
|
|
|
gsed 's|@DEB_ARCH@|darwin-arm64|g' -i stage/DEBIAN/control
|
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
|
|
|
ginstall -Dm644 ready/binaries/palera1n-macos-arm64 stage/opt/procursus/bin/palera1n
|
|
zstd -c19 docs/palera1n.1 > stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
|
|
chmod 644 stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
|
|
chmod 755 stage/opt/procursus/bin/palera1n
|
|
|
|
dpkg-deb --root-owner-group -Zzstd -b stage palera1n_darwin-arm64.deb
|
|
rm -rf stage
|
|
|
|
# iPhoneOS
|
|
mkdir -p stage/DEBIAN
|
|
mkdir -p stage/usr/bin
|
|
mkdir -p stage/usr/share/man/man1
|
|
cp packaging/control stage/DEBIAN/control
|
|
|
|
gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
|
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
|
|
|
ginstall -Dm644 ready/binaries/palera1n-iphoneos-arm64 stage/usr/bin/palera1n
|
|
zstd -c19 docs/palera1n.1 > stage/usr/share/man/man1/palera1n.1.zst
|
|
chmod 644 stage/usr/share/man/man1/palera1n.1.zst
|
|
chmod 755 stage/usr/bin/palera1n
|
|
|
|
dpkg-deb --root-owner-group -Zzstd -b stage palera1n_iphoneos-arm.deb
|
|
rm -rf stage
|
|
|
|
# iPhoneOS (rootless)
|
|
mkdir -p stage/DEBIAN
|
|
mkdir -p stage/var/jb/usr/bin
|
|
mkdir -p stage/var/jb/usr/share/man/man1
|
|
cp packaging/control stage/DEBIAN/control
|
|
|
|
gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
|
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
|
|
|
ginstall -Dm644 ready/binaries/palera1n-iphoneos-arm64 stage/var/jb/usr/bin/palera1n
|
|
zstd -c19 docs/palera1n.1 > stage/var/jb/usr/share/man/man1/palera1n.1.zst
|
|
chmod 644 stage/var/jb/usr/share/man/man1/palera1n.1.zst
|
|
chmod 755 stage/var/jb/usr/bin/palera1n
|
|
|
|
dpkg-deb --root-owner-group -Zzstd -b stage palera1n_iphoneos-arm64.deb
|
|
rm -rf stage
|
|
|
|
mv palera1n*.deb ready/debian
|
|
|
|
- name: Save build tag
|
|
run: echo "$(git describe --dirty --tags --abbrev=7 | sed 's|-dirty||')" > build-tag.txt
|
|
|
|
- name: Upload build tag
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-tag
|
|
path: build-tag.txt
|
|
|
|
- name: Get branch name
|
|
id: branch-name
|
|
uses: tj-actions/branch-names@v7
|
|
|
|
- name: Upload artifact
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: wangyucode/[email protected]
|
|
with:
|
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
|
username: palera1n
|
|
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
|
forceUpload: true
|
|
dryRun: false
|
|
localDir: 'ready/'
|
|
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
|
|
|
build-Linux:
|
|
strategy:
|
|
matrix:
|
|
triple:
|
|
- i486-linux-musl
|
|
- x86_64-linux-musl
|
|
- armel-linux-musleabi
|
|
- aarch64-linux-musl
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
MBEDTLS_VERSION: 3.5.2
|
|
LIBUSB_VERSION: 1.0.27
|
|
READLINE_VERSION: 8.2
|
|
GPM_VERSION: 1.20.7
|
|
LIBIMOBILEDEVICE_COMMIT: ed0d66d0341562731bb19928dfe48155509fa7a7
|
|
LIBIRECOVERY_COMMIT: 7ce02c347b7c26e59498e6af31c9da51018d0fa1
|
|
LIBIMOBILEDEVICE_GLUE_COMMIT: 362f7848ac89b74d9dd113b38b51ecb601f76094
|
|
USBMUXD_COMMIT: bc0b91ca856811f4393318dc83db6dc3c1ac326d
|
|
LIBPLIST_COMMIT: 2117b8fdb6b4096455bd2041a63e59a028120136
|
|
LIBUSBMUXD_COMMIT: a7f0543fb1ecb20ac7121c0fd77297200e0e43fc
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install build dependencies (packages)
|
|
run: |
|
|
sudo apt-get remove -y libssl-dev libreadline-dev
|
|
sudo apt-get install -y pkg-config autoconf automake autopoint mandoc
|
|
sudo pip3 install jsonschema jinja2
|
|
|
|
- name: Download toolchain checksum
|
|
run: |
|
|
curl -LO https://musl.cc/SHA512SUMS
|
|
echo "TOOLCHAIN_CHECKSUM="$(grep ${{ matrix.triple }}-cross.tgz SHA512SUMS | cut -d' ' -f1) >> $GITHUB_ENV
|
|
|
|
- name: Download toolchain (cached)
|
|
id: toolchain_cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ matrix.triple }}-cross.tgz
|
|
key: ${{ matrix.triple }}-${{ env.TOOLCHAIN_CHECKSUM }}-toolchain
|
|
|
|
- name: Download toolchain
|
|
if: steps.toolchain_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
curl -LO https://musl.cc/${{ matrix.triple }}-cross.tgz
|
|
|
|
- name: Setup environment
|
|
run: |
|
|
tar -xf ${{ matrix.triple }}-cross.tgz
|
|
mkdir sysroot
|
|
echo "$(pwd)/${{ matrix.triple }}-cross/bin" >> $GITHUB_PATH
|
|
case ${{ matrix.triple }} in
|
|
i486-linux-musl)
|
|
echo "CHECKRA1N_NAME=linux-x86" >> $GITHUB_ENV
|
|
echo "ARCH_NAME=i386" >> $GITHUB_ENV
|
|
;;
|
|
x86_64-linux-musl)
|
|
echo "CHECKRA1N_NAME=linux-x86_64" >> $GITHUB_ENV
|
|
echo "ARCH_NAME=amd64" >> $GITHUB_ENV
|
|
;;
|
|
armel-linux-musleabi)
|
|
echo "CHECKRA1N_NAME=linux-armel" >> $GITHUB_ENV
|
|
echo "ARCH_NAME=armel" >> $GITHUB_ENV
|
|
;;
|
|
aarch64-linux-musl)
|
|
echo "CHECKRA1N_NAME=linux-arm64" >> $GITHUB_ENV
|
|
echo "ARCH_NAME=arm64" >> $GITHUB_ENV
|
|
;;
|
|
esac
|
|
echo "PKG_CONFIG_PATH=$(pwd)/sysroot/usr/local/lib/pkgconfig" >> $GITHUB_ENV
|
|
echo "CFLAGS=-g -fdata-sections -ffunction-sections -I$(pwd)/sysroot/usr/local/include -L$(pwd)/sysroot/usr/local/lib -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
|
|
echo "CXXFLAGS=-g -fdata-sections -ffunction-sections -I$(pwd)/sysroot/usr/local/include -L$(pwd)/sysroot/usr/local/lib -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
|
|
echo "LDFLAGS=-g -Wl,--gc-sections -fdata-sections -ffunction-sections -I$(pwd)/sysroot/usr/local/include -L$(pwd)/sysroot/usr/local/lib" >> $GITHUB_ENV
|
|
echo "INSTALL=$(command -v install) --strip-program=${{ matrix.triple }}-strip" >> $GITHUB_ENV
|
|
echo "DESTDIR=$(pwd)/sysroot" >> $GITHUB_ENV
|
|
echo "PREFIX=/usr/local" >> $GITHUB_ENV
|
|
echo "CONFIGURE_ARGS=--build=x86_64-linux-gnu --host=${{ matrix.triple }} --prefix=/usr/local --disable-shared --enable-static" >> $GITHUB_ENV
|
|
echo "CROSS_COMPILE=${{ matrix.triple }}-" >> $GITHUB_ENV
|
|
|
|
- name: Check dependencies cache
|
|
run: |
|
|
echo "target: ${{ matrix.triple }}" > cache.txt
|
|
echo "mbedtls ${{ env.MBEDTLS_VERSION }}" >> cache.txt
|
|
echo "readline: ${{ env.READLINE_VERSION }}" >> cache.txt
|
|
echo "libimobiledevice: ${{ env.LIBIMOBILEDEVICE_COMMIT }}" >> cache.txt
|
|
echo "libirecovery: ${{ env.LIBIRECOVERY_COMMIT }}" >> cache.txt
|
|
echo "libimobiledevice-glue: ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }}" >> cache.txt
|
|
echo "libplist: ${{ env.LIBPLIST_COMMIT }}" >> cache.txt
|
|
echo "libusbmuxd: ${{ env.LIBUSBMUXD_COMMIT }}" >> cache.txt
|
|
echo "usbmuxd: ${{ env.USBMUXD_COMMIT }}" >> cache.txt
|
|
echo "cc: $(${{ env.CROSS_COMPILE }}gcc --version)" >> cache.txt
|
|
echo "CACHE_TXT_CHECKSUM=sysroot-$(sha512sum cache.txt | cut -d' ' -f1)" >> $GITHUB_ENV
|
|
|
|
- name: Download cached sysroot
|
|
id: sysroot_cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz
|
|
key: sysroot-${{ env.CACHE_TXT_CHECKSUM }}
|
|
|
|
- name: Extract cached sysroot
|
|
if: steps.sysroot_cache.outputs.cache-hit == 'true'
|
|
run: |
|
|
xz -dcT0 sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz | tar -x
|
|
|
|
- name: Setup sysroot
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
mkdir -p $(pwd)/sysroot/usr/local/lib
|
|
ln -sf $(pwd)/sysroot/usr/local/lib{,64}
|
|
|
|
- name: Download dependencies (source code)
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
curl -LOOOOOOO \
|
|
https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${{ env.MBEDTLS_VERSION }}.tar.gz \
|
|
https://github.com/libusb/libusb/releases/download/v${{ env.LIBUSB_VERSION }}/libusb-${{ env.LIBUSB_VERSION }}.tar.bz2 \
|
|
https://mirror-hk.koddos.net/gnu/readline/readline-${{ env.READLINE_VERSION }}.tar.gz \
|
|
https://github.com/telmich/gpm/archive/refs/tags/${{ env.GPM_VERSION }}.tar.gz
|
|
|
|
tar -xf v${{ env.MBEDTLS_VERSION }}.tar.gz
|
|
tar -xjf libusb-${{ env.LIBUSB_VERSION }}.tar.bz2
|
|
tar -xf readline-${{ env.READLINE_VERSION }}.tar.gz
|
|
tar -xf ${{ env.GPM_VERSION }}.tar.gz
|
|
git clone --depth=1 https://github.com/libimobiledevice/libplist
|
|
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice-glue
|
|
git clone --depth=1 https://github.com/libimobiledevice/libirecovery
|
|
git clone --depth=1 https://github.com/libimobiledevice/libusbmuxd
|
|
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice
|
|
git clone --depth=1 https://github.com/libimobiledevice/usbmuxd
|
|
cd libplist && git fetch origin ${{ env.LIBPLIST_COMMIT }} && git reset --hard ${{ env.LIBPLIST_COMMIT }} && cd ..
|
|
cd libirecovery && git fetch origin ${{ env.LIBIRECOVERY_COMMIT }} && git reset --hard ${{ env.LIBIRECOVERY_COMMIT }} && cd ..
|
|
cd libimobiledevice-glue && git fetch origin ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }} && git reset --hard ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }} && cd ..
|
|
cd usbmuxd && git fetch origin ${{ env.USBMUXD_COMMIT }} && git reset --hard ${{ env.USBMUXD_COMMIT }} && cd ..
|
|
cd libimobiledevice && git fetch origin ${{ env.LIBIMOBILEDEVICE_COMMIT }} && git reset --hard ${{ env.LIBIMOBILEDEVICE_COMMIT }} && cd ..
|
|
cd libusbmuxd && git fetch origin ${{ env.LIBUSBMUXD_COMMIT }} && git reset --hard ${{ env.LIBUSBMUXD_COMMIT }} && cd ..
|
|
|
|
- name: Build Mbed TLS
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd mbedtls-${{ env.MBEDTLS_VERSION }}
|
|
cat ../patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch | patch -sN -d . -p1
|
|
mkdir build
|
|
if [ "${{ matrix.triple }}" = "i486-linux-musl" ]; then sed -i '/define MBEDTLS_AESNI_C/d' include/mbedtls/mbedtls_config.h; fi
|
|
cd build
|
|
cmake .. \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_CROSSCOMPILING=true \
|
|
-DCMAKE_SYSTEM_NAME=Linux \
|
|
-DCMAKE_SYSTEM_PROCESSOR=$(echo ${{ matrix.triple }} | cut -d- -f1) \
|
|
-DCMAKE_C_COMPILER='${{ env.CROSS_COMPILE }}gcc' \
|
|
-DCMAKE_C_FLAGS='${{ env.CFLAGS }}' \
|
|
-DCMAKE_CXX_FLAGS='${{ env.CXXFLAGS }}' \
|
|
-DCMAKE_FIND_ROOT_PATH="${{ env.DESTDIR }}" \
|
|
-DCMAKE_INSTALL_PREFIX="${{ env.PREFIX }}" \
|
|
-DENABLE_TESTING=OFF \
|
|
-DENABLE_PROGRAMS=OFF \
|
|
-DCMAKE_INSTALL_SYSCONFDIR="/etc"
|
|
make -j$(nproc)
|
|
make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libusb
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libusb-${{ env.LIBUSB_VERSION }}
|
|
./configure ${{ env.CONFIGURE_ARGS }} --disable-udev
|
|
make -j$(nproc)
|
|
make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build readline
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd readline-${{ env.READLINE_VERSION }}
|
|
./configure ${{ env.CONFIGURE_ARGS }}
|
|
make -j$(nproc)
|
|
make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build GPM
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd gpm-${{ env.GPM_VERSION }}
|
|
cat ../patches/gpm/*.patch | patch -sN -d . -p1
|
|
./autogen.sh
|
|
./configure \
|
|
${{ env.CONFIGURE_ARGS }}
|
|
gmake -j$(sysctl -n hw.ncpu)
|
|
gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libplist
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libplist
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }} --without-cython
|
|
make -j$(nproc)
|
|
make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libimobiledevice-glue
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libimobiledevice-glue
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }}
|
|
make -j$(nproc)
|
|
make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libirecovery (sorta)
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
sudo mv /usr/local /usr/local.bak
|
|
sudo ln -s ${{ env.DESTDIR }}${{ env.PREFIX }} /usr/local
|
|
cd libirecovery
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }}
|
|
echo -e 'all:\ninstall:' > tools/Makefile
|
|
make -ij$(nproc)
|
|
make -ij$(nproc) install DESTDIR=${{ env.DESTDIR }}
|
|
install -m644 src/.libs/libirecovery-1.0.a ${{ env.DESTDIR }}${{ env.PREFIX }}/lib
|
|
cd ..
|
|
|
|
- name: Build libusbmuxd
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libusbmuxd
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }}
|
|
make -j$(nproc)
|
|
make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
|
|
- name: Build libimobiledevice
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd libimobiledevice
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }} --with-mbedtls --disable-debug --disable-wireless-pairing
|
|
echo -e 'all:\ninstall:' > tools/Makefile
|
|
make -j$(nproc)
|
|
make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
|
|
cd ..
|
|
sudo rm /usr/local
|
|
sudo mv /usr/local.bak /usr/local
|
|
|
|
- name: Build usbmuxd
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd usbmuxd
|
|
autoreconf -fiv
|
|
./configure ${{ env.CONFIGURE_ARGS }} --without-systemd
|
|
${{ matrix.triple }}-gcc ${{ env.CFLAGS }} -I${{ env.DESTDIR }}/${{ env.PREFIX }}/include/libusb-1.0 src/*.c \
|
|
-DHAVE_CONFIG_H -no-pie \
|
|
-I. -static ${{ env.LDFLAGS }}} -limobiledevice-1.0 -lusbmuxd-2.0 -limobiledevice-glue-1.0 \
|
|
-lplist-2.0 -lusb-1.0 -lmbedtls -lmbedcrypto -lmbedx509 -lpthread -o usbmuxd
|
|
mkdir -p ${{ env.DESTDIR }}/${{ env.PREFIX }}/sbin
|
|
${{ matrix.triple }}-objcopy --only-keep-debug usbmuxd usbmuxd.debug
|
|
${{ matrix.triple }}-strip --strip-debug --strip-unneeded usbmuxd
|
|
${{ matrix.triple }}-objcopy --add-gnu-debuglink=usbmuxd.debug usbmuxd
|
|
install -m755 usbmuxd usbmuxd.debug ${{ env.DESTDIR }}/${{ env.PREFIX }}/sbin
|
|
cd ..
|
|
|
|
- name: Build palera1n
|
|
run: |
|
|
cp -a ${{ env.DESTDIR }}/${{ env.PREFIX }}/{include,lib} dep_root
|
|
find dep_root -name '*.so' -delete
|
|
find dep_root -name '*.la' -delete
|
|
CC="${{ matrix.triple }}-gcc" make -j$(nproc) ROOTFUL=1
|
|
cp src/palera1n palera1n.release
|
|
|
|
- name: Seperate debug symbols
|
|
run: |
|
|
${{ matrix.triple }}-objcopy --only-keep-debug palera1n.release palera1n.debug
|
|
${{ matrix.triple }}-strip --strip-debug --strip-unneeded palera1n.release
|
|
${{ matrix.triple }}-objcopy --add-gnu-debuglink=palera1n.debug palera1n.release
|
|
chmod -x palera1n.debug
|
|
|
|
- name: Build palera1n (Development)
|
|
run: |
|
|
CC="${{ matrix.triple }}-gcc" make -j$(nproc) clean
|
|
CC="${{ matrix.triple }}-gcc" make -j$(nproc) DEV_BUILD=1 ROOTFUL=1
|
|
cp src/palera1n palera1n.development
|
|
|
|
- name: Prepare artifact
|
|
run: |
|
|
mkdir -p ready/{binaries,debian,binaries_development,build_depends,debug_symbols} usbmuxd-static
|
|
mv palera1n.debug ready/debug_symbols/palera1n-${{ env.CHECKRA1N_NAME }}.debug
|
|
mv palera1n.release ready/binaries/palera1n-${{ env.CHECKRA1N_NAME }}
|
|
mv palera1n.development ready/binaries_development/palera1n-${{ env.CHECKRA1N_NAME }}.development
|
|
tar -zcf ready/build_depends/dep_root_${{ matrix.triple }}.tgz dep_root
|
|
install -m755 sysroot/${{ env.PREFIX }}/sbin/usbmuxd usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}
|
|
install -m755 sysroot/${{ env.PREFIX }}/sbin/usbmuxd.debug usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}.debug
|
|
|
|
- name: Build debs
|
|
run: |
|
|
version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||' | sed 's|-beta|~beta|')
|
|
|
|
make -j$(nproc) docs
|
|
mkdir -p stage/DEBIAN
|
|
mkdir -p stage/usr/bin
|
|
mkdir -p stage/usr/share/man/man1
|
|
cp packaging/control stage/DEBIAN/control
|
|
|
|
sed 's|@DEB_ARCH@|${{ env.ARCH_NAME }}|g' -i stage/DEBIAN/control
|
|
sed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
|
|
|
install -Dm644 ready/binaries/palera1n-${{ env.CHECKRA1N_NAME }} stage/usr/bin/palera1n
|
|
gzip -c9 docs/palera1n.1 > stage/usr/share/man/man1/palera1n.1.gz
|
|
chmod 755 stage/usr/bin/palera1n
|
|
chmod 644 stage/usr/share/man/man1/palera1n.1.gz
|
|
|
|
dpkg-deb --root-owner-group -b stage palera1n_${{ env.ARCH_NAME }}.deb
|
|
mv palera1n*.deb ready/debian
|
|
rm -rf stage
|
|
|
|
- name: Get branch name
|
|
id: branch-name
|
|
uses: tj-actions/branch-names@v7
|
|
|
|
- name: Upload artifact
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: wangyucode/[email protected]
|
|
with:
|
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
|
username: palera1n
|
|
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
|
forceUpload: true
|
|
dryRun: false
|
|
localDir: 'ready/'
|
|
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
|
|
|
- name: Upload usbmuxd artifact
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: wangyucode/[email protected]
|
|
with:
|
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
|
username: palera1n
|
|
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
|
forceUpload: true
|
|
dryRun: false
|
|
localDir: 'usbmuxd-static/'
|
|
remoteDir: "/palera1n/artifacts/usbmuxd-static"
|
|
|
|
- name: Generate cached sysroot archive
|
|
if: steps.sysroot_cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
tar -c sysroot | xz -zce9T 0 > sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz
|
|
|
|
finish-build:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
needs: [build-docs, build-darwin, darwin-dist, build-Linux]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Get branch name
|
|
id: branch-name
|
|
uses: tj-actions/branch-names@v7
|
|
|
|
- name: Download build tag
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-tag
|
|
|
|
- uses: geekyeggo/delete-artifact@v2
|
|
with:
|
|
name: '*'
|
|
failOnError: false
|
|
|
|
- name: Send Discord build message
|
|
run: |
|
|
COMMITMESSAGE=`git log --pretty=format:'- \`%h\` %s' -1 --reverse` &&
|
|
(curl "${{ secrets.DISCORD_WEBHOOK }}" -sS -H "Content-Type:application/json" -X POST -d "{\"content\":null,\"embeds\":[{\"title\":\"[palera1n:${{ steps.branch-name.outputs.ref_branch }}] Nightly Build ${{ github.run_number }}\",\"url\":\"https://github.com/palera1n/palera1n/actions/runs/${GITHUB_RUN_ID}\",\"color\":2829617,\"fields\":[{\"name\":\"Build tag\",\"value\":\"- \`$(cat build-tag.txt | sed 's|\n||')\`\"},{\"name\":\"Destination\",\"value\":\"- https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}\"},{\"name\":\"Documentation\",\"value\":\"- [palera1n.1.html](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/docs/palera1n.1.html)\"},{\"name\":\"Main Artifacts\",\"value\":\"- [palera1n-iphoneos-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-iphoneos-arm64)\n- [palera1n-linux-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-arm64)\n- [palera1n-linux-armel](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-armel)\n- [palera1n-linux-x86](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-x86)\n- [palera1n-linux-x86_64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-x86_64)\n- [palera1n-macos-universal](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-macos-universal)\"}],\"footer\":{\"text\":\"${{ github.actor }}\", \"icon_url\": \"https://github.com/${{ github.actor }}.png\",\"timestamp\":\"$(date -u +"%FT%TZ")\"}}],\"username\":\"GitHub Actions\",\"avatar_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}")
|
|
|