forked from Kron4ek/Wine-Builds
-
Notifications
You must be signed in to change notification settings - Fork 17
/
create_ubuntu_bootstraps.sh
executable file
·177 lines (156 loc) · 6.77 KB
/
create_ubuntu_bootstraps.sh
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/env bash
## A script for creating Ubuntu bootstraps for Wine compilation.
##
## debootstrap and perl are required
## root rights are required
##
## About 5.5 GB of free space is required
## And additional 2.5 GB is required for Wine compilation
if [ "$EUID" != 0 ]; then
echo "This script requires root rights!"
exit 1
fi
if ! command -v debootstrap 1>/dev/null || ! command -v perl 1>/dev/null; then
echo "Please install debootstrap and perl and run the script again"
exit 1
fi
# Keep in mind that although you can choose any version of Ubuntu/Debian
# here, but this script has only been tested with Ubuntu 18.04 Bionic
export CHROOT_DISTRO="bionic"
export CHROOT_MIRROR="https://ftp.uni-stuttgart.de/ubuntu/"
# Set your preferred path for storing chroots
# Also don't forget to change the path to the chroots in the build_wine.sh
# script, if you are going to use it
export MAINDIR=/opt/chroot/
export CHROOT_X32="${MAINDIR}"/${CHROOT_DISTRO}32_chroot
export CHROOT_X64="${MAINDIR}"/${CHROOT_DISTRO}64_chroot
prepare_chroot () {
if [ "$1" = "32" ]; then
CHROOT_PATH="${CHROOT_X32}"
else
CHROOT_PATH="${CHROOT_X64}"
fi
echo "Unmount chroot directories. Just in case."
umount -Rl "${CHROOT_PATH}"
echo "Mount directories for chroot"
mount --bind "${CHROOT_PATH}" "${CHROOT_PATH}"
mount -t proc /proc "${CHROOT_PATH}"/proc
mount --bind /sys "${CHROOT_PATH}"/sys
mount --make-rslave "${CHROOT_PATH}"/sys
mount --bind /dev "${CHROOT_PATH}"/dev
mount --bind /dev/pts "${CHROOT_PATH}"/dev/pts
mount --bind /dev/shm "${CHROOT_PATH}"/dev/shm
mount --make-rslave "${CHROOT_PATH}"/dev
rm -f "${CHROOT_PATH}"/etc/resolv.conf
cp /etc/resolv.conf "${CHROOT_PATH}"/etc/resolv.conf
echo "Chrooting into ${CHROOT_PATH}"
chroot "${CHROOT_PATH}" /usr/bin/env LANG=en_US.UTF-8 TERM=xterm PATH="/bin:/sbin:/usr/bin:/usr/sbin" /opt/prepare_chroot.sh
echo "Unmount chroot directories"
umount -l "${CHROOT_PATH}"
umount "${CHROOT_PATH}"/proc
umount "${CHROOT_PATH}"/sys
umount "${CHROOT_PATH}"/dev/pts
umount "${CHROOT_PATH}"/dev/shm
umount "${CHROOT_PATH}"/dev
}
create_build_scripts () {
sdl2_version="2.26.4"
faudio_version="23.03"
vulkan_headers_version="1.3.239"
vulkan_loader_version="1.3.239"
spirv_headers_version="sdk-1.3.239.0"
libpcap_version="1.10.4"
libxkbcommon_version="1.6.0"
cat <<EOF > "${MAINDIR}"/prepare_chroot.sh
#!/bin/bash
apt-get update
apt-get -y install nano
apt-get -y install locales
echo ru_RU.UTF_8 UTF-8 >> /etc/locale.gen
echo en_US.UTF_8 UTF-8 >> /etc/locale.gen
locale-gen
echo deb '${CHROOT_MIRROR}' ${CHROOT_DISTRO} main universe > /etc/apt/sources.list
echo deb '${CHROOT_MIRROR}' ${CHROOT_DISTRO}-updates main universe >> /etc/apt/sources.list
echo deb '${CHROOT_MIRROR}' ${CHROOT_DISTRO}-security main universe >> /etc/apt/sources.list
echo deb-src '${CHROOT_MIRROR}' ${CHROOT_DISTRO} main universe >> /etc/apt/sources.list
echo deb-src '${CHROOT_MIRROR}' ${CHROOT_DISTRO}-updates main universe >> /etc/apt/sources.list
echo deb-src '${CHROOT_MIRROR}' ${CHROOT_DISTRO}-security main universe >> /etc/apt/sources.list
apt-get update
apt-get -y upgrade
apt-get -y dist-upgrade
apt-get -y install software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
add-apt-repository -y ppa:cybermax-dexter/mingw-w64-backport
apt-get update
apt-get -y build-dep wine-development libsdl2 libvulkan1
apt-get -y install ccache cmake perl bison gcc-9 g++-9 wget git gcc-mingw-w64 g++-mingw-w64
apt-get -y install libxpresent-dev libjxr-dev libusb-1.0-0-dev libgcrypt20-dev libpulse-dev libudev-dev libsane-dev libv4l-dev libkrb5-dev libgphoto2-dev liblcms2-dev libcapi20-dev
apt-get -y install libjpeg62-dev samba-dev
apt-get -y install libpcsclite-dev libcups2-dev
apt-get -y install python3-pip libxcb-xkb-dev
apt-get -y purge libvulkan-dev libvulkan1 libsdl2-dev libsdl2-2.0-0 libpcap0.8-dev libpcap0.8 --purge --autoremove
apt-get -y clean
apt-get -y autoclean
pip3 install meson
pip3 install ninja
export PATH="/usr/local/bin:${PATH}"
mkdir /opt/build_libs
cd /opt/build_libs
wget -O sdl.tar.gz https://www.libsdl.org/release/SDL2-${sdl2_version}.tar.gz
wget -O faudio.tar.gz https://github.com/FNA-XNA/FAudio/archive/${faudio_version}.tar.gz
wget -O vulkan-loader.tar.gz https://github.com/KhronosGroup/Vulkan-Loader/archive/v${vulkan_loader_version}.tar.gz
wget -O vulkan-headers.tar.gz https://github.com/KhronosGroup/Vulkan-Headers/archive/v${vulkan_headers_version}.tar.gz
wget -O spirv-headers.tar.gz https://github.com/KhronosGroup/SPIRV-Headers/archive/${spirv_headers_version}.tar.gz
wget -O libpcap.tar.gz https://www.tcpdump.org/release/libpcap-${libpcap_version}.tar.gz
wget -O libxkbcommon.tar.xz https://xkbcommon.org/download/libxkbcommon-${libxkbcommon_version}.tar.xz
if [ -d /usr/lib/i386-linux-gnu ]; then wget -O wine.deb https://dl.winehq.org/wine-builds/ubuntu/dists/bionic/main/binary-i386/wine-stable_4.0.3~bionic_i386.deb; fi
if [ -d /usr/lib/x86_64-linux-gnu ]; then wget -O wine.deb https://dl.winehq.org/wine-builds/ubuntu/dists/bionic/main/binary-amd64/wine-stable_4.0.3~bionic_amd64.deb; fi
git clone https://gitlab.winehq.org/wine/vkd3d.git
tar xf sdl.tar.gz
tar xf faudio.tar.gz
tar xf vulkan-loader.tar.gz
tar xf vulkan-headers.tar.gz
tar xf spirv-headers.tar.gz
tar xf libpcap.tar.gz
tar xf libxkbcommon.tar.xz
export CFLAGS="-O2"
export CXXFLAGS="-O2"
mkdir build && cd build
cmake ../SDL2-${sdl2_version} && make -j$(nproc) && make install
cd ../ && rm -r build && mkdir build && cd build
cmake ../FAudio-${faudio_version} && make -j$(nproc) && make install
cd ../ && rm -r build && mkdir build && cd build
cmake ../Vulkan-Headers-${vulkan_headers_version} && make -j$(nproc) && make install
cd ../ && rm -r build && mkdir build && cd build
cmake ../Vulkan-Loader-${vulkan_loader_version}
make -j$(nproc)
make install
cd ../ && rm -r build && mkdir build && cd build
cmake ../SPIRV-Headers-${spirv_headers_version} && make -j$(nproc) && make install
cd ../ && dpkg -x wine.deb .
cp opt/wine-stable/bin/widl /usr/bin
cd vkd3d && ./autogen.sh
cd ../ && rm -r build && mkdir build && cd build
../vkd3d/configure && make -j$(nproc) && make install
cd ../ && rm -r build && mkdir build && cd build
../libpcap-${libpcap_version}/configure && make -j$(nproc) install
cd ../libxkbcommon-${libxkbcommon_version}
meson setup build -Denable-docs=false
meson compile -C build
meson install -C build
cd /opt && rm -r /opt/build_libs
EOF
chmod +x "${MAINDIR}"/prepare_chroot.sh
cp "${MAINDIR}"/prepare_chroot.sh "${CHROOT_X32}"/opt
mv "${MAINDIR}"/prepare_chroot.sh "${CHROOT_X64}"/opt
}
mkdir -p "${MAINDIR}"
debootstrap --arch amd64 $CHROOT_DISTRO "${CHROOT_X64}" $CHROOT_MIRROR
debootstrap --arch i386 $CHROOT_DISTRO "${CHROOT_X32}" $CHROOT_MIRROR
create_build_scripts
prepare_chroot 32
prepare_chroot 64
rm "${CHROOT_X64}"/opt/prepare_chroot.sh
rm "${CHROOT_X32}"/opt/prepare_chroot.sh
clear
echo "Done"