Add script for building wine on Debian 12

This commit is contained in:
tar 2024-01-13 15:55:14 +01:00
parent babfd91f38
commit 254e88f0be
1 changed files with 192 additions and 0 deletions

192
wine-build-debian12.sh Executable file
View File

@ -0,0 +1,192 @@
#!/usr/bin/env bash
# RUN AS NORMAL USER!
X_BIT=32
X_COMMIT=ff1642f32cfcd2efd8d60be1a8cb432d393587c7
X_PREFIX=$HOME/.local # default is /usr/local
info() {
GREEN='\033[1;32m'
NC='\033[0m'
echo -e "${GREEN}$1${NC}"
}
error() {
RED='\033[1;31m'
NC='\033[0m'
echo -e "${RED}$1${NC}"
}
user=$(whoami)
if [ $user == root ]; then
error "You are using a root account. Script is designed to run under a normal user"
exit 1
fi
info 'Install 32-bit only? (y/N)? '
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
X_BIT=32
info "Installing 32-bit only"
else
X_BIT=64
info "Installing 64-bit version with WoW (32-bit will be also compiled)"
fi
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y \
git \
build-essential \
autoconf \
automake \
ccache \
flex \
bison \
gettext \
cabextract
# 32-bit toolchain, needed for 32-bit builds
sudo apt install -y gcc-multilib
# MinGW cross-compiler, PE format DLLs
sudo apt install -y gcc-mingw-w64
if [ $X_BIT == 64 ]; then
# PulseAudio, sound backend
sudo apt install -y libpulse-dev
# Dynamic device detection (specifically, mass storage), Removable drives may be incorrectly detected otherwise
sudo apt install -y libdbus-1-dev
# Host font enumeration, host fonts detection
sudo apt install -y libfontconfig-dev
# FreeType font reading
sudo apt install -y libfreetype-dev
# Cryptography
sudo apt install -y libgnutls28-dev
# Hardware-accelerated/3D graphics
sudo apt install -y libgl-dev
# Exception unwinding, necessary for x86_64 and arm64, but not used on other platforms
sudo apt install -y libunwind-dev
# Window management
sudo apt install -y libx11-dev
# Window drawing
sudo apt install -y libxcomposite-dev
# Cursor management
sudo apt install -y libxcursor-dev
# Clipboard management
sudo apt install -y libxfixes-dev
# Keyboard and mouse
sudo apt install -y libxi-dev
# Display device management
sudo apt install -y libxrandr-dev
# Window drawing
sudo apt install -y libxrender-dev
# Window drawing
sudo apt install -y libxext-dev
# Multimedia playback, generally necessary for games or applications that play back audio or video files
sudo apt install -y libgstreamer1.0-dev
# same
sudo apt install -y libgstreamer-plugins-base1.0-dev
# OpenGL bitmap support
sudo apt install -y libosmesa6-dev
# HID joystick support, necessary for joystick or other HID support
sudo apt install -y libsdl2-dev
# Hardware-accelerated/3D graphics, Necessary for some games; only supported by some video cards
sudo apt install -y libvulkan-dev
# Wayland support needed this
sudo apt install -y libxkbregistry-dev
# For parallel computing or GPGPU software
sudo apt install -y ocl-icd-opencl-dev
# libnetapi for Samba NetAPI support
sudo apt install -y samba-dev
fi
sudo apt install -y libpulse-dev:i386 \
libdbus-1-dev:i386 \
libfontconfig-dev:i386 \
libfreetype-dev:i386 \
libgnutls28-dev:i386 \
libgl-dev:i386 \
libunwind-dev:i386 \
libx11-dev:i386 \
libxcomposite-dev:i386 \
libxcursor-dev:i386 \
libxfixes-dev:i386 \
libxi-dev:i386 \
libxrandr-dev:i386 \
libxrender-dev:i386 \
libxext-dev:i386 \
libgstreamer1.0-dev:i386 \
libgstreamer-plugins-base1.0-dev:i386 \
libosmesa6-dev:i386 \
libsdl2-dev:i386 \
libvulkan-dev:i386 \
libxkbregistry-dev:i386 \
ocl-icd-opencl-dev:i386 \
samba-dev:i386
cd ~/Public
git clone --single-branch -b master https://gitlab.winehq.org/wine/wine.git
cd wine
git checkout $X_COMMIT
cd ..
mkdir wine32
WoW=''
if [ $X_BIT == 64 ]; then
mkdir wine64
cd wine64
../wine/configure CC="ccache gcc" CROSSCC="ccache x86_64-w64-mingw32-gcc" --enable-win64 -prefix=$X_PREFIX --disable-tests
info "Press enter to proceed with compiling wine 64 bit"; read
make
cd ..
WoW='--with-wine64=../wine64'
fi
cd wine32
PKG_CONFIG_PATH=/usr/lib/pkgconfig ../wine/configure CC="ccache gcc" CROSSCC="ccache i686-w64-mingw32-gcc" -prefix=$X_PREFIX --disable-tests $WoW
info "Press enter to proceed with compiling wine 32 bit"; read
make
cd $HOME/.local/bin
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod 744 winetricks
cd $HOME/Public/wine32
info "Now it can be installed into ${X_PREFIX} by the `make install` command";
info "REBOOT NOW and then read the notes below"
# (!) FIRST RUN for 32 bit:
# WINEARCH=win32 WINEPREFIX=~/wine32 winecfg
# echo 'export WINEPREFIX="$HOME/wine32"' >> ~/.bashrc
# wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N
# wine reg add "HKEY_CURRENT_USER\Software\Wine\Drivers" /v Graphics /d x11,wayland
# run winetricks
# to run under Wayland:
# run commands as 'DISPLAY= wine64 notepad' for 64 bit OR 'DISPLAY= wine notepad' for 32 bit
# xlsclients - lists the applications running under XWayland (thus not native Wayland windows)
# xwininfo - check X window info (shows nothing if it is not X window)
# usage examples:
# wine start /unix path_to_installer
# winefile OR wine explorer
# wine explorer /desktop=name,1024x768 program.exe
# references:
# https://wiki.winehq.org/Building_Wine
# https://wiki.winehq.org/Winetricks
# https://wiki.winehq.org/FAQ
# https://wiki.archlinux.org/title/wine