forked from virtio-win/virtio-win-pkg-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
virtio-win.spec
203 lines (158 loc) · 5.71 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
# -*- 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/crobinso/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.
%global virtio_win_prewhql_build virtio-win-prewhql-0.1-173
%global qemu_ga_win_build qemu-ga-win-100.0.0.0-3.el7ev
%global qxl_build qxl-win-unsigned-0.1-24
# qxlwddm is fedora only for now
%if 0%{?fedora}
%global qxlwddm_build spice-qxl-wddm-dod-0.19-0
%endif
Summary: VirtIO para-virtualized drivers for Windows(R)
Name: virtio-win
Version: 0.1.173
Release: 9
Group: Applications/System
URL: http://www.redhat.com/
BuildArch: noarch
%if 0%{?rhel}
# RHEL RPM ships WHQL signed drivers, which are under a proprietary license
# qemu-ga builds are GPLv2
License: Red Hat Proprietary and GPLv2
%else
# virtio-win drivers are licensed under the BSD license, qxldod under Apache,
# 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
%if 0%{?fedora}
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
%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 into place
%if 0%{?fedora}
%{__cp} %{SOURCE21} iso-content/
%{__cp} %{SOURCE22} iso-content/
%endif
%if 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
# 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
}
add_link .iso
# RHEL-8 does not support vfd images
%if 0%{?rhel} <= 7
add_link _x86.vfd
add_link _amd64.vfd
add_link _servers_x86.vfd
add_link _servers_amd64.vfd
%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 into final RPM location
%if 0%{?fedora}
%{__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/
%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
%exclude %{_datadir}/%{name}/drivers/by-driver/virtio-win_license.txt
%if 0%{?fedora}
%{_datadir}/%{name}/drivers/by-driver/qxldod
%{_datadir}/%{name}/drivers/by-driver/smbus
%endif
%{_datadir}/%{name}/drivers/by-os/i386
%{_datadir}/%{name}/drivers/by-os/amd64
%if 0%{?fedora}
%{_datadir}/%{name}/drivers/by-os/ARM64
%endif
%if 0%{?rhel} <= 7
%{_datadir}/%{name}/*.vfd
%endif
%if 0%{?fedora}
%{_datadir}/%{name}/installer/*.msi
%endif