forked from pret/pokeplatinum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.sh
More file actions
executable file
·76 lines (65 loc) · 2.02 KB
/
Copy pathconfig.sh
File metadata and controls
executable file
·76 lines (65 loc) · 2.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
#!/bin/sh
set -e
build="build"
if [ "$#" -ge 1 ]; then
build="$1"
shift
fi
wrap=tools/cw
# Build the wrapper
if ! "$wrap/mwrap" -test 2> /dev/null; then
rm -rf "$wrap/mwrap" "$wrap/build"
"${MESON:-meson}" setup "$wrap/build" "$wrap"
"${MESON:-meson}" compile -C "$wrap/build"
install -m755 "$wrap/build/mwrap" "$wrap/mwrap"
rm -rf "$wrap/build"
fi
is_wsl_accessing_windows() {
kernel=$(uname -r)
script_path=$(realpath "$0")
if echo "$kernel" | grep -q Microsoft && echo "$script_path" | grep -qE '^/mnt/'; then
return 0
else
return 1
fi
}
mkdir -p -- "$build"
root="$PWD"
if [ -n "$MSYSTEM" -a "$MSYSTEM" != MSYS ]; then
root="$(cygpath -w "$root")"
fi
# Bootstrap machine file pointing to the repo
echo "[constants]" > "$build/root.ini"
echo "root = '$root'" >> "$build/root.ini"
# Select toolchain
if [ "$(uname -s)" = "Linux" ]; then
if is_wsl_accessing_windows; then
native_file="native.ini"
cross_file="cross_unix.ini"
else
native_file="native_unix.ini"
cross_file="cross_unix.ini"
fi
elif [ "$(uname -s)" = "Darwin" ]; then
native_file="native_unix.ini"
cross_file="cross_unix.ini"
else
native_file="native.ini"
cross_file="cross.ini"
fi
touch "$build/.mwconfig"
export MWCONFIG="$(realpath -- "$build/.mwconfig")"
if [ "$native_file" = "native_unix.ini" ]; then
wrap_wine="$(command -v "${WINELOADER:-wine}")"
wrap_path_unx="$PWD"
wrap_path_win="$("$wrap_wine" winepath -w "$wrap_path_unx")"
"$wrap/mwrap" -conf -wine "$wrap_wine" \
-path_unx "$wrap_path_unx" -path_win "$wrap_path_win"
elif is_wsl_accessing_windows; then
wrap_path_unx="$PWD"
wrap_path_win="$(wslpath -w "$wrap_path_unx")"
"$wrap/mwrap" -conf \
-path_unx "$wrap_path_unx" -path_win "$wrap_path_win"
fi
# Launch meson
"${MESON:-meson}" setup --wrap-mode=nopromote --native-file=meson/"$native_file" --native-file="$build/root.ini" --cross-file=meson/"$cross_file" --cross-file="$build/root.ini" "$@" -- "$build"