]>
Commit | Line | Data |
---|---|---|
6d2010ae A |
1 | #! /bin/bash - |
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. Please obtain a copy of the License at | |
11 | # http://www.opensource.apple.com/apsl/ and read it before using this | |
12 | # file. | |
13 | # | |
14 | # The Original Code and all software distributed under the License are | |
15 | # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
16 | # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
17 | # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
18 | # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
19 | # Please see the License for the specific language governing rights and | |
20 | # limitations under the License. | |
21 | # | |
22 | # @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
23 | # | |
24 | ||
316670eb A |
25 | function usage() { |
26 | echo "Usage: $0 <sdk> <output>" 1>&2 | |
27 | exit 1 | |
28 | } | |
29 | ||
30 | if [ $# -ne 2 ]; then | |
31 | usage | |
32 | fi | |
33 | ||
34 | SDKROOT="$1" | |
35 | OUTPUT="$2" | |
36 | ||
cb323159 A |
37 | AVAILABILITY_PL="${SDKROOT}/${DRIVERKITROOT}/usr/local/libexec/availability.pl" |
38 | ||
39 | if [ ! -x "${AVAILABILITY_PL}" ] ; then | |
40 | echo "Unable to locate ${AVAILABILITY_PL} (or not executable)" >&2 | |
316670eb A |
41 | exit 1 |
42 | fi | |
43 | ||
6d2010ae A |
44 | { |
45 | cat <<EOF | |
46 | /* Copyright (c) 2010 Apple Inc. All rights reserved. | |
47 | * | |
48 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
49 | * | |
50 | * This file contains Original Code and/or Modifications of Original Code | |
51 | * as defined in and that are subject to the Apple Public Source License | |
52 | * Version 2.0 (the 'License'). You may not use this file except in | |
53 | * compliance with the License. The rights granted to you under the License | |
54 | * may not be used to create, or enable the creation or redistribution of, | |
55 | * unlawful or unlicensed copies of an Apple operating system, or to | |
56 | * circumvent, violate, or enable the circumvention or violation of, any | |
57 | * terms of an Apple operating system software license agreement. | |
58 | * | |
59 | * Please obtain a copy of the License at | |
60 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
61 | * | |
62 | * The Original Code and all software distributed under the License are | |
63 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
64 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
65 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
66 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
67 | * Please see the License for the specific language governing rights and | |
68 | * limitations under the License. | |
69 | * | |
70 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
71 | */ | |
72 | ||
73 | #ifndef _CDEFS_H_ | |
74 | # error "Never use <sys/_symbol_aliasing.h> directly. Use <sys/cdefs.h> instead." | |
75 | #endif | |
76 | ||
77 | EOF | |
78 | ||
cb323159 | 79 | for ver in $(${AVAILABILITY_PL} --ios) ; do |
6d2010ae A |
80 | ver_major=${ver%.*} |
81 | ver_minor=${ver#*.} | |
82 | value=$(printf "%d%02d00" ${ver_major} ${ver_minor}) | |
83 | str=$(printf "__IPHONE_%d_%d" ${ver_major} ${ver_minor}) | |
84 | echo "#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= ${value}" | |
85 | echo "#define __DARWIN_ALIAS_STARTING_IPHONE_${str}(x) x" | |
86 | echo "#else" | |
87 | echo "#define __DARWIN_ALIAS_STARTING_IPHONE_${str}(x)" | |
88 | echo "#endif" | |
89 | echo "" | |
90 | done | |
91 | ||
cb323159 | 92 | for ver in $(${AVAILABILITY_PL} --macosx) ; do |
a1c7dba1 A |
93 | set -- $(echo "$ver" | tr '.' ' ') |
94 | ver_major=$1 | |
95 | ver_minor=$2 | |
96 | ver_rel=$3 | |
97 | if [ -z "$ver_rel" ]; then | |
98 | ver_rel=0 | |
99 | fi | |
100 | if [ "$ver_major" -lt 10 -o \( "$ver_major" -eq 10 -a "$ver_minor" -lt 10 \) ]; then | |
101 | value=$(printf "%d%d0" ${ver_major} ${ver_minor}) | |
102 | str=$(printf "__MAC_%d_%d" ${ver_major} ${ver_minor}) | |
103 | else | |
104 | value=$(printf "%d%02d%02d" ${ver_major} ${ver_minor} ${ver_rel}) | |
105 | if [ "$ver_rel" -gt 0 ]; then | |
106 | str=$(printf "__MAC_%d_%d_%d" ${ver_major} ${ver_minor} ${ver_rel}) | |
107 | else | |
108 | str=$(printf "__MAC_%d_%d" ${ver_major} ${ver_minor}) | |
109 | fi | |
110 | fi | |
6d2010ae A |
111 | echo "#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= ${value}" |
112 | echo "#define __DARWIN_ALIAS_STARTING_MAC_${str}(x) x" | |
113 | echo "#else" | |
114 | echo "#define __DARWIN_ALIAS_STARTING_MAC_${str}(x)" | |
115 | echo "#endif" | |
116 | echo "" | |
117 | done | |
316670eb | 118 | } > "$OUTPUT" |
6d2010ae | 119 |