From 95856ac80b4f168d9b62f822f8e0b6e5b07f78a0 Mon Sep 17 00:00:00 2001 From: faroukbmiled Date: Fri, 3 Apr 2026 09:40:43 +0100 Subject: [PATCH] build script improvments --- .gitignore | 2 + RELEASE_CHECKLIST.md | 14 ------ build.sh | 101 ++++++++++++++++++++++++++++++++++++------- modules/FLEXing | 1 + 4 files changed, 88 insertions(+), 30 deletions(-) delete mode 100644 RELEASE_CHECKLIST.md create mode 160000 modules/FLEXing diff --git a/.gitignore b/.gitignore index e84d7db..85bd685 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ src/**/wip.xm .claude CLAUDE.md upstream-scinsta +*.ipa +*.dylib diff --git a/RELEASE_CHECKLIST.md b/RELEASE_CHECKLIST.md deleted file mode 100644 index 798e499..0000000 --- a/RELEASE_CHECKLIST.md +++ /dev/null @@ -1,14 +0,0 @@ -# New Version - Release Checklist - -### Before git pushing -- [ ] Update version string in `control` -- [ ] Update version string in `src/Tweak.x` -- [ ] Update version string at top of `README.md` -- [ ] Update compatible Instagram app version at top of `README.md` -- [ ] Update features list in `README.md` -- [ ] (Optional) Update screenshots - -### Creating new release -- [ ] Ensure new tag is created with proper format -- [ ] Make sure to include full changelog in release notes -- [ ] Include rootful & rootless deb files in release \ No newline at end of file diff --git a/build.sh b/build.sh index 54b9404..ed566a3 100755 --- a/build.sh +++ b/build.sh @@ -2,22 +2,56 @@ set -e +# Auto-detect THEOS if not set +if [ -z "$THEOS" ]; then + if [ -d "$HOME/theos" ]; then + export THEOS="$HOME/theos" + else + echo -e '\033[1m\033[0;31mTHEOS not set and ~/theos not found.\nSet THEOS or install Theos to ~/theos\033[0m' + exit 1 + fi +fi + CMAKE_OSX_ARCHITECTURES="arm64e;arm64" CMAKE_OSX_SYSROOT="iphoneos" -# Building modes -if [ "$1" == "sideload" ]; +# Build just the dylib (for Feather/manual injection) +if [ "$1" == "dylib" ]; then - # FLEXing is only needed for sideload builds + make clean 2>/dev/null || true + rm -rf .theos + + echo -e '\033[1m\033[32mBuilding RyukGram dylib\033[0m' + + make + + mkdir -p packages + cp .theos/obj/debug/RyukGram.dylib packages/RyukGram.dylib + + echo -e "\033[1m\033[32mDone!\033[0m\n\nDylib at: $(pwd)/packages/RyukGram.dylib" + +# Build sideloaded IPA +elif [ "$1" == "sideload" ]; +then + + # Check for FLEXing submodule + HAS_FLEX=1 if [ -z "$(ls -A modules/FLEXing 2>/dev/null)" ]; then - echo -e '\033[1m\033[0;31mFLEXing submodule not found.\nPlease run the following command to checkout submodules:\n\n\033[0m git submodule update --init --recursive' - exit 1 + echo -e '\033[1m\033[0;33mFLEXing submodule not found — building without FLEX debugger.\033[0m' + echo -e '\033[0;33mTo include FLEX, run: git submodule update --init --recursive\033[0m' + echo + HAS_FLEX=0 fi # Check if building with dev mode if [ "$2" == "--dev" ]; then + if [ "$HAS_FLEX" == "0" ]; then + echo -e '\033[1m\033[0;31mDev mode requires FLEXing submodule.\033[0m' + exit 1 + fi + # Cache pre-built FLEX libs mkdir -p "packages/cache" cp -f ".theos/obj/debug/FLEXing.dylib" "packages/cache/FLEXing.dylib" 2>/dev/null || true @@ -39,26 +73,55 @@ then # Clear cached FLEX libs rm -rf "packages/cache" - MAKEARGS='SIDELOAD=1' - FLEXPATH='.theos/obj/debug/FLEXing.dylib .theos/obj/debug/libflex.dylib' + if [ "$HAS_FLEX" == "1" ]; then + MAKEARGS='SIDELOAD=1' + FLEXPATH='.theos/obj/debug/FLEXing.dylib .theos/obj/debug/libflex.dylib' + else + MAKEARGS='' + FLEXPATH='' + fi COMPRESSION=9 fi # Clean build artifacts - make clean + make clean 2>/dev/null || true rm -rf .theos - # Check for decrypted instagram ipa - ipaFile="$(find ./packages/*com.burbn.instagram*.ipa -type f -exec basename {} \;)" + # Check for decrypted Instagram IPA + ipaFile="$(find ./packages/ -name '*com.burbn.instagram*.ipa' -type f -exec basename {} \; 2>/dev/null || true)" if [ -z "${ipaFile}" ]; then echo -e '\033[1m\033[0;31m./packages/com.burbn.instagram.ipa not found.\nPlease put a decrypted Instagram IPA in its path.\033[0m' exit 1 fi + # Check for cyan and ipapatch before building (skip check for --buildonly) + if [ "$2" != "--buildonly" ]; then + if ! command -v cyan &> /dev/null; then + echo -e '\033[1m\033[0;31mcyan not found. Install it with:\033[0m' + echo ' pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip' + echo + echo -e '\033[0;33mUse ./build.sh sideload --buildonly to just compile without creating the IPA.\033[0m' + echo -e '\033[0;33mOr use ./build.sh dylib to build the dylib for Feather injection.\033[0m' + exit 1 + fi + if ! command -v ipapatch &> /dev/null; then + echo -e '\033[1m\033[0;31mipapatch not found. Install it from:\033[0m' + echo ' https://github.com/asdfzxcvbn/ipapatch/releases/latest' + echo + echo -e '\033[0;33mUse ./build.sh sideload --buildonly to just compile without creating the IPA.\033[0m' + echo -e '\033[0;33mOr use ./build.sh dylib to build the dylib for Feather injection.\033[0m' + exit 1 + fi + fi + echo -e '\033[1m\033[32mBuilding RyukGram tweak for sideloading (as IPA)\033[0m' make $MAKEARGS + # Copy dylib to packages + mkdir -p packages + cp .theos/obj/debug/RyukGram.dylib packages/RyukGram.dylib + # Only build libs (for future use in dev build mode) if [ "$2" == "--buildonly" ]; then @@ -68,10 +131,11 @@ then TWEAKPATH=".theos/obj/debug/RyukGram.dylib" if [ "$2" == "--devquick" ]; then + # Exclude RyukGram.dylib from IPA for livecontainer quick builds TWEAKPATH="" fi - # Create IPA File + # Create IPA file echo -e '\033[1m\033[32mCreating the IPA file...\033[0m' rm -f packages/RyukGram-sideloaded.ipa cyan -i "packages/${ipaFile}" -o packages/RyukGram-sideloaded.ipa -f $TWEAKPATH $FLEXPATH -c $COMPRESSION -m 15.0 -du @@ -81,11 +145,11 @@ then echo -e "\033[1m\033[32mDone, enjoy RyukGram!\033[0m\n\nYou can find the ipa file at: $(pwd)/packages" +# Build rootless .deb elif [ "$1" == "rootless" ]; then - # Clean build artifacts - make clean + make clean 2>/dev/null || true rm -rf .theos echo -e '\033[1m\033[32mBuilding RyukGram tweak for rootless\033[0m' @@ -95,11 +159,11 @@ then echo -e "\033[1m\033[32mDone, enjoy RyukGram!\033[0m\n\nYou can find the deb file at: $(pwd)/packages" +# Build rootful .deb elif [ "$1" == "rootful" ]; then - # Clean build artifacts - make clean + make clean 2>/dev/null || true rm -rf .theos echo -e '\033[1m\033[32mBuilding RyukGram tweak for rootful\033[0m' @@ -114,6 +178,11 @@ else echo '|RyukGram Build Script |' echo '+----------------------+' echo - echo 'Usage: ./build.sh ' + echo 'Usage: ./build.sh ' + echo + echo ' dylib - Build the dylib only (for Feather/manual injection)' + echo ' sideload - Build a patched IPA (requires cyan + ipapatch + decrypted IPA)' + echo ' rootless - Build a rootless .deb package' + echo ' rootful - Build a rootful .deb package' exit 1 fi diff --git a/modules/FLEXing b/modules/FLEXing new file mode 160000 index 0000000..339eba9 --- /dev/null +++ b/modules/FLEXing @@ -0,0 +1 @@ +Subproject commit 339eba9d999338fa9df7c336bb37a5a862c7abc6