]>
Commit | Line | Data |
---|---|---|
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 | ||
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 | ||
37 | if [ ! -x "${SDKROOT}/usr/local/libexec/availability.pl" ] ; then | |
38 | echo "Unable to locate ${SDKROOT}/usr/local/libexec/availability.pl (or not executable)" >&2 | |
39 | exit 1 | |
40 | fi | |
41 | ||
42 | { | |
43 | cat <<EOF | |
44 | /* Copyright (c) 2010 Apple Inc. All rights reserved. | |
45 | * | |
46 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
47 | * | |
48 | * This file contains Original Code and/or Modifications of Original Code | |
49 | * as defined in and that are subject to the Apple Public Source License | |
50 | * Version 2.0 (the 'License'). You may not use this file except in | |
51 | * compliance with the License. The rights granted to you under the License | |
52 | * may not be used to create, or enable the creation or redistribution of, | |
53 | * unlawful or unlicensed copies of an Apple operating system, or to | |
54 | * circumvent, violate, or enable the circumvention or violation of, any | |
55 | * terms of an Apple operating system software license agreement. | |
56 | * | |
57 | * Please obtain a copy of the License at | |
58 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
59 | * | |
60 | * The Original Code and all software distributed under the License are | |
61 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
62 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
63 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
64 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
65 | * Please see the License for the specific language governing rights and | |
66 | * limitations under the License. | |
67 | * | |
68 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
69 | */ | |
70 | ||
71 | #ifndef _CDEFS_H_ | |
72 | # error "Never use <sys/_symbol_aliasing.h> directly. Use <sys/cdefs.h> instead." | |
73 | #endif | |
74 | ||
75 | EOF | |
76 | ||
77 | for ver in $(${SDKROOT}/usr/local/libexec/availability.pl --ios) ; do | |
78 | ver_major=${ver%.*} | |
79 | ver_minor=${ver#*.} | |
80 | value=$(printf "%d%02d00" ${ver_major} ${ver_minor}) | |
81 | str=$(printf "__IPHONE_%d_%d" ${ver_major} ${ver_minor}) | |
82 | echo "#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= ${value}" | |
83 | echo "#define __DARWIN_ALIAS_STARTING_IPHONE_${str}(x) x" | |
84 | echo "#else" | |
85 | echo "#define __DARWIN_ALIAS_STARTING_IPHONE_${str}(x)" | |
86 | echo "#endif" | |
87 | echo "" | |
88 | done | |
89 | ||
90 | for ver in $(${SDKROOT}/usr/local/libexec/availability.pl --macosx) ; do | |
91 | ver_major=${ver%.*} | |
92 | ver_minor=${ver#*.} | |
93 | value=$(printf "%d%d0" ${ver_major} ${ver_minor}) | |
94 | str=$(printf "__MAC_%d_%d" ${ver_major} ${ver_minor}) | |
95 | echo "#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= ${value}" | |
96 | echo "#define __DARWIN_ALIAS_STARTING_MAC_${str}(x) x" | |
97 | echo "#else" | |
98 | echo "#define __DARWIN_ALIAS_STARTING_MAC_${str}(x)" | |
99 | echo "#endif" | |
100 | echo "" | |
101 | done | |
102 | } > "$OUTPUT" | |
103 |