diff --git a/Makefile b/Makefile index 170d6b3..9ce0938 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,19 @@ SCInsta_PRIVATE_FRAMEWORKS = Preferences SCInsta_EXTRA_FRAMEWORKS = Cephei CepheiPrefs CepheiUI SCInsta_CFLAGS = -fobjc-arc -Wno-unsupported-availability-guard -Wno-unused-value -Wno-deprecated-declarations -Wno-nullability-completeness -Wno-unused-function -Wno-incompatible-pointer-types +CCFLAGS += -std=c++11 + include $(THEOS_MAKE_PATH)/tweak.mk -ifndef DEV -SCInsta_SUBPROJECTS += modules/libflex +# Dev mode (skip building FLEX) +ifdef DEV + SCInsta_SUBPROJECTS += modules/sideloadfix +else + + ifdef SIDELOAD + SCInsta_SUBPROJECTS += modules/sideloadfix modules/libflex + else + SCInsta_SUBPROJECTS += modules/libflex + endif + endif \ No newline at end of file diff --git a/build-dev.sh b/build-dev.sh index b248e55..b1e8480 100755 --- a/build-dev.sh +++ b/build-dev.sh @@ -6,7 +6,7 @@ echo 'Note: This script is meant to be used while developing the tweak.' echo ' This does not build "libbhFLEX", it must be done manually and moved to ./packages' echo -./build.sh --dev +./build.sh sideload --dev # Install to device cp -fr ./packages/SCInsta-sideloaded.ipa ~/Documents/Signing/SCInsta/ipas/UNSIGNED.ipa diff --git a/build.sh b/build.sh index 5b30069..853d4ec 100755 --- a/build.sh +++ b/build.sh @@ -4,36 +4,77 @@ set -e CMAKE_OSX_ARCHITECTURES="arm64e;arm64" -ipaFile="$(find ./packages/*com.burbn.instagram*.ipa -type f -exec basename {} \;)" - -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 -elif [ -z "$(ls -A modules/libflex/FLEX)" ]; then +# Prerequisites +if [ -z "$(ls -A modules/libflex/FLEX)" ]; then echo -e '\033[1m\033[0;31mFLEX submodule not found.\nPlease run the following command to checkout submodules:\n\n\033[0m git submodule update --init --recursive' exit 1 fi -echo -e '\033[1m\033[32mBuilding SCInsta tweak for sideloading (as IPA)\033[0m' +# Building modes +if [ "$1" == "sideload" ]; +then + + # Clean build artifacts + make clean + rm -rf .theos + + # Check for decrypted instagram ipa + ipaFile="$(find ./packages/*com.burbn.instagram*.ipa -type f -exec basename {} \;)" + 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 + + echo -e '\033[1m\033[32mBuilding SCInsta tweak for sideloading (as IPA)\033[0m' + + # Check if building with dev mode + if [ "$2" == "--dev" ]; + then + FLEXPATH='packages/libbhFLEX.dylib' + + make "DEV=1" + else + FLEXPATH='.theos/obj/debug/libbhFLEX.dylib' + + make + fi -# Clean build artifacts -make clean -rm -rf .theos + # Create IPA File + echo -e '\033[1m\033[32mCreating the IPA file...\033[0m' + rm -f packages/SCInsta-sideloaded.ipa + pyzule -i "packages/${ipaFile}" -o packages/SCInsta-sideloaded.ipa -f .theos/obj/debug/SCInsta.dylib .theos/obj/debug/sideloadfix.dylib $FLEXPATH -c 0 -m 15.0 -du + + echo -e "\033[1m\033[32mDone, we hope you enjoy SCInsta!\033[0m\n\nYou can find the ipa file at: $(pwd)/packages" -# Check if building with dev mode -if [ "$1" == "--dev" ]; +elif [ "$1" == "rootless" ]; then - FLEXPATH='packages/libbhFLEX.dylib' + + # Clean build artifacts + make clean + rm -rf .theos - make "DEV=1" -else - FLEXPATH='.theos/obj/debug/libbhFLEX.dylib' + echo -e '\033[1m\033[32mBuilding SCInsta tweak for rootless\033[0m' - make -fi + export THEOS_PACKAGE_SCHEME=rootless + make package + +elif [ "$1" == "rootful" ]; +then + + # Clean build artifacts + make clean + rm -rf .theos -# IPA File -echo -e '\033[1m\033[32mBuilding the IPA.\033[0m' -rm -f packages/SCInsta-sideloaded.ipa -pyzule -i "packages/${ipaFile}" -o packages/SCInsta-sideloaded.ipa -f .theos/obj/debug/SCInsta.dylib $FLEXPATH -c 0 -m 15.0 -du -echo -e "\033[1m\033[32mDone, we hope you enjoy SCInsta!\033[0m\n\nYou can find the ipa file at: $(pwd)/packages" + echo -e '\033[1m\033[32mBuilding SCInsta tweak for rootful\033[0m' + + unset THEOS_PACKAGE_SCHEME + make package + +else + echo '+--------------------+' + echo '|SCInsta Build Script|' + echo '+--------------------+' + echo + echo 'Usage: ./build.sh ' + exit 1 +fi \ No newline at end of file diff --git a/modules/sideloadfix/Makefile b/modules/sideloadfix/Makefile new file mode 100644 index 0000000..9b9fa24 --- /dev/null +++ b/modules/sideloadfix/Makefile @@ -0,0 +1,13 @@ +TARGET := iphone:clang:14.5 +INSTALL_TARGET_PROCESSES = Instagram +ARCHS = arm64 + +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = sideloadfix + +sideloadfix_FILES = SideloadFix.x +sideloadfix_FRAMEWORKS = Foundation +sideloadfix_CFLAGS = -fobjc-arc + +include $(THEOS_MAKE_PATH)/tweak.mk \ No newline at end of file diff --git a/src/SideloadFix.x b/modules/sideloadfix/SideloadFix.x similarity index 100% rename from src/SideloadFix.x rename to modules/sideloadfix/SideloadFix.x