]>
Commit | Line | Data |
---|---|---|
316670eb | 1 | #!/bin/sh -x |
6d2010ae A |
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 | |
316670eb A |
34 | if [ "${RC_ProjectName%_Sim}" != "${RC_ProjectName}" ] ; then |
35 | DSTROOT="${DSTROOT}${SDKROOT}" | |
36 | fi | |
6d2010ae A |
37 | |
38 | MIG=`xcrun -sdk "$SDKROOT" -find mig` | |
39 | MIGCC=`xcrun -sdk "$SDKROOT" -find cc` | |
40 | export MIGCC | |
41 | MIG_DEFINES="-DLIBSYSCALL_INTERFACE" | |
42 | MIG_HEADER_DST="$DSTROOT/usr/include/mach" | |
316670eb | 43 | MIG_PRIVATE_HEADER_DST="$DSTROOT/usr/local/include/mach" |
6d2010ae A |
44 | SERVER_HEADER_DST="$DSTROOT/usr/include/servers" |
45 | # from old Libsystem makefiles | |
46 | MACHINE_ARCH=`echo $ARCHS | cut -d' ' -f 1` | |
47 | SRC="$SRCROOT/mach" | |
316670eb A |
48 | MIG_INTERNAL_HEADER_DST="$DERIVED_SOURCES_DIR/mach" |
49 | MIG_PRIVATE_DEFS_INCFLAGS="-I${SDKROOT}/System/Library/Frameworks/System.framework/PrivateHeaders" | |
6d2010ae A |
50 | |
51 | MIGS="clock.defs | |
52 | clock_priv.defs | |
53 | clock_reply.defs | |
54 | exc.defs | |
55 | host_priv.defs | |
56 | host_security.defs | |
6d2010ae | 57 | lock_set.defs |
6d2010ae | 58 | mach_host.defs |
316670eb | 59 | mach_port.defs |
6d2010ae A |
60 | processor.defs |
61 | processor_set.defs | |
62 | vm_map.defs" | |
63 | ||
316670eb A |
64 | MIGS_PRIVATE="" |
65 | ||
66 | MIGS_DUAL_PUBLIC_PRIVATE="" | |
67 | ||
68 | if [[ "$PLATFORM" = "iPhoneOS" || "$RC_ProjectName" = "Libsyscall_headers_Sim" ]] | |
69 | then | |
70 | MIGS_PRIVATE="mach_vm.defs" | |
71 | else | |
72 | MIGS+=" mach_vm.defs" | |
73 | fi | |
74 | ||
75 | ||
6d2010ae A |
76 | MIGS_ARCH="thread_act.defs |
77 | task.defs" | |
78 | ||
316670eb A |
79 | MIGS_INTERNAL="mach_port.defs |
80 | mach_vm.defs | |
81 | vm_map.defs" | |
82 | ||
6d2010ae A |
83 | SERVER_HDRS="key_defs.h |
84 | ls_defs.h | |
85 | netname_defs.h | |
86 | nm_defs.h" | |
87 | ||
88 | # install /usr/include/server headers | |
89 | mkdir -p $SERVER_HEADER_DST | |
90 | for hdr in $SERVER_HDRS; do | |
91 | install -o 0 -c -m 444 $SRC/servers/$hdr $SERVER_HEADER_DST | |
92 | done | |
93 | ||
94 | # special case because we only have one to do here | |
95 | $MIG -arch $MACHINE_ARCH -header "$SERVER_HEADER_DST/netname.h" $SRC/servers/netname.defs | |
96 | ||
97 | # install /usr/include/mach mig headers | |
98 | ||
99 | mkdir -p $MIG_HEADER_DST | |
100 | ||
316670eb | 101 | for mig in $MIGS $MIGS_DUAL_PUBLIC_PRIVATE; do |
6d2010ae A |
102 | MIG_NAME=`basename $mig .defs` |
103 | $MIG -arch $MACHINE_ARCH -cc $MIGCC -header "$MIG_HEADER_DST/$MIG_NAME.h" $MIG_DEFINES $SRC/$mig | |
104 | done | |
105 | ||
316670eb A |
106 | mkdir -p $MIG_PRIVATE_HEADER_DST |
107 | ||
108 | for mig in $MIGS_PRIVATE $MIGS_DUAL_PUBLIC_PRIVATE; do | |
109 | MIG_NAME=`basename $mig .defs` | |
110 | $MIG -arch $MACHINE_ARCH -cc $MIGCC -header "$MIG_PRIVATE_HEADER_DST/$MIG_NAME.h" $MIG_DEFINES $MIG_PRIVATE_DEFS_INCFLAGS $SRC/$mig | |
111 | if [ ! -e "$MIG_HEADER_DST/$MIG_NAME.h" ]; then | |
112 | echo "#error $MIG_NAME.h unsupported." > "$MIG_HEADER_DST/$MIG_NAME.h" | |
113 | fi | |
114 | done | |
115 | ||
116 | ||
117 | # special headers used just for building Libsyscall | |
118 | # Note: not including -DLIBSYSCALL_INTERFACE to mig so we'll get the proper | |
119 | # 'internal' version of the headers being built | |
120 | ||
121 | mkdir -p $MIG_INTERNAL_HEADER_DST | |
122 | ||
123 | for mig in $MIGS_INTERNAL; do | |
124 | MIG_NAME=`basename $mig .defs` | |
125 | $MIG -arch $MACHINE_ARCH -cc $MIGCC -header "$MIG_INTERNAL_HEADER_DST/${MIG_NAME}_internal.h" $SRC/$mig | |
126 | done | |
127 | ||
6d2010ae A |
128 | ARCHS=`echo $ARCHS | sed -e 's/armv./arm/g'` |
129 | for arch in $ARCHS; do | |
130 | MIG_ARCH_DST="$MIG_HEADER_DST/$arch" | |
131 | ||
132 | mkdir -p $MIG_ARCH_DST | |
133 | ||
134 | for mig in $MIGS_ARCH; do | |
135 | MIG_NAME=`basename $mig .defs` | |
136 | $MIG -arch $MACHINE_ARCH -cc $MIGCC -header "$MIG_ARCH_DST/$MIG_NAME.h" $MIG_DEFINES $SRC/$mig | |
137 | done | |
138 | done |