]> git.saurik.com Git - apple/xnu.git/blobdiff - libsyscall/xcodescripts/mach_install_mig.sh
xnu-4903.231.4.tar.gz
[apple/xnu.git] / libsyscall / xcodescripts / mach_install_mig.sh
index 174fa8c3ccb1375390a583fb0319afce485d6056..cdd598aee7b745712463017cde103c73738d0602 100755 (executable)
@@ -39,19 +39,30 @@ MIG_HEADER_DST="$BUILT_PRODUCTS_DIR/mig_hdr/include/mach"
 MIG_PRIVATE_HEADER_DST="$BUILT_PRODUCTS_DIR/mig_hdr/local/include/mach"
 SERVER_HEADER_DST="$BUILT_PRODUCTS_DIR/mig_hdr/include/servers"
 MACH_HEADER_DST="$BUILT_PRODUCTS_DIR/mig_hdr/include/mach"
+MACH_PRIVATE_HEADER_DST="$BUILT_PRODUCTS_DIR/mig_hdr/local/include/mach"
 
 # from old Libsystem makefiles
 MACHINE_ARCH=`echo $ARCHS | cut -d' ' -f 1`
-if [[ ( "$MACHINE_ARCH" = "arm64" || "$MACHINE_ARCH" = "x86_64" || "$MACHINE_ARCH" = "x86_64h" ) && `echo $ARCHS | wc -w` -gt 1 ]]
+if [[ ( "$MACHINE_ARCH" =~ ^"arm64" || "$MACHINE_ARCH" =~ ^"x86_64" ) && `echo $ARCHS | wc -w` -gt 1 ]]
 then
        # MACHINE_ARCH needs to be a 32-bit arch to generate vm_map_internal.h correctly.
        MACHINE_ARCH=`echo $ARCHS | cut -d' ' -f 2`
-    if [[ ( "$MACHINE_ARCH" = "arm64" || "$MACHINE_ARCH" = "x86_64" || "$MACHINE_ARCH" = "x86_64h" ) && `echo $ARCHS | wc -w` -gt 1 ]]
-    then
-           # MACHINE_ARCH needs to be a 32-bit arch to generate vm_map_internal.h correctly.
-           MACHINE_ARCH=`echo $ARCHS | cut -d' ' -f 3`
-    fi
+       if [[ ( "$MACHINE_ARCH" =~ ^"arm64" || "$MACHINE_ARCH" =~ ^"x86_64" ) && `echo $ARCHS | wc -w` -gt 2 ]]
+       then
+               # MACHINE_ARCH needs to be a 32-bit arch to generate vm_map_internal.h correctly.
+               MACHINE_ARCH=`echo $ARCHS | cut -d' ' -f 3`
+       fi
+fi
+# MACHINE_ARCH *really* needs to be a 32-bit arch to generate vm_map_internal.h correctly, even if there are no 32-bit targets.
+if [[ ( "$MACHINE_ARCH" =~ ^"arm64" ) ]]
+then
+       MACHINE_ARCH="armv7"
+fi
+if [[ ( "$MACHINE_ARCH" =~ ^"x86_64" ) ]]
+then
+       MACHINE_ARCH="i386"
 fi
+
 SRC="$SRCROOT/mach"
 MIG_INTERNAL_HEADER_DST="$BUILT_PRODUCTS_DIR/internal_hdr/include/mach"
 MIG_PRIVATE_DEFS_INCFLAGS="-I${SDKROOT}/System/Library/Frameworks/System.framework/PrivateHeaders"
@@ -82,7 +93,7 @@ MIGS_PRIVATE=""
 
 MIGS_DUAL_PUBLIC_PRIVATE=""
 
-if ( echo {iphone,tv,appletv,watch}{os,simulator} iphone{osnano,nanosimulator} | grep -wFq "$PLATFORM_NAME" )
+if ( echo {iphone,tv,appletv,watch,bridge}{os,simulator} iphone{osnano,nanosimulator} | grep -wFq "$PLATFORM_NAME" )
 then
        MIGS_PRIVATE="mach_vm.defs"
 else
@@ -103,12 +114,16 @@ MACH_HDRS="mach.h
        mach_error.h
        mach_init.h
        mach_interface.h
+       mach_right.h
        port_obj.h
        sync.h
        vm_task.h
        vm_page_size.h
        thread_state.h"
 
+MACH_PRIVATE_HDRS="port_descriptions.h
+       mach_sync_ipc.h"
+
 MIG_FILTERS="watchos_prohibited_mig.txt tvos_prohibited_mig.txt"
 
 # install /usr/include/server headers 
@@ -123,6 +138,12 @@ for hdr in $MACH_HDRS; do
        install $ASROOT -c -m 444 $SRC/mach/$hdr $MACH_HEADER_DST
 done
 
+# install /usr/local/include/mach headers
+mkdir -p $MACH_PRIVATE_HEADER_DST
+for hdr in $MACH_PRIVATE_HDRS; do
+       install $ASROOT -c -m 444 $SRC/mach/$hdr $MACH_PRIVATE_HEADER_DST
+done
+
 # special case because we only have one to do here
 $MIG -novouchers -arch $MACHINE_ARCH -header "$SERVER_HEADER_DST/netname.h" $SRC/servers/netname.defs
 
@@ -147,7 +168,7 @@ for mig in $MIGS_PRIVATE $MIGS_DUAL_PUBLIC_PRIVATE; do
        MIG_NAME=`basename $mig .defs`
        $MIG -novouchers -arch $MACHINE_ARCH -cc $MIGCC -header "$MIG_PRIVATE_HEADER_DST/$MIG_NAME.h" $MIG_DEFINES $MIG_PRIVATE_DEFS_INCFLAGS $SRC/$mig
        if [ ! -e "$MIG_HEADER_DST/$MIG_NAME.h" ]; then
-           echo "#error $MIG_NAME.h unsupported." > "$MIG_HEADER_DST/$MIG_NAME.h"
+               echo "#error $MIG_NAME.h unsupported." > "$MIG_HEADER_DST/$MIG_NAME.h"
        fi
 done