#
# TODO:
-# - Doesn't compile without /usr/src/linux/include/linux/autoconf.h so one must
-# symlink it before building package. This is because during compilation kernel
-# module is being build. Since we are building kernel modules later
-# sources/makefiles probably needs some hacking to drop this requirement.
+# - finish kernel/userspace bconds (deps, limit build to only selected part)
# - Home page says that some addons should be compiled, I don't see any except.
# vboxaddon kernel module and {vboxmouse,vboxvideo)_drv.so. Are they required?
-# - BR list was a quickie so it may be incomplete or too big.
-# - R list probably required.
-# - .desktop file, some wrapper to launch VirtualBox (LD_LIBRARY_PATH must include
-# %{_libdir}/VirtualBox), maybe some init script to launch VBoxSVC.
+# - it seems that VBoxSVC should not be started by init script but I'm still
+# testing this
# - Devel stuff is not packaged yet.
# - Now its EA ix86 x8664, but looking into autogenerated env.sh suggests that
# code may be compiled exclusively for i686.
#
# Conditional build:
%bcond_without dist_kernel # without distribution kernel
-%bcond_without smp # without SMP kernel modules
-#
-Summary: VirtualBox
-Summary(pl.UTF-8): VirtualBox
+%bcond_without kernel # don't build kernel module
+%bcond_without userspace # don't build userspace package
+
+%define _rel 0.4
+
+Summary: VirtualBox - x86 hardware virtualizer
+Summary(pl.UTF-8): VirtualBox - wirtualizator sprzętu x86
Name: VirtualBox
-Version: 1.3.6
-Release: 0.1
+Version: 1.5.0
+Release: %{_rel}
License: GPL v2
Group: Applications/Emulators
-Source0: http://www.virtualbox.org/download/%{version}/VirtualBox-OSE-%{version}.tar.bz2
-# Source0-md5: 70c24ccee8b5778efd8d22f9996fbec9
+Source0: http://www.virtualbox.org/download/%{version}/%{name}-%{version}_OSE.tar.bz2
+# Source0-md5: 56c074900260c109ed735c08e726fe81
+Source1: virtualbox.init
+Source2: http://www.virtualbox.org/download/UserManual.pdf
+# Source2-md5: 2e5458bd5b4b9acd18cc86866e8a7284
+Source3: %{name}.desktop
+Source4: %{name}.sh
Patch0: %{name}-configure.patch
Patch1: %{name}-qt-paths.patch
URL: http://www.virtualbox.org/
BuildRequires: iasl
%{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.7}
BuildRequires: libIDL-devel
+BuildRequires: libstdc++-static
BuildRequires: libuuid-devel
BuildRequires: libxslt-progs
BuildRequires: qt-devel >= 6:3.3.6
+BuildRequires: qt-linguist
BuildRequires: rpmbuild(macros) >= 1.329
BuildRequires: xalan-c-devel >= 1.10.0
#BuildRequires: xcursor-devel
BuildRequires: xerces-c-devel >= 2.6.0
BuildRequires: xorg-lib-libXcursor-devel
BuildRequires: zlib-devel >= 1.2.1
+Requires(postun): /usr/sbin/groupdel
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Suggests: gxmessage
+Provides: group(vbox)
ExclusiveArch: %{ix86} %{x8664}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
Requires(post,postun): /sbin/depmod
Requires: dev >= 2.9.0-7
%if %{with dist_kernel}
-%requires_releq_kernel_up
-Requires(postun): %releq_kernel_up
+%requires_releq_kernel
+Requires(postun): %releq_kernel
%endif
Provides: kernel(vboxdrv) = %{version}-%{_rel}
%description -n kernel%{_alt_kernel}-misc-vboxdrv -l pl.UTF-8
Moduł jądra Linuksa vboxdrv dla VirtualBoksa.
-%package -n kernel%{_alt_kernel}-smp-misc-vboxdrv
-Summary: Linux SMP kernel module for VirtualBox
-Summary(pl.UTF-8): Moduł jądra Linuksa SMP dla VirtualBoksa
-Release: %{_rel}@%{_kernel_ver_str}
-Group: Base/Kernel
-Requires(post,postun): /sbin/depmod
-Requires: dev >= 2.9.0-7
-%if %{with dist_kernel}
-%requires_releq_kernel_smp
-Requires(postun): %releq_kernel_smp
-%endif
-Provides: kernel(vboxdrv) = %{version}-%{_rel}
-
-%description -n kernel%{_alt_kernel}-smp-misc-vboxdrv
-Linux SMP kernel module vboxdrv for VirtualBox.
-
-%description -n kernel%{_alt_kernel}-smp-misc-vboxdrv -l pl.UTF-8
-Moduł jądra Linuksa SMP vboxdrv dla VirtualBoksa.
-
%prep
-%setup -q -n %{name}-OSE-%{version}
+%setup -q -n %{name}-%{version}_OSE
%patch0 -p0
%patch1 -p0
+install %{SOURCE2} .
%build
+KDIR="%{_builddir}/%{buildsubdir}/kernel"
+mkdir -p $KDIR
+cp -a %{_kernelsrcdir}/include $KDIR
+%ifarch %{x8664}
+ln -sf $KDIR/include/asm-x86_64 $KDIR/include/asm
+%else
+ln -sf $KDIR/include/asm-i386 $KDIR/include/asm
+%endif
+ln -sf $KDIR/include/linux/autoconf-dist.h $KDIR/include/linux/autoconf.h
+
./configure \
--with-gcc="%{__cc}" \
- --with-g++="%{__cxx}"
+ --with-g++="%{__cxx}" \
+ --with-linux="$KDIR"
. ./env.sh
kmk
+%if %{with kernel}
cd out/linux.%{_outdir}/release/bin/src
-for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
+for cfg in %{?with_dist_kernel:dist}%{!?with_dist_kernel:nondist}; do
if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
exit 1
fi
SYSOUT=$PWD/o \
M=$PWD O=$PWD/o \
%{?with_verbose:V=1}
- mv vboxdrv.ko vboxdrv-$cfg.ko
+ mv vboxdrv.ko ../../../../../vboxdrv-$cfg.ko
done
+%endif
%install
rm -rf $RPM_BUILD_ROOT
+%if %{with userspace}
install -d \
- $RPM_BUILD_ROOT%{_bindir} \
- $RPM_BUILD_ROOT%{_libdir}/VirtualBox
+ $RPM_BUILD_ROOT{%{_bindir},%{_pixmapsdir},%{_desktopdir}} \
+ $RPM_BUILD_ROOT%{_libdir}/VirtualBox \
+ $RPM_BUILD_ROOT/etc/rc.d/init.d
+
+for f in {VBox{BFE,Manage,SDL,SVC,XPCOMIPCD},VirtualBox}; do
+ install out/linux.%{_outdir}/release/bin/$f $RPM_BUILD_ROOT%{_libdir}/VirtualBox/$f
+ install %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}/$f
+done
-install out/linux.%{_outdir}/release/bin/{VBox{BFE,Manage,SDL,SVC,XPCOMIPCD},VirtualBox} \
- $RPM_BUILD_ROOT%{_bindir}
-install out/linux.%{_outdir}/release/bin/VBox{DD,DD2,REM,REMImp,RT,VMM,XML,XPCOM,XPCOMIPCC}.so \
+install out/linux.%{_outdir}/release/bin/VBox*.so \
$RPM_BUILD_ROOT%{_libdir}/VirtualBox
-install out/linux.%{_outdir}/release/bin/{VBox{DD,DD2}{GC.gc,R0.r0},VMM{GC.gc,R0.r0}} \
+install out/linux.%{_outdir}/release/bin/{VBox{DD,DD2}{GC.gc,R0.r0},VMM{GC.gc,R0.r0},*.xpt} \
$RPM_BUILD_ROOT%{_libdir}/VirtualBox
-%if %{with kernel}
-install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
-%if %{with smp} && %{with dist_kernel}
-install out/linux.%{_outdir}/release/bin/src/vboxdrv-smp.ko \
- $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/vboxdrv.ko
+cp -a out/linux.%{_outdir}/release/bin/components $RPM_BUILD_ROOT%{_libdir}/VirtualBox
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/virtualbox
+
+install out/linux.%{_outdir}/release/bin/VBox.png $RPM_BUILD_ROOT%{_pixmapsdir}/VBox.png
+install %{SOURCE3} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
%endif
+
+%if %{with kernel}
+install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc
+install vboxdrv-dist.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/vboxdrv.ko
%endif
%clean
rm -rf $RPM_BUILD_ROOT
+%pre
+%groupadd -g 221 -r -f vbox
+
+%post
+/sbin/chkconfig --add virtualbox
+%service virtualbox restart "VBoxSVC daemon"
+if [ "$1" = 1 ]; then
+%banner -e %{name} <<'EOF'
+Remember to add users which will use VirtualBox to vbox group or they won't be
+able to write to /dev/vboxdrv.
+EOF
+#'
+fi
+
+%preun
+if [ "$1" = "0" ]; then
+ %service virtualbox stop
+ /sbin/chkconfig --del virtualbox
+fi
+
+%postun
+if [ "$1" = "0" ]; then
+ %groupremove vbox
+fi
+
%post -n kernel%{_alt_kernel}-misc-vboxdrv
%depmod %{_kernel_ver}
%postun -n kernel%{_alt_kernel}-misc-vboxdrv
%depmod %{_kernel_ver}
-%if %{with smp} && %{with dist_kernel}
-%post -n kernel%{_alt_kernel}-smp-misc-vboxdrv
-%depmod %{_kernel_ver}smp
-
-%postun -n kernel%{_alt_kernel}-smp-misc-vboxdrv
-%depmod %{_kernel_ver}smp
-%endif
-
+%if %{with userspace}
%files
%defattr(644,root,root,755)
+%doc UserManual.pdf
%attr(755,root,root) %{_bindir}/VBox*
%attr(755,root,root) %{_bindir}/VirtualBox
-%{_libdir}/VirtualBox
-
-%files -n kernel%{_alt_kernel}-misc-vboxdrv
-%defattr(644,root,root,755)
+%dir %{_libdir}/VirtualBox
+%attr(755,root,root) %{_libdir}/VirtualBox/VBoxSVC
+%attr(755,root,root) %{_libdir}/VirtualBox/VBoxBFE
+%attr(755,root,root) %{_libdir}/VirtualBox/VBoxManage
+%attr(755,root,root) %{_libdir}/VirtualBox/VBoxSDL
+%attr(755,root,root) %{_libdir}/VirtualBox/VBoxXPCOMIPCD
+%attr(755,root,root) %{_libdir}/VirtualBox/VirtualBox
+%{_libdir}/VirtualBox/*.gc
+%{_libdir}/VirtualBox/*.r0
+%attr(755,root,root) %{_libdir}/VirtualBox/VBox*.so
+%{_libdir}/VirtualBox/*.xpt
+%dir %{_libdir}/VirtualBox/components
+%{_libdir}/VirtualBox/components/*
+%attr(754,root,root) /etc/rc.d/init.d/virtualbox
+%{_pixmapsdir}/VBox.png
+%{_desktopdir}/%{name}.desktop
+%endif
-%if %{with smp} && %{with dist_kernel}
-%files -n kernel%{_alt_kernel}-smp-misc-vboxdrv
+%if %{with kernel}
+%files -n kernel%{_alt_kernel}-misc-vboxdrv
%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}/misc/vboxdrv.ko*
%endif