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 if [ "$PLATFORM_NAME" = iphonesimulator
]; then
32 SYSTEMFRAMEWORK
=${DSTROOT}/${SDKROOT}/System
/Library
/Frameworks
/System.framework
33 KERNELFRAMEWORK
=${DSTROOT}/${SDKROOT}/System
/Library
/Frameworks
/Kernel.framework
36 PRIVHDRS
=${SYSTEMFRAMEWORK}/Versions
/B
/PrivateHeaders
37 PRIVKERNELHDRS
=${KERNELFRAMEWORK}/Versions
/A
/PrivateHeaders
38 INSTALLMODE
=$([[ `id -u` -eq 0 ]] && echo 444 || echo 644)
41 ${SRCROOT}/gen
/get_compat.h
42 ${SRCROOT}/gen
/execinfo.h
46 NSSystemDirectories.h _locale.h _structs.h _types.h _wctype.h _xlocale.h aio.h alloca.h \
47 ar.h assert.h asm.h bitstring.h
cpio.h crt_externs.h ctype.h db.h dirent.h disktab.h err.h \
48 errno.h fcntl.h fmtmsg.h fnmatch.h fsproperties.h fstab.h fts.h ftw.h getopt.h glob.h inttypes.h \
49 iso646.h langinfo.h libc.h libgen.h limits.h locale.h memory.h monetary.h monitor.h mpool.h ndbm.h \
50 nlist.h paths.h
printf.h poll.h ranlib.h readpassphrase.h regex.h runetype.h search.h \
51 semaphore.h sgtty.h signal.h stab.h standards.h stdbool.h stddef.h stdio.h stdint.h \
52 stdlib.h strhash.h string.h stringlist.h
strings.h struct.h sysexits.h syslog.h
tar.h termios.h
time.h \
53 timeconv.h ttyent.h
ulimit.h unistd.h util.h utime.h vis.h wchar.h wctype.h \
56 if [ "x${FEATURE_LEGACY_RUNE_APIS}" == "x1" ]; then
57 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" rune.h
)
59 if [ "x${FEATURE_LEGACY_UTMP_APIS}" == "x1" ]; then
60 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" utmp.h
)
64 "${INC_INSTHDRS[@]/#/${SRCROOT}/include/}"
65 ${SRCROOT}/include
/FreeBSD
/nl_types.h
66 ${SRCROOT}/include
/NetBSD
/utmpx.h
67 ${SRCROOT}/stdtime
/FreeBSD
/tzfile.h
69 INSTHDRS
=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" )
71 INC_ARPA_INSTHDRS
=( ftp.h inet.h nameser_compat.h
telnet.h tftp.h
)
72 ARPA_INSTHDRS
=( "${INC_ARPA_INSTHDRS[@]/#/${SRCROOT}/include/arpa/}" )
74 if [ "x${FEATURE_MEM_THERM_NOTIFICATION_APIS}" == "x1" ]; then
75 INC_LIBKERN_INSTHDRS
=( OSMemoryNotification.h OSThermalNotification.h
)
76 LIBKERN_INSTHDRS
=( "${INC_LIBKERN_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
79 INC_PROTO_INSTHDRS
=(routed.h rwhod.h talkd.h timed.h
)
80 PROTO_INSTHDRS
=( "${INC_PROTO_INSTHDRS[@]/#/${SRCROOT}/include/protocols/}" )
82 INC_SECURE_INSTHDRS
=( _common.h _string.h _stdio.h
)
83 SECURE_INSTHDRS
=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
85 SYS_INSTHDRS
=( ${SRCROOT}/include
/sys
/acl.h
${SRCROOT}/include
/sys
/statvfs.h
)
87 INC_XLOCALE_INSTHDRS
=(
88 __wctype.h _ctype.h _inttypes.h _langinfo.h _monetary.h _regex.h
89 _stdio.h _stdlib.h _string.h _time.h _wchar.h _wctype.h
91 XLOCALE_INSTHDRS
=( "${INC_XLOCALE_INSTHDRS[@]/#/${SRCROOT}/include/xlocale/}" )
94 ${SRCROOT}/include
/_types
/_intmax_t.h
95 ${SRCROOT}/include
/_types
/_nl_item.h
96 ${SRCROOT}/include
/_types
/_uint16_t.h
97 ${SRCROOT}/include
/_types
/_uint32_t.h
98 ${SRCROOT}/include
/_types
/_uint64_t.h
99 ${SRCROOT}/include
/_types
/_uint8_t.h
100 ${SRCROOT}/include
/_types
/_uintmax_t.h
101 ${SRCROOT}/include
/_types
/_wctrans_t.h
102 ${SRCROOT}/include
/_types
/_wctype_t.h
106 ${SRCROOT}/darwin
/dirhelper.defs
107 ${SRCROOT}/darwin
/dirhelper_priv.h
108 ${SRCROOT}/gen
/assumes.h
109 ${SRCROOT}/gen
/utmpx_thread.h
110 ${SRCROOT}/nls
/FreeBSD
/msgcat.h
113 OS_LOCALHDRS
=( ${SRCROOT}/os
/assumes.h
${SRCROOT}/os
/base.h
${SRCROOT}/os
/trace.h
)
116 ${SRCROOT}/stdlib
/FreeBSD
/atexit.h
120 ${SRCROOT}/db
/btree
/FreeBSD
/btree.h
121 ${SRCROOT}/db
/btree
/FreeBSD
/bt_extern.h
124 SYS_INSTHDRS
=( ${SRCROOT}/include
/sys
/acl.h
${SRCROOT}/include
/sys
/rbtree.h
${SRCROOT}/include
/sys
/statvfs.h
)
125 PRIVUUID_INSTHDRS
=( ${SRCROOT}/uuid
/namespace.h
)
127 ${MKDIR} ${INCDIR}/arpa
128 ${MKDIR} ${INCDIR}/libkern
129 ${MKDIR} ${INCDIR}/malloc
130 ${MKDIR} ${INCDIR}/protocols
131 ${MKDIR} ${INCDIR}/secure
132 ${MKDIR} ${INCDIR}/sys
133 ${MKDIR} ${INCDIR}/xlocale
134 ${MKDIR} ${INCDIR}/_types
135 ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR}
136 ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa
137 if [ "x${FEATURE_MEM_THERM_NOTIFICATION_APIS}" == "x1" ]; then
138 ${INSTALL} -m ${INSTALLMODE} ${LIBKERN_INSTHDRS[@]} ${INCDIR}/libkern
140 ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols
141 ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure
142 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${INCDIR}/sys
143 ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS[@]} ${INCDIR}/xlocale
144 ${INSTALL} -m ${INSTALLMODE} ${TYPES_INSTHDRS[@]} ${INCDIR}/_types
145 ${MKDIR} ${LOCINCDIR}
146 ${MKDIR} ${LOCINCDIR}/os
147 ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS[@]} ${LOCINCDIR}
148 ${INSTALL} -m ${INSTALLMODE} ${OS_LOCALHDRS[@]} ${LOCINCDIR}/os
149 ${MKDIR} ${PRIVHDRS}/btree
150 ${MKDIR} ${PRIVHDRS}/machine
151 ${MKDIR} ${PRIVHDRS}/uuid
152 ${MKDIR} ${PRIVHDRS}/sys
153 ${MKDIR} ${PRIVKERNELHDRS}/uuid
154 ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS[@]} ${PRIVHDRS}
155 ${INSTALL} -m ${INSTALLMODE} ${PRIV_BTREEHDRS[@]} ${PRIVHDRS}/btree
156 ${MV} ${INCDIR}/asm.h
${PRIVHDRS}/machine
157 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${PRIVHDRS}/sys
158 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVHDRS}/uuid
159 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVKERNELHDRS}/uuid
161 for i
in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
163 ${ECHO} ${ED} - $i \
< ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
164 ${ED} - $i < ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
165 ${CHMOD} u
-w $i || exit 1;
167 for i
in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l -e UNIFDEF -e OPEN_SOURCE`; do
170 ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $i.orig \
> $i &&
171 { ${UNIFDEF} ${UNIFDEFARGS} $i.orig
> $i || [ $?
-ne 2 ]; } &&
173 ${CHMOD} u
-w $i || exit 1;