]> git.saurik.com Git - apple/xnu.git/blob - libsyscall/xcodescripts/mach_install_mig.sh
xnu-1699.32.7.tar.gz
[apple/xnu.git] / libsyscall / xcodescripts / mach_install_mig.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2010 Apple Inc. All rights reserved.
4 #
5 # @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 #
7 # This file contains Original Code and/or Modifications of Original Code
8 # as defined in and that are subject to the Apple Public Source License
9 # Version 2.0 (the 'License'). You may not use this file except in
10 # compliance with the License. The rights granted to you under the License
11 # may not be used to create, or enable the creation or redistribution of,
12 # unlawful or unlicensed copies of an Apple operating system, or to
13 # circumvent, violate, or enable the circumvention or violation of, any
14 # terms of an Apple operating system software license agreement.
15 #
16 # Please obtain a copy of the License at
17 # http://www.opensource.apple.com/apsl/ and read it before using this file.
18 #
19 # The Original Code and all software distributed under the License are
20 # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
21 # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
22 # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
23 # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
24 # Please see the License for the specific language governing rights and
25 # limitations under the License.
26 #
27 # @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 #
29
30 # build inside OBJROOT
31 cd $OBJROOT
32
33 # check if we're building for the simulator
34 [ "$RC_ProjectName" == "Libmach_Sim" ] && DSTROOT="$DSTROOT$SDKROOT"
35
36 MIG=`xcrun -sdk "$SDKROOT" -find mig`
37 MIGCC=`xcrun -sdk "$SDKROOT" -find cc`
38 export MIGCC
39 MIG_DEFINES="-DLIBSYSCALL_INTERFACE"
40 MIG_HEADER_DST="$DSTROOT/usr/include/mach"
41 SERVER_HEADER_DST="$DSTROOT/usr/include/servers"
42 # from old Libsystem makefiles
43 MACHINE_ARCH=`echo $ARCHS | cut -d' ' -f 1`
44 SRC="$SRCROOT/mach"
45
46 MIGS="clock.defs
47 clock_priv.defs
48 clock_reply.defs
49 exc.defs
50 host_priv.defs
51 host_security.defs
52 ledger.defs
53 lock_set.defs
54 mach_port.defs
55 mach_host.defs
56 mach_vm.defs
57 processor.defs
58 processor_set.defs
59 vm_map.defs"
60
61 MIGS_ARCH="thread_act.defs
62 task.defs"
63
64 SERVER_HDRS="key_defs.h
65 ls_defs.h
66 netname_defs.h
67 nm_defs.h"
68
69 # install /usr/include/server headers
70 mkdir -p $SERVER_HEADER_DST
71 for hdr in $SERVER_HDRS; do
72 install -o 0 -c -m 444 $SRC/servers/$hdr $SERVER_HEADER_DST
73 done
74
75 # special case because we only have one to do here
76 $MIG -arch $MACHINE_ARCH -header "$SERVER_HEADER_DST/netname.h" $SRC/servers/netname.defs
77
78 # install /usr/include/mach mig headers
79
80 mkdir -p $MIG_HEADER_DST
81
82 for mig in $MIGS; do
83 MIG_NAME=`basename $mig .defs`
84 $MIG -arch $MACHINE_ARCH -cc $MIGCC -header "$MIG_HEADER_DST/$MIG_NAME.h" $MIG_DEFINES $SRC/$mig
85 done
86
87 ARCHS=`echo $ARCHS | sed -e 's/armv./arm/g'`
88 for arch in $ARCHS; do
89 MIG_ARCH_DST="$MIG_HEADER_DST/$arch"
90
91 mkdir -p $MIG_ARCH_DST
92
93 for mig in $MIGS_ARCH; do
94 MIG_NAME=`basename $mig .defs`
95 $MIG -arch $MACHINE_ARCH -cc $MIGCC -header "$MIG_ARCH_DST/$MIG_NAME.h" $MIG_DEFINES $SRC/$mig
96 done
97 done