Loading...
xcodescripts/headers.sh Libc-1725.40.4 Libc-825.25
--- Libc/Libc-1725.40.4/xcodescripts/headers.sh
+++ Libc/Libc-825.25/xcodescripts/headers.sh
@@ -1,14 +1,10 @@
 #!/bin/bash
 set -x
 
+# Skip installing headers during Xcode build (buildit uses installhdrs+install)
+if [ "$ACTION" == build ]; then exit 0; fi
+
 # Installs Libc header files
-
-if [ -n "${DRIVERKIT}" -a -z "${DRIVERKITSDK}" ]; then
-	# Run script in the mode that installs public DriverKit SDK headers first:
-	# required to get the correct header unifdef ordering, that mode strips out more
-	# and rewrites all headers under the parent directory (/System/DriverKit)
-	DRIVERKITSDK=1 SDK_INSTALL_HEADERS_ROOT="${SDK_INSTALL_ROOT}" "${BASH}" -e "$0"
-fi
 
 MKDIR="mkdir -p"
 INSTALL=install
@@ -27,132 +23,37 @@
 eval $(${SRCROOT}/xcodescripts/generate_features.pl --bash)
 UNIFDEFARGS=$(${SRCROOT}/xcodescripts/generate_features.pl --unifdef)
 
-if [[ "${DEPLOYMENT_LOCATION}" == "NO" ]] ; then
-    HDRROOT=${BUILT_PRODUCTS_DIR}
-else
-    HDRROOT=${DSTROOT}
+INCDIR=${DSTROOT}/${PUBLIC_HEADERS_FOLDER_PATH}
+LOCINCDIR=${DSTROOT}/${PRIVATE_HEADERS_FOLDER_PATH}
+SYSTEMFRAMEWORK=${DSTROOT}/System/Library/Frameworks/System.framework
+KERNELFRAMEWORK=${DSTROOT}/System/Library/Frameworks/Kernel.framework
+
+if [ "$PLATFORM_NAME" = iphonesimulator ]; then
+	SYSTEMFRAMEWORK=${DSTROOT}/${SDKROOT}/System/Library/Frameworks/System.framework
+	KERNELFRAMEWORK=${DSTROOT}/${SDKROOT}/System/Library/Frameworks/Kernel.framework
 fi
-
-INCDIR=${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}/usr/include
-LOCINCDIR=${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}/usr/local/include
-SYSTEMFRAMEWORK=${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}/System/Library/Frameworks/System.framework
-KERNELFRAMEWORK=${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}/System/Library/Frameworks/Kernel.framework
 
 PRIVHDRS=${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders
 PRIVKERNELHDRS=${KERNELFRAMEWORK}/Versions/A/PrivateHeaders
 INSTALLMODE=$([[ `id -u` -eq 0 ]] && echo 444 || echo 644)
 
-if [ -z "${DRIVERKITSDK}" ]; then
-
 INSTHDRS=(
+	${SRCROOT}/darwin/libproc.h
 	${SRCROOT}/gen/get_compat.h
 	${SRCROOT}/gen/execinfo.h
 )
 
 INC_INSTHDRS=(
-	___wctype.h
-	__wctype.h
-	__xlocale.h
-	_abort.h
-	_assert.h
-	_bounds.h
-	_ctype.h
-	_inttypes.h
-	_langinfo.h
-	_locale.h
-	_locale_posix2008.h
-	_mb_cur_max.h
-	_monetary.h
-	_printf.h
-	_regex.h
-	_static_assert.h
-	_stdio.h
-	_stdlib.h
-	_string.h
-	_strings.h
-	_time.h
-	_types.h
-	_wchar.h
-	_wctype.h
-	_xlocale.h
-	_ctermid.h
-	aio.h
-	alloca.h
-	assert.h
-	asm.h
-	bitstring.h
-	cpio.h
-	crt_externs.h
-	ctype.h
-	db.h
-	dirent.h
-	disktab.h
-	err.h
-	errno.h
-	fcntl.h
-	fmtmsg.h
-	fnmatch.h
-	fsproperties.h
-	fstab.h
-	fts.h
-	ftw.h
-	getopt.h
-	glob.h
-	inttypes.h
-	iso646.h
-	langinfo.h
-	libc.h
-	libgen.h
-	limits.h
-	locale.h
-	memory.h
-	monetary.h
-	monitor.h
-	mpool.h
-	ndbm.h
-	nlist.h
-	paths.h
-	printf.h
-	poll.h
-	ranlib.h
-	readpassphrase.h
-	regex.h
-	runetype.h
-	search.h
-	semaphore.h
-	sgtty.h
-	signal.h
-	stab.h
-	standards.h
-	stddef.h
-	stdio.h
-	stdint.h
-	stdlib.h
-	strhash.h
-	string.h
-	stringlist.h
-	strings.h
-	struct.h
-	sysexits.h
-	syslog.h
-	tar.h
-	termios.h
-	time.h
-	timeconv.h
-	ttyent.h
-	ulimit.h
-	unistd.h
-	util.h
-	utime.h
-	vis.h
-	wchar.h
-	wctype.h
-	wordexp.h
-	xlocale.h
+	NSSystemDirectories.h _locale.h _structs.h _types.h _wctype.h _xlocale.h aio.h alloca.h \
+	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 \
+	errno.h fcntl.h fmtmsg.h fnmatch.h fsproperties.h fstab.h fts.h ftw.h getopt.h glob.h inttypes.h \
+	iso646.h langinfo.h libc.h libgen.h limits.h locale.h memory.h monetary.h monitor.h mpool.h ndbm.h \
+	nlist.h paths.h poll.h ranlib.h readpassphrase.h regex.h runetype.h search.h \
+	semaphore.h setjmp.h sgtty.h signal.h spawn.h stab.h standards.h stdbool.h stddef.h stdio.h stdint.h \
+	stdlib.h strhash.h string.h stringlist.h strings.h struct.h sysexits.h syslog.h tar.h termios.h time.h \
+	timeconv.h ttyent.h ucontext.h ulimit.h unistd.h util.h utime.h vis.h wchar.h wctype.h \
+	wordexp.h xlocale.h
 )
-if [ "${PLATFORM_NAME}" == "macosx" -o -n "${DRIVERKIT}" ]; then
-	INC_INSTHDRS=( "${INC_INSTHDRS[@]}" ar.h )
-fi
 if [ "x${FEATURE_LEGACY_RUNE_APIS}" == "x1" ]; then
 	INC_INSTHDRS=( "${INC_INSTHDRS[@]}" rune.h )
 fi
@@ -166,80 +67,63 @@
 	${SRCROOT}/include/NetBSD/utmpx.h
 	${SRCROOT}/stdtime/FreeBSD/tzfile.h
 )
-INSTHDRS=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" )
+INC_PTHREADHDRS=(
+	${SRCROOT}/pthreads/pthread.h 
+	${SRCROOT}/pthreads/pthread_spis.h 
+	${SRCROOT}/pthreads/pthread_impl.h 
+	${SRCROOT}/pthreads/sched.h
+)
+INSTHDRS=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" "${INC_PTHREADHDRS[@]}" )
 
-INC_ARPA_INSTHDRS=( ftp.h inet.h nameser_compat.h telnet.h tftp.h )
+INC_ARPA_INSTHDRS=( ftp.h nameser_compat.h telnet.h tftp.h )
 ARPA_INSTHDRS=( "${INC_ARPA_INSTHDRS[@]/#/${SRCROOT}/include/arpa/}" )
 
-if [ "x${FEATURE_THERM_NOTIFICATION_APIS}" == "x1" ]; then
-	INC_THERM_INSTHDRS=( OSThermalNotification.h )
-	if [ "${PLATFORM_NAME}" == "macosx" ]; then
-		THERM_INSTHDRS=( "${INC_THERM_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
-	else
-		THERM_LOCALHDRS=( "${INC_THERM_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
-	fi
+INC_LIBKERN_INSTHDRS=( OSAtomic.h OSCacheControl.h )
+if [ "x${FEATURE_MEM_THERM_NOTIFICATION_APIS}" == "x1" ]; then
+	INC_LIBKERN_INSTHDRS+=( OSMemoryNotification.h OSThermalNotification.h )
 fi
+LIBKERN_INSTHDRS=( "${INC_LIBKERN_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
 
-INC_PROTO_INSTHDRS=( routed.h rwhod.h talkd.h timed.h )
+MALLOC_INSTHDRS=( ${SRCROOT}/include/malloc/malloc.h )
+
+INC_PROTO_INSTHDRS=(routed.h rwhod.h talkd.h timed.h )
 PROTO_INSTHDRS=( "${INC_PROTO_INSTHDRS[@]/#/${SRCROOT}/include/protocols/}" )
 
-INC_SECURE_INSTHDRS=( _common.h _string.h _strings.h _stdio.h )
+INC_SECURE_INSTHDRS=( _common.h _string.h _stdio.h )
 SECURE_INSTHDRS=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
 
 SYS_INSTHDRS=( ${SRCROOT}/include/sys/acl.h ${SRCROOT}/include/sys/statvfs.h )
 
 INC_XLOCALE_INSTHDRS=(
-	___wctype.h
-	_ctype.h
-	_inttypes.h
-	_langinfo.h
-	_monetary.h
-	_regex.h
-	_stdio.h
-	_stdlib.h
-	_string.h
-	_time.h
-	_wchar.h
-	_wctype.h
+	__wctype.h _ctype.h _inttypes.h _langinfo.h _monetary.h _regex.h
+	_stdio.h _stdlib.h _string.h _time.h _wchar.h _wctype.h
 )
 XLOCALE_INSTHDRS=( "${INC_XLOCALE_INSTHDRS[@]/#/${SRCROOT}/include/xlocale/}" )
 
-MODULEMAPS=(
+LOCALHDRS=(
+	${SRCROOT}/darwin/dirhelper.defs
+	${SRCROOT}/darwin/dirhelper_priv.h
+	${SRCROOT}/darwin/libproc.h
+	${SRCROOT}/darwin/libproc_internal.h
+	${SRCROOT}/gen/asl_core.h 
+	${SRCROOT}/gen/asl_file.h 
+	${SRCROOT}/gen/asl_ipc.defs 
+	${SRCROOT}/gen/asl_legacy1.h 
+	${SRCROOT}/gen/asl_msg.h 
+	${SRCROOT}/gen/asl_private.h 
+	${SRCROOT}/gen/asl_store.h 
+	${SRCROOT}/gen/assumes.h 
+	${SRCROOT}/gen/_simple.h 
+	${SRCROOT}/gen/stack_logging.h 
+	${SRCROOT}/gen/utmpx_thread.h
+	${SRCROOT}/include/spawn_private.h
+	${SRCROOT}/nls/FreeBSD/msgcat.h
+	${SRCROOT}/pthreads/pthread_workqueue.h
 )
 
-PRIV_MODULEMAPS=(
-)
-
-TYPES_INSTHDRS=(
-	${SRCROOT}/include/_types/_intmax_t.h
-	${SRCROOT}/include/_types/_locale_t.h
-	${SRCROOT}/include/_types/_nl_item.h
-	${SRCROOT}/include/_types/_uint16_t.h
-	${SRCROOT}/include/_types/_uint32_t.h
-	${SRCROOT}/include/_types/_uint64_t.h
-	${SRCROOT}/include/_types/_uint8_t.h
-	${SRCROOT}/include/_types/_uintmax_t.h
-	${SRCROOT}/include/_types/_wctrans_t.h
-	${SRCROOT}/include/_types/_wctype_t.h
-)
-
-LOCALHDRS=(
-	${SRCROOT}/darwin/libc_private.h
-	${SRCROOT}/darwin/libc_hooks.h
-	${SRCROOT}/gen/utmpx_thread.h
-	${SRCROOT}/nls/FreeBSD/msgcat.h
-	${SRCROOT}/gen/thread_stack_pcs.h
-	${SRCROOT}/libdarwin/h/dirstat.h
-	${SRCROOT}/darwin/subsystem.h
-	${SRCROOT}/darwin/_libc_init.h
-)
-if [ "${PLATFORM_NAME}" != "macosx" -a -z "${DRIVERKIT}" ]; then
-	LOCALHDRS=( "${LOCALHDRS[@]}" ${SRCROOT}/include/ar.h )
-fi
-
-OS_LOCALHDRS=( ${SRCROOT}/os/assumes.h ${SRCROOT}/os/debug_private.h )
-
 PRIV_INSTHDRS=(
+	${SRCROOT}/gen/stack_logging.h
+	${SRCROOT}/pthreads/pthread_machdep.h
 	${SRCROOT}/stdlib/FreeBSD/atexit.h
 )
 
@@ -248,163 +132,45 @@
 	${SRCROOT}/db/btree/FreeBSD/bt_extern.h
 )
 
-SYS_INSTHDRS=(
-	${SRCROOT}/include/sys/acl.h
-	${SRCROOT}/include/sys/rbtree.h
-	${SRCROOT}/include/sys/statvfs.h
-)
-
+SYS_INSTHDRS=( ${SRCROOT}/include/sys/acl.h ${SRCROOT}/include/sys/statvfs.h )
 PRIVUUID_INSTHDRS=( ${SRCROOT}/uuid/namespace.h )
 
-else # DRIVERKITSDK
-
-# Public DriverKit SDK headers
-
-UNIFDEFARGS="${UNIFDEFARGS} -U_USE_EXTENDED_LOCALES_"
-
-INC_INSTHDRS=(
-	___wctype.h
-	__wctype.h
-	_abort.h
-	_assert.h
-	_bounds.h
-	_ctype.h
-	_inttypes.h
-	_locale.h
-	_locale_posix2008.h
-	_mb_cur_max.h
-	_printf.h
-	_static_assert.h
-	_stdio.h
-	_stdlib.h
-	_string.h
-	_strings.h
-	_time.h
-	_types.h
-	_wchar.h
-	_wctype.h
-	alloca.h
-	assert.h
-	ctype.h
-	inttypes.h
-	limits.h
-	locale.h
-	runetype.h
-	stddef.h
-	stdio.h
-	stdint.h
-	stdlib.h
-	string.h
-	strings.h
-	time.h
-	wchar.h
-	wctype.h
-)
-
-TYPES_INSTHDRS=(
-	${SRCROOT}/include/_types/_intmax_t.h
-	${SRCROOT}/include/_types/_locale_t.h
-	${SRCROOT}/include/_types/_uint16_t.h
-	${SRCROOT}/include/_types/_uint32_t.h
-	${SRCROOT}/include/_types/_uint64_t.h
-	${SRCROOT}/include/_types/_uint8_t.h
-	${SRCROOT}/include/_types/_uintmax_t.h
-	${SRCROOT}/include/_types/_wctrans_t.h
-	${SRCROOT}/include/_types/_wctype_t.h
-)
-
-INC_INSTHDRS=(
-	"${INC_INSTHDRS[@]/#/${SRCROOT}/include/}"
-)
-INSTHDRS=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" )
-
-INC_SECURE_INSTHDRS=( _common.h _string.h _strings.h _stdio.h )
-SECURE_INSTHDRS=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
-
-fi # DRIVERKITSDK
-
-if [ -n "${INSTHDRS}" ]; then
-${MKDIR} ${INCDIR}
+${MKDIR} ${INCDIR}/arpa
+${MKDIR} ${INCDIR}/libkern
+${MKDIR} ${INCDIR}/malloc
+${MKDIR} ${INCDIR}/protocols
+${MKDIR} ${INCDIR}/secure
+${MKDIR} ${INCDIR}/sys
+${MKDIR} ${INCDIR}/xlocale
 ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR}
-fi
-if [ -n "${ARPA_INSTHDRS}" ]; then
-${MKDIR} ${INCDIR}/arpa
 ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa
-fi
-if [ -n "${THERM_INSTHDRS}" ]; then
-${MKDIR} ${INCDIR}/libkern
-${INSTALL} -m ${INSTALLMODE} ${THERM_INSTHDRS[@]} ${INCDIR}/libkern
-fi
-if [ -n "${PROTO_INSTHDRS}" ]; then
-${MKDIR} ${INCDIR}/protocols
+${INSTALL} -m ${INSTALLMODE} ${LIBKERN_INSTHDRS[@]} ${INCDIR}/libkern
+${INSTALL} -m ${INSTALLMODE} ${MALLOC_INSTHDRS[@]} ${INCDIR}/malloc
 ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols
-fi
-if [ -n "${SECURE_INSTHDRS}" ]; then
-${MKDIR} ${INCDIR}/secure
 ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure
-fi
-if [ -n "${SYS_INSTHDRS}" ]; then
-${MKDIR} ${INCDIR}/sys
 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${INCDIR}/sys
-fi
-if [ -n "${XLOCALE_INSTHDRS}" ]; then
-${MKDIR} ${INCDIR}/xlocale
 ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS[@]} ${INCDIR}/xlocale
-fi
-if [ -n "${TYPES_INSTHDRS}" ]; then
-${MKDIR} ${INCDIR}/_types
-${INSTALL} -m ${INSTALLMODE} ${TYPES_INSTHDRS[@]} ${INCDIR}/_types
-fi
-if [ -n "${MODULEMAPS}" ]; then
-${MKDIR} ${INCDIR}
-${INSTALL} -m ${INSTALLMODE} ${MODULEMAPS[@]} ${INCDIR}
-fi
-if [ -n "${LOCALHDRS}" ]; then
 ${MKDIR} ${LOCINCDIR}
 ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS[@]} ${LOCINCDIR}
-fi
-if [ -n "${THERM_LOCALHDRS}" ]; then
-${MKDIR} ${LOCINCDIR}/libkern
-${INSTALL} -m ${INSTALLMODE} ${THERM_LOCALHDRS[@]} ${LOCINCDIR}/libkern
-fi
-if [ -n "${OS_LOCALHDRS}" ]; then
-${MKDIR} ${LOCINCDIR}/os
-${INSTALL} -m ${INSTALLMODE} ${OS_LOCALHDRS[@]} ${LOCINCDIR}/os
-fi
-if [ -n "${PRIV_MODULEMAPS}" ]; then
-${MKDIR} ${LOCINCDIR}
-${INSTALL} -m ${INSTALLMODE} ${PRIV_MODULEMAPS[@]} ${LOCINCDIR}
-fi
-if [ -n "${PRIV_INSTHDRS}" ]; then
-${MKDIR} ${PRIVHDRS}
+${MKDIR} ${PRIVHDRS}/btree
+${MKDIR} ${PRIVHDRS}/machine
+${MKDIR} ${PRIVHDRS}/uuid
+${MKDIR} ${PRIVHDRS}/sys
+${MKDIR} ${PRIVKERNELHDRS}/uuid
 ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS[@]} ${PRIVHDRS}
-fi
-if [ -n "${PRIV_BTREEHDRS}" ]; then
-${MKDIR} ${PRIVHDRS}/btree
 ${INSTALL} -m ${INSTALLMODE} ${PRIV_BTREEHDRS[@]} ${PRIVHDRS}/btree
-fi
-if [ -n "${SYS_INSTHDRS}" ]; then
-${MKDIR} ${PRIVHDRS}/sys
+${MV} ${INCDIR}/asm.h ${PRIVHDRS}/machine
 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${PRIVHDRS}/sys
-fi
-if [ -n "${PRIVUUID_INSTHDRS}" ]; then
-${MKDIR} ${PRIVHDRS}/uuid
 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVHDRS}/uuid
-${MKDIR} ${PRIVKERNELHDRS}/uuid
 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVKERNELHDRS}/uuid
-fi
-if [ -f "${INCDIR}/asm.h" ]; then
-${MKDIR} ${PRIVHDRS}/machine
-${MV} ${INCDIR}/asm.h ${PRIVHDRS}/machine
-fi
 
-for i in `${FIND} "${HDRROOT}/${SDK_INSTALL_HEADERS_ROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
+for i in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
 	${CHMOD} u+w $i &&
 	${ECHO} ${ED} - $i \< ${SRCROOT}/xcodescripts/strip-header.ed &&
 	${ED} - $i < ${SRCROOT}/xcodescripts/strip-header.ed &&
 	${CHMOD} u-w $i || exit 1;
 done
-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
+for i in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l UNIFDEF`; do
 	${CHMOD} u+w $i &&
 	${CP} $i $i.orig &&
 	${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $i.orig \> $i &&