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
/_intmax_t.h
186 ${SRCROOT}/include
/_types
/_nl_item.h
187 ${SRCROOT}/include
/_types
/_uint16_t.h
188 ${SRCROOT}/include
/_types
/_uint32_t.h
189 ${SRCROOT}/include
/_types
/_uint64_t.h
190 ${SRCROOT}/include
/_types
/_uint8_t.h
191 ${SRCROOT}/include
/_types
/_uintmax_t.h
192 ${SRCROOT}/include
/_types
/_wctrans_t.h
193 ${SRCROOT}/include
/_types
/_wctype_t.h
197 ${SRCROOT}/darwin
/libc_private.h
198 ${SRCROOT}/gen
/utmpx_thread.h
199 ${SRCROOT}/nls
/FreeBSD
/msgcat.h
200 ${SRCROOT}/gen
/thread_stack_pcs.h
201 ${SRCROOT}/libdarwin
/h
/dirstat.h
204 OS_LOCALHDRS
=( ${SRCROOT}/os
/assumes.h
${SRCROOT}/os
/debug_private.h
)
207 ${SRCROOT}/stdlib
/FreeBSD
/atexit.h
211 ${SRCROOT}/db
/btree
/FreeBSD
/btree.h
212 ${SRCROOT}/db
/btree
/FreeBSD
/bt_extern.h
216 ${SRCROOT}/include
/sys
/acl.h
217 ${SRCROOT}/include
/sys
/rbtree.h
218 ${SRCROOT}/include
/sys
/statvfs.h
220 PRIVUUID_INSTHDRS
=( ${SRCROOT}/uuid
/namespace.h
)
224 # Public DriverKit SDK headers
226 UNIFDEFARGS
="${UNIFDEFARGS} -U_USE_EXTENDED_LOCALES_"
254 ${SRCROOT}/include
/_types
/_intmax_t.h
255 ${SRCROOT}/include
/_types
/_uint16_t.h
256 ${SRCROOT}/include
/_types
/_uint32_t.h
257 ${SRCROOT}/include
/_types
/_uint64_t.h
258 ${SRCROOT}/include
/_types
/_uint8_t.h
259 ${SRCROOT}/include
/_types
/_uintmax_t.h
260 ${SRCROOT}/include
/_types
/_wctrans_t.h
261 ${SRCROOT}/include
/_types
/_wctype_t.h
265 "${INC_INSTHDRS[@]/#/${SRCROOT}/include/}"
267 INSTHDRS
=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" )
269 INC_SECURE_INSTHDRS
=( _common.h _string.h _strings.h _stdio.h
)
270 SECURE_INSTHDRS
=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
274 if [ -n "${INSTHDRS}" ]; then
276 ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR}
278 if [ -n "${ARPA_INSTHDRS}" ]; then
279 ${MKDIR} ${INCDIR}/arpa
280 ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa
282 if [ -n "${THERM_INSTHDRS}" ]; then
283 ${MKDIR} ${INCDIR}/libkern
284 ${INSTALL} -m ${INSTALLMODE} ${THERM_INSTHDRS[@]} ${INCDIR}/libkern
286 if [ -n "${PROTO_INSTHDRS}" ]; then
287 ${MKDIR} ${INCDIR}/protocols
288 ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols
290 if [ -n "${SECURE_INSTHDRS}" ]; then
291 ${MKDIR} ${INCDIR}/secure
292 ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure
294 if [ -n "${SYS_INSTHDRS}" ]; then
295 ${MKDIR} ${INCDIR}/sys
296 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${INCDIR}/sys
298 if [ -n "${XLOCALE_INSTHDRS}" ]; then
299 ${MKDIR} ${INCDIR}/xlocale
300 ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS[@]} ${INCDIR}/xlocale
302 if [ -n "${TYPES_INSTHDRS}" ]; then
303 ${MKDIR} ${INCDIR}/_types
304 ${INSTALL} -m ${INSTALLMODE} ${TYPES_INSTHDRS[@]} ${INCDIR}/_types
306 if [ -n "${LOCALHDRS}" ]; then
307 ${MKDIR} ${LOCINCDIR}
308 ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS[@]} ${LOCINCDIR}
310 if [ -n "${OS_LOCALHDRS}" ]; then
311 ${MKDIR} ${LOCINCDIR}/os
312 ${INSTALL} -m ${INSTALLMODE} ${OS_LOCALHDRS[@]} ${LOCINCDIR}/os
314 if [ -n "${PRIV_INSTHDRS}" ]; then
316 ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS[@]} ${PRIVHDRS}
318 if [ -n "${PRIV_BTREEHDRS}" ]; then
319 ${MKDIR} ${PRIVHDRS}/btree
320 ${INSTALL} -m ${INSTALLMODE} ${PRIV_BTREEHDRS[@]} ${PRIVHDRS}/btree
322 if [ -n "${SYS_INSTHDRS}" ]; then
323 ${MKDIR} ${PRIVHDRS}/sys
324 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${PRIVHDRS}/sys
326 if [ -n "${PRIVUUID_INSTHDRS}" ]; then
327 ${MKDIR} ${PRIVHDRS}/uuid
328 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVHDRS}/uuid
329 ${MKDIR} ${PRIVKERNELHDRS}/uuid
330 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVKERNELHDRS}/uuid
332 if [ -f "${INCDIR}/asm.h" ]; then
333 ${MKDIR} ${PRIVHDRS}/machine
334 ${MV} ${INCDIR}/asm.h
${PRIVHDRS}/machine
337 for i
in `${FIND} "${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
339 ${ECHO} ${ED} - $i \
< ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
340 ${ED} - $i < ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
341 ${CHMOD} u
-w $i || exit 1;
343 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
346 ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $i.orig \
> $i &&
347 { ${UNIFDEF} ${UNIFDEFARGS} $i.orig
> $i || [ $?
-ne 2 ]; } &&
349 ${CHMOD} u
-w $i || exit 1;