在64位Debian中构建Wine的正确方法是什么?

问题描述 投票:0回答:1

问)在64位Debian中构建Wine的正确方法是什么?什么是现代工具链以及如何实施以完成任务?而且..我如何将Wine Nine纳入包装?

人们多年来一直在问,即使可用的教程是最新的,它们也是不完整的,所以请在这个帖子上找到完整的答案!

linux debian wine
1个回答
1
投票

A)我会尝试自己的答案。随意回收它的一部分作为改进或更现代的答案的一部分!这最初是针对17.1,但之后添加了17.3更改。这些都来自零星的笔记/术语输出,所以这里肯定有更好的答案空间。事实上我觉得我在某个地方丢了一块!希望这可以帮助Debian爱好者吧!祝你好运!这肯定会破坏你的周末,并以极度失败告终,所以至少有期待!

Building Wine in Debian > 9

1) Setting up the Environment:

# Start by grabing some development tools and basic dependencies:

sudo apt-get install debhelper apt-utils binutils-multiarch-dev gcc-multilib pkg-config libtool-bin python-mako build-essential devscripts git git-buildpackage

sudo dpkg --add-architecture i386
sudo apt-get build-dep mesa
sudo apt-get build-dep wine

# And you could make git pretty like that one guy does, which debian probably did already:

git config --global color.ui auto
git config --global core.whitespace trailing-space,space-before-tab

# From: https://wiki.debian.org/PbuilderTricks https://wiki.ubuntu.com/PbuilderHowto
# http://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.building.html

# Essentially we need to build some libraries then build against those libraries. Even with a true multiarch process in hand we'd be at the mercy of debian packaging, and DFSG policy is not for the faint of heart. At first gbp may seem like yet another tool but infact git-buildpackage is a wrapper that makes dealing with it all easier and solves that irritating little chroot problem for us. Mostly.

# First lets prep our 32bit chroot a bit:
ARCH=i386 git-pbuilder create
ARCH=i386 git-pbuilder login --save-after-login

# We need to build wine against mesa, so we start a private repo for when we've built it:
apt-get install nano apt-utils
nano /etc/apt/sources.list

# Example
deb http://mirrors.accretive-networks.net/debian/ sid main contrib
deb-src http://mirrors.accretive-networks.net/debian/ sid main contrib
# apt-ftparchive:
deb [trusted=yes] file:///home/user/pbuilder/deps ./

apt-get update
apt-get upgrade
apt-get dist-upgrade

# If it wasn't sid it is now. Oh yeah, dependencies:
sudo apt-get build-dep mesa
sudo apt-get build-dep wine
exit

# Now create that directory!
mkdir -p /home/user/pbuilder/deps

# You can do the same with amd64 but realy we only need it for wine64.. it simplifies cross building the wow64 stuff:

ARCH=amd64 git-pbuilder create

# Optional, just saves redownloading if your first build fails:
ARCH=amd64 git-pbuilder login --save-after-login
sudo apt-get build-dep wine
exit

# Install the private repo with a script, so you don't have to log in and do it by hand in the future (even more optional):
sudo mkdir -p /var/cache/pbuilder/hook.d
mkdir -p /home/doc/pbuilder/deps

# This doesn't work on drives using nodev, add 'dev' to defaults or remove for drives /etc/fstab entry
# Somebody should do something about that.

bash -c 'cat > /etc/pbuilderrc << EOF
# the file in /usr/share/pbuilder/pbuilderrc is the default template.
# /etc/pbuilderrc is the one meant for overwriting defaults read pbuilderrc.5
MIRRORSITE=http://mirrors.accretive-networks.net/debian/
OTHERMIRROR="deb [trusted=yes] file:///home/user/pbuilder/deps ./"
BINDMOUNTS="/home/user/pbuilder/deps"
# the hook dir may already be set/populated!
HOOKDIR="/var/cache/pbuilder/hook.d"
# this is necessary for running 'apt-ftp-archive' in the hook below
EXTRAPACKAGES="apt-utils"
EOF'

bash -c 'cat > /var/cache/pbuilder/hook.d/D01mesa << EOF
#!/bin/bash
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=788580
# This fix didnt seem to work for test sys: mount -t devpts none /dev/pts
# Added dev to defaults on / and /opt in /etc/fstab, this is potentially a security issue but should be fine temporarily.

# Private Repo
(cd /home/user/pbuilder/deps; apt-ftparchive packages . > Packages)
# Add deps:
apt-get update
#apt-get install -f libegl1-mesa:i386=17.1.5-1 etc, etc,
#apt --fix-broken install
EOF'

# Create the empty list:
touch /home/user/pbuilder/deps/Packages

# updates chroots sources.list
sudo pbuilder --update --override-config --distribution sid

chmod u+x /home/user/pbuilder/D01deps

# The tutorial shows the actual editing of the appropriate debian/ directory. We supply those for the tutorial versions.
# If your version debian/ is older than source, you will need to remove the debian/patches it comes with.
# (i.e wget urltosome.deb; dpkg -x some.deb /some/where)
# We assume you will have them ready in /opt/src/debian-mesa and -wine/ so no git is provided here:

# Lets establish /opt/src as our working directory and populate our gits

mkdir -p /opt/src; cd /opt/src

# old: git clone http://copr-dist-git.fedorainfracloud.org/git/kkofler/qtwebengine/mesa.git mesa.nlp/
git clone git://anongit.freedesktop.org/mesa/mesa mesa.git/
git clone git://source.winehq.org/git/wine.git wine.git/
git clone --depth=1 https://github.com/wine-compholio/wine-staging.git wine-staging/
git clone --depth=1 https://github.com/sarnex/wine-d3d9-patches wine-d3d9/

# Go ahead and skip this bit if you plan to go straight to the Mesa 32bit build:

git clone --depth=1 git://anongit.freedesktop.org/mesa/drm libdrm/
git clone --depth=1 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

# So thats most the downloading finished anyways!

2) Proper Kernel Config

# This next bit mostly from: https://people.freedesktop.org/~mslusarz/nouveau-wiki-dump/InstallDRM.html
# This kernel worked on the test system, but was not with out issues. Kernel config needs it own tutorial the minimum for nouveau is shown here:

cd /opt/src/linux-2.6
apt-get install xorg-dev kernel-package

# For nouveau:
git remote add nouveau git://anongit.freedesktop.org/nouveau/linux-2.6
git remote update
git checkout -b nouveau-master nouveau/master

# Otherwise -b master

# Ok to just hit enter for all the new stuff...
cp -i /boot/config-`uname -r` ./.config
make oldconfig

# ... because we are looking closer now
make xconfig # needs libqt4-dev or use menuconfig and libncurses5

# Nouveau sanity checks:
#scripts/config --enable CONFIG_FB
scripts/config --enable CONFIG_I2C
scripts/config --enable CONFIG_I2C_ALGOBIT
scripts/config --enable CONFIG_FRAMEBUFFER_CONSOLE
scripts/config --enable CONFIG_BACKLIGHT_LCD_SUPPORT
scripts/config --enable CONFIG_BACKLIGHT_CLASS_DEVICE
scripts/config --enable CONFIG_FB_CFB_FILLRECT
scripts/config --enable CONFIG_FB_CFB_COPYAREA
scripts/config --enable CONFIG_FB_CFB_IMAGEBLIT
scripts/config --enable CONFIG_VT_HW_CONSOLE_BINDING

# Avoid the following framebuffers: offb uvesafb nvidiafb rivafb nvidia
cat .config | grep NVIDIA

# (Outdated) If you need firmware:
# Download file from https://people.freedesktop.org/~pq/nouveau-drm/
# Or follow steps at https://people.freedesktop.org/~mslusarz/nouveau-wiki-dump/NVC0_Firmware.html
# Place in /lib/usr/nouveau

git merge origin

# The fun bit..
search "<<<" keep origin:
#sudo nano drivers/gpu/drm/nouveau/nouveau_fence.c
# OR
git checkout origin drivers/gpu/drm/nouveau/nouveau_fence.c

git add .
git commit
git merge origin

make-kpkg clean
fakeroot make-kpkg --initrd --revision=1.0.custom kernel_image

# To later update gits:

git remote update
git reset --hard nouveau/master

# Libdrm, for reference:

autoreconf -vfi
./configure --prefix=/usr/ --disable-intel --disable-vmwgfx --disable-radeon --enable-omap-experimental-api --enable-install-test-programs
sudo cp src/.libs/nouveau_drv.so /usr/lib/xorg/modules/drivers

3) Build Mesa:

cd /opt/src/mesa.git

git checkout -b master origin/master

cp ../debian-mesa/ debian/ -R

# You can skip these edits if your using debian/ from tutorial or use your and edit:
echo "10" > debian/compat

# Be sure to use tabs not spaces and stay to format in:
nano debian/rules

# You should replace all gallium-llvm with -llvm, but it's not entirely needed.

# find: confflags += \
# add:    --enable-nine \

# replace:  --disable-omx \
# with:  --disable-omx-bellagio \

# replace: dh_install -a --fail-missing
# with:    dh_install -a

echo "17.3.0" > VERSION

# You can follow the examples inside, or use dch -i instead:
nano debian/changelog

# echo "NOT_INSTALLED :=" > debian/not-installed # ?

# We need to install st nine somewhere, it may as well be here:

sudo bash -c 'cat > debian/libgl1-mesa-glx.install << EOF
usr/lib/*/d3d/d3dadapter9.so
usr/lib/*/d3d/d3dadapter9.so.*
usr/lib/*/pkgconfig/d3d.pc
usr/include/d3dadapter/drm.h
usr/include/d3dadapter/d3dadapter9.h
usr/include/d3dadapter/present.h
EOF'

# There will be symbol changes, if your lucky, my diff will get you by.
# If not, your first build will fail and generate it's own diff, use that like so:

sudo bash -c 'cat > debian/patches/gbm-addsymbols.diff << EOF
--- debian/libgbm1.symbols (libgbm1_17.3.0_i386)
+++ dpkg-gensymbols4b6R6J   2017-09-18 09:07:51.531786647 +0000
@@ -3,6 +3,7 @@
  gbm_bo_create@Base 7.11~1
  gbm_bo_create_with_modifiers@Base 17.1.0~rc2
  gbm_bo_destroy@Base 7.11~1
+ gbm_bo_get_bpp@Base 17.3.0
  gbm_bo_get_device@Base 8.1~0
  gbm_bo_get_fd@Base 10.2~0
  gbm_bo_get_format@Base 8.1~0
@@ -25,6 +26,7 @@
  gbm_device_destroy@Base 7.11~1
  gbm_device_get_backend_name@Base 7.11~1
  gbm_device_get_fd@Base 7.11~1
+ gbm_device_get_format_modifier_plane_count@Base 17.3.0
  gbm_device_is_format_supported@Base 8.1~0
  gbm_surface_create@Base 8.1~0
  gbm_surface_create_with_modifiers@Base 17.1.0~rc2
EOF'

echo 'gbm-addsymbols.diff' >> debian/patches/series

git add .
git commit -a

ARCH=i386 gbp buildpackage --git-pbuilder --git-dist=sid --arch=i386 --git-force-create --git-upstream-tree=SLOPPY --git-no-pristine-tar --git-ignore-new

# Failed?

# should be same as git reset --hard, debian/rules clean will get ran anyways:
git clean -f -d -i -x

# <fix problem>

git add .
git commit -a

ARCH=i386 gbp buildpackage --git-pbuilder --git-dist=sid --git-arch=i386 --git-force-create --git-upstream-tree=SLOPPY --git-no-pristine-tar --git-ignore-new

# Success?

# Great! The 64bit build should now be trivial (and faster with out gbp):

git clean -f -d -i -x
debuild -us -uc -B

# Let's move the clutter:
mkdir /opt/debs; mv /opt/src/*.deb /opt/debs

# And put some i386 copies in our repo:

cp /opt/debs/*i386.deb /home/user/pbuilder/deps

# Go install them!

sudo dpkg -i /opt/debs/*.deb
sudo aptitude

# Resolve, repeat! Twice should do it!

### OLD:
# Pre 17.2 symbol changes:

debian/libgl1-mesa-glx.symbols
# Top:

d3dadapter9.so.1 libgl1-mesa-glx #MINVER#
 D3DAdapter9GetProc@Base 17.1.8
libGL.so.1 libgl1-mesa-glx | libgl1
 (arch=!hurd-any)MesaGLInteropGLXExportObject@Base 12.0.4
 (arch=!hurd-any)MesaGLInteropGLXQueryDeviceInfo@Base 12.0.4

4) Build Wine Already!

# The generate.py package generator from winehq is less work to modify then the official packages, bit still needs changes for nine

git clone https://github.com/<tut> debian-mesa/
git clone https://github.com/<tut> debian-wine/
git clone https://github.com/wine-compholio/wine-staging.git wine-staging/
git clone https://github.com/wine-compholio/wine-packaging.git wine-packaging/

ARCH=i386 git-pbuilder create
git clone git://source.winehq.org/git/wine.git wine.git/

cd /opt/src/wine.git

 # Find staging version and match it to the wine source:
/opt/src/wine-staging/patches/patchinstall.sh --upstream-commit
# Should be on branch master already, so stay there:
git reset --hard 0b1d7ff7655c5aa7ff073f67400bd4401727183f

# OR:
# git checkout -b <name> 0b1d7ff7655c5aa7ff073f67400bd4401727183f
# and use gbp --git-debian-branch=<name>

# Apply ixit patches:

mkdir d3d9; cp ../d3d9/*.patch d3d9/;
cp ../wine-staging/patches/ ./ -R

# Build the winehq packaging and place it:
/opt/src/wine-packaging/generate.py --out . debian-sid-staging
cp /opt/src/wine-packaging/debian-sid-staging/debian debain/ -R
@@ -1,3 +1,5 @@
+d3dadapter9.so.1 libgl1-mesa-glx #MINVER#
+ D3DAdapter9GetProc@Base 17.1.8
 libGL.so.1 libgl1-mesa-glx | libgl1
  (arch=!hurd-any)MesaGLInteropGLXExportObject@Base 12.0.4
  (arch=!hurd-any)MesaGLInteropGLXQueryDeviceInfo@Base 12.0.4

# Use tabs in things like debian/rules.. you were warned!

nano debian/rules
#Find:   "$(CURDIR)/patches/patchinstall.sh" DESTDIR="$(CURDIR)" --all
#Add:    patch -p1 < "$(CURDIR)d3d9/staging-helper.patch
#        patch -p1 < "$(CURDIR)d3d9/wine-d3d9.patch

# On both:

#Find:  $(CONFFLAGS)
#Replace:       $(CONFFLAGS) \
            --enable-nine

ARCH=i386 gbp buildpackage --git-pbuilder --git-dist=sid --git-arch=i386 --git-force-create --git-upstream-tree=SLOPPY --git-no-pristine-tar --git-ignore-new

wine --check-libs
wine --patches

Good Luck! (You'll need it)

© www.soinside.com 2019 - 2024. All rights reserved.