Skip to content

Commit f320eaf

Browse files
Add wine setup scripts to site (MonoGame#134)
1 parent 0fc18f0 commit f320eaf

File tree

3 files changed

+117
-0
lines changed

3 files changed

+117
-0
lines changed

website/.config/eleventy.config.passthrough.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ module.exports = function (config) {
1414
config.addPassthroughCopy({
1515
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js": "/js/bootstrap.bundle.min.js"
1616
});
17+
config.addPassthroughCopy({ "./website/content/public/downloads/**/*": "/downloads"});
1718
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
# This script is used to setup the needed Wine environment
3+
# so that mgfxc can be run on Linux / macOS systems.
4+
5+
# check dependencies
6+
if ! type "wine64" > /dev/null 2>&1
7+
then
8+
echo "wine64 not found"
9+
exit 1
10+
fi
11+
12+
if ! type "7z" > /dev/null 2>&1
13+
then
14+
echo "7z not found"
15+
exit 1
16+
fi
17+
18+
# init wine stuff
19+
export WINEARCH=win64
20+
export WINEPREFIX=$HOME/.winemonogame
21+
wine64 wineboot
22+
23+
TEMP_DIR="${TMPDIR:-/tmp}"
24+
SCRIPT_DIR="$TEMP_DIR/winemg2"
25+
mkdir -p "$SCRIPT_DIR"
26+
27+
# disable wine crash dialog
28+
cat > "$SCRIPT_DIR"/crashdialog.reg <<_EOF_
29+
REGEDIT4
30+
[HKEY_CURRENT_USER\\Software\\Wine\\WineDbg]
31+
"ShowCrashDialog"=dword:00000000
32+
_EOF_
33+
34+
pushd $SCRIPT_DIR
35+
wine64 regedit crashdialog.reg
36+
popd
37+
38+
# get dotnet
39+
DOTNET_URL="https://download.visualstudio.microsoft.com/download/pr/44d08222-aaa9-4d35-b24b-d0db03432ab7/52a4eb5922afd19e8e0d03e0dbbb41a0/dotnet-sdk-6.0.302-win-x64.zip"
40+
curl $DOTNET_URL --output "$SCRIPT_DIR/dotnet-sdk.zip"
41+
7z x "$SCRIPT_DIR/dotnet-sdk.zip" -o"$WINEPREFIX/drive_c/windows/system32/"
42+
43+
# get d3dcompiler_47
44+
FIREFOX_URL="https://download-installer.cdn.mozilla.net/pub/firefox/releases/62.0.3/win64/ach/Firefox%20Setup%2062.0.3.exe"
45+
curl $FIREFOX_URL --output "$SCRIPT_DIR/firefox.exe"
46+
7z x "$SCRIPT_DIR/firefox.exe" -o"$SCRIPT_DIR/firefox_data/"
47+
cp -f "$SCRIPT_DIR/firefox_data/core/d3dcompiler_47.dll" "$WINEPREFIX/drive_c/windows/system32/d3dcompiler_47.dll"
48+
49+
# append MGFXC_WINE_PATH env variable
50+
echo -e "\nexport MGFXC_WINE_PATH=$HOME/.winemonogame" >> ~/.profile
51+
echo -e "\nexport MGFXC_WINE_PATH=$HOME/.winemonogame" >> ~/.zprofile
52+
53+
# cleanup
54+
rm -rf "$SCRIPT_DIR"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
# This script is used to setup the needed Wine environment
3+
# so that mgfxc can be run on Linux / macOS systems.
4+
5+
# check dependencies
6+
if ! type "wine64" > /dev/null 2>&1
7+
then
8+
echo "wine64 not found"
9+
exit 1
10+
fi
11+
12+
if ! type "7z" > /dev/null 2>&1
13+
then
14+
echo "7z not found"
15+
exit 1
16+
fi
17+
18+
# wine 8 is the minimum requirement for dotnet 8
19+
# wine --version will output "wine-#.# (Distro #.#.#)" or "wine-#.#"
20+
WINE_VERSION=$(wine --version 2>&1 | grep -oP 'wine-\d+' | sed 's/wine-//')
21+
if (( $WINE_VERSION < 8 )); then
22+
echo "Wine version $WINE_VERSION is below the minimum required version (8.0)."
23+
exit 1
24+
fi
25+
26+
# init wine stuff
27+
export WINEARCH=win64
28+
export WINEPREFIX=$HOME/.winemonogame
29+
wine64 wineboot
30+
31+
TEMP_DIR="${TMPDIR:-/tmp}"
32+
SCRIPT_DIR="$TEMP_DIR/winemg2"
33+
mkdir -p "$SCRIPT_DIR"
34+
35+
# disable wine crash dialog
36+
cat > "$SCRIPT_DIR"/crashdialog.reg <<_EOF_
37+
REGEDIT4
38+
[HKEY_CURRENT_USER\\Software\\Wine\\WineDbg]
39+
"ShowCrashDialog"=dword:00000000
40+
_EOF_
41+
42+
pushd $SCRIPT_DIR
43+
wine64 regedit crashdialog.reg
44+
popd
45+
46+
# get dotnet
47+
DOTNET_URL="https://dotnetcli.azureedge.net/dotnet/Sdk/8.0.201/dotnet-sdk-8.0.201-win-x64.zip"
48+
curl $DOTNET_URL --output "$SCRIPT_DIR/dotnet-sdk.zip"
49+
7z x "$SCRIPT_DIR/dotnet-sdk.zip" -o"$WINEPREFIX/drive_c/windows/system32/"
50+
51+
# get d3dcompiler_47
52+
FIREFOX_URL="https://download-installer.cdn.mozilla.net/pub/firefox/releases/62.0.3/win64/ach/Firefox%20Setup%2062.0.3.exe"
53+
curl $FIREFOX_URL --output "$SCRIPT_DIR/firefox.exe"
54+
7z x "$SCRIPT_DIR/firefox.exe" -o"$SCRIPT_DIR/firefox_data/"
55+
cp -f "$SCRIPT_DIR/firefox_data/core/d3dcompiler_47.dll" "$WINEPREFIX/drive_c/windows/system32/d3dcompiler_47.dll"
56+
57+
# append MGFXC_WINE_PATH env variable
58+
echo -e "\nexport MGFXC_WINE_PATH=$HOME/.winemonogame" >> ~/.profile
59+
echo -e "\nexport MGFXC_WINE_PATH=$HOME/.winemonogame" >> ~/.zprofile
60+
61+
# cleanup
62+
rm -rf "$SCRIPT_DIR"

0 commit comments

Comments
 (0)