]> git.cameronkatri.com Git - apple_cmds.git/blob - setup.sh
system_cmds: use libiosexec
[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
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 wget -q -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/nls/FreeBSD/msgcat.h
37 wget -q -nc -Pbase/include https://opensource.apple.com/source/libmalloc/libmalloc-317.40.8/private/stack_logging.h
38 wget -q -nc -Pbase/include/os https://opensource.apple.com/source/Libc/Libc-1439.40.11/os/assumes.h
39 wget -q -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/include/libc.h
40 wget -q -nc -Pbase/include https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/_simple.h
41 wget -q -nc -Pbase/include/os https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/os/base_private.h
42 wget -q -nc -Pbase/include/System/uuid/ https://opensource.apple.com/source/Libc/Libc-1439.40.11/uuid/namespace.h
43 wget -q -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/mntopts.h
44 wget -q -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/libutil.h
45 wget -q -nc -Pbase/include https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/membership.subproj/membershipPriv.h
46 wget -q -nc -Pbase/include/rpc https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/rpc.subproj/pmap_clnt.h
47 wget -q -nc -Pbase/include/CommonCrypto https://opensource.apple.com/source/CommonCrypto/CommonCrypto-60118.30.2/include/CommonDigestSPI.h
48 wget -q -nc -Pbase/include \
49 https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/vproc_priv.h \
50 https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/reboot2.h \
51 https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/bootstrap_priv.h
52 wget -q -nc -Pbase/include/bsm \
53 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/bsm/audit_kevents.h \
54 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/bsm/audit_record.h
55 chmod -Rf u+w base/include
56 wget -q -nc -Pbase/include/libkern \
57 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSTypes.h \
58 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSReturn.h \
59 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSKextLib.h
60 wget -q -nc -Pbase/include/Kernel/libkern \
61 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSKextLibPrivate.h
62 wget -q -nc -Pbase/include/System/libkern \
63 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSKextLibPrivate.h
64 wget -q -nc -Pbase/include/os \
65 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/os/log_private.h \
66 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/os/log.h \
67 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/os/atomic_private.h \
68 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/os/atomic_private_arch.h \
69 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/os/atomic_private_impl.h
70 wget -q -nc -Pbase/include/firehose \
71 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/firehose/tracepoint_private.h \
72 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/firehose/firehose_types_private.h
73 wget -q -nc -Pbase/include/machine https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/machine/cpu_capabilities.h
74 wget -q -nc -Pbase/include/Kernel/kern https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/kern/ledger.h
75 wget -q -nc -Pbase/include/kern \
76 https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/kern/debug.h \
77 https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/kern/kcdata.h
78 wget -q -nc -Pbase/include/System/machine https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/machine/cpu_capabilities.h
79 wget -q -nc -Pbase/include/System/arm https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/arm/cpu_capabilities.h
80 wget -q -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/mach/coalition.h
81 wget -q -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/mach/vm_statistics.h
82 ln -sf mach/vm_statistics.h base/include/vm_statistics.h
83 wget -q -nc -Pbase/include/netinet6 \
84 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/in6_var.h \
85 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/in6_pcb.h \
86 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/mld6_var.h \
87 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/ip6_var.h \
88 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/raw_ip6.h \
89 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/in6.h \
90 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/nd6.h
91 wget -q -nc -Pbase/include/netinet \
92 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/in.h \
93 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/ip_flowid.h \
94 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/tcp.h \
95 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/if_ether.h \
96 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/ip_var.h \
97 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/icmp_var.h \
98 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/igmp_var.h \
99 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/tcpip.h \
100 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/tcp_seq.h \
101 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/tcp_fsm.h \
102 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/udp_var.h \
103 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/in_var.h \
104 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/in_stat.h \
105 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/in_pcb.h \
106 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/tcp_var.h \
107 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/mptcp_var.h \
108 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet/ip_dummynet.h
109 wget -q -nc -Pbase/include/net \
110 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/route.h \
111 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if.h \
112 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/net_perf.h \
113 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/packet_mangler.h \
114 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_var.h \
115 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/pktap.h \
116 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/bpf.h \
117 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/iptap.h \
118 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_media.h \
119 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_bond_var.h \
120 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_6lowpan_var.h \
121 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_bond_internal.h \
122 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_bridgevar.h \
123 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/lacp.h \
124 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_mib.h \
125 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/network_agent.h \
126 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_fake_var.h \
127 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_vlan_var.h \
128 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_arp.h \
129 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/net_api_stats.h \
130 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/if_llreach.h \
131 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/ntstat.h \
132 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/radix.h \
133 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/content_filter.h
134 wget -q -nc -Pbase/include/net/pktsched \
135 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/pktsched/pktsched.h \
136 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/pktsched/pktsched_fq_codel.h
137 wget -q -nc -Pbase/include/net/classq \
138 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/classq/if_classq.h \
139 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/net/classq/classq.h
140 wget -q -nc -Pbase/include/sys \
141 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/socket.h \
142 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/socketvar.h \
143 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/event.h \
144 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/mbuf.h \
145 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/mbuf.h \
146 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/kern_control.h \
147 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/kern_event.h \
148 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/sys_domain.h \
149 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/ipcs.h \
150 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/sem_internal.h \
151 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/shm_internal.h \
152 https://opensource.apple.com/source/xnu/xnu-1228.3.13/bsd/sys/mtio.h \
153 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/unpcb.h \
154 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/pgo.h \
155 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/kdebug.h \
156 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys_private/kdebug_private.h \
157 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/proc_info.h \
158 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/kern_memorystatus.h \
159 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/ptrace.h \
160 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/stackshot.h \
161 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/spawn_internal.h \
162 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/resource.h \
163 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/sockio.h
164 wget -q -nc -Pbase/include/corecrypto \
165 https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/ccsha2.h \
166 https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/ccdigest.h \
167 https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/cc.h \
168 https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/cc_config.h \
169 https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/ccn.h \
170 https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/cc_error.h
171 wget -q -nc -Pbase/include/System/sys \
172 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/proc_uuid_policy.h \
173 https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/kdebug.h
174 wget -q -nc -Pbase/include/dispatch \
175 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/private.h \
176 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/queue_private.h \
177 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/workloop_private.h \
178 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/source_private.h \
179 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/mach_private.h \
180 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/data_private.h \
181 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/io_private.h \
182 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/layout_private.h \
183 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/time_private.h \
184 https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/benchmark.h
185 wget -q -nc -Pbase/include/IOKit \
186 https://opensource.apple.com/source/xnu/xnu-7195.81.3/iokit/IOKit/IOKitKeysPrivate.h
187 wget -q -nc -Pbase/include/Kernel/IOKit \
188 https://opensource.apple.com/source/xnu/xnu-7195.81.3/iokit/IOKit/IOKitDebug.h
189 wget -q -nc -Pbase/include/IOKit/kext \
190 https://opensource.apple.com/source/IOKitUser/IOKitUser-1845.81.1/kext.subproj/kextmanager_types.h \
191 https://opensource.apple.com/source/IOKitUser/IOKitUser-1845.81.1/kext.subproj/OSKext.h
192 wget -q -nc -Pbase/include \
193 https://opensource.apple.com/source/xnu/xnu-7195.81.3/libsyscall/wrappers/spawn/spawn_private.h
194 wget -q -nc -Pbase/include/mach-o \
195 https://opensource.apple.com/source/dyld/dyld-832.7.3/include/mach-o/dyld_process_info.h
196
197 sed -i '' -E 's/__API_UNAVAILABLE\(.*\)//g' base/include/mach-o/dyld_process_info.h
198 sed -i '' -E 's/DISPATCH_ENUM_API_AVAILABLE\(.*\)//g' base/include/dispatch/source_private.h
199 sed -i '' -E 's/API_AVAILABLE\(.*\)//g' base/include/dispatch/mach_private.h
200 sed -i '' -E 's/API_AVAILABLE\(.*\)//g' base/include/dispatch/data_private.h
201
202 CC=aarch64-apple-darwin-clang
203 CXX=aarch64-apple-darwin-clang++
204
205 CFLAGS="-O2 -arch arm64 -isysroot /home/cameron/Documents/iOS/SDK/iPhoneOS14.3.sdk -miphoneos-version-min=14.0 -isystem /usr/home/cameron/Documents/iOS/bsdstrap/base/include -L /usr/home/cameron/Documents/iOS/bsdstrap/base/lib"
206 CPPFLAGS="-O2 -arch arm64 -isysroot /home/cameron/Documents/iOS/SDK/iPhoneOS14.3.sdk -miphoneos-version-min=14.0 -isystem /usr/home/cameron/Documents/iOS/bsdstrap/base/include -L /usr/home/cameron/Documents/iOS/bsdstrap/base/lib"
207 CXXFLAGS="-O2 -arch arm64 -isysroot /home/cameron/Documents/iOS/SDK/iPhoneOS14.3.sdk -miphoneos-version-min=14.0 -isystem /usr/home/cameron/Documents/iOS/bsdstrap/base/include -L /usr/home/cameron/Documents/iOS/bsdstrap/base/lib"
208 LDFLAGS="-O2 -arch arm64 -isysroot /home/cameron/Documents/iOS/SDK/iPhoneOS14.3.sdk -miphoneos-version-min=14.0 -isystem /usr/home/cameron/Documents/iOS/bsdstrap/base/include -L /usr/home/cameron/Documents/iOS/bsdstrap/base/lib"
209
210 export CC CXX CPPFLAGS CXXFLAGS LDFLAGS