Skip to content

Instantly share code, notes, and snippets.

@rsanden
Last active March 19, 2021 12:00
Show Gist options
  • Save rsanden/e793c46e7d022686bf089ae92bed58ec to your computer and use it in GitHub Desktop.
Save rsanden/e793c46e7d022686bf089ae92bed58ec to your computer and use it in GitHub Desktop.
wine-starcraft WoW64 build
#!bash # For syntax highlighting. This is not a script...
###########################################################
# Part I -- Setting up the 64-bit and 32-bit environments #
# Start this section as: root@Host #
###########################################################
# This is where we want wine-starcraft to live
INSTALLPREFIX=/opt/wine-starcraft
echo "$INSTALLPREFIX" > /tmp/INSTALLPREFIX.txt # recklessly presume this file doesn't already exist
apt update
apt build-dep wine
apt install lxc
apt install winbind
useradd -s /bin/bash -m -u 1200 builder # any UID is okay, but we need to remember it
lxc-create -P /home/builder -n winesc -t /usr/share/lxc/templates/lxc-download
Providing answers:
Distribution: ubuntu
Release: xenial
Architecture: i386
# let it download an 83M rootfs.tar.xz file
# i.e: http://images.linuxcontainers.org/images/ubuntu/xenial/i386/default/20170504_03:49/rootfs.tar.xz
chmod 755 /home/builder/winesc
cp /INSTALLPREFIX.txt /home/builder/winesc/rootfs/tmp/INSTALLPREFIX.txt
# Use sane mirrors in the LXC's /etc/apt/sources.list
cp /etc/apt/sources.list /home/builder/winesc/rootfs/etc/apt/sources.list
lxc-start -P /home/builder -n winesc
lxc-attach -P /home/builder -n winesc
apt update
apt build-dep wine
apt install git
useradd -s /bin/bash -m -u 1200 builder # needs the same UID as the Host's 'builder' user
su - builder
mkdir -p $HOME/src
cd $HOME/src
GIT_SSL_NO_VERIFY=true git clone --depth=1 'https://github.com/awesie/wine-starcraft'
exit # back to root@winesc
exit # back to root@Host
lxc-stop -P /home/builder -n winesc
####################################
# Part II -- One 64-bit build #
# Start this section as: root@Host #
####################################
su - builder
INSTALLPREFIX=$(cat /tmp/INSTALLPREFIX.txt)
cd $HOME/winesc/rootfs/home/builder/src
mkdir wine64-build
cd wine64-build
../wine-starcraft/configure --prefix="$INSTALLPREFIX" --enable-win64
make -j4
exit # back to root@Host
####################################
# Part III -- Two 32-bit builds #
# Start this section as: root@Host #
####################################
lxc-start -P /home/builder -n winesc
lxc-attach -P /home/builder -n winesc
su - builder
INSTALLPREFIX=$(cat /tmp/INSTALLPREFIX.txt)
cd $HOME/src
mkdir wine32-tools
cd wine32-tools
../wine-starcraft/configure --prefix="$INSTALLPREFIX"
make -j4
cd $HOME/src
mkdir wine32-combo
cd wine32-combo
../wine-starcraft/configure --prefix="$INSTALLPREFIX" --with-wine64=../wine64-build --with-wine-tools=../wine32-tools
make -j4
exit # back to root@winesc
######################################
# Part IV -- Wine Installation #
# Start this section as: root@winesc #
######################################
INSTALLPREFIX=$(cat /tmp/INSTALLPREFIX.txt)
cd /home/builder/src/wine32-combo
mkdir -p "$INSTALLPREFIX"
make install
exit #back to root@HOST
lxc-stop -P /home/builder -n winesc
INSTALLPREFIX=$(cat /tmp/INSTALLPREFIX.txt)
mkdir -p "$INSTALLPREFIX"
shopt -s dotglob # unnecessary here, but good practice in general
cp -a "/home/builder/winesc/rootfs/$INSTALLPREFIX"/* "$INSTALLPREFIX"
shopt -u dotglob
cd /home/builder/winesc/rootfs/home/builder/src/wine64-build
make install
#--- get mono and gecko ---
cd "$INSTALLPREFIX/share/wine"
mkdir mono
cd mono
wget 'http://dl.winehq.org/wine/wine-mono/4.7.0/wine-mono-4.7.0.msi'
cd "$INSTALLPREFIX/share/wine"
mkdir gecko
cd gecko
wget 'http://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86.msi'
#--- get winetricks ---
cd "$INSTALLPREFIX/bin"
wget 'https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks'
chmod +x winetricks
#--- chown (optional) ---
# Finally, if the $INSTALLPREFIX lives under a user's home directory
# (instead of globally, such as in /opt or /usr), then you'll need
# to chown it to that user so it isn't filled with root-owned files
# chown -R wineowner:wineowner "$INSTALLPREFIX"
su - gamer # the user who will be running the game
#####################################
# Part V -- StarCraft Setup #
# Start this section as: gamer@Host #
#####################################
# SC is installed on a windows partition. This is the path to it.. do be sure to mount it first
SC_PATH='/media/gamer/4C91234567890DD8/Program Files (x86)/StarCraft'
ls "$SC_PATH" # this should show the StarCraft directory contents
INSTALLPREFIX=$(cat /tmp/INSTALLPREFIX.txt)
export PATH="$INSTALLPREFIX/bin:$PATH"
export LD_LIBRARY_PATH="$INSTALLPREFIX/lib"
hash -r
which wine # --> /path/to/wine-starcraft/bin/wine
which wineserver # --> /path/to/wine-starcraft/bin/wineserver
mkdir -p $HOME/WinePrefixes
export WINEPREFIX=$HOME/WinePrefixes/SC
export WINEARCH=win32
wine wineboot
winetricks unifont
cd "$HOME/WinePrefixes/SC/drive_c/Program Files"
cp -r "$SC_PATH" .
chmod -R 0755 ./StarCraft
find ./StarCraft -type f -exec chmod 0644 "{}" \;
#--- make run script (optional) ---
cat << EOF > "$HOME/WinePrefixes/SC.run"
#!/bin/bash
export PATH="$INSTALLPREFIX/bin:\$PATH"
export LD_LIBRARY_PATH="$INSTALLPREFIX/lib"
export WINEPREFIX=$HOME/WinePrefixes/SC
export WINEARCH=win32
wine "$HOME/WinePrefixes/SC/drive_c/Program Files/StarCraft/StarCraft.exe"
EOF
chmod 755 "$HOME/WinePrefixes/SC.run"
#--- Configure Wine ---
winecfg # Under "Applications" tab, click "Add application..."
# Navigate to and select "StarCraft.exe"
# For StarCraft.exe only, set Windows Version to "Windows XP"
# For "Default Settings", ensure Windows Version is "Windows 7"
#
# Under "Staging" tab, select:
# [x] Enable_CSMT for better graphic performance
# [x] Hide Wine version from applications
#
# Click "Apply" and then "OK"
#--- Update SC ---
wine "$HOME/WinePrefixes/SC/drive_c/Program Files/StarCraft/StarCraft Launcher.exe"
exit # to root@Host
# Now test it
su - gamer
$HOME/WinePrefixes/SC.run
exit # to root@Host
####################################
# Part VI -- Clean Up #
# Start this section as: root@Host #
####################################
lxc-destroy -P /home/builder -n winesc
userdel -r builder
rm /tmp/INSTALLPREFIX.txt
su - gamer # the user who will be running the game
#####################################
# Part VII -- Run SC #
# Start this section as: gamer@Host #
#####################################
$HOME/WinePrefixes/SC.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment