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}/darwin
/libproc.h
42 ${SRCROOT}/gen
/get_compat.h
43 ${SRCROOT}/gen
/execinfo.h
47 NSSystemDirectories.h _locale.h _structs.h _types.h _wctype.h _xlocale.h aio.h alloca.h \
48 ar.h asl.h assert.h asm.h bitstring.h
cpio.h crt_externs.h ctype.h db.h dirent.h disktab.h err.h \
49 errno.h fcntl.h fmtmsg.h fnmatch.h fsproperties.h fstab.h fts.h ftw.h getopt.h glob.h inttypes.h \
50 iso646.h langinfo.h libc.h libgen.h limits.h locale.h memory.h monetary.h monitor.h mpool.h ndbm.h \
51 nlist.h paths.h poll.h ranlib.h readpassphrase.h regex.h runetype.h search.h \
52 semaphore.h setjmp.h sgtty.h signal.h spawn.h stab.h standards.h stdbool.h stddef.h stdio.h stdint.h \
53 stdlib.h strhash.h string.h stringlist.h
strings.h struct.h sysexits.h syslog.h
tar.h termios.h
time.h \
54 timeconv.h ttyent.h ucontext.h
ulimit.h unistd.h util.h utime.h vis.h wchar.h wctype.h \
57 if [ "x${FEATURE_LEGACY_RUNE_APIS}" == "x1" ]; then
58 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" rune.h
)
60 if [ "x${FEATURE_LEGACY_UTMP_APIS}" == "x1" ]; then
61 INC_INSTHDRS
=( "${INC_INSTHDRS[@]}" utmp.h
)
65 "${INC_INSTHDRS[@]/#/${SRCROOT}/include/}"
66 ${SRCROOT}/include
/FreeBSD
/nl_types.h
67 ${SRCROOT}/include
/NetBSD
/utmpx.h
68 ${SRCROOT}/stdtime
/FreeBSD
/tzfile.h
71 ${SRCROOT}/pthreads
/pthread.h
72 ${SRCROOT}/pthreads
/pthread_spis.h
73 ${SRCROOT}/pthreads
/pthread_impl.h
74 ${SRCROOT}/pthreads
/sched.h
76 INSTHDRS
=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" "${INC_PTHREADHDRS[@]}" )
78 INC_ARPA_INSTHDRS
=( ftp.h nameser_compat.h
telnet.h tftp.h
)
79 ARPA_INSTHDRS
=( "${INC_ARPA_INSTHDRS[@]/#/${SRCROOT}/include/arpa/}" )
81 INC_LIBKERN_INSTHDRS
=( OSAtomic.h OSCacheControl.h
)
82 if [ "x${FEATURE_MEM_THERM_NOTIFICATION_APIS}" == "x1" ]; then
83 INC_LIBKERN_INSTHDRS
+=( OSMemoryNotification.h OSThermalNotification.h
)
85 LIBKERN_INSTHDRS
=( "${INC_LIBKERN_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
87 MALLOC_INSTHDRS
=( ${SRCROOT}/include
/malloc
/malloc.h
)
89 INC_PROTO_INSTHDRS
=(routed.h rwhod.h talkd.h timed.h
)
90 PROTO_INSTHDRS
=( "${INC_PROTO_INSTHDRS[@]/#/${SRCROOT}/include/protocols/}" )
92 INC_SECURE_INSTHDRS
=( _common.h _string.h _stdio.h
)
93 SECURE_INSTHDRS
=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
95 SYS_INSTHDRS
=( ${SRCROOT}/include
/sys
/acl.h
${SRCROOT}/include
/sys
/statvfs.h
)
97 INC_XLOCALE_INSTHDRS
=(
98 __wctype.h _ctype.h _inttypes.h _langinfo.h _monetary.h _regex.h
99 _stdio.h _stdlib.h _string.h _time.h _wchar.h _wctype.h
101 XLOCALE_INSTHDRS
=( "${INC_XLOCALE_INSTHDRS[@]/#/${SRCROOT}/include/xlocale/}" )
104 ${SRCROOT}/darwin
/dirhelper.defs
105 ${SRCROOT}/darwin
/dirhelper_priv.h
106 ${SRCROOT}/darwin
/libproc.h
107 ${SRCROOT}/darwin
/libproc_internal.h
108 ${SRCROOT}/gen
/asl_core.h
109 ${SRCROOT}/gen
/asl_file.h
110 ${SRCROOT}/gen
/asl_ipc.defs
111 ${SRCROOT}/gen
/asl_legacy1.h
112 ${SRCROOT}/gen
/asl_msg.h
113 ${SRCROOT}/gen
/asl_private.h
114 ${SRCROOT}/gen
/asl_store.h
115 ${SRCROOT}/gen
/assumes.h
116 ${SRCROOT}/gen
/_simple.h
117 ${SRCROOT}/gen
/stack_logging.h
118 ${SRCROOT}/gen
/utmpx_thread.h
119 ${SRCROOT}/include
/spawn_private.h
120 ${SRCROOT}/nls
/FreeBSD
/msgcat.h
121 ${SRCROOT}/pthreads
/pthread_workqueue.h
125 ${SRCROOT}/gen
/stack_logging.h
126 ${SRCROOT}/pthreads
/pthread_machdep.h
127 ${SRCROOT}/stdlib
/FreeBSD
/atexit.h
131 ${SRCROOT}/db
/btree
/FreeBSD
/btree.h
132 ${SRCROOT}/db
/btree
/FreeBSD
/bt_extern.h
135 SYS_INSTHDRS
=( ${SRCROOT}/include
/sys
/acl.h
${SRCROOT}/include
/sys
/statvfs.h
)
136 PRIVUUID_INSTHDRS
=( ${SRCROOT}/uuid
/namespace.h
)
138 ${MKDIR} ${INCDIR}/arpa
139 ${MKDIR} ${INCDIR}/libkern
140 ${MKDIR} ${INCDIR}/malloc
141 ${MKDIR} ${INCDIR}/protocols
142 ${MKDIR} ${INCDIR}/secure
143 ${MKDIR} ${INCDIR}/sys
144 ${MKDIR} ${INCDIR}/xlocale
145 ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR}
146 ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa
147 ${INSTALL} -m ${INSTALLMODE} ${LIBKERN_INSTHDRS[@]} ${INCDIR}/libkern
148 ${INSTALL} -m ${INSTALLMODE} ${MALLOC_INSTHDRS[@]} ${INCDIR}/malloc
149 ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols
150 ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure
151 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${INCDIR}/sys
152 ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS[@]} ${INCDIR}/xlocale
153 ${MKDIR} ${LOCINCDIR}
154 ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS[@]} ${LOCINCDIR}
155 ${MKDIR} ${PRIVHDRS}/btree
156 ${MKDIR} ${PRIVHDRS}/machine
157 ${MKDIR} ${PRIVHDRS}/uuid
158 ${MKDIR} ${PRIVHDRS}/sys
159 ${MKDIR} ${PRIVKERNELHDRS}/uuid
160 ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS[@]} ${PRIVHDRS}
161 ${INSTALL} -m ${INSTALLMODE} ${PRIV_BTREEHDRS[@]} ${PRIVHDRS}/btree
162 ${MV} ${INCDIR}/asm.h
${PRIVHDRS}/machine
163 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${PRIVHDRS}/sys
164 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVHDRS}/uuid
165 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVKERNELHDRS}/uuid
167 for i
in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
169 ${ECHO} ${ED} - $i \
< ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
170 ${ED} - $i < ${SRCROOT}/xcodescripts
/strip
-header.ed
&&
171 ${CHMOD} u
-w $i || exit 1;
173 for i
in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l UNIFDEF`; do
176 ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $i.orig \
> $i &&
177 { ${UNIFDEF} ${UNIFDEFARGS} $i.orig
> $i || [ $?
-ne 2 ]; } &&
179 ${CHMOD} u
-w $i || exit 1;