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
124 if [ "x${FEATURE_LEGACY_RUNE_APIS}" == "x1" ]; then
125 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" rune.h
)
127 if [ "x${FEATURE_LEGACY_UTMP_APIS}" == "x1" ]; then
128 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" utmp.h
)
132 "${INC_INSTHDRS[@]/#/${SRCROOT}/include/}"
133 ${SRCROOT}/include
/FreeBSD
/nl_types.h
134 ${SRCROOT}/include
/NetBSD
/utmpx.h
135 ${SRCROOT}/stdtime
/FreeBSD
/tzfile.h
137 INSTHDRS
=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" )
139 INC_ARPA_INSTHDRS
=( ftp.h inet.h nameser_compat.h
telnet.h tftp.h
)
140 ARPA_INSTHDRS
=( "${INC_ARPA_INSTHDRS[@]/#/${SRCROOT}/include/arpa/}" )
142 if [ "x${FEATURE_THERM_NOTIFICATION_APIS}" == "x1" ]; then
143 INC_THERM_INSTHDRS
=( OSThermalNotification.h
)
144 THERM_INSTHDRS
=( "${INC_THERM_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
147 INC_PROTO_INSTHDRS
=( routed.h rwhod.h talkd.h timed.h
)
148 PROTO_INSTHDRS
=( "${INC_PROTO_INSTHDRS[@]/#/${SRCROOT}/include/protocols/}" )
150 INC_SECURE_INSTHDRS
=( _common.h _string.h _strings.h _stdio.h
)
151 SECURE_INSTHDRS
=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
153 SYS_INSTHDRS
=( ${SRCROOT}/include
/sys
/acl.h
${SRCROOT}/include
/sys
/statvfs.h
)
155 INC_XLOCALE_INSTHDRS
=(
169 XLOCALE_INSTHDRS
=( "${INC_XLOCALE_INSTHDRS[@]/#/${SRCROOT}/include/xlocale/}" )
172 ${SRCROOT}/include
/_types
/_intmax_t.h
173 ${SRCROOT}/include
/_types
/_nl_item.h
174 ${SRCROOT}/include
/_types
/_uint16_t.h
175 ${SRCROOT}/include
/_types
/_uint32_t.h
176 ${SRCROOT}/include
/_types
/_uint64_t.h
177 ${SRCROOT}/include
/_types
/_uint8_t.h
178 ${SRCROOT}/include
/_types
/_uintmax_t.h
179 ${SRCROOT}/include
/_types
/_wctrans_t.h
180 ${SRCROOT}/include
/_types
/_wctype_t.h
184 ${SRCROOT}/darwin
/libc_private.h
185 ${SRCROOT}/gen
/utmpx_thread.h
186 ${SRCROOT}/nls
/FreeBSD
/msgcat.h
187 ${SRCROOT}/libdarwin
/dirstat.h
190 OS_LOCALHDRS
=( ${SRCROOT}/os
/assumes.h
${SRCROOT}/os
/debug_private.h
)
193 ${SRCROOT}/stdlib
/FreeBSD
/atexit.h
197 ${SRCROOT}/db
/btree
/FreeBSD
/btree.h
198 ${SRCROOT}/db
/btree
/FreeBSD
/bt_extern.h
202 ${SRCROOT}/include
/sys
/acl.h
203 ${SRCROOT}/include
/sys
/rbtree.h
204 ${SRCROOT}/include
/sys
/statvfs.h
206 PRIVUUID_INSTHDRS
=( ${SRCROOT}/uuid
/namespace.h
)
208 ${MKDIR} ${INCDIR}/arpa
209 ${MKDIR} ${INCDIR}/libkern
210 ${MKDIR} ${INCDIR}/malloc
211 ${MKDIR} ${INCDIR}/protocols
212 ${MKDIR} ${INCDIR}/secure
213 ${MKDIR} ${INCDIR}/sys
214 ${MKDIR} ${INCDIR}/xlocale
215 ${MKDIR} ${INCDIR}/_types
216 ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR}
217 ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa
218 if [ "x${FEATURE_MEM_NOTIFICATION_APIS}" == "x1" ]; then
219 ${INSTALL} -m ${INSTALLMODE} ${MEM_INSTHDRS[@]} ${INCDIR}/libkern
221 if [ "x${FEATURE_THERM_NOTIFICATION_APIS}" == "x1" ]; then
222 ${INSTALL} -m ${INSTALLMODE} ${THERM_INSTHDRS[@]} ${INCDIR}/libkern
224 ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols
225 ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure
226 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${INCDIR}/sys
227 ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS[@]} ${INCDIR}/xlocale
228 ${INSTALL} -m ${INSTALLMODE} ${TYPES_INSTHDRS[@]} ${INCDIR}/_types
229 ${MKDIR} ${LOCINCDIR}
230 ${MKDIR} ${LOCINCDIR}/os
231 ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS[@]} ${LOCINCDIR}
232 ${INSTALL} -m ${INSTALLMODE} ${OS_LOCALHDRS[@]} ${LOCINCDIR}/os
233 ${MKDIR} ${PRIVHDRS}/btree
234 ${MKDIR} ${PRIVHDRS}/machine
235 ${MKDIR} ${PRIVHDRS}/uuid
236 ${MKDIR} ${PRIVHDRS}/sys
237 ${MKDIR} ${PRIVKERNELHDRS}/uuid
238 ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS[@]} ${PRIVHDRS}
239 ${INSTALL} -m ${INSTALLMODE} ${PRIV_BTREEHDRS[@]} ${PRIVHDRS}/btree
240 ${MV} ${INCDIR}/asm.h
${PRIVHDRS}/machine
241 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${PRIVHDRS}/sys
242 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVHDRS}/uuid
243 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVKERNELHDRS}/uuid
245 for i
in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
247 ${ECHO} ${ED} - $i \
< ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
248 ${ED} - $i < ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
249 ${CHMOD} u
-w $i || exit 1;
251 for i
in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l -e UNIFDEF -e OPEN_SOURCE`; do
254 ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $i.orig \
> $i &&
255 { ${UNIFDEF} ${UNIFDEFARGS} $i.orig
> $i || [ $?
-ne 2 ]; } &&
257 ${CHMOD} u
-w $i || exit 1;