VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec@ 107044

Last change on this file since 107044 was 106617, checked in by vboxsync, 5 weeks ago

Installer/linux: bugref:10450: Install Wayland stuff for linux; S.a. r165307, r165308, r165418 and r165419.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 13.0 KB
Line 
1# $Id: VirtualBox.tmpl.spec 106617 2024-10-23 11:52:05Z vboxsync $
2## @file
3# Spec file for creating VirtualBox rpm packages
4#
5
6#
7# Copyright (C) 2006-2024 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
27
28%define %SPEC% 1
29%define %OSE% 1
30%define %PYTHON% 1
31%define VBOXDOCDIR %{_defaultdocdir}/%NAME%
32%global __requires_exclude_from ^/usr/lib/virtualbox/VBoxPython.*$|^/usr/lib/python.*$|^.*\\.py$
33%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
34
35Summary: Oracle VirtualBox
36Name: %NAME%
37Version: %BUILDVER%_%BUILDREL%
38Release: 1
39URL: http://www.virtualbox.org/
40Source: VirtualBox.tar
41License: GPLv3
42Group: Applications/System
43Vendor: Oracle Corporation
44BuildRoot: %BUILDROOT%
45Requires: %INITSCRIPTS% %LIBASOUND% %NETTOOLS% %LIBVULKAN%
46
47%if %{?rpm_suse:1}%{!?rpm_suse:0}
48%debug_package
49%endif
50
51%MACROSPYTHON%
52%if %{?__python3:1}%{!?__python3:0}
53%define vbox_python %{__python3}
54%define vbox_python_sitelib %{python3_sitelib}
55%else
56%define vbox_python %{__python}
57%{?rpm_suse: %define vbox_python_sitelib %{py_sitedir}}
58%{!?rpm_suse: %define vbox_python_sitelib %{python_sitelib}}
59%endif
60
61# Remove source code from debuginfo package, needed for Fedora 27 and later
62# as we build the binaries before creating the RPMs.
63%if 0%{?fedora} >= 27
64%undefine _debugsource_packages
65%undefine _debuginfo_subpackages
66%endif
67%if 0%{?rhel} >= 8
68%undefine _debugsource_packages
69%undefine _debuginfo_subpackages
70%endif
71
72%description
73VirtualBox is a powerful PC virtualization solution allowing
74you to run a wide range of PC operating systems on your Linux
75system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
76and others. VirtualBox comes with a broad feature set and
77excellent performance, making it the premier virtualization
78software solution on the market.
79
80
81%prep
82%setup -q
83DESTDIR=""
84unset DESTDIR
85
86
87%build
88
89
90%install
91# Mandriva: prevent replacing 'echo' by 'gprintf'
92export DONT_GPRINTIFY=1
93rm -rf $RPM_BUILD_ROOT
94install -m 755 -d $RPM_BUILD_ROOT/sbin
95install -m 755 -d $RPM_BUILD_ROOT%{_initrddir}
96install -m 755 -d $RPM_BUILD_ROOT/lib/modules
97install -m 755 -d $RPM_BUILD_ROOT/etc/vbox
98install -m 755 -d $RPM_BUILD_ROOT/usr/bin
99install -m 755 -d $RPM_BUILD_ROOT/usr/src
100install -m 755 -d $RPM_BUILD_ROOT/usr/share/applications
101install -m 755 -d $RPM_BUILD_ROOT/usr/share/pixmaps
102install -m 755 -d $RPM_BUILD_ROOT/usr/share/icons/hicolor
103install -m 755 -d $RPM_BUILD_ROOT%{VBOXDOCDIR}
104install -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox
105install -m 755 -d $RPM_BUILD_ROOT/usr/share/virtualbox
106install -m 755 -d $RPM_BUILD_ROOT/usr/share/mime/packages
107%if %{?with_python:1}%{!?with_python:0}
108(export VBOX_INSTALL_PATH=/usr/lib/virtualbox && \
109 cd ./sdk/installer/python && \
110 %{vbox_python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
111%endif
112rm -rf sdk/installer
113mv UnattendedTemplates $RPM_BUILD_ROOT/usr/share/virtualbox
114mv nls $RPM_BUILD_ROOT/usr/share/virtualbox
115cp -a src $RPM_BUILD_ROOT/usr/share/virtualbox
116mv VBox.sh $RPM_BUILD_ROOT/usr/bin/VBox
117mv VBoxSysInfo.sh $RPM_BUILD_ROOT/usr/share/virtualbox
118cp icons/128x128/virtualbox.png $RPM_BUILD_ROOT/usr/share/pixmaps/virtualbox.png
119cd icons
120 for i in *; do
121 if [ -f $i/virtualbox.* ]; then
122 install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
123 mv $i/virtualbox.* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
124 fi
125 install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes
126 mv $i/* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes || true
127 rmdir $i
128 done
129cd -
130rmdir icons
131mv virtualbox.xml $RPM_BUILD_ROOT/usr/share/mime/packages
132%if %{?is_ose:0}%{!?is_ose:1}
133%if "%BUILDREL%" == "el7"
134# For el7 we use gcc from devtoolset-4, which is not suitable for kernel work.
135# See the PATH trickery in src/VBox/Installer/linux/rpm/rules.
136old_path="$PATH"
137PATH=${PATH#/opt/rh/devtoolset-4/root/usr/bin:}
138%endif
139for d in /lib/modules/*; do
140 if [ -L $d/build ]; then
141 rm -f /tmp/vboxdrv-Module.symvers
142 ./src/vboxhost/build_in_tmp \
143 --save-module-symvers /tmp/vboxdrv-Module.symvers \
144 --module-source `pwd`/src/vboxhost/vboxdrv \
145 KBUILD_VERBOSE= KERN_VER=$(basename $d) INSTALL_MODULE_PATH=$RPM_BUILD_ROOT -j4 \
146 %INSTMOD%
147 ./src/vboxhost/build_in_tmp \
148 --use-module-symvers /tmp/vboxdrv-Module.symvers \
149 --module-source `pwd`/src/vboxhost/vboxnetflt \
150 KBUILD_VERBOSE= KERN_VER=$(basename $d) INSTALL_MODULE_PATH=$RPM_BUILD_ROOT -j4 \
151 %INSTMOD%
152 ./src/vboxhost/build_in_tmp \
153 --use-module-symvers /tmp/vboxdrv-Module.symvers \
154 --module-source `pwd`/src/vboxhost/vboxnetadp \
155 KBUILD_VERBOSE= KERN_VER=$(basename $d) INSTALL_MODULE_PATH=$RPM_BUILD_ROOT -j4 \
156 %INSTMOD%
157 if [ -e `pwd`/src/vboxhost/vboxpci ]; then
158 ./src/vboxhost/build_in_tmp \
159 --use-module-symvers /tmp/vboxdrv-Module.symvers \
160 --module-source `pwd`/src/vboxhost/vboxpci \
161 KBUILD_VERBOSE= KERN_VER=$(basename $d) INSTALL_MODULE_PATH=$RPM_BUILD_ROOT -j4 \
162 %INSTMOD%
163 fi
164 fi
165done
166%if "%BUILDREL%" == "el7"
167# For el7 restore PATH, see above.
168PATH="$old_path"
169unset old_path
170%endif
171rm -r src
172%endif
173for i in additions/VBoxGuestAdditions.iso; do
174 mv $i $RPM_BUILD_ROOT/usr/share/virtualbox; done
175ln -s VBox $RPM_BUILD_ROOT/usr/bin/VirtualBox
176ln -s VBox $RPM_BUILD_ROOT/usr/bin/virtualbox
177ln -s VBox $RPM_BUILD_ROOT/usr/bin/VirtualBoxVM
178ln -s VBox $RPM_BUILD_ROOT/usr/bin/virtualboxvm
179ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxManage
180ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxmanage
181test -f VBoxSDL && ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxSDL
182test -f VBoxSDL && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxsdl
183ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxVRDP
184ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxHeadless
185ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxheadless
186ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxDTrace
187ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxAudioTest
188ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxdtrace
189ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxaudiotest
190test -f VBoxBugReport && ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxBugReport
191test -f VBoxBugReport && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxbugreport
192test -f VBoxBalloonCtrl && ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxBalloonCtrl
193test -f VBoxBalloonCtrl && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxballoonctrl
194test -f VBoxAutostart && ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxAutostart
195test -f VBoxAutostart && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxautostart
196test -f vboxwebsrv && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxwebsrv
197ln -s /usr/lib/virtualbox/vbox-img $RPM_BUILD_ROOT/usr/bin/vbox-img
198ln -s /usr/lib/virtualbox/vboximg-mount $RPM_BUILD_ROOT/usr/bin/vboximg-mount
199ln -s /usr/share/virtualbox/src/vboxhost $RPM_BUILD_ROOT/usr/src/vboxhost-%VER%
200mv virtualbox.desktop $RPM_BUILD_ROOT/usr/share/applications/virtualbox.desktop
201mv VBox.png $RPM_BUILD_ROOT/usr/share/pixmaps/VBox.png
202%{!?is_ose: mv LICENSE $RPM_BUILD_ROOT%{VBOXDOCDIR}}
203mv UserManual*.pdf UserManual*.qch UserManual*.qhc $RPM_BUILD_ROOT%{VBOXDOCDIR}
204install -m 755 -d $RPM_BUILD_ROOT/usr/lib/debug/usr/lib/virtualbox
205%if %{?rpm_suse:1}%{!?rpm_suse:0}
206rm *.debug
207%else
208mv *.debug $RPM_BUILD_ROOT/usr/lib/debug/usr/lib/virtualbox
209%endif
210mv * $RPM_BUILD_ROOT/usr/lib/virtualbox
211if [ -f $RPM_BUILD_ROOT/usr/lib/virtualbox/libQt6CoreVBox.so.6 ]; then
212 $RPM_BUILD_ROOT/usr/lib/virtualbox/chrpath --keepgoing --replace /usr/lib/virtualbox \
213 $RPM_BUILD_ROOT/usr/lib/virtualbox/*.so.6 \
214 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/platforms/*.so \
215 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/platformthemes/*.so \
216 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/sqldrivers/*.so \
217 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/styles/*.so || true
218 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/wayland-shell-integration/*.so || true
219 echo "[Paths]" > $RPM_BUILD_ROOT/usr/lib/virtualbox/qt.conf
220 echo "Plugins = /usr/lib/virtualbox/plugins" >> $RPM_BUILD_ROOT/usr/lib/virtualbox/qt.conf
221fi
222rm -f $RPM_BUILD_ROOT/usr/lib/virtualbox/chrpath
223ln -s ../VBoxVMM.so $RPM_BUILD_ROOT/usr/lib/virtualbox/components/VBoxVMM.so
224for i in VirtualBoxVM VBoxHeadless VBoxNetDHCP VBoxNetNAT VBoxNetAdpCtl; do
225 chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/$i; done
226if [ -f $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo ]; then
227 chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo
228fi
229test -f $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxSDL && \
230 chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxSDL
231%if %{?with_python:1}%{!?with_python:0}
232if [ -x /usr/bin/pathfix.py ]; then
233 /usr/bin/pathfix.py -pni "%{__python3} %{py3_shbang_opts}" $RPM_BUILD_ROOT/usr/lib/virtualbox/vboxshell.py
234fi
235%endif
236
237
238%pre
239# defaults
240[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
241
242# check for old installation
243if [ -r /etc/vbox/vbox.cfg ]; then
244 . /etc/vbox/vbox.cfg
245 if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
246 echo "An old installation of VirtualBox was found. To install this package the"
247 echo "old package has to be removed first. Have a look at /etc/vbox/vbox.cfg to"
248 echo "determine the installation directory of the previous installation. After"
249 echo "uninstalling the old package remove the file /etc/vbox/vbox.cfg."
250 exit 1
251 fi
252fi
253
254# check for active VMs of the installed (old) package
255# Execute the installed packages pre-uninstaller if present.
256/usr/lib/virtualbox/prerm-common.sh 2>/dev/null
257# Stop services from older versions without pre-uninstaller.
258/etc/init.d/vboxballoonctrl-service stop 2>/dev/null
259/etc/init.d/vboxautostart-service stop 2>/dev/null
260/etc/init.d/vboxweb-service stop 2>/dev/null
261VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
262if [ -n "$VBOXSVC_PID" ]; then
263 # ask the daemon to terminate immediately
264 kill -USR1 $VBOXSVC_PID
265 sleep 1
266 if pidof VBoxSVC > /dev/null 2>&1; then
267 echo "A copy of VirtualBox is currently running. Please close it and try again."
268 echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
269 echo "the VBoxSVC daemon) to finish running."
270 exit 1
271 fi
272fi
273
274
275%post
276LOG="/var/log/vbox-install.log"
277
278# defaults
279[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
280
281# remove old cruft
282if [ -f /etc/init.d/vboxdrv.sh ]; then
283 echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
284 rm /etc/init.d/vboxdrv.sh
285fi
286if [ -f /etc/vbox/vbox.cfg ]; then
287 echo "Found old version of /etc/vbox/vbox.cfg, removing."
288 rm /etc/vbox/vbox.cfg
289fi
290rm -f /etc/vbox/module_not_compiled
291
292# create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
293if [ "$INSTALL_NO_GROUP" != "1" ]; then
294 echo
295 echo "Creating group 'vboxusers'. VM users must be member of that group!"
296 echo
297 groupadd -r -f vboxusers 2> /dev/null
298fi
299
300%if %{?rpm_mdv:1}%{!?rpm_mdv:0}
301/sbin/ldconfig
302%update_menus
303%endif
304update-mime-database /usr/share/mime &> /dev/null || :
305update-desktop-database -q > /dev/null 2>&1 || :
306touch --no-create /usr/share/icons/hicolor
307gtk-update-icon-cache -q /usr/share/icons/hicolor 2> /dev/null || :
308
309# Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
310if test "${INSTALL_NO_VBOXDRV}" = 1; then
311 POSTINST_START=--nostart
312else
313 POSTINST_START=
314fi
315# Install and start the new service scripts.
316/usr/lib/virtualbox/prerm-common.sh || true
317/usr/lib/virtualbox/postinst-common.sh ${POSTINST_START} > /dev/null || true
318
319
320%preun
321# Called before the package is removed, or during upgrade after (not before)
322# the new version's "post" scriptlet.
323# $1==0: remove the last version of the package
324# $1>=1: upgrade
325if [ "$1" = 0 ]; then
326 /usr/lib/virtualbox/prerm-common.sh || exit 1
327 rm -f /etc/udev/rules.d/60-vboxdrv.rules
328 rm -f /etc/vbox/license_agreed
329 rm -f /etc/vbox/module_not_compiled
330fi
331
332%postun
333%if %{?rpm_mdv:1}%{!?rpm_mdv:0}
334/sbin/ldconfig
335%{clean_desktop_database}
336%clean_menus
337%endif
338update-mime-database /usr/share/mime &> /dev/null || :
339update-desktop-database -q > /dev/null 2>&1 || :
340touch --no-create /usr/share/icons/hicolor
341gtk-update-icon-cache -q /usr/share/icons/hicolor 2> /dev/null || :
342rm -rf /usr/lib/virtualbox/ExtensionPacks
343
344
345%clean
346rm -rf $RPM_BUILD_ROOT
347
348
349%changelog
350* %DATE% Oracle Corporation <info@virtualbox.org>
351- rebuild RPM package, see https://www.virtualbox.org/wiki/Changelog
352
353
354%files
355%defattr(-,root,root)
356%doc %{VBOXDOCDIR}/*
357%if %{?with_python:1}%{!?with_python:0}
358%{vbox_python_sitelib}/*
359%endif
360/etc/vbox
361/usr/bin/*
362/usr/src/vbox*
363/usr/lib/virtualbox
364/usr/share/applications/*
365/usr/share/icons/hicolor/*/apps/*
366/usr/share/icons/hicolor/*/mimetypes/*
367/usr/share/mime/packages/*
368/usr/share/pixmaps/*
369/usr/share/virtualbox
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette