-
Notifications
You must be signed in to change notification settings - Fork 6
/
generate_headers.sh
executable file
·145 lines (111 loc) · 5.42 KB
/
generate_headers.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/zsh
rm -fr iOS
rm -fr macOS
rm -fr watchOS
rm -fr tvOS
mkdir -p iOS/Frameworks
mkdir -p iOS/Applications
mkdir -p iOS/PrivateFrameworks
mkdir -p iOS/AccessibilityBundles
mkdir -p iOS/usr/lib
mkdir -p watchOS/Frameworks
mkdir -p watchOS/PrivateFrameworks
mkdir -p watchOS/usr/lib
mkdir -p tvOS/Frameworks
mkdir -p tvOS/PrivateFrameworks
mkdir -p tvOS/usr/lib
mkdir -p macOS/Frameworks
mkdir -p macOS/PrivateFrameworks
mkdir -p macOS/usr/lib
visitFrameworkOrApp() {
FRAMEWORK="$1"
ARCH="$2"
BASEPATH="$3"
if [[ -f "$FRAMEWORK" ]]; then
FRAMEWORK_BASENAME="${${$(basename "$FRAMEWORK")%.*}##lib}"
else
FRAMEWORK_BASENAME="$(basename "$FRAMEWORK")"
fi
echo -e "\033[1;34mProcessing $FRAMEWORK\033[0m"
./class-dump --arch "$ARCH" -H -o "$BASEPATH/$FRAMEWORK_BASENAME" "$FRAMEWORK"
if [[ -d "$FRAMEWORK/Frameworks" ]]; then
for INNER_FRAMEWORK in "${FRAMEWORK}"/Frameworks/* ; do
visitFrameworkOrApp "$INNER_FRAMEWORK" "$ARCH" "$BASEPATH/$FRAMEWORK_BASENAME"/Frameworks
done
fi
if [[ -d "$FRAMEWORK/Support" ]]; then
for INNER_FRAMEWORK in "${FRAMEWORK}"/Support/* ; do
visitFrameworkOrApp "$INNER_FRAMEWORK" "$ARCH" "$BASEPATH/$FRAMEWORK_BASENAME"/Support
done
fi
}
iOS() {
# iOS
for FRAMEWORK in "$(xcode-select -p)"/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/*.framework ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 iOS/Frameworks/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/*.framework ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 iOS/PrivateFrameworks/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/*.dylib ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 iOS/usr/lib/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/*.dylib ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 iOS/usr/lib/
done
for APPLICATION in "$(xcode-select -p)"/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Applications/* ; do
visitFrameworkOrApp "$APPLICATION" x86_64 iOS/Applications/
done
for BUNDLE in "$(xcode-select -p)"/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/AccessibilityBundles/* ; do
visitFrameworkOrApp "$BUNDLE" x86_64 iOS/AccessibilityBundles
done
}
watchOS() {
# watchOS
for FRAMEWORK in "$(xcode-select -p)"/Platforms/WatchOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/watchOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/*.framework ; do
visitFrameworkOrApp "$FRAMEWORK" i386 watchOS/Frameworks/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/WatchOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/watchOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/*.framework ; do
visitFrameworkOrApp "$FRAMEWORK" i386 watchOS/PrivateFrameworks/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/WatchOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/watchOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/*.dylib ; do
visitFrameworkOrApp "$FRAMEWORK" i386 watchOS/usr/lib/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/WatchOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/watchOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/*.dylib ; do
visitFrameworkOrApp "$FRAMEWORK" i386 watchOS/usr/lib/
done
}
tvOS() {
# tvOS
for FRAMEWORK in "$(xcode-select -p)"/Platforms/AppleTVOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/*.framework ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 tvOS/Frameworks/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/AppleTVOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/*.framework ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 tvOS/PrivateFrameworks/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/AppleTVOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/*.dylib ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 tvOS/usr/lib/
done
for FRAMEWORK in "$(xcode-select -p)"/Platforms/AppleTVOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/*.dylib ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 tvOS/usr/lib/
done
}
macOS() {
# macOS
for FRAMEWORK in /System/Library/Frameworks/*.framework ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 macOS/Frameworks/
done
for FRAMEWORK in /System/Library/PrivateFrameworks/*.framework ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 macOS/PrivateFrameworks/
done
for FRAMEWORK in /usr/lib/*.dylib ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 macOS/usr/lib/
done
for FRAMEWORK in /usr/lib/system/*.dylib ; do
visitFrameworkOrApp "$FRAMEWORK" x86_64 macOS/usr/lib/
done
}
iOS
#watchOS
#tvOS
#macOS