4 # Skip installing headers during Xcode build (buildit uses installhdrs+install)
5 if [ "$ACTION" == build
]; then exit 0; fi
7 # Installs Libc header files
23 eval $(${SRCROOT}/xcodescripts/generate_features.pl --bash)
24 UNIFDEFARGS
=$(${SRCROOT}/xcodescripts/generate_features.pl --unifdef)
26 INCDIR
=${DSTROOT}/${PUBLIC_HEADERS_FOLDER_PATH}
27 LOCINCDIR
=${DSTROOT}/${PRIVATE_HEADERS_FOLDER_PATH}
28 SYSTEMFRAMEWORK
=${DSTROOT}/System
/Library
/Frameworks
/System.framework
29 KERNELFRAMEWORK
=${DSTROOT}/System
/Library
/Frameworks
/Kernel.framework
31 PRIVHDRS
=${SYSTEMFRAMEWORK}/Versions
/B
/PrivateHeaders
32 PRIVKERNELHDRS
=${KERNELFRAMEWORK}/Versions
/A
/PrivateHeaders
33 INSTALLMODE
=$([[ `id -u` -eq 0 ]] && echo 444 || echo 644)
36 ${SRCROOT}/gen
/get_compat.h
37 ${SRCROOT}/gen
/execinfo.h
120 if [ "x${FEATURE_LEGACY_RUNE_APIS}" == "x1" ]; then
121 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" rune.h
)
123 if [ "x${FEATURE_LEGACY_UTMP_APIS}" == "x1" ]; then
124 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" utmp.h
)
128 "${INC_INSTHDRS[@]/#/${SRCROOT}/include/}"
129 ${SRCROOT}/include
/FreeBSD
/nl_types.h
130 ${SRCROOT}/include
/NetBSD
/utmpx.h
131 ${SRCROOT}/stdtime
/FreeBSD
/tzfile.h
133 INSTHDRS
=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" )
135 INC_ARPA_INSTHDRS
=( ftp.h inet.h nameser_compat.h
telnet.h tftp.h
)
136 ARPA_INSTHDRS
=( "${INC_ARPA_INSTHDRS[@]/#/${SRCROOT}/include/arpa/}" )
138 if [ "x${FEATURE_THERM_NOTIFICATION_APIS}" == "x1" ]; then
139 INC_THERM_INSTHDRS
=( OSThermalNotification.h
)
140 THERM_INSTHDRS
=( "${INC_THERM_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
143 INC_PROTO_INSTHDRS
=( routed.h rwhod.h talkd.h timed.h
)
144 PROTO_INSTHDRS
=( "${INC_PROTO_INSTHDRS[@]/#/${SRCROOT}/include/protocols/}" )
146 INC_SECURE_INSTHDRS
=( _common.h _string.h _stdio.h
)
147 SECURE_INSTHDRS
=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
149 SYS_INSTHDRS
=( ${SRCROOT}/include
/sys
/acl.h
${SRCROOT}/include
/sys
/statvfs.h
)
151 INC_XLOCALE_INSTHDRS
=(
165 XLOCALE_INSTHDRS
=( "${INC_XLOCALE_INSTHDRS[@]/#/${SRCROOT}/include/xlocale/}" )
168 ${SRCROOT}/include
/_types
/_intmax_t.h
169 ${SRCROOT}/include
/_types
/_nl_item.h
170 ${SRCROOT}/include
/_types
/_uint16_t.h
171 ${SRCROOT}/include
/_types
/_uint32_t.h
172 ${SRCROOT}/include
/_types
/_uint64_t.h
173 ${SRCROOT}/include
/_types
/_uint8_t.h
174 ${SRCROOT}/include
/_types
/_uintmax_t.h
175 ${SRCROOT}/include
/_types
/_wctrans_t.h
176 ${SRCROOT}/include
/_types
/_wctype_t.h
180 ${SRCROOT}/darwin
/libc_private.h
181 ${SRCROOT}/gen
/utmpx_thread.h
182 ${SRCROOT}/nls
/FreeBSD
/msgcat.h
185 OS_LOCALHDRS
=( ${SRCROOT}/os
/assumes.h
${SRCROOT}/os
/debug_private.h
)
188 ${SRCROOT}/stdlib
/FreeBSD
/atexit.h
192 ${SRCROOT}/db
/btree
/FreeBSD
/btree.h
193 ${SRCROOT}/db
/btree
/FreeBSD
/bt_extern.h
197 ${SRCROOT}/include
/sys
/acl.h
198 ${SRCROOT}/include
/sys
/rbtree.h
199 ${SRCROOT}/include
/sys
/statvfs.h
201 PRIVUUID_INSTHDRS
=( ${SRCROOT}/uuid
/namespace.h
)
203 ${MKDIR} ${INCDIR}/arpa
204 ${MKDIR} ${INCDIR}/libkern
205 ${MKDIR} ${INCDIR}/malloc
206 ${MKDIR} ${INCDIR}/protocols
207 ${MKDIR} ${INCDIR}/secure
208 ${MKDIR} ${INCDIR}/sys
209 ${MKDIR} ${INCDIR}/xlocale
210 ${MKDIR} ${INCDIR}/_types
211 ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR}
212 ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa
213 if [ "x${FEATURE_MEM_NOTIFICATION_APIS}" == "x1" ]; then
214 ${INSTALL} -m ${INSTALLMODE} ${MEM_INSTHDRS[@]} ${INCDIR}/libkern
216 if [ "x${FEATURE_THERM_NOTIFICATION_APIS}" == "x1" ]; then
217 ${INSTALL} -m ${INSTALLMODE} ${THERM_INSTHDRS[@]} ${INCDIR}/libkern
219 ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols
220 ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure
221 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${INCDIR}/sys
222 ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS[@]} ${INCDIR}/xlocale
223 ${INSTALL} -m ${INSTALLMODE} ${TYPES_INSTHDRS[@]} ${INCDIR}/_types
224 ${MKDIR} ${LOCINCDIR}
225 ${MKDIR} ${LOCINCDIR}/os
226 ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS[@]} ${LOCINCDIR}
227 ${INSTALL} -m ${INSTALLMODE} ${OS_LOCALHDRS[@]} ${LOCINCDIR}/os
228 ${MKDIR} ${PRIVHDRS}/btree
229 ${MKDIR} ${PRIVHDRS}/machine
230 ${MKDIR} ${PRIVHDRS}/uuid
231 ${MKDIR} ${PRIVHDRS}/sys
232 ${MKDIR} ${PRIVKERNELHDRS}/uuid
233 ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS[@]} ${PRIVHDRS}
234 ${INSTALL} -m ${INSTALLMODE} ${PRIV_BTREEHDRS[@]} ${PRIVHDRS}/btree
235 ${MV} ${INCDIR}/asm.h
${PRIVHDRS}/machine
236 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${PRIVHDRS}/sys
237 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVHDRS}/uuid
238 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVKERNELHDRS}/uuid
240 for i
in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
242 ${ECHO} ${ED} - $i \
< ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
243 ${ED} - $i < ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
244 ${CHMOD} u
-w $i || exit 1;
246 for i
in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l -e UNIFDEF -e OPEN_SOURCE`; do
249 ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $i.orig \
> $i &&
250 { ${UNIFDEF} ${UNIFDEFARGS} $i.orig
> $i || [ $?
-ne 2 ]; } &&
252 ${CHMOD} u
-w $i || exit 1;