-
Notifications
You must be signed in to change notification settings - Fork 64
/
build_dylib.sh
executable file
·50 lines (40 loc) · 1.87 KB
/
build_dylib.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
echo "Cleaning up..."
rm -rf bin
src="DingTalkNoJailTweak"
BIN_NAME="libDingTalkNoJailTweak.dylib"
IOS_VERSION_MIN=7.0
# DEVELOPER_DIR="$(xcode-select --path)" com.yohunlent.genyunNews
DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
SDK_ROOT_OS=$DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
SDK_ROOT_SIMULATOR=$DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
ARCHS="armv7 arm64"
INPUT=$(find ${src} -type f -name "*.m")
for ARCH in ${ARCHS}
do
DIR=bin/${ARCH}
mkdir -p ${DIR}
echo "Building for ${ARCH}..."
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]];
then
SDK_ROOT=${SDK_ROOT_SIMULATOR}
IOS_VERSION_MIN_FLAG=-mios-simulator-version-min
else
SDK_ROOT=${SDK_ROOT_OS}
IOS_VERSION_MIN_FLAG=-mios-version-min
fi
FRAMEWORKS=${SDK_ROOT}/System/Library/Frameworks/
INCLUDES=${SDK_ROOT}/usr/include/
LIBRARIES=${SDK_ROOT}/usr/lib/
clang -I${INCLUDES} -F${FRAMEWORKS} -L${LIBRARIES} -Os -dynamiclib -isysroot ${SDK_ROOT} -arch ${ARCH} -fobjc-arc ${IOS_VERSION_MIN_FLAG}=${IOS_VERSION_MIN} -framework Foundation -framework UIKit -framework CoreLocation -framework CoreGraphics -framework QuartzCore -framework Security -framework MapKit ${INPUT} -o ${DIR}/${BIN_NAME}
done
echo "Creating universal binary..."
FAT_BIN_DIR="bin/universal"
mkdir -p ${FAT_BIN_DIR}
lipo -create bin/**/${BIN_NAME} -output ${FAT_BIN_DIR}/${BIN_NAME}
jail_dir="JailBreakLoadtweak/layout/Library/Application Support/DingDing"
#cp bin/universal/libDingTalkNoJailTweak.dylib JailBreakLoadtweak/layout/Library/Application\ Suppor/DingDing/${BIN_NAME}
#cp bin/universal/libDingTalkNoJailTweak.dylib JailBreakLoadtweak/layout/Library/Application\ Support/DingDing/libDingTalkNoJailTweak.dylib
cp ${FAT_BIN_DIR}/${BIN_NAME} "$jail_dir"/${BIN_NAME}
#cp ${FAT_BIN_DIR}/${BIN_NAME} ${jail_dir}/${BIN_NAME}
echo "Done."