mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2025-07-07 16:16:07 +08:00
55 lines
1.5 KiB
Makefile
55 lines
1.5 KiB
Makefile
WECHATPATH=/Applications/WeChat.app/Contents/MacOS
|
|
DYLIBFILE=WeChatTweak.dylib
|
|
|
|
build::
|
|
clang -dynamiclib ./WeChatTweak.m -fobjc-link-runtime -current_version 1.0 -compatibility_version 1.0 -o ./${DYLIBFILE}
|
|
|
|
debug::
|
|
make clean
|
|
make build
|
|
DYLD_INSERT_LIBRARIES=./${DYLIBFILE} ${WECHATPATH}/WeChat &
|
|
|
|
install::
|
|
@if ! [[ $EUID -eq 0 ]]; then\
|
|
echo "This script should be run using sudo or as the root user.";\
|
|
exit 1;\
|
|
fi
|
|
@if ! [ -f "${WECHATPATH}/WeChat" ]; then\
|
|
echo "Can not find the WeChat.";\
|
|
exit 1;\
|
|
fi
|
|
@if ! [ -f "./${DYLIBFILE}" ]; then\
|
|
echo "Can not find the dylib file, please build first.";\
|
|
exit 1;\
|
|
fi
|
|
@if [ -f "${WECHATPATH}/${DYLIBFILE}" ]; then\
|
|
cp ./${DYLIBFILE} ${WECHATPATH}/${DYLIBFILE};\
|
|
echo "Tweak file found! Replace with new tweak file successed!";\
|
|
else \
|
|
cp ${WECHATPATH}/WeChat ${WECHATPATH}/WeChat.bak;\
|
|
cp ./${DYLIBFILE} ${WECHATPATH}/${DYLIBFILE};\
|
|
./insert_dylib @executable_path/${DYLIBFILE} ${WECHATPATH}/WeChat ${WECHATPATH}/WeChat --all-yes;\
|
|
echo "Install successed!";\
|
|
fi
|
|
|
|
uninstall::
|
|
@if ! [[ $EUID -eq 0 ]]; then\
|
|
echo "This script should be run using sudo or as the root user.";\
|
|
exit 1;\
|
|
fi
|
|
@if ! [ -f "${WECHATPATH}/WeChat" ]; then\
|
|
echo "Can not find the WeChat.";\
|
|
exit 1;\
|
|
fi
|
|
@if ! [ -f "${WECHATPATH}/WeChat.bak" ]; then\
|
|
echo "Can not find the WeChat backup file.";\
|
|
exit 1;\
|
|
fi
|
|
|
|
@rm -rf ${WECHATPATH}/${DYLIBFILE};
|
|
@mv ${WECHATPATH}/WeChat.bak ${WECHATPATH}/WeChat;
|
|
@echo "Uninstall successed";
|
|
|
|
clean::
|
|
rm -rf ./${DYLIBFILE}
|