-
Notifications
You must be signed in to change notification settings - Fork 5
/
update.sh
executable file
·117 lines (102 loc) · 8.48 KB
/
update.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
#!/usr/bin/env bash
set -ex
rm -rf ./root ./MacOSX11.3.sdk
mkdir -p MacOSX11.3.sdk
cp -R /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/* ./MacOSX11.3.sdk/
# Hack: link some header files under a common folder to workaround an issue in Zig:
# https://github.com/ziglang/zig/issues/8811
pushd ./MacOSX11.3.sdk/usr/include/
cp -R ../../System/Library/Frameworks/Cocoa.framework/Versions/Current/Headers Cocoa
cp -R ../../System/Library/Frameworks/Foundation.framework/Versions/Current/Headers Foundation
cp -R ../../System/Library/Frameworks/AppKit.framework/Versions/Current/Headers AppKit
cp -R ../../System/Library/Frameworks/CoreData.framework/Versions/Current/Headers CoreData
cp -R ../../System/Library/Frameworks/CoreImage.framework/Versions/Current/Headers CoreImage
cp -R ../../System/Library/Frameworks/CoreVideo.framework/Versions/Current/Headers CoreVideo
cp -R ../../System/Library/Frameworks/Metal.framework/Versions/Current/Headers Metal
cp -R ../../System/Library/Frameworks/IOSurface.framework/Versions/Current/Headers IOSurface
cp -R ../../System/Library/Frameworks/QuartzCore.framework/Versions/Current/Headers QuartzCore
cp -R ../../System/Library/Frameworks/CloudKit.framework/Versions/Current/Headers CloudKit
cp -R ../../System/Library/Frameworks/CoreLocation.framework/Versions/Current/Headers CoreLocation
cp -R ../../System/Library/Frameworks/Kernel.framework/Versions/Current/Headers Kernel
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Versions/Current/Headers ApplicationServices
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Versions/Current/Headers ATS
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATSUI.framework/Versions/Current/Headers ATSUI
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/ColorSync.framework/Versions/Current/Headers ColorSync
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Versions/Current/Headers CoreGraphics
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Versions/Current/Headers CoreText
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Versions/Current/Headers HIServices
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/Versions/Current/Headers ImageIO
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/LangAnalysis.framework/Versions/Current/Headers LangAnalysis
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Versions/Current/Headers PrintCore
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Versions/Current/Headers QD
cp -R ../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/SpeechSynthesis.framework/Versions/Current/Headers SpeechSynthesis
cp -R ../../System/Library/Frameworks/Carbon.framework/Versions/Current/Headers Carbon
cp -R ../../System/Library/Frameworks/Carbon.framework/Frameworks/CommonPanels.framework/Versions/Current/Headers CommonPanels
cp -R ../../System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/Headers HIToolbox
cp -R ../../System/Library/Frameworks/Carbon.framework/Frameworks/Help.framework/Versions/Current/Headers Help
cp -R ../../System/Library/Frameworks/Carbon.framework/Frameworks/ImageCapture.framework/Versions/Current/Headers ImageCapture
cp -R ../../System/Library/Frameworks/Carbon.framework/Frameworks/OpenScripting.framework/Versions/Current/Headers OpenScripting
cp -R ../../System/Library/Frameworks/Carbon.framework/Frameworks/Print.framework/Versions/Current/Headers Print
cp -R ../../System/Library/Frameworks/Carbon.framework/Frameworks/SecurityHI.framework/Versions/Current/Headers SecurityHI
cp -R ../../System/Library/Frameworks/Carbon.framework/Frameworks/SpeechRecognition.framework/Versions/Current/Headers SpeechRecognition
cp -R ../../System/Library/Frameworks/IOKit.framework/Versions/Current/Headers IOKit
cp -R ../../System/Library/Frameworks/CoreFoundation.framework/Versions/Current/Headers CoreFoundation
cp -R ../../System/Library/Frameworks/DiskArbitration.framework/Versions/Current/Headers DiskArbitration
cp -R ../../System/Library/Frameworks/CFNetwork.framework/Versions/Current/Headers CFNetwork
pushd security && cp -R ../../../System/Library/Frameworks/Security.framework/Versions/Current/Headers/* . && popd
mv security/ Security/
cp -R ../../System/Library/Frameworks/CoreServices.framework/Versions/Current/Headers CoreServices
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Versions/Current/Headers AE
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/DictionaryServices.framework/Versions/Current/Headers DictionaryServices
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/Current/Headers LaunchServices
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Versions/Current/Headers OSServices
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/SharedFileList.framework/Versions/Current/Headers SharedFileList
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/Current/Headers CarbonCore
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Versions/Current/Headers FSEvents
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/Current/Headers Metadata
cp -R ../../System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Versions/Current/Headers SearchKit
cp -R ../../System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers OpenGL
popd
# Remove unnecessary files (574M -> 164M)
rm -rf MacOSX11.3.sdk/usr/share/man/
rm -rf MacOSX11.3.sdk/System/PrivateFrameworks/
rm -rf MacOSX11.3.sdk/usr/lib/swift
rm -rf MacOSX11.3.sdk/System/iOSSupport/usr/lib/swift
rm -rf MacOSX11.3.sdk/System/Library/Perl/
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/SwiftUI.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Python.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/SwiftUI.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Combine.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Accelerate.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/WebKit.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Python.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/RealityKit.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/AVFoundation.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Intents.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/CoreTelephony.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/AudioToolbox.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Quartz.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/OpenCL.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/CryptoKit.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/DriverKit.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Tcl.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/Tk.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/IOBluetooth.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/DiscRecording.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/JavaScriptCore.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/HIDDriverKit.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/GameKit.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/SceneKit.framework
rm -rf MacOSX11.3.sdk/System/Library/Frameworks/WidgetKit.framework
mv MacOSX11.3.sdk root
# Eliminate symlinks, which are difficult to use on Windows.
# Convert symlinks into regular files.
find . -type l -exec sh -c 'resolved_link="$(readlink "{}")"; gsed -i "" "{}"' '{}' \;
# Remove private frameworks (should not be used outside of Apple)
rm -rf root/System/Library/PrivateFrameworks/
# Remove reexported libraries section from all tbd files. These have absolute paths that zld would
# not be able to resolve unless sysroot was set.
# See https://github.com/hexops/mach/issues/108
go build ./strip-reexported.go
find root/System -type f -name "*.tbd" -not -name "System.*" -print0 | xargs -P128 -n1 -0 -- ./strip-reexported