]> git.cameronkatri.com Git - apple_cmds.git/blob - setup.sh
Merge branch 'apple'
[apple_cmds.git] / setup.sh
1 #!/bin/sh
2 mkdir -p base/include/sys/ base/include/os/ base/lib/ base/include/System/uuid/ base/include/System/sys/ base/include/CommonCrypto base/include/bsm base/include/corecrypto base/include/firehose base/include/machine base/include/System/arm base/include/rpc base/include/mach-o base/include/libkern base/include/Kernel/kern base/include/dispatch base/include/IOkit/kext base/include/kern base/include/Kernel/IOKit base/include/Kernel/libkern base/include/mach_debug base/include/pthread
3
4 cp -af ${MACOSX_SYSROOT}/usr/include/tzfile.h base/include/
5 cp -af ${MACOSX_SYSROOT}/usr/include/launch.h base/include/
6 cp -af ${MACOSX_SYSROOT}/usr/include/sys/user.h base/include/sys/
7 cp -af ${MACOSX_SYSROOT}/usr/include/xpc base/include/
8 cp -af ${MACOSX_SYSROOT}/usr/include/libproc.h base/include/
9 cp -af ${MACOSX_SYSROOT}/usr/include/nlist.h base/include/
10 cp -af ${MACOSX_SYSROOT}/usr/include/sys/resourcevar.h base/include/sys
11 cp -af ${MACOSX_SYSROOT}/usr/include/mach base/include/
12 cp -af ${MACOSX_SYSROOT}/usr/include/get_compat.h base/include/
13 cp -af ${MACOSX_SYSROOT}/usr/include/sys/ioctl_compat.h base/include/sys
14 cp -af ${MACOSX_SYSROOT}/usr/include/sys/ttychars.h base/include/sys
15 cp -af ${MACOSX_SYSROOT}/usr/include/sys/ttydev.h base/include/sys
16 cp -af ${MACOSX_SYSROOT}/usr/include/sys/tty.h base/include/sys
17 cp -af ${MACOSX_SYSROOT}/usr/include/sys/reboot.h base/include/sys/
18 cp -af ${MACOSX_SYSROOT}/usr/include/sys/disk.h base/include/sys/
19 cp -af ${MACOSX_SYSROOT}/usr/include/sys/vnode.h base/include/sys/
20 cp -af ${MACOSX_SYSROOT}/usr/include/sys/vnioctl.h base/include/sys/
21 cp -af ${MACOSX_SYSROOT}/usr/include/sys/conf.h base/include/sys/
22 cp -af ${MACOSX_SYSROOT}/usr/include/nameser.h base/include/
23 cp -af ${MACOSX_SYSROOT}/usr/include/arpa base/include/
24 cp -af ${MACOSX_SYSROOT}/usr/include/protocols base/include/
25 cp -af ${MACOSX_SYSROOT}/usr/include/histedit.h base/include/
26 cp -af ${MACOSX_SYSROOT}/usr/include/sys/acct.h base/include/sys/
27 cp -af ${MACOSX_SYSROOT}/usr/include/struct.h base/include/
28 cp -af ${MACOSX_SYSROOT}/usr/include/vproc.h base/include/
29 cp -af ${MACOSX_SYSROOT}/usr/include/bootstrap.h base/include/
30 cp -af ${MACOSX_SYSROOT}/usr/include/servers base/include/
31 cp -af ${MACOSX_SYSROOT}/usr/include/timeconv.h base/include/
32 cp -rf ${MACOSX_SYSROOT}/System/Library/Frameworks/IOKit.framework/Headers/ base/include/IOKit
33 cp -af /usr/include/stdalign.h base/include/
34 sed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $TARGET_SYSROOT/usr/include/stdlib.h > base/include/stdlib.h
35
36 # iOS 12.0 XNU for maximum compatibility
37 # iOS 12.0 (4903.202.2) source is missing so we use a slightly newer one from between
38 # 12.1 beta 2 and beta 3
39 XNUVER="4903.221.2"
40 DISPATCHVER="1008.270.1"
41
42 wget -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/nls/FreeBSD/msgcat.h
43 wget -nc -Pbase/include https://opensource.apple.com/source/libmalloc/libmalloc-317.40.8/private/stack_logging.h
44 wget -nc -Pbase/include/os https://opensource.apple.com/source/Libc/Libc-1439.40.11/os/assumes.h
45 wget -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/include/libc.h
46 wget -nc -Pbase/include https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/_simple.h
47 wget -nc -Pbase/include/os https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/os/base_private.h
48 wget -nc -Pbase/include/System/uuid/ https://opensource.apple.com/source/Libc/Libc-1439.40.11/uuid/namespace.h
49 wget -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/mntopts.h
50 wget -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/libutil.h
51 wget -nc -Pbase/include https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/membership.subproj/membershipPriv.h
52 wget -nc -Pbase/include/rpc https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/rpc.subproj/pmap_clnt.h
53 wget -nc -Pbase/include/CommonCrypto https://opensource.apple.com/source/CommonCrypto/CommonCrypto-60118.30.2/include/CommonDigestSPI.h
54 wget -nc -Pbase/include \
55 https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/vproc_priv.h \
56 https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/reboot2.h \
57 https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/bootstrap_priv.h
58 wget -nc -Pbase/include/bsm \
59 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/bsm/audit_kevents.h \
60 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/bsm/audit_record.h
61 chmod -Rf u+w base/include
62 wget -nc -Pbase/include/libkern \
63 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSTypes.h \
64 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSReturn.h \
65 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSKextLib.h
66 wget -nc -Pbase/include/Kernel/libkern \
67 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSKextLibPrivate.h
68 wget -nc -Pbase/include/System/libkern \
69 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSKextLibPrivate.h
70 wget -nc -Pbase/include/os \
71 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/log_private.h \
72 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/log.h \
73 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/atomic_private.h \
74 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/atomic_private_arch.h \
75 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/atomic_private_impl.h
76 wget -nc -Pbase/include/firehose \
77 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/firehose/tracepoint_private.h \
78 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/firehose/firehose_types_private.h
79 wget -nc -Pbase/include/machine https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/machine/cpu_capabilities.h
80 wget -nc -Pbase/include/Kernel/kern https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/ledger.h
81 wget -nc -Pbase/include/kern \
82 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/debug.h \
83 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/kern_types.h \
84 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/kcdata.h
85 wget -nc -Pbase/include/System/machine https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/machine/cpu_capabilities.h
86 wget -nc -Pbase/include/System/arm https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/arm/cpu_capabilities.h
87 wget -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/mach/coalition.h
88 wget -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/mach/vm_statistics.h
89 ln -sf mach/vm_statistics.h base/include/vm_statistics.h
90 wget -nc -Pbase/include/netinet6 \
91 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/in6_var.h \
92 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/in6_pcb.h \
93 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/mld6_var.h \
94 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/ip6_var.h \
95 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/raw_ip6.h \
96 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/in6.h \
97 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/nd6.h
98 wget -nc -Pbase/include/netinet \
99 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/in.h \
100 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/ip_flowid.h \
101 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcp.h \
102 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/if_ether.h \
103 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/ip_var.h \
104 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/icmp_var.h \
105 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/igmp_var.h \
106 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcpip.h \
107 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcp_seq.h \
108 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcp_fsm.h \
109 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/udp_var.h \
110 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/in_var.h \
111 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/in_stat.h \
112 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/in_pcb.h \
113 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcp_var.h \
114 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/mptcp_var.h \
115 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/ip_dummynet.h
116 wget -nc -Pbase/include/net \
117 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/route.h \
118 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if.h \
119 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/net_perf.h \
120 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/packet_mangler.h \
121 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_var.h \
122 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktap.h \
123 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/bpf.h \
124 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/iptap.h \
125 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_media.h \
126 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_bond_var.h \
127 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_6lowpan_var.h \
128 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_bond_internal.h \
129 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_bridgevar.h \
130 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/lacp.h \
131 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_mib.h \
132 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/network_agent.h \
133 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_fake_var.h \
134 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_vlan_var.h \
135 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_arp.h \
136 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/net_api_stats.h \
137 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_llreach.h \
138 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/ntstat.h \
139 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/radix.h \
140 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/content_filter.h
141 wget -nc -Pbase/include/net/pktsched \
142 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktsched/pktsched.h \
143 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktsched/pktsched_tcq.h \
144 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktsched/pktsched_qfq.h \
145 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktsched/pktsched_fq_codel.h
146 wget -nc -Pbase/include/net/classq \
147 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/if_classq.h \
148 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq_red.h \
149 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq_blue.h \
150 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq_rio.h \
151 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq_sfb.h \
152 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq.h
153 wget -nc -Pbase/include/sys \
154 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/socket.h \
155 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/socketvar.h \
156 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/event.h \
157 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/mbuf.h \
158 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/mbuf.h \
159 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kern_control.h \
160 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kern_event.h \
161 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/sys_domain.h \
162 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/ipcs.h \
163 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/sem_internal.h \
164 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/shm_internal.h \
165 https://opensource.apple.com/source/xnu/xnu-1228.3.13/bsd/sys/mtio.h \
166 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/unpcb.h \
167 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/pgo.h \
168 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kdebug.h \
169 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys_private/kdebug_private.h \
170 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/proc_info.h \
171 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kern_memorystatus.h \
172 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/ptrace.h \
173 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/stackshot.h \
174 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/spawn_internal.h \
175 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/resource.h \
176 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/sockio.h
177 wget -nc -Pbase/include/corecrypto \
178 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/ccsha2.h \
179 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/ccdigest.h \
180 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/cc.h \
181 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/cc_config.h \
182 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/ccn.h \
183 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/cc_error.h
184 wget -nc -Pbase/include/System/sys \
185 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/proc.h \
186 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/proc_uuid_policy.h \
187 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kdebug.h
188 wget -nc -Pbase/include/dispatch \
189 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/private.h \
190 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/queue_private.h \
191 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/workloop_private.h \
192 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/source_private.h \
193 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/mach_private.h \
194 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/data_private.h \
195 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/io_private.h \
196 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/layout_private.h \
197 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/time_private.h \
198 https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/benchmark.h
199 wget -nc -Pbase/include/IOKit \
200 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/iokit/IOKit/IOKitKeysPrivate.h
201 wget -nc -Pbase/include/Kernel/IOKit \
202 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/iokit/IOKit/IOKitDebug.h
203 wget -nc -Pbase/include/IOKit/kext \
204 https://opensource.apple.com/source/IOKitUser/IOKitUser-1845.81.1/kext.subproj/kextmanager_types.h \
205 https://opensource.apple.com/source/IOKitUser/IOKitUser-1845.81.1/kext.subproj/OSKext.h
206 wget -nc -Pbase/include \
207 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libsyscall/wrappers/spawn/spawn_private.h
208 rm base/include/mach/mach_init.h
209 wget -nc -Pbase/include/mach \
210 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libsyscall/mach/mach/mach_init.h
211 wget -nc -Pbase/include/mach_debug \
212 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/mach_debug/ipc_info.h
213 wget -nc -Pbase/include/mach-o \
214 https://opensource.apple.com/source/dyld/dyld-832.7.3/include/mach-o/dyld_process_info.h
215 wget -nc -Pbase/include/pthread \
216 https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/pthread/priority_private.h \
217 https://opensource.apple.com/source/libpthread/libpthread-454.100.8/private/pthread/qos.h
218
219 sed -i'' -E 's/__API_UNAVAILABLE\(.*\)//g' base/include/mach-o/dyld_process_info.h
220 sed -i'' -E 's/API_AVAILABLE\(.*\)//g' base/include/dispatch/mach_private.h
221 sed -i'' -E 's/API_AVAILABLE\(.*\)//g' base/include/dispatch/data_private.h
222 sed -i'' -E 's/#if INET6/#ifdef INET6/g' base/include/sys/sockio.h
223 sed -i'' -E 's/^__OSX_AVAILABLE_STARTING\(.*\)//g' base/include/xpc/xpc.h