makefile structure changes

This commit is contained in:
Nick Chan committed 2023-11-06 01:54:57 +08:00
1 parent 6605a10b2f
commit ded58231fb
18 files changed
+198 -106

No files matched your search

+88 -49
View File
@@ -36,8 +36,8 @@ jobs:
- name: Build Documentation - name: Build Documentation
run: | run: |
make -j$(nproc) docs make -j$(nproc) docs
mkdir ready mkdir -p ready/docs
cp docs/*.html docs/mandoc.css docs/palera1n.1 ready cp docs/*.html docs/mandoc.css docs/palera1n.1 ready/docs
- name: Get branch name - name: Get branch name
id: branch-name id: branch-name
@@ -317,17 +317,25 @@ jobs:
find dep_root -name '*.dylib' -delete find dep_root -name '*.dylib' -delete
find dep_root -name '*.la' -delete find dep_root -name '*.la' -delete
gmake -j$(sysctl -n hw.ncpu) gmake -j$(sysctl -n hw.ncpu)
mkdir -p ready cp src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}
mv src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}
dsymutil palera1n-${{ matrix.os }}-${{ matrix.arch }} dsymutil palera1n-${{ matrix.os }}-${{ matrix.arch }}
strip palera1n-${{ matrix.os }}-${{ matrix.arch }} strip palera1n-${{ matrix.os }}-${{ matrix.arch }}
- name: Build palera1n (Development)
run: |
CC="${{ matrix.triple }}-gcc" gmake -j$(sysctl -n hw.ncpu) clean
CC="${{ matrix.triple }}-gcc" 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 if [ "${{ matrix.os }}" == "macosx" ]; then
ldid -S palera1n-${{ matrix.os }}-${{ matrix.arch }} ldid -S palera1n-${{ matrix.os }}-${{ matrix.arch }}{,.development}
else else
ldid -Ssrc/usb.xml palera1n-${{ matrix.os }}-${{ matrix.arch }} ldid -Ssrc/usb.xml palera1n-${{ matrix.os }}-${{ matrix.arch }}{,.development}
fi fi
mkdir -p ready
tar -zcf ready/dep_root-${{ matrix.os }}-${{ matrix.arch }}.tgz dep_root
- name: Get branch name - name: Get branch name
id: branch-name id: branch-name
@@ -354,6 +362,15 @@ jobs:
path: palera1n-${{ matrix.os }}-${{ matrix.arch }} path: palera1n-${{ matrix.os }}-${{ matrix.arch }}
retention-days: 1 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 - name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} debug symbols
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@@ -384,18 +401,24 @@ jobs:
- name: Prepare artifact - name: Prepare artifact
run: | run: |
find .
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/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 mkdir -p palera1n-macos.dSYM/Contents/Resources/DWARF
cp ./palera1n-macosx-x86_64.dSYM/Contents/Info.plist palera1n-macos.dSYM/Contents 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 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 ready mkdir -p ready/{debian,binaries,debug_symbols,binaries_development}
cp palera1n-macos ready/palera1n-macos-universal cp palera1n-macos.development ready/binaries_development/palera1n-macos-universal.development
cp ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 ready/palera1n-macos-x86_64 cp palera1n-macos ready/binaries/palera1n-macos-universal
cp ./palera1n-macosx-arm64/palera1n-macosx-arm64 ready/palera1n-macos-arm64 cp ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 ready/binaries/palera1n-macos-x86_64
cp ./palera1n-iphoneos-arm64/palera1n-iphoneos-arm64 ready/palera1n-iphoneos-arm64 cp ./palera1n-macosx-arm64/palera1n-macosx-arm64 ready/binaries/palera1n-macos-arm64
zip -r9 ready/palera1n-iphoneos-arm64.dSYM.zip palera1n-iphoneos-arm64.dSYM cp ./palera1n-iphoneos-arm64/palera1n-iphoneos-arm64 ready/binaries/palera1n-iphoneos-arm64
zip -r9 ready/palera1n-macos.dSYM.zip palera1n-macos.dSYM 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 - name: Build debs
run: | run: |
@@ -411,12 +434,12 @@ jobs:
gsed 's|@DEB_ARCH@|darwin-amd64|g' -i stage/DEBIAN/control gsed 's|@DEB_ARCH@|darwin-amd64|g' -i stage/DEBIAN/control
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
ginstall -Dm644 ready/palera1n-macos-x86_64 stage/opt/procursus/bin/palera1n ginstall -Dm644 ready/binaries/palera1n-macos-x86_64 stage/opt/procursus/bin/palera1n
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1 zstd -c19 docs/palera1n.1 > stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
chmod +x stage/opt/procursus/bin/palera1n chmod 644 stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
chmod 755 stage/opt/procursus/bin/palera1n
dpkg-deb -Zzstd -b stage palera1n_darwin-amd64.deb dpkg-deb --root-owner-group -Zzstd -b stage palera1n_darwin-amd64.deb
mv palera1n*.deb ready/
rm -rf stage rm -rf stage
# Darwin arm64 # Darwin arm64
@@ -428,12 +451,12 @@ jobs:
gsed 's|@DEB_ARCH@|darwin-arm64|g' -i stage/DEBIAN/control gsed 's|@DEB_ARCH@|darwin-arm64|g' -i stage/DEBIAN/control
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
ginstall -Dm644 ready/palera1n-macos-arm64 stage/opt/procursus/bin/palera1n ginstall -Dm644 ready/binaries/palera1n-macos-arm64 stage/opt/procursus/bin/palera1n
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1 zstd -c19 docs/palera1n.1 > stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
chmod +x stage/opt/procursus/bin/palera1n chmod 644 stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
chmod 755 stage/opt/procursus/bin/palera1n
dpkg-deb -Zzstd -b stage palera1n_darwin-arm64.deb dpkg-deb --root-owner-group -Zzstd -b stage palera1n_darwin-arm64.deb
mv palera1n*.deb ready/
rm -rf stage rm -rf stage
# iPhoneOS # iPhoneOS
@@ -445,12 +468,12 @@ jobs:
gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
ginstall -Dm644 ready/palera1n-iphoneos-arm64 stage/usr/bin/palera1n ginstall -Dm644 ready/binaries/palera1n-iphoneos-arm64 stage/usr/bin/palera1n
ginstall -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1 zstd -c19 docs/palera1n.1 > stage/usr/share/man/man1/palera1n.1.zst
chmod +x stage/usr/bin/palera1n chmod 644 stage/usr/share/man/man1/palera1n.1.zst
chmod 755 stage/usr/bin/palera1n
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm.deb dpkg-deb --root-owner-group -Zzstd -b stage palera1n_iphoneos-arm.deb
mv palera1n*.deb ready/
rm -rf stage rm -rf stage
# iPhoneOS (rootless) # iPhoneOS (rootless)
@@ -462,14 +485,16 @@ jobs:
gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
ginstall -Dm644 ready/palera1n-iphoneos-arm64 stage/var/jb/usr/bin/palera1n ginstall -Dm644 ready/binaries/palera1n-iphoneos-arm64 stage/var/jb/usr/bin/palera1n
ginstall -Dm644 docs/palera1n.1 stage/var/jb/usr/share/man/man1/palera1n.1 zstd -c19 docs/palera1n.1 > stage/var/jb/usr/share/man/man1/palera1n.1.zst
chmod +x stage/var/jb/usr/bin/palera1n chmod 644 stage/var/jb/usr/share/man/man1/palera1n.1.zst
chmod 755 stage/var/jb/usr/bin/palera1n
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm64.deb dpkg-deb --root-owner-group -Zzstd -b stage palera1n_iphoneos-arm64.deb
mv palera1n*.deb ready/
rm -rf stage rm -rf stage
mv palera1n*.deb ready/debian
- name: Save build tag - name: Save build tag
run: echo "$(git describe --dirty --tags --abbrev=7 | sed 's|-dirty||')" > build-tag.txt run: echo "$(git describe --dirty --tags --abbrev=7 | sed 's|-dirty||')" > build-tag.txt
@@ -774,20 +799,28 @@ jobs:
find dep_root -name '*.so' -delete find dep_root -name '*.so' -delete
find dep_root -name '*.la' -delete find dep_root -name '*.la' -delete
CC="${{ matrix.triple }}-gcc" make -j$(nproc) CC="${{ matrix.triple }}-gcc" make -j$(nproc)
cp src/palera1n palera1n.release
- name: Seperate debug symbols - name: Seperate debug symbols
run: | run: |
${{ matrix.triple }}-objcopy --only-keep-debug src/palera1n palera1n.debug ${{ matrix.triple }}-objcopy --only-keep-debug palera1n.release palera1n.debug
${{ matrix.triple }}-strip --strip-debug --strip-unneeded src/palera1n ${{ matrix.triple }}-strip --strip-debug --strip-unneeded palera1n.release
${{ matrix.triple }}-objcopy --add-gnu-debuglink=palera1n.debug src/palera1n ${{ matrix.triple }}-objcopy --add-gnu-debuglink=palera1n.debug palera1n.release
chmod -x palera1n.debug 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 TUI=1 ROOTFUL=1
cp src/palera1n palera1n.development
- name: Prepare artifact - name: Prepare artifact
run: | run: |
mkdir ready usbmuxd-static mkdir -p ready/{binaries,debian,binaries_development,build_depends,debug_symbols} usbmuxd-static
mv palera1n.debug ready/palera1n-${{ env.CHECKRA1N_NAME }}.debug mv palera1n.debug ready/debug_symbols/palera1n-${{ env.CHECKRA1N_NAME }}.debug
mv src/palera1n ready/palera1n-${{ env.CHECKRA1N_NAME }} mv palera1n.release ready/binaries/palera1n-${{ env.CHECKRA1N_NAME }}
tar -zcf ready/dep_root_${{ matrix.triple }}.tgz dep_root 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 usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}
install -m755 sysroot/${{ env.PREFIX }}/sbin/usbmuxd.debug usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}.debug install -m755 sysroot/${{ env.PREFIX }}/sbin/usbmuxd.debug usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}.debug
@@ -804,12 +837,13 @@ jobs:
sed 's|@DEB_ARCH@|${{ env.ARCH_NAME }}|g' -i 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 sed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
install -Dm644 ready/palera1n-${{ env.CHECKRA1N_NAME }} stage/usr/bin/palera1n install -Dm644 ready/binaries/palera1n-${{ env.CHECKRA1N_NAME }} stage/usr/bin/palera1n
install -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1 gzip -c9 docs/palera1n.1 > stage/usr/share/man/man1/palera1n.1.gz
chmod +x stage/usr/bin/palera1n chmod 755 stage/usr/bin/palera1n
chmod 644 stage/usr/share/man/man1/palera1n.1.gz
dpkg-deb -b stage palera1n_${{ env.ARCH_NAME }}.deb dpkg-deb --root-owner-group -b stage palera1n_${{ env.ARCH_NAME }}.deb
mv palera1n*.deb ready/ mv palera1n*.deb ready/debian
rm -rf stage rm -rf stage
- name: Get branch name - name: Get branch name
@@ -859,8 +893,13 @@ jobs:
with: with:
name: build-tag name: build-tag
- uses: geekyeggo/delete-artifact@v2
with:
name: '*'
failOnError: false
- name: Send Discord build message - name: Send Discord build message
run: | run: |
COMMITMESSAGE=`git log --pretty=format:'- \`%h\` %s' -1 --reverse` && 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 }}/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 }}/palera1n-iphoneos-arm64)\n- [palera1n-linux-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-linux-arm64)\n- [palera1n-linux-armel](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-linux-armel)\n- [palera1n-linux-x86](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/$${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/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 }}/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 }}/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\"}") (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\"}")
+3 -3
View File
@@ -2,7 +2,7 @@ SRC = $(shell pwd)
DEP = $(SRC)/dep_root DEP = $(SRC)/dep_root
STRIP = strip STRIP = strip
CC ?= cc CC ?= cc
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC) -D_XOPEN_SOURCE=500 CFLAGS += -isystem $(DEP)/include -I$(SRC)/include -I$(SRC) -D_XOPEN_SOURCE=500
CFLAGS += -Wall -Wextra -Wno-unused-parameter -DPALERAIN_VERSION=\"2.0.0\" CFLAGS += -Wall -Wextra -Wno-unused-parameter -DPALERAIN_VERSION=\"2.0.0\"
CFLAGS += -Wno-unused-variable -I$(SRC)/src -std=c99 -pedantic-errors -D_C99_SOURCE -D_POSIX_C_SOURCE=200112L CFLAGS += -Wno-unused-variable -I$(SRC)/src -std=c99 -pedantic-errors -D_C99_SOURCE -D_POSIX_C_SOURCE=200112L
LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
@@ -74,13 +74,13 @@ clean:
$(MAKE) -C docs clean $(MAKE) -C docs clean
download-deps: download-deps:
$(MAKE) -C src checkra1n-macos checkra1n-linux-arm64 checkra1n-linux-armel checkra1n-linux-x86 checkra1n-linux-x86_64 checkra1n-kpf-pongo ramdisk.dmg binpack.dmg Pongo.bin $(MAKE) -C src $(patsubst %, resources/%, checkra1n-macos checkra1n-linux-arm64 checkra1n-linux-armel checkra1n-linux-x86 checkra1n-linux-x86_64 checkra1n-kpf-pongo ramdisk.dmg binpack.dmg Pongo.bin)
docs: docs:
$(MAKE) -C docs $(MAKE) -C docs
distclean: clean distclean: clean
rm -rf palera1n-* palera1n*.dSYM src/checkra1n-* src/checkra1n-kpf-pongo src/ramdisk.dmg src/binpack.dmg src/Pongo.bin $(MAKE) -C src distclean
.PHONY: all palera1n clean docs distclean .PHONY: all palera1n clean docs distclean
+1 -1
View File
@@ -20,7 +20,7 @@ extern unsigned int binpack_dmg_len;
extern unsigned char Pongo_bin[]; extern unsigned char Pongo_bin[];
extern unsigned int Pongo_bin_len; extern unsigned int Pongo_bin_len;
#if defined(__APPLE__) && (TARGET_OS_IPHONE || defined(DEV_BUILD)) #if defined(__APPLE__) && (TARGET_OS_IPHONE || defined(DEV_BUILD) || defined(FORCE_HELPER))
extern unsigned char libcheckra1nhelper_dylib[]; extern unsigned char libcheckra1nhelper_dylib[];
extern unsigned int libcheckra1nhelper_dylib_len; extern unsigned int libcheckra1nhelper_dylib_len;
#endif #endif
+56 -52
View File
@@ -1,57 +1,57 @@
all: palera1n all: palera1n
OBJECTS = main.o dfuhelper.o devhelper.o lockdown_helper.o OBJDIR = obj
OBJECTS += optparse.o override_file.o log.o lock_vars.o credits.o GENDIR = gen
OBJECTS += fake_embedded.o exec_checkra1n.o pongo_helper.o RESOURCES_DIR = resources
OBJECTS += boyermoore_memmem.o
C_SRC = $(wildcard *.c)
OBJS = $(patsubst %,$(OBJDIR)/%,$(C_SRC:.c=.c.o))
ifeq (,$(findstring macosx, $(CFLAGS))) ifeq (,$(findstring macosx, $(CFLAGS)))
ifneq (,$(findstring version-min=, $(CFLAGS))) ifneq (,$(findstring version-min=, $(CFLAGS)))
OBJECTS += xxd-libcheckra1nhelper.dylib.o C_SRC += $(GENDIR)/gen-libcheckra1nhelper.dylib.c
endif endif
endif endif
ifeq ($(FORCE_HELPER),1) ifeq ($(FORCE_HELPER),1)
OBJECTS += xxd-libcheckra1nhelper.dylib.o C_SRC += $(GENDIR)/gen-libcheckra1nhelper.dylib.c
CFLAGS += -DFORCE_HELPER CFLAGS += -DFORCE_HELPER
BUILD_OPTIONS += FORCE_HELPER BUILD_OPTIONS += FORCE_HELPER
endif endif
ifneq ($(NO_RAMDISK),1) ifneq ($(NO_RAMDISK),1)
OBJECTS += xxd-ramdisk.dmg.lzma.o C_SRC += $(GENDIR)/gen-ramdisk.dmg.lzma.c
else else
CFLAGS += -DNO_RAMDISK -DRAMDISK_COMPRESSED_SIZE=\"0\" CFLAGS += -DNO_RAMDISK -DRAMDISK_COMPRESSED_SIZE=\"0\"
BUILD_OPTIONS += NO_RAMDISK BUILD_OPTIONS += NO_RAMDISK
endif endif
ifneq ($(NO_KPF),1) ifneq ($(NO_KPF),1)
OBJECTS += xxd-checkra1n-kpf-pongo.lzma.o C_SRC += $(GENDIR)/gen-checkra1n-kpf-pongo.lzma.c
else else
CFLAGS += -DNO_KPF CFLAGS += -DNO_KPF
BUILD_OPTIONS += NO_KPF BUILD_OPTIONS += NO_KPF
endif endif
ifneq ($(NO_OVERLAY),1) ifneq ($(NO_OVERLAY),1)
OBJECTS += xxd-binpack.dmg.o C_SRC += $(GENDIR)/gen-binpack.dmg.c
else else
CFLAGS += -DNO_OVERLAY CFLAGS += -DNO_OVERLAY
BUILD_OPTIONS += NO_OVERLAY BUILD_OPTIONS += NO_OVERLAY
endif endif
ifneq ($(NO_CHECKRAIN),1) ifneq ($(NO_CHECKRAIN),1)
OBJECTS += xxd-checkra1n.o C_SRC += $(GENDIR)/gen-checkra1n.c
else else
CFLAGS += -DNO_CHECKRAIN CFLAGS += -DNO_CHECKRAIN
BUILD_OPTIONS += NO_CHECKRAIN BUILD_OPTIONS += NO_CHECKRAIN
endif endif
ifneq ($(NO_CUSTOM_PONGO),1) ifneq ($(NO_CUSTOM_PONGO),1)
OBJECTS += xxd-Pongo.bin.o C_SRC += $(GENDIR)/gen-Pongo.bin.c
else else
CFLAGS += -DNO_CUSTOM_PONGO CFLAGS += -DNO_CUSTOM_PONGO
BUILD_OPTIONS += NO_CUSTOM_PONGO BUILD_OPTIONS += NO_CUSTOM_PONGO
endif endif
ifeq ($(TUI),1) ifeq ($(TUI),1)
OBJECTS += tui_screen_enter_recovery.o tui_screen_enter_dfu.o tui_main.o
OBJECTS += tui_screen_jailbreak.o tui_screen_main.o tui_screen_options.o
BUILD_OPTIONS += TUI BUILD_OPTIONS += TUI
CFLAGS += -DTUI CFLAGS += -DTUI
endif endif
@@ -62,20 +62,18 @@ LDID = ldid
ifeq ($(TARGET_OS),Darwin) ifeq ($(TARGET_OS),Darwin)
ifneq ($(USE_LIBUSB),1) ifneq ($(USE_LIBUSB),1)
OBJECTS += usb_iokit.o
else else
LIBS += -framework SystemConfiguration -framework Security LIBS += -framework SystemConfiguration -framework Security
BUILD_OPTIONS += USE_LIBUSB BUILD_OPTIONS += USE_LIBUSB
endif endif
# add lto and debug symbols for lto # add lto and debug symbols for lto
CFLAGS += -flto=full -g CFLAGS += -flto=full -g
LDFLAGS += -Wl,-object_path_lto,lto.o LDFLAGS += -Wl,-object_path_lto,obj/lto.o
else else
USE_LIBUSB = 1 USE_LIBUSB = 1
endif endif
ifeq ($(USE_LIBUSB),1) ifeq ($(USE_LIBUSB),1)
OBJECTS += usb_libusb.o
CFLAGS += -DUSE_LIBUSB=1 CFLAGS += -DUSE_LIBUSB=1
LIBS += $(DEP)/lib/libusb-1.0.a LIBS += $(DEP)/lib/libusb-1.0.a
endif endif
@@ -91,73 +89,79 @@ endif
CFLAGS += -DBUILD_OPTIONS=\""$(BUILD_OPTIONS)"\" CFLAGS += -DBUILD_OPTIONS=\""$(BUILD_OPTIONS)"\"
checkra1n-%: $(RESOURCES_DIR)/checkra1n-%:
curl -LO https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$@ curl -Lfo $@ https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$$(echo $@ | cut -d/ -f2)
chmod 755 $@ chmod 755 $@
checkra1n: checkra1n-macos usb.xml $(RESOURCES_DIR)/checkra1n: $(RESOURCES_DIR)/checkra1n-macos usb.xml
ifeq ($(TARGET_OS),Darwin) ifeq ($(TARGET_OS),Darwin)
ifneq (,$(findstring arm64, $(CFLAGS))) ifneq (,$(findstring arm64, $(CFLAGS)))
$(LIPO) -thin arm64 -output checkra1n checkra1n-macos $(LIPO) -thin arm64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
else ifneq (,$(findstring x86_64, $(CFLAGS))) else ifneq (,$(findstring x86_64, $(CFLAGS)))
$(LIPO) -thin x86_64 -output checkra1n checkra1n-macos $(LIPO) -thin x86_64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
else ifeq ($(shell arch),i386) else ifeq ($(shell arch),i386)
$(LIPO) -thin x86_64 -output checkra1n checkra1n-macos $(LIPO) -thin x86_64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
else else
$(LIPO) -thin $(shell arch) -output checkra1n checkra1n-macos $(LIPO) -thin $(shell arch) -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
endif endif
ifeq (,$(findstring macosx, $(CFLAGS))) ifeq (,$(findstring macosx, $(CFLAGS)))
ifneq (,$(findstring version-min=, $(CFLAGS))) ifneq (,$(findstring version-min=, $(CFLAGS)))
vtool -remove-build-version 1 -replace -output checkra1n checkra1n vtool -remove-build-version 1 -replace -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n
vtool -set-build-version $(FAKE_PLATFORM) $(FAKE_MINOS) $(FAKE_SDK) -replace -output checkra1n checkra1n vtool -set-build-version $(FAKE_PLATFORM) $(FAKE_MINOS) $(FAKE_SDK) -replace -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n
install_name_tool -change /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit /System/Library/Frameworks/IOKit.framework/IOKit checkra1n install_name_tool -change /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit /System/Library/Frameworks/IOKit.framework/IOKit $(RESOURCES_DIR)/checkra1n
install_name_tool -change /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation checkra1n install_name_tool -change /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation $(RESOURCES_DIR)/checkra1n
$(LDID) -Susb.xml checkra1n $(LDID) -Susb.xml $(RESOURCES_DIR)/checkra1n
endif endif
endif endif
else else
cp checkra1n-$(CHECKRA1N_NAME) checkra1n cp $(RESOURCES_DIR)/checkra1n-$(CHECKRA1N_NAME) $(RESOURCES_DIR)/checkra1n
endif endif
xxd-%.c: % $(GENDIR)/gen-%.c: $(RESOURCES_DIR)/%
xxd -iC $< > $@ cd $(RESOURCES_DIR) && xxd -iC $$(echo $< | cut -d/ -f2) > ../$@
pongo_helper.o: pongo_helper.c $(wildcard ../include/*.h) ramdisk.dmg checkra1n-kpf-pongo $(OBJDIR)/pongo_helper.c.o: pongo_helper.c $(wildcard ../include/*.h) $(RESOURCES_DIR)/ramdisk.dmg $(RESOURCES_DIR)/checkra1n-kpf-pongo
$(CC) -c $(CFLAGS) -DRAMDISK_UNCOMPRESSED_SIZE="\"$$(wc -c < ramdisk.dmg | tr -d ' ')\"" -DKPF_UNCOMPRESSED_SIZE="\"$$(wc -c < checkra1n-kpf-pongo | tr -d ' ')\"" $< $(CC) -c -o $@ $(CFLAGS) -DRAMDISK_UNCOMPRESSED_SIZE="\"$$(wc -c < $(RESOURCES_DIR)/ramdisk.dmg | tr -d ' ')\"" -DKPF_UNCOMPRESSED_SIZE="\"$$(wc -c < $(RESOURCES_DIR)/checkra1n-kpf-pongo | tr -d ' ')\"" $<
%.o: %.c $(wildcard ../include/*.h) $(OBJDIR)/%.c.o: $(GENDIR)/gen-%.c $(wildcard ../include/*.h)
$(CC) -c $(CFLAGS) $< $(CC) $(CFLAGS) -c -o $<
palera1n: $(OBJECTS) $(OBJDIR)/%.c.o: %.c $(wildcard ../include/*.h)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o palera1n $(CC) $(CFLAGS) -c -o $@ $<
palera1n: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o palera1n
ifeq (,$(findstring macosx, $(CFLAGS))) ifeq (,$(findstring macosx, $(CFLAGS)))
ifneq (,$(findstring version-min=, $(CFLAGS))) ifneq (,$(findstring version-min=, $(CFLAGS)))
$(LDID) -Susb.xml palera1n $(LDID) -Susb.xml palera1n
endif endif
endif endif
libcheckra1nhelper.dylib: chkstk.S $(RESOURCES_DIR)/libcheckra1nhelper.dylib: chkstk.S
$(CC) $(CFLAGS) $(LDFLAGS) -shared chkstk.S -o libcheckra1nhelper.dylib $(CC) $(CFLAGS) $(LDFLAGS) -shared chkstk.S -o $@
checkra1n-kpf-pongo: $(RESOURCES_DIR)/checkra1n-kpf-pongo:
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/checkra1n-kpf-pongo curl -Lfo $@ https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/checkra1n-kpf-pongo
%.lzma: % $(RESOURCES_DIR)/ramdisk.dmg.lzma: $(RESOURCES_DIR)/ramdisk.dmg
xz --format=lzma -vf6ekT 0 $< xz --format=lzma -vfc6ekT 0 $< > $@
checkra1n-kpf-pongo.lzma: checkra1n-kpf-pongo $(RESOURCES_DIR)/checkra1n-kpf-pongo.lzma: $(RESOURCES_DIR)/checkra1n-kpf-pongo
xz --format=lzma -vf6ekT 0 checkra1n-kpf-pongo xz --format=lzma -vfc6ekT 0 $< > $@
ramdisk.dmg: $(RESOURCES_DIR)/ramdisk.dmg:
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg curl -Lfo $@ https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg
binpack.dmg: $(RESOURCES_DIR)/binpack.dmg:
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg curl -Lfo $@ https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg
Pongo.bin: $(RESOURCES_DIR)/Pongo.bin:
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/Pongo.bin curl -Lfo $@ https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/Pongo.bin
clean: clean:
rm -rf *.o palera1n checkra1n checkra1n.c palera1n.dSYM ramdisk.dmg.lzma libcheckra1nhelper.dylib rm -rf $(OBJDIR)/*.o $(GENDIR)/*.c $(GENDIR)/*.o palera1n palera1n.dSYM libcheckra1nhelper.dylib
distclean: clean
rm -rf $(RESOURCES_DIR)/*
.PHONY: all clean .PHONY: all clean
+1
View File
@@ -0,0 +1 @@
*.o
+1
View File
@@ -0,0 +1 @@
.
+1 -1
View File
@@ -122,7 +122,7 @@ int palera1n(int argc, char *argv[]) {
if (!(palerain_flags & palerain_option_device_info)) if (!(palerain_flags & palerain_option_device_info))
LOG(LOG_INFO, "Waiting for devices"); LOG(LOG_INFO, "Waiting for devices");
if (access("/var/run/usbmuxd", F_OK) != 0) if (getenv("USBMUXD_SOCKET_ADDRESS") == NULL && access("/var/run/usbmuxd", F_OK) != 0)
LOG(LOG_WARNING, "/var/run/usbmuxd not found, normal mode device detection will not work."); LOG(LOG_WARNING, "/var/run/usbmuxd not found, normal mode device detection will not work.");
pthread_create(&pongo_thread, NULL, pongo_helper, NULL); pthread_create(&pongo_thread, NULL, pongo_helper, NULL);
+1
View File
@@ -0,0 +1 @@
*.o
+1
View File
@@ -0,0 +1 @@
.
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+5
View File
@@ -1,3 +1,4 @@
#ifdef TUI
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@@ -99,3 +100,7 @@ out:
tui_started = false; tui_started = false;
return 0; return 0;
} }
#else
/* ISO C forbids an empty translation unit */
extern char** environ;
#endif
+6
View File
@@ -1,3 +1,4 @@
#ifdef TUI
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@@ -13,3 +14,8 @@
#include <tui.h> #include <tui.h>
tui_screen_t tui_screen_enter_dfu(void) { return JAILBREAKING_SCREEN; } tui_screen_t tui_screen_enter_dfu(void) { return JAILBREAKING_SCREEN; }
#else
/* ISO C forbids an empty translation unit */
extern char** environ;
#endif
+6
View File
@@ -1,3 +1,4 @@
#ifdef TUI
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@@ -13,3 +14,8 @@
#include <tui.h> #include <tui.h>
tui_screen_t tui_screen_enter_recovery(void) { return ENTER_DFU_SCREEN; } tui_screen_t tui_screen_enter_recovery(void) { return ENTER_DFU_SCREEN; }
#else
/* ISO C forbids an empty translation unit */
extern char** environ;
#endif
+6
View File
@@ -1,3 +1,4 @@
#ifdef TUI
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@@ -13,3 +14,8 @@
#include <tui.h> #include <tui.h>
tui_screen_t tui_screen_jailbreak(void) { return EXIT_SCREEN; } tui_screen_t tui_screen_jailbreak(void) { return EXIT_SCREEN; }
#else
/* ISO C forbids an empty translation unit */
extern char** environ;
#endif
+6
View File
@@ -1,3 +1,4 @@
#ifdef TUI
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@@ -45,3 +46,8 @@ tui_screen_t tui_screen_main(void) {
newtFormDestroy(form); newtFormDestroy(form);
return ret; return ret;
} }
#else
/* ISO C forbids an empty translation unit */
extern char** environ;
#endif
+6
View File
@@ -1,3 +1,4 @@
#ifdef TUI
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@@ -73,3 +74,8 @@ tui_screen_t tui_screen_options(void) {
newtFormDestroy(form); newtFormDestroy(form);
return ret; return ret;
} }
#else
/* ISO C forbids an empty translation unit */
extern char** environ;
#endif
+5
View File
@@ -24,6 +24,7 @@
* SOFTWARE. * SOFTWARE.
* *
*/ */
#ifndef USE_LIBUSB
#include <errno.h> #include <errno.h>
#include <fcntl.h> // open #include <fcntl.h> // open
#include <pthread.h> #include <pthread.h>
@@ -250,3 +251,7 @@ int wait_for_pongo(void) {
CFRelease(cfdict); CFRelease(cfdict);
return 0; return 0;
} }
#else
/* ISO C forbids an empty translation unit */
extern char** environ;
#endif
+3
View File
@@ -264,4 +264,7 @@ int wait_for_pongo(void)
libusb_exit(ctx); libusb_exit(ctx);
return 0; return 0;
} }
#else
/* ISO C forbids an empty translation unit */
extern char** environ;
#endif #endif