-
Notifications
You must be signed in to change notification settings - Fork 575
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·238 lines (208 loc) · 7.02 KB
/
Copy pathconfigure
File metadata and controls
executable file
·238 lines (208 loc) · 7.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#!/bin/bash -e
function show_help () {
cat <<EOL
Usage: configure [options]
-h, --help Displays this help
--enable-macos
--disable-macos Enable/disable building the macOS SDK.
--enable-ios
--disable-ios Enable/disable building the iOS SDK.
--enable-tvos
--disable-tvos Enable/disable building the tvOS SDK.
--enable-maccatalyst
--disable-maccatalyst Enable/disable building the Mac Catalyst SDK.
--disable-all-platforms Disable building all SDKs (typically followed by --enable-[iOS|tvOS|macOS|MacCatalyst] to only enable a single platform).
--enable-ccache
--disable-ccache Enable/disable ccache. Default: enabled if detected.
--enable-xamarin
--disable-xamarin Enable/disable additional Xamarin-specific parts of the build.
--only-sharpie Only build Objective-Sharpie. This is on by default for the branch 'release/sharpie', and disabled otherwise.
--custom-dotnet=[dotnet/runtime] Use a locally built version of dotnet/runtime. Pass the path to an already build checkout of dotnet/runtime. See docs/CORECLR.md for detailed instructions about how to build dotnet/runtime from source.
--xcode=[path] Select the Xcode app or developer root to use for the build.
--xcode-root=[path] Select the Xcode app to use for the build.
--xcode-developer-root=[path]
Select the Xcode developer root to use for the build.
--ignore-unknown-params alters the default behavior to not return an non-zero exit code when an unknown parameter is provided.
--no-xcode Only do things that don't require Xcode. This won't produce anything useful, but might come in handy once in a blue moon when testing something that doesn't require Xcode somewhere Xcode can't be installed (Linux, older macOS devices, etc.)
EOL
}
cd "$(dirname "${BASH_SOURCE[0]}")"
CONFIGURED_FILE=configure.inc
IGNORE_UNKNOWN_PARAMS=false
UNKNOWN_PARAMETERS=
NO_XCODE_FLAG=
XCODE_ARG=
function fail_configure () {
echo "configure: $1" >&2
rm -f "$CONFIGURED_FILE"
exit 1
}
function set_xcode_arg () {
local value="$1"
local option="$2"
while [[ "$value" == */ ]]; do
value="${value%/}"
done
if [[ -z "$value" ]]; then
fail_configure "$option requires a non-empty path"
fi
if [[ ! "$value" =~ ^/[A-Za-z0-9._+/-]+$ ]]; then
fail_configure "$option path contains unsupported characters: '$value'"
fi
if [[ "$value" == *.app ]]; then
value="$value/Contents/Developer"
elif [[ "$value" != */Contents/Developer ]]; then
fail_configure "$option must point to an Xcode .app bundle or Contents/Developer directory"
fi
XCODE_ARG="$value"
}
rm -f $CONFIGURED_FILE
if test -z "$1"; then
echo "configure: all default values assumed."
exit 0
fi
echo "# Configure arguments: $*" >> $CONFIGURED_FILE
while test "x$1" != x; do
case $1 in
--disable-all-platforms)
echo "INCLUDE_MAC=" >> $CONFIGURED_FILE
echo "INCLUDE_IOS=" >> $CONFIGURED_FILE
echo "INCLUDE_TVOS=" >> $CONFIGURED_FILE
echo "INCLUDE_MACCATALYST=" >> $CONFIGURED_FILE
echo "Disabled all platforms"
shift
;;
--disable-mac | --disable-macos)
echo "INCLUDE_MAC=" >> $CONFIGURED_FILE
echo "Mac Build disabled"
shift
;;
--enable-mac | --enable-macos)
echo "INCLUDE_MAC=1" >> $CONFIGURED_FILE
echo "Mac Build enabled"
shift
;;
--disable-ios)
echo "INCLUDE_IOS=" >> $CONFIGURED_FILE
echo "iOS Build disabled"
shift
;;
--enable-ios)
echo "INCLUDE_IOS=1" >> $CONFIGURED_FILE
echo "iOS Build enabled"
shift
;;
--disable-tvos)
echo "INCLUDE_TVOS=" >> $CONFIGURED_FILE
echo "tvOS Build disabled"
shift
;;
--enable-tvos)
echo "INCLUDE_TVOS=1" >> $CONFIGURED_FILE
echo "tvOS Build enabled"
shift
;;
--disable-maccatalyst)
echo "INCLUDE_MACCATALYST=" >> $CONFIGURED_FILE
echo "Mac Catalyst Build disabled"
shift
;;
--enable-maccatalyst)
echo "INCLUDE_MACCATALYST=1" >> $CONFIGURED_FILE
echo "Mac Catalyst Build enabled"
shift
;;
--disable-ccache)
echo "ENABLE_CCACHE=" >> $CONFIGURED_FILE
shift
;;
--enable-ccache)
if ! command -v ccache >/dev/null; then
echo "Could not find ccache"
else
echo "ENABLE_CCACHE=1" >> $CONFIGURED_FILE
echo "cache enabled"
fi
shift
;;
--enable-xamarin)
echo "The argument '$1' is no longer in use."
shift
;;
--disable-xamarin)
echo "The argument '$1' is no longer in use."
shift
;;
--custom-dotnet=*)
echo "CUSTOM_DOTNET=1" >> "$CONFIGURED_FILE"
echo "DOTNET_RUNTIME_PATH=${1:16}" >> "$CONFIGURED_FILE"
shift
;;
--custom-dotnet)
echo "CUSTOM_DOTNET=1" >> "$CONFIGURED_FILE"
echo "DOTNET_RUNTIME_PATH=$2" >> "$CONFIGURED_FILE"
shift 2
;;
--xcode=*|--xcode-root=*|--xcode-developer-root=*)
set_xcode_arg "${1#*=}" "${1%%=*}"
shift
;;
--xcode|--xcode-root|--xcode-developer-root)
if [[ $# -lt 2 ]] || [[ "$2" == --* ]]; then
fail_configure "$1 requires a value"
fi
set_xcode_arg "$2" "$1"
shift 2
;;
--disable-device)
echo "INCLUDE_DEVICE=" >> "$CONFIGURED_FILE"
shift
;;
--disable-simulator)
echo "INCLUDE_SIMULATOR=" >> "$CONFIGURED_FILE"
shift
;;
--only-sharpie)
echo "ONLY_SHARPIE=1" >> "$CONFIGURED_FILE"
echo "INCLUDE_MAC=" >> $CONFIGURED_FILE
echo "INCLUDE_IOS=" >> $CONFIGURED_FILE
echo "INCLUDE_TVOS=" >> $CONFIGURED_FILE
echo "INCLUDE_MACCATALYST=" >> $CONFIGURED_FILE
shift
;;
--ignore-unknown-params)
echo "ignoring unknown parameters"
IGNORE_UNKNOWN_PARAMS=true
shift
;;
--no-xcode)
echo "Ignoring Xcode requirement"
NO_XCODE_FLAG=1
echo "NO_XCODE=1" >> "$CONFIGURED_FILE"
shift
;;
--help|-h)
show_help
exit 0
;;
*)
echo "Unknown configure argument $1" >&2
UNKNOWN_PARAMETERS="$UNKNOWN_PARAMETERS $1"
shift
;;
esac
done
if [[ -n "$NO_XCODE_FLAG" && -n "$XCODE_ARG" ]]; then
fail_configure "--no-xcode cannot be combined with --xcode, --xcode-root, or --xcode-developer-root"
fi
if [[ "$IGNORE_UNKNOWN_PARAMS" = false ]] && [[ -n "$UNKNOWN_PARAMETERS" ]]; then
exit 1
fi
if [[ "$IGNORE_UNKNOWN_PARAMS" = true ]] && [[ -n "$UNKNOWN_PARAMETERS" ]]; then
echo "The following parameters were ignored: $UNKNOWN_PARAMETERS"
fi
if [[ -n "$XCODE_ARG" ]]; then
echo "XCODE_DEVELOPER_ROOT=$XCODE_ARG" >> "$CONFIGURED_FILE"
echo "Xcode developer root set to $XCODE_ARG"
fi
exit 0