4 # Installs Libc header files
6 if [ -n "${DRIVERKIT}" -a -z "${DRIVERKITSDK}" ]; then
7 # Run script in the mode that installs public DriverKit SDK headers first:
8 # required to get the correct header unifdef ordering, that mode strips out more
9 # and rewrites all headers under the parent directory (/System/DriverKit)
10 DRIVERKITSDK
=1 SDK_INSTALL_HEADERS_ROOT
="${SDK_INSTALL_ROOT}" "${BASH}" -e "$0"
27 eval $(${SRCROOT}/xcodescripts/generate_features.pl --bash)
28 UNIFDEFARGS
=$(${SRCROOT}/xcodescripts/generate_features.pl --unifdef)
30 if [[ "${DEPLOYMENT_LOCATION}" == "NO" ]] ; then
31 HDRROOT
=${BUILT_PRODUCTS_DIR}
36 INCDIR
=${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}/usr
/include
37 LOCINCDIR
=${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}/usr
/local
/include
38 SYSTEMFRAMEWORK
=${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}/System
/Library
/Frameworks
/System.framework
39 KERNELFRAMEWORK
=${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}/System
/Library
/Frameworks
/Kernel.framework
41 PRIVHDRS
=${SYSTEMFRAMEWORK}/Versions
/B
/PrivateHeaders
42 PRIVKERNELHDRS
=${KERNELFRAMEWORK}/Versions
/A
/PrivateHeaders
43 INSTALLMODE
=$([[ `id -u` -eq 0 ]] && echo 444 || echo 644)
45 if [ -z "${DRIVERKITSDK}" ]; then
48 ${SRCROOT}/gen
/get_compat.h
49 ${SRCROOT}/gen
/execinfo.h
137 if [ "x${FEATURE_LEGACY_RUNE_APIS}" == "x1" ]; then
138 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" rune.h
)
140 if [ "x${FEATURE_LEGACY_UTMP_APIS}" == "x1" ]; then
141 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" utmp.h
)
145 "${INC_INSTHDRS[@]/#/${SRCROOT}/include/}"
146 ${SRCROOT}/include
/FreeBSD
/nl_types.h
147 ${SRCROOT}/include
/NetBSD
/utmpx.h
148 ${SRCROOT}/stdtime
/FreeBSD
/tzfile.h
150 INSTHDRS
=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" )
152 INC_ARPA_INSTHDRS
=( ftp.h inet.h nameser_compat.h
telnet.h tftp.h
)
153 ARPA_INSTHDRS
=( "${INC_ARPA_INSTHDRS[@]/#/${SRCROOT}/include/arpa/}" )
155 if [ "x${FEATURE_THERM_NOTIFICATION_APIS}" == "x1" ]; then
156 INC_THERM_INSTHDRS
=( OSThermalNotification.h
)
157 THERM_INSTHDRS
=( "${INC_THERM_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
160 INC_PROTO_INSTHDRS
=( routed.h rwhod.h talkd.h timed.h
)
161 PROTO_INSTHDRS
=( "${INC_PROTO_INSTHDRS[@]/#/${SRCROOT}/include/protocols/}" )
163 INC_SECURE_INSTHDRS
=( _common.h _string.h _strings.h _stdio.h
)
164 SECURE_INSTHDRS
=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
166 SYS_INSTHDRS
=( ${SRCROOT}/include
/sys
/acl.h
${SRCROOT}/include
/sys
/statvfs.h
)
168 INC_XLOCALE_INSTHDRS
=(
182 XLOCALE_INSTHDRS
=( "${INC_XLOCALE_INSTHDRS[@]/#/${SRCROOT}/include/xlocale/}" )
185 ${SRCROOT}/include
/_types.modulemap
186 ${SRCROOT}/include
/stdint.modulemap
190 ${SRCROOT}/include
/_types
/_intmax_t.h
191 ${SRCROOT}/include
/_types
/_nl_item.h
192 ${SRCROOT}/include
/_types
/_uint16_t.h
193 ${SRCROOT}/include
/_types
/_uint32_t.h
194 ${SRCROOT}/include
/_types
/_uint64_t.h
195 ${SRCROOT}/include
/_types
/_uint8_t.h
196 ${SRCROOT}/include
/_types
/_uintmax_t.h
197 ${SRCROOT}/include
/_types
/_wctrans_t.h
198 ${SRCROOT}/include
/_types
/_wctype_t.h
202 ${SRCROOT}/darwin
/libc_private.h
203 ${SRCROOT}/gen
/utmpx_thread.h
204 ${SRCROOT}/nls
/FreeBSD
/msgcat.h
205 ${SRCROOT}/gen
/thread_stack_pcs.h
206 ${SRCROOT}/libdarwin
/h
/dirstat.h
207 ${SRCROOT}/darwin
/subsystem.h
210 OS_LOCALHDRS
=( ${SRCROOT}/os
/assumes.h
${SRCROOT}/os
/debug_private.h
)
213 ${SRCROOT}/stdlib
/FreeBSD
/atexit.h
217 ${SRCROOT}/db
/btree
/FreeBSD
/btree.h
218 ${SRCROOT}/db
/btree
/FreeBSD
/bt_extern.h
222 ${SRCROOT}/include
/sys
/acl.h
223 ${SRCROOT}/include
/sys
/rbtree.h
224 ${SRCROOT}/include
/sys
/statvfs.h
227 PRIVUUID_INSTHDRS
=( ${SRCROOT}/uuid
/namespace.h
)
231 # Public DriverKit SDK headers
233 UNIFDEFARGS
="${UNIFDEFARGS} -U_USE_EXTENDED_LOCALES_"
261 ${SRCROOT}/include
/_types
/_intmax_t.h
262 ${SRCROOT}/include
/_types
/_uint16_t.h
263 ${SRCROOT}/include
/_types
/_uint32_t.h
264 ${SRCROOT}/include
/_types
/_uint64_t.h
265 ${SRCROOT}/include
/_types
/_uint8_t.h
266 ${SRCROOT}/include
/_types
/_uintmax_t.h
267 ${SRCROOT}/include
/_types
/_wctrans_t.h
268 ${SRCROOT}/include
/_types
/_wctype_t.h
272 "${INC_INSTHDRS[@]/#/${SRCROOT}/include/}"
274 INSTHDRS
=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" )
276 INC_SECURE_INSTHDRS
=( _common.h _string.h _strings.h _stdio.h
)
277 SECURE_INSTHDRS
=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
281 if [ -n "${INSTHDRS}" ]; then
283 ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR}
285 if [ -n "${ARPA_INSTHDRS}" ]; then
286 ${MKDIR} ${INCDIR}/arpa
287 ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa
289 if [ -n "${THERM_INSTHDRS}" ]; then
290 ${MKDIR} ${INCDIR}/libkern
291 ${INSTALL} -m ${INSTALLMODE} ${THERM_INSTHDRS[@]} ${INCDIR}/libkern
293 if [ -n "${PROTO_INSTHDRS}" ]; then
294 ${MKDIR} ${INCDIR}/protocols
295 ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols
297 if [ -n "${SECURE_INSTHDRS}" ]; then
298 ${MKDIR} ${INCDIR}/secure
299 ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure
301 if [ -n "${SYS_INSTHDRS}" ]; then
302 ${MKDIR} ${INCDIR}/sys
303 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${INCDIR}/sys
305 if [ -n "${XLOCALE_INSTHDRS}" ]; then
306 ${MKDIR} ${INCDIR}/xlocale
307 ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS[@]} ${INCDIR}/xlocale
309 if [ -n "${TYPES_INSTHDRS}" ]; then
310 ${MKDIR} ${INCDIR}/_types
311 ${INSTALL} -m ${INSTALLMODE} ${TYPES_INSTHDRS[@]} ${INCDIR}/_types
313 if [ -n "${MODULEMAPS}" ]; then
315 ${INSTALL} -m ${INSTALLMODE} ${MODULEMAPS[@]} ${INCDIR}
317 if [ -n "${LOCALHDRS}" ]; then
318 ${MKDIR} ${LOCINCDIR}
319 ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS[@]} ${LOCINCDIR}
321 if [ -n "${OS_LOCALHDRS}" ]; then
322 ${MKDIR} ${LOCINCDIR}/os
323 ${INSTALL} -m ${INSTALLMODE} ${OS_LOCALHDRS[@]} ${LOCINCDIR}/os
325 if [ -n "${PRIV_INSTHDRS}" ]; then
327 ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS[@]} ${PRIVHDRS}
329 if [ -n "${PRIV_BTREEHDRS}" ]; then
330 ${MKDIR} ${PRIVHDRS}/btree
331 ${INSTALL} -m ${INSTALLMODE} ${PRIV_BTREEHDRS[@]} ${PRIVHDRS}/btree
333 if [ -n "${SYS_INSTHDRS}" ]; then
334 ${MKDIR} ${PRIVHDRS}/sys
335 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${PRIVHDRS}/sys
337 if [ -n "${PRIVUUID_INSTHDRS}" ]; then
338 ${MKDIR} ${PRIVHDRS}/uuid
339 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVHDRS}/uuid
340 ${MKDIR} ${PRIVKERNELHDRS}/uuid
341 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVKERNELHDRS}/uuid
343 if [ -f "${INCDIR}/asm.h" ]; then
344 ${MKDIR} ${PRIVHDRS}/machine
345 ${MV} ${INCDIR}/asm.h
${PRIVHDRS}/machine
348 for i
in `${FIND} "${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
350 ${ECHO} ${ED} - $i \
< ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
351 ${ED} - $i < ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
352 ${CHMOD} u
-w $i || exit 1;
354 for i
in `${FIND} "${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}" -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l -e UNIFDEF -e OPEN_SOURCE -e _USE_EXTENDED_LOCALES_`; do
357 ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $i.orig \
> $i &&
358 { ${UNIFDEF} ${UNIFDEFARGS} $i.orig
> $i || [ $?
-ne 2 ]; } &&
360 ${CHMOD} u
-w $i || exit 1;