-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvars.src
355 lines (313 loc) · 20.1 KB
/
vars.src
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#!/bin/false
# The above line stops anyone from running this script normally, but allows `source`ing it.
# This script configures environment variables for Quasi-MSYS2. Run it with `source` from Bash.
# Make a dummy function to be able to have local variables.
__dummy_func() {
# Stop this script from running more than once.
if test "$QUASI_MSYS2_ROOT"; then
echo -e "The environment variables are already set.\nRestart the shell and re-run this script to update them."
return
fi
# Local variable that stores a fancy warning prefix.
# We use `tput` instead of hardcoding the codes because it's supposedly more portable.
local warn="$(tput bold)$(tput setaf 5)[$(tput setaf 1)WARNING$(tput setaf 5)]$(tput sgr0) "
# Load all variables starting with `MSYSTEM` from the primary makefile.
export -- $(make -C "$(dirname "$BASH_SOURCE")"/.. -pq | grep '^MSYSTEM' | sed 's/\s*:=\s*/=/g')
if test -z "$MSYSTEM" -o -z "$MSYSTEM_CARCH" -o -z "$MSYSTEM_CHOST" -o -z "$MSYSTEM_PREFIX"; then
echo "$warn"'Failed to load the config variables from the primary makefile.'
false
fi
# Helper variable pointing to our installation directory.
export QUASI_MSYS2_ROOT="$(realpath "$(dirname "$BASH_SOURCE")"/..)"
# Make sure the resulting variable is not empty due to some error. If it is, abort.
test -z "$QUASI_MSYS2_ROOT" && return
[[ $QUASI_MSYS2_QUIET ]] || echo "Installation directory:"
[[ $QUASI_MSYS2_QUIET ]] || echo "QUASI_MSYS2_ROOT = $QUASI_MSYS2_ROOT"
[[ $QUASI_MSYS2_QUIET ]] || echo ''
# `MSYSTEM_PREFIX` is an MSYS2-style variable points to the MinGW installation path, i.e. `root/ucrt64`.
# We load its default value from the primary makefile, but we optionally prefix it with the proper absolute path, unless it already exists as a symlink.
if [[ "$(readlink -m $MSYSTEM_PREFIX)" == "$QUASI_MSYS2_ROOT/root$MSYSTEM_PREFIX" ]]; then
echo 'Found symlink `'"$MSYSTEM_PREFIX"'` -> `'"$QUASI_MSYS2_ROOT/root$MSYSTEM_PREFIX"'`, will use it.'
else
echo "$warn"'Didn'"'"'t find symlink `'"$MSYSTEM_PREFIX"'` -> `'"$QUASI_MSYS2_ROOT/root$MSYSTEM_PREFIX"'`.'
echo 'It can improve compatibility in some cases. Consider creating it using following command:'
echo ' sudo ln -nfs "'"$QUASI_MSYS2_ROOT/root$MSYSTEM_PREFIX"'" '"$MSYSTEM_PREFIX"
echo ''
export "MSYSTEM_PREFIX=$QUASI_MSYS2_ROOT/root$MSYSTEM_PREFIX"
fi
echo "MSYSTEM_PREFIX = $MSYSTEM_PREFIX"
# Select C/C++ compilers.
local clang_ver_suffix=""
if [[ -v WIN_CC || -v WIN_CXX ]]; then
# Back up the native compiler.
export "WIN_NATIVE_CC=${CC-/usr/bin/cc}"
export "WIN_NATIVE_CXX=${CXX-/usr/bin/c++}"
export "WIN_NATIVE_LD=${LD-/usr/bin/ld}"
# A custom compiler is specified, use it.
export "CC=$WIN_CC"
export "CXX=$WIN_CXX"
unset LD # I don't think anything needs it? If we decide to add it, do we need some kind of `--target` for the linker?
else
# No custom compiler is specified, try to guess.
echo -e '\nGuessing a compiler... To override, set `WIN_CC` and `WIN_CXX` and restart.'
# First, try the native Clang.
echo "Trying native Clang + LLD..."
if [[ -v WIN_NATIVE_CLANG_CC || -v WIN_NATIVE_CLANG_CXX || -v WIN_NATIVE_CLANG_USE_LD ]]; then
echo ' Custom binaries were specified:'
echo ' WIN_NATIVE_CLANG_CC = '"$WIN_NATIVE_CLANG_CC"
echo ' WIN_NATIVE_CLANG_CXX = '"$WIN_NATIVE_CLANG_CXX"
echo ' WIN_NATIVE_CLANG_USE_LD = '"$WIN_NATIVE_CLANG_USE_LD" # This must be a relative path!
if [[ ! -v WIN_NATIVE_CLANG_CC || ! -v WIN_NATIVE_CLANG_CXX || ! -v WIN_NATIVE_CLANG_USE_LD ]]; then
echo "$warn"'You must specify all three binaries.'
fi
else
if [[ -v WIN_NATIVE_CLANG_VER ]]; then
echo ' Using user-provided version suffix: WIN_NATIVE_CLANG_VER = '"$WIN_NATIVE_CLANG_VER"
else
export "WIN_NATIVE_CLANG_VER=$(compgen -c clang | grep -E '^clang-[0-9]+$' | sort | tail -1 | sed 's/clang-//')"
# If we found no suffix OR the executable doesn't exist for some reason, set the suffix to NONE.
( test -z "$WIN_NATIVE_CLANG_VER" || ! which "clang-$WIN_NATIVE_CLANG_VER" "clang++-$WIN_NATIVE_CLANG_VER" "lld-$WIN_NATIVE_CLANG_VER" >/dev/null 2>/dev/null ) && export "WIN_NATIVE_CLANG_VER=NONE"
echo ' Guessed Clang version suffix: WIN_NATIVE_CLANG_VER = '"$WIN_NATIVE_CLANG_VER"
echo ' You can override it by setting it to a number or to `NONE` for no suffix.'
fi
if test "$WIN_NATIVE_CLANG_VER" = "NONE"; then
local clang_ver_suffix=""
else
local clang_ver_suffix="-$WIN_NATIVE_CLANG_VER"
fi
# Those variables are used by our Clang wrapper in `env/wrappers`.
export "WIN_NATIVE_CLANG_CC=clang$clang_ver_suffix"
export "WIN_NATIVE_CLANG_CXX=clang++$clang_ver_suffix"
export "WIN_NATIVE_CLANG_USE_LD=lld$clang_ver_suffix"
fi
if which "$WIN_NATIVE_CLANG_CC" "$WIN_NATIVE_CLANG_CXX" "$WIN_NATIVE_CLANG_USE_LD" >/dev/null 2>/dev/null; then
# Successfully found a native Clang.
echo "Success! Will use wrappers for the native Clang."
# Warn if MSYS2 GCC (or Clang, for CLANG* environments) is not installed.
if [[ $MSYSTEM != CLANG* ]]; then
if test ! -f "$MSYSTEM_PREFIX/bin/gcc.exe" || test ! -f "$MSYSTEM_PREFIX/bin/g++.exe"; then
echo ''
echo "$warn""Couldn't find the MSYS2 GCC. It has to be installed for the native Clang to be able to cross-compile."
echo ''
fi
else
if test ! -f "$MSYSTEM_PREFIX/bin/clang.exe" || test ! -f "$MSYSTEM_PREFIX/bin/clang++.exe"; then
echo ''
echo "$warn""Couldn't find the MSYS2 Clang. It has to be installed for the native Clang to be able to cross-compile. Restart the shell after after installing it."
echo ''
fi
fi
# If MSYS2 Clang is installed, switch to absolute paths and warn.
if test -f "$MSYSTEM_PREFIX/bin/clang.exe" || test -f "$MSYSTEM_PREFIX/bin/clang++.exe"; then
echo "To avoid conflicts with the MSYS2 Clang, absolute paths will be used."
export "WIN_NATIVE_CLANG_CC=$(which $WIN_NATIVE_CLANG_CC)"
export "WIN_NATIVE_CLANG_CXX=$(which $WIN_NATIVE_CLANG_CXX)"
# Don't touch `WIN_NATIVE_CLANG_USE_LD` here, it can't be an absolute path!
fi
echo ''
echo "WIN_NATIVE_CLANG_CC = $WIN_NATIVE_CLANG_CC"
echo "WIN_NATIVE_CLANG_CXX = $WIN_NATIVE_CLANG_CXX"
echo "WIN_NATIVE_CLANG_USE_LD = $WIN_NATIVE_CLANG_USE_LD"
# Now that `WIN_NATIVE_CLANG_{CC,CXX}` are stabilized, copy them to `WIN_NATIVE_{CC,CXX}`.
export "WIN_NATIVE_CC=${CC-${WIN_NATIVE_CLANG_CC}}"
export "WIN_NATIVE_CXX=${CXX-${WIN_NATIVE_CLANG_CXX}}"
export "WIN_NATIVE_LD=${LD-${WIN_NATIVE_CLANG_USE_LD}}"
# Update `CC` and `CXX` after backing them up.
export "CC=win-clang"
export "CXX=win-clang++"
unset LD # See above.
# This custom variable specifies the flags for our Clang wrapper in `env/wrappers`.
# `--target` sets the target platform.
# Note that `clang --version` will report a slightly different target than what we set here. This is normal, and specifying that target directly would also work.
# `--sysroot` tells Clang where to look for a GCC/Clang installation.
# `-pthread` tells is to link winpthread, since it doesn't happen automatically and some CMake scripts expect it.
# `-fuse-ld=lld...` tells Clang to use the LLD linker.
# `-femulated-tls` is necessary when using libstdc++ atomics with Clang. Conversely, libc++ atomics need `-fno-emulated-tls`.
# `-rtlib`, `-unwindlib` - not sure about those, guessed experimentally to match what MSYS2 does.
# `-resource-dir` - not sure if only needed on CLANG{32,64} environments, probably yes.
if [[ ! -v WIN_NATIVE_CLANG_FLAGS ]]; then
export "WIN_NATIVE_CLANG_FLAGS=--target=$MSYSTEM_CHOST --sysroot=$MSYSTEM_PREFIX -fuse-ld=$WIN_NATIVE_CLANG_USE_LD -pthread"
if [[ $MSYSTEM != CLANG* ]]; then
# `-stdlib=libstdc++ -rtlib=libgcc` are used by default on my Ubuntu Clang, adding them just in case.
export "WIN_NATIVE_CLANG_FLAGS+= -stdlib=libstdc++ -femulated-tls -rtlib=libgcc -unwindlib=libgcc"
else
# `-fno-emulated-tls` is used by default on my Ubuntu Clang, adding it just in case.
export "WIN_NATIVE_CLANG_FLAGS+= -stdlib=libc++ -fno-emulated-tls -rtlib=compiler-rt -unwindlib=libunwind"
# The `find` command is used to descend into the only subdirectory, named after the Clang version.
local clang_res_dir="$(find "$MSYSTEM_PREFIX/lib/clang" -maxdepth 1 -mindepth 1 -print -quit)"
if [[ $clang_res_dir && $(basename "$clang_res_dir") == $(basename "$("$WIN_NATIVE_CLANG_CC" -print-resource-dir)") ]]; then
export "WIN_NATIVE_CLANG_FLAGS+= -resource-dir=$clang_res_dir"
else
echo "$warn""Couldn't find a suitable Clang resource directory in the MSYS2 installation. Either MSYS2 Clang is not installed or it has a different version compared to the native Clang. Must restart this shell after fixing this."
fi
fi
fi
echo "WIN_NATIVE_CLANG_FLAGS = $WIN_NATIVE_CLANG_FLAGS"
else
# Couldn't find a native Clang.
unset WIN_NATIVE_CLANG_CC
unset WIN_NATIVE_CLANG_CXX
unset WIN_NATIVE_CLANG_USE_LD
echo "Fail."
echo ''
echo "$warn"'Unable to find a native Clang (and/or LLD).'
echo 'You should install them using your distribution'"'"'s package manager, or, for Ubuntu, using the command from the readme for the latest version.'
echo 'Then restart this shell.'
echo ''
echo 'I will try running MSYS2 compilers using Wine instead, but this is slow and can confuse some build systems.'
echo ''
# Back up `CC` and `CXX` before we modify them.
export "WIN_NATIVE_CC=${CC-/usr/bin/cc}"
export "WIN_NATIVE_CXX=${CXX-/usr/bin/c++}"
export "WIN_NATIVE_LD=${LD-/usr/bin/ld}"
# Now try the MSYS2 Clang.
echo "Trying MSYS2 Clang..."
if test -f "$MSYSTEM_PREFIX/bin/clang.exe" && test -f "$MSYSTEM_PREFIX/bin/clang++.exe"; then
# Successfully found the MSYS2 Clang.
echo "Success."
export "CC=clang"
export "CXX=clang++"
unset LD # See above.
else
# Couldn't find the MSYS2 Clang.
echo "Fail, probably not installed."
# Now try the MSYS2 GCC.
echo "Trying MSYS2 GCC..."
if test -f "$MSYSTEM_PREFIX/bin/gcc.exe" && test -f "$MSYSTEM_PREFIX/bin/g++.exe"; then
echo "Success."
export "CC=gcc"
export "CXX=g++"
unset LD # See above.
else
echo "Fail, probably not installed."
echo "$warn""Couldn't find any suitable compiler."
fi
fi
fi
fi
echo ''
# Select Winres. The variable named `RC` is sometimes used by CMake.
if [[ -v WIN_RC ]]; then
export "RC=$WIN_RC"
else
# `clang_ver_suffix` is still accessible here, let's use it.
[[ -v WIN_NATIVE_CLANG_WINDRES ]] || export "WIN_NATIVE_CLANG_WINDRES=llvm-windres$clang_ver_suffix"
if ! which "$WIN_NATIVE_CLANG_WINDRES" >/dev/null 2>/dev/null; then
echo "$warn""Couldn't find Windres \`$WIN_NATIVE_CLANG_WINDRES\`. Will try to run MSYS2 Windres using Wine, which might be slow. You should install the \`llvm\` native package to get the native Windres."
fi
# Note that `windres` is our own wrapper script.
export "RC=windres"
fi
# Create a variable for `win-ldd`. Not sure if anyone uses this, it's mostly for my convenience.
if test "$WIN_LDD"; then
export "LDD=$WIN_LDD"
else
export "LDD=win-ldd"
fi
# Print the compilers we ended up with.
echo "CC = $CC"
echo "CXX = $CXX"
[[ $QUASI_MSYS2_QUIET ]] || echo "WIN_NATIVE_CC = $WIN_NATIVE_CC"
[[ $QUASI_MSYS2_QUIET ]] || echo "WIN_NATIVE_CXX = $WIN_NATIVE_CXX"
[[ $QUASI_MSYS2_QUIET ]] || echo "WIN_NATIVE_LD = $WIN_NATIVE_LD"
echo "RC = $RC"
echo ''
# A variable read by `Makefile` (the package manager), containing the hook that should be called after installing/uninstalling packages.
if test -z "$QUASI_MSYS2_PKG_HOOK"; then
if test -d "$QUASI_MSYS2_ROOT/env/fake_bin"; then
[[ $QUASI_MSYS2_QUIET ]] || echo '`fakebin.mk` is in use, installing a package manager hook for it:'
export "QUASI_MSYS2_PKG_HOOK=make -f '$QUASI_MSYS2_ROOT/env/fakebin.mk' QUIET=1"
else
[[ $QUASI_MSYS2_QUIET ]] || echo '`fakebin.mk` is not in use, it doesn'"'"'t need a package manager hook.'
[[ $QUASI_MSYS2_QUIET ]] || echo ''
fi
fi
if test "$QUASI_MSYS2_PKG_HOOK"; then
[[ $QUASI_MSYS2_QUIET ]] || echo "QUASI_MSYS2_PKG_HOOK = $QUASI_MSYS2_PKG_HOOK"
[[ $QUASI_MSYS2_QUIET ]] || echo ''
fi
# Wine will look for executables in this directory.
export "WINEPATH=$MSYSTEM_PREFIX/bin"
[[ $QUASI_MSYS2_QUIET ]] || echo "WINEPATH = $WINEPATH"
which wine >/dev/null 2>/dev/null || echo "$warn""Can't find Wine. If you want to run native executables, it has to be installed."
# Autotools will read config from that file.
export "CONFIG_SITE=$QUASI_MSYS2_ROOT/env/config/config.site"
[[ $QUASI_MSYS2_QUIET ]] || echo "CONFIG_SITE = $CONFIG_SITE"
# Pkg-config will look for packages in this directory.
# The value was taken from MSYS2, except `/ucrt64` was replaced with `$MSYSTEM_PREFIX`.
export "PKG_CONFIG_PATH=$MSYSTEM_PREFIX/lib/pkgconfig:$MSYSTEM_PREFIX/share/pkgconfig"
[[ $QUASI_MSYS2_QUIET ]] || echo "PKG_CONFIG_PATH = $PKG_CONFIG_PATH"
# Pkg-config will add this prefix to every path it outputs.
# This will be empty if and only if we have a symlink in `/` (see definition of `MSYSTEM_PREFIX`).
export "PKG_CONFIG_SYSROOT_DIR=$(dirname "$MSYSTEM_PREFIX")"
[[ $PKG_CONFIG_SYSROOT_DIR == "/" ]] && export PKG_CONFIG_SYSROOT_DIR=
[[ $QUASI_MSYS2_QUIET ]] || echo "PKG_CONFIG_SYSROOT_DIR = $PKG_CONFIG_SYSROOT_DIR"
# Disable default pkg-config search paths.
# Note setting it to a random character rather than an empty string. Empty string works on Ubuntu, but e.g. Fedora has a stupid
# script in place of `pkg-config` that assigns a default value to this variable if it's undefined OR EMPTY.
export "PKG_CONFIG_LIBDIR=-"
[[ $QUASI_MSYS2_QUIET ]] || echo "PKG_CONFIG_LIBDIR = $PKG_CONFIG_LIBDIR"
# Those are `pkgconf` extensions on top of `pkg-config`. Flags pointing to those dirs are stripped from the output.
export "PKG_CONFIG_SYSTEM_INCLUDE_PATH=$MSYSTEM_PREFIX/include"
export "PKG_CONFIG_SYSTEM_LIBRARY_PATH=$MSYSTEM_PREFIX/lib"
[[ $QUASI_MSYS2_QUIET ]] || echo "PKG_CONFIG_SYSTEM_INCLUDE_PATH = $PKG_CONFIG_SYSTEM_INCLUDE_PATH"
[[ $QUASI_MSYS2_QUIET ]] || echo "PKG_CONFIG_SYSTEM_LIBRARY_PATH = $PKG_CONFIG_SYSTEM_LIBRARY_PATH"
# Not sure what exactly `aclocal` is, but MSYS2 sets this variable, and so do we.
# MSYS2 also stores a second path in it, `/usr/share/aclocal` (separated by a `:`), but we probably shouldn't add it forcefully if it's not already there.
# Since one of the paths MSYS2 stores in it doesn't start with `/ucrt64`, it seemed logical to me to append to this variable rather than overwriting it.
local new_aclocal_path="$(make -f "$QUASI_MSYS2_ROOT/env/internal/AddToPath.mk" "var=ACLOCAL_PATH" "dirs=$MSYSTEM_PREFIX/share/aclocal")"
test -z "$new_aclocal_path" && return
export "ACLOCAL_PATH=$new_aclocal_path"
[[ $QUASI_MSYS2_QUIET ]] || echo "ACLOCAL_PATH = $ACLOCAL_PATH"
# Check if MSYS2 CMake is installed. Warn if it is, because it doesn't work properly under Wine.
test -f "$MSYSTEM_PREFIX/bin/cmake.exe" && echo -e "$warn"'MSYS2 CMake is installed. It won'"'"'t function properly,\nget rid of it and use the `win-cmake` wrapper that calls the native CMake.'
# This variable is used by our wrapper in `env/wrappers`. We use an absolute path
# to avoid collisions with MSYS2 CMake if it's installed for some reason.
export "WIN_NATIVE_CMAKE=$(which cmake)"
[[ $QUASI_MSYS2_QUIET ]] || echo "WIN_NATIVE_CMAKE = $WIN_NATIVE_CMAKE"
# This variable is also used by our wrapper in `env/wrappers`, and contains the extra CMake flags.
export "WIN_CMAKE_FLAGS=-DCMAKE_TOOLCHAIN_FILE=$QUASI_MSYS2_ROOT/env/config/toolchain.cmake -DCMAKE_INSTALL_PREFIX=$MSYSTEM_PREFIX"
[[ $QUASI_MSYS2_QUIET ]] || echo "WIN_CMAKE_FLAGS = $WIN_CMAKE_FLAGS"
# And similarly for meson.
# Note the "native file". It's not usually needed, but sometimes can be needed. See the comments in `env/generate_meson_config.mk`.
export "WIN_NATIVE_MESON=$(which meson)"
[[ $QUASI_MSYS2_QUIET ]] || echo "WIN_NATIVE_MESON = $WIN_NATIVE_MESON"
export "WIN_MESON_FLAGS=--cross-file=$QUASI_MSYS2_ROOT/env/config/meson_cross_file.ini --native-file=$QUASI_MSYS2_ROOT/env/config/meson_native_file.ini"
[[ $QUASI_MSYS2_QUIET ]] || echo "WIN_MESON_FLAGS = $WIN_MESON_FLAGS"
[[ $QUASI_MSYS2_QUIET ]] || echo ''
# Rust variables:
# Convert the target name to what rustc understands. You can get the same conversion from `clang --target=... --version`.
export CARGO_BUILD_TARGET="${MSYSTEM_CHOST/%w64-mingw32/pc-windows-gnu}"
local uppercase_target="${CARGO_BUILD_TARGET^^}"
local rustc_linker_var="CARGO_TARGET_${uppercase_target//-/_}_LINKER"
export "$rustc_linker_var"="$CC"
[[ $QUASI_MSYS2_QUIET ]] || echo "CARGO_BUILD_TARGET = $CARGO_BUILD_TARGET"
[[ $QUASI_MSYS2_QUIET ]] || echo "$rustc_linker_var = ${!rustc_linker_var}"
[[ $QUASI_MSYS2_QUIET ]] || echo ''
# Update the PATH.
export "WIN_ORIGINAL_PATH=$PATH"
local new_path="$(make -f "$QUASI_MSYS2_ROOT/env/internal/AddToPath.mk" "dirs=$QUASI_MSYS2_ROOT/env/wrappers:$QUASI_MSYS2_ROOT/env/fake_bin:$WINEPATH")"
test -z "$new_path" && return
export "PATH=$new_path"
[[ $QUASI_MSYS2_QUIET ]] || echo "PATH = $PATH"
[[ $QUASI_MSYS2_QUIET ]] || echo 'Backed up original path to `WIN_ORIGINAL_PATH`.'
# We don't use the following variables, but still define them for some extra compatibility with MSYS2.
# The list of variables was obtained by running `printenv` on MSYS2 and manually sorting through the list.
# Note that some useful MSYS2-style variables (that are actually useful) are defined above and not there.
# Note that some of the variables we print here were obtained from the config in the primary makefile, at the very beginning of this script.
[[ $QUASI_MSYS2_QUIET ]] || echo ''
[[ $QUASI_MSYS2_QUIET ]] || echo 'Extra MSYS2 mimicry:'
[[ $QUASI_MSYS2_QUIET ]] || echo -n "MSYSTEM=$MSYSTEM; "
export "OS=Windows_NT";
[[ $QUASI_MSYS2_QUIET ]] || echo -n "OS=$OS; "
[[ $QUASI_MSYS2_QUIET ]] || echo -n "MSYSTEM_CARCH=$MSYSTEM_CARCH; "
export "MINGW_CHOST=$MSYSTEM_CHOST";
[[ $QUASI_MSYS2_QUIET ]] || echo -n "MSYSTEM_CHOST=MINGW_CHOST=$MSYSTEM_CHOST; "
# Finally, copy the MSYS2 prompt.
export 'PS1=\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n\[\e[1m\]\$\[\e[0m\] ';
[[ $QUASI_MSYS2_QUIET ]] || echo "PS1 = ..."
}
# Call our dummy funcion.
__dummy_func
# Delete the function.
unset -f __dummy_func