-
Notifications
You must be signed in to change notification settings - Fork 161
/
virtio-win.spec
262 lines (218 loc) · 8.21 KB
/
virtio-win.spec
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# -*- rpm-spec -*-
# Note: This spec file is largely shared with the public virtio-win drivers
# shipped on fedora sites. The canonical location is here:
#
# https://github.com/virtio-win/virtio-win-pkg-scripts
#
# If you make any changes to this file that affect the RPM content (but not
# version numbers or changelogs, etc), submit a patch to the upstream spec.
# Whether we build Fedora or RHEL style virtio-win file layout doesn't
# have much to do with the build host, but about what content we are
# supporting for the target distro. This adds rpmbuild options
#
# --with fedora_defaults
# --with rhel_defaults
#
# That allow explicitly specifying which method we want. Otherwise
# default to build host distro, or Fedora otherwise
%bcond_with fedora_defaults
%bcond_with rhel_defaults
%global fedora_defaults 0
%global rhel_defaults 0
%if %{with fedora_defaults}
%global fedora_defaults 1
%elif %{with rhel_defaults}
%global rhel_defaults 1
%elif 0%{?rhel}
%global rhel_defaults 1
%else
%global fedora_defaults 1
%endif
%global virtio_win_prewhql_build virtio-win-prewhql-0.1-262
%global qemu_ga_win_build qemu-ga-win-108.0.2-1.el9
%global qxl_build qxl-win-unsigned-0.1-24
# qxlwddm is fedora only for now
%if %{fedora_defaults}
%global qxlwddm_build spice-qxl-wddm-dod-0.21-2
%global spice_vdagent spice-vdagent-win-0.10.0-5
%endif
Summary: VirtIO para-virtualized drivers for Windows(R)
Name: virtio-win
Version: 0.1.262
Release: 2
Group: Applications/System
URL: http://www.redhat.com/
BuildArch: noarch
%if %{rhel_defaults}
# RHEL RPM ships WHQL signed drivers, which are under a proprietary license
# qemu-ga builds are GPLv2
License: BSD-3-Clause and Apache-2.0 and GPLv2
%else
# virtio-win drivers are licensed under the BSD license, qxldod under Apache-2.0,
# everything else is GPLv2
# virtio-win: https://github.com/virtio-win/kvm-guest-drivers-windows/blob/master/LICENSE
# qxl: http://cgit.freedesktop.org/spice/win32/qxl/tree/xddm/COPYING
# qxldod: https://github.com/vrozenfe/qxl-dod/blob/master/LICENSE
# qemu-ga: http://git.qemu.org/?p=qemu.git;a=blob;f=COPYING
License: BSD and Apache and GPLv2
%endif
# Already built files
Source1: %{name}-%{version}-bin-for-rpm.tar.gz
Source2: %{qemu_ga_win_build}.noarch.rpm
# Source files shipped in the srpm
Source3: %{virtio_win_prewhql_build}-sources.zip
Source4: mingw-%{qemu_ga_win_build}.src.rpm
Source5: %{qxl_build}-sources.zip
Source6: winfsp-master-sources.zip
%if %{fedora_defaults}
Source20: %{qxlwddm_build}-sources.zip
Source21: virtio-win-gt-x86.msi
Source22: virtio-win-gt-x64.msi
Source23: virtio-win-guest-tools-installer-%{version}.tar.gz
Source24: virtio-win-guest-tools.exe
Source25: %{spice_vdagent}-sources.zip
%endif
BuildRequires: /usr/bin/mkisofs
BuildRequires: findutils
%description
VirtIO para-virtualized Windows(R) drivers for 32-bit and 64-bit
Windows(R) guests.
%prep
%setup -q -T -b 1 -n %{name}-%{version}
# Extract qemu-ga RPM
mkdir -p iso-content/guest-agent
mkdir -p %{qemu_ga_win_build}
pushd %{qemu_ga_win_build}/ && rpm2cpio %{SOURCE2} | cpio -idmv
popd
%{__mv} %{qemu_ga_win_build}/usr/i686-w64-mingw32/sys-root/mingw/bin/qemu-ga-i386.msi iso-content/guest-agent/
%{__mv} %{qemu_ga_win_build}/usr/x86_64-w64-mingw32/sys-root/mingw/bin/qemu-ga-x86_64.msi iso-content/guest-agent/
# Move virtio-win MSIs and EXE into place
%if %{fedora_defaults}
%{__cp} %{SOURCE21} iso-content/
%{__cp} %{SOURCE22} iso-content/
%{__cp} %{SOURCE24} iso-content/
%endif
%if %{rhel_defaults} && 0%{?rhel} > 7
# Dropping unsupported Windows versions.
# It's done here to fix two issues at the same time: do not
# release them in iso AND as binary drivers.
for srcdir in iso-content rpm-drivers; do
rm_driver_dir() {
find $srcdir -type d -name $1 -print0 | xargs -0 rm -rf
}
# ISO naming
rm_driver_dir xp
rm_driver_dir 2k3
rm_driver_dir 2k8
rm_driver_dir smbus
rm_driver_dir cert
# Old floppy naming
rm_driver_dir WinXP
rm_driver_dir Win2003
rm_driver_dir Win2008
done
%endif
%build
# Generate .iso
pushd iso-content
/usr/bin/mkisofs \
-o ../media/%{name}-%{version}.iso \
-r -iso-level 4 \
-input-charset iso8859-1 \
-V "%{name}-%{version}" .
popd
%install
%{__install} -d -m0755 %{buildroot}%{_datadir}/%{name}
add_link() {
# Adds name-version$1 to datadir, with a non-versioned symlink
%{__install} -p -m0644 media/%{name}-%{version}$1 %{buildroot}%{_datadir}/%{name}
%{__ln_s} %{name}-%{version}$1 %{buildroot}%{_datadir}/%{name}/%{name}$1
}
# Install .iso, create non-versioned symlink
add_link .iso
# RHEL-8 does not support vfd images
%if %{rhel_defaults} && 0%{?rhel} <= 7
add_link _x86.vfd
add_link _amd64.vfd
add_link _servers_x86.vfd
add_link _servers_amd64.vfd
%endif
%if %{rhel_defaults}
add_osinfo() {
OSINFOFILE="osinfo-xml/$1"
OSINFODIR="%{buildroot}/%{_datadir}/osinfo/os/microsoft.com/$2"
%{__mkdir} -p "${OSINFODIR}"
%{__cp} "${OSINFOFILE}" "${OSINFODIR}"
}
add_osinfo virtio-win-pre-installable-drivers-win-7.xml win-7.d
add_osinfo virtio-win-pre-installable-drivers-win-8.xml win-8.d
add_osinfo virtio-win-pre-installable-drivers-win-8.1.xml win-8.1.d
add_osinfo virtio-win-pre-installable-drivers-win-10.xml win-10.d
add_osinfo virtio-win-pre-installable-drivers-win-11.xml win-11.d
%endif
%{__cp} -a rpm-drivers %{buildroot}/%{_datadir}/%{name}/drivers
# Copy the guest agent .msi into final RPM location
%{__mkdir} -p %{buildroot}%{_datadir}/%{name}/guest-agent/
%{__install} -p -m0644 iso-content/guest-agent/qemu-ga-i386.msi %{buildroot}%{_datadir}/%{name}/guest-agent/qemu-ga-i386.msi
%{__install} -p -m0644 iso-content/guest-agent/qemu-ga-x86_64.msi %{buildroot}%{_datadir}/%{name}/guest-agent/qemu-ga-x86_64.msi
# Copy virtio-win install .msi and .exe into final RPM location
%if %{fedora_defaults}
%{__mkdir} -p %{buildroot}%{_datadir}/%{name}/installer/
%{__install} -p -m0644 iso-content/virtio-win-gt-x86.msi %{buildroot}%{_datadir}/%{name}/installer/
%{__install} -p -m0644 iso-content/virtio-win-gt-x64.msi %{buildroot}%{_datadir}/%{name}/installer/
%{__install} -p -m0644 iso-content/virtio-win-guest-tools.exe %{buildroot}%{_datadir}/%{name}/installer/
%endif
%files
%doc iso-content/virtio-win_license.txt
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/%{name}-%{version}.iso
%{_datadir}/%{name}/%{name}.iso
%{_datadir}/%{name}/guest-agent/*.msi
%{_datadir}/%{name}/drivers/i386
%{_datadir}/%{name}/drivers/amd64
# Add some by-os and by-driver whitelisting, so unintended things don't
# sneak into the hierarchy
%{_datadir}/%{name}/drivers/by-driver/Balloon
%{_datadir}/%{name}/drivers/by-driver/NetKVM
%{_datadir}/%{name}/drivers/by-driver/pvpanic
%{_datadir}/%{name}/drivers/by-driver/qemufwcfg
%{_datadir}/%{name}/drivers/by-driver/qemupciserial
%{_datadir}/%{name}/drivers/by-driver/qxl
%{_datadir}/%{name}/drivers/by-driver/vioinput
%{_datadir}/%{name}/drivers/by-driver/viorng
%{_datadir}/%{name}/drivers/by-driver/vioscsi
%{_datadir}/%{name}/drivers/by-driver/vioserial
%{_datadir}/%{name}/drivers/by-driver/viostor
%{_datadir}/%{name}/drivers/by-driver/viofs
%{_datadir}/%{name}/drivers/by-driver/sriov
%{_datadir}/%{name}/drivers/by-driver/qxldod
%{_datadir}/%{name}/drivers/by-driver/viogpudo
%{_datadir}/%{name}/drivers/by-driver/viomem
%exclude %{_datadir}/%{name}/drivers/by-driver/virtio-win_license.txt
%if %{fedora_defaults}
%{_datadir}/%{name}/drivers/by-driver/smbus
%{_datadir}/%{name}/drivers/by-driver/fwcfg
%endif
%if %{fedora_defaults}
%{_datadir}/%{name}/drivers/by-driver/cert
%endif
%{_datadir}/%{name}/drivers/by-os/i386
%{_datadir}/%{name}/drivers/by-os/amd64
%if %{fedora_defaults}
%{_datadir}/%{name}/drivers/by-os/ARM64
%endif
%if %{rhel_defaults} && 0%{?rhel} <= 7
%{_datadir}/%{name}/*.vfd
%endif
%if %{fedora_defaults}
%{_datadir}/%{name}/installer/*.msi
%{_datadir}/%{name}/installer/*.exe
%endif
# osinfo-db drop-in files
%if %{rhel_defaults}
%{_datadir}/osinfo/os/microsoft.com/win-7.d/virtio-win-pre-installable-drivers-win-7.xml
%{_datadir}/osinfo/os/microsoft.com/win-8.d/virtio-win-pre-installable-drivers-win-8.xml
%{_datadir}/osinfo/os/microsoft.com/win-8.1.d/virtio-win-pre-installable-drivers-win-8.1.xml
%{_datadir}/osinfo/os/microsoft.com/win-10.d/virtio-win-pre-installable-drivers-win-10.xml
%{_datadir}/osinfo/os/microsoft.com/win-11.d/virtio-win-pre-installable-drivers-win-11.xml
%endif