SPECS: VirtualBox.spec - Release 0.2 - Req kernel module - initial...

pascalek pascalek at pld-linux.org
Tue Mar 13 18:04:50 CET 2007


Author: pascalek                     Date: Tue Mar 13 17:04:50 2007 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- Release 0.2
- Req kernel module
- initial init script
- fixed build and install so it started its basic work

---- Files affected:
SPECS:
   VirtualBox.spec (1.12 -> 1.13) 

---- Diffs:

================================================================
Index: SPECS/VirtualBox.spec
diff -u SPECS/VirtualBox.spec:1.12 SPECS/VirtualBox.spec:1.13
--- SPECS/VirtualBox.spec:1.12	Wed Feb 28 00:29:29 2007
+++ SPECS/VirtualBox.spec	Tue Mar 13 18:04:45 2007
@@ -1,16 +1,12 @@
 # $Revision$, $Date$
 #
 # 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.
 # - 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.
+# - .desktop file
+# - it seems that VBoxSVC should not be started by init script but I'm still 
+#   testing this
+# - /dev/vboxdrv should belong to vboxusers group and have rw rights to it
 # - 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.
@@ -18,17 +14,21 @@
 #
 # Conditional build:
 %bcond_without	dist_kernel	# without distribution kernel
+%bcond_without	up		# without up packages
 %bcond_without	smp		# without SMP kernel modules
-#
+
+%define		_rel		0.2
+
 Summary:	VirtualBox
 Summary(pl.UTF-8):	VirtualBox
 Name:		VirtualBox
 Version:	1.3.6
-Release:	0.1
+Release:	%{_rel}
 License:	GPL v2
 Group:		Applications/Emulators
 Source0:	http://www.virtualbox.org/download/%{version}/VirtualBox-OSE-%{version}.tar.bz2
 # Source0-md5:	70c24ccee8b5778efd8d22f9996fbec9
+Source1:	virtualbox.init
 Patch0:		%{name}-configure.patch
 Patch1:		%{name}-qt-paths.patch
 URL:		http://www.virtualbox.org/
@@ -49,6 +49,7 @@
 BuildRequires:	xerces-c-devel >= 2.6.0
 BuildRequires:	xorg-lib-libXcursor-devel
 BuildRequires:	zlib-devel >= 1.2.1
+Requires:	kernel(vboxdrv) = %{version}-%{_rel}
 ExclusiveArch:	%{ix86} %{x8664}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -145,9 +146,20 @@
 %patch1 -p0
 
 %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-up.h $KDIR/include/linux/autoconf.h
+
 ./configure \
 	--with-gcc="%{__cc}" \
-	--with-g++="%{__cxx}"
+	--with-g++="%{__cxx}" \
+	--with-linux="$KDIR"
 . ./env.sh
 kmk
 
@@ -180,7 +192,7 @@
 		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
 
 %install
@@ -188,26 +200,61 @@
 
 install -d \
 	$RPM_BUILD_ROOT%{_bindir} \
-	$RPM_BUILD_ROOT%{_libdir}/VirtualBox
+	$RPM_BUILD_ROOT%{_libdir}/VirtualBox \
+	$RPM_BUILD_ROOT/etc/rc.d/init.d
 
-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 \
+cat > VBox.sh << EOF
+#!/bin/sh
+
+if [ ! -c /dev/vboxdrv ]; then
+    echo "Special character device /dev/vboxdrv doesn't exists!"
+    echo "Check your installation and if vboxdrv kernel module is loaded."
+    exit 1
+fi
+
+if [ ! -w /dev/vboxdrv ]; then
+    echo "You don't have write access to /dev/vboxdrv!"
+    echo "Correct this situation or contact with your system administrator."
+    exit 1
+fi
+
+BINFILE=\`basename \$0\`
+LD_LIBRARY_PATH=%{_libdir}/VirtualBox %{_libdir}/VirtualBox/\$BINFILE \$@
+EOF
+
+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 VBox.sh $RPM_BUILD_ROOT%{_bindir}/$f
+done
+
+install out/linux.%{_outdir}/release/bin/VBox{C,DD,DD2,REM,REMImp,RT,VMM,XML,XPCOM,XPCOMIPCC}.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
+install vboxdrv-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/vboxdrv.ko
 %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
-%endif
+install vboxdrv-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/vboxdrv.ko
 %endif
 
+cp -a out/linux.%{_outdir}/release/bin/components $RPM_BUILD_ROOT%{_libdir}/VirtualBox
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/virtualbox
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+/sbin/chkconfig --add virtualbox
+%service virtualbox restart "VBoxSVC daemon"
+
+%preun 
+if [ "$1" = "0" ]; then
+	%service virtualbox stop
+	/sbin/chkconfig --del virtualbox
+fi
+
 %post	-n kernel%{_alt_kernel}-misc-vboxdrv
 %depmod %{_kernel_ver}
 
@@ -224,16 +271,33 @@
 
 %files
 %defattr(644,root,root,755)
+%dir %{_libdir}/VirtualBox
+%dir %{_libdir}/VirtualBox/components
 %attr(755,root,root) %{_bindir}/VBox*
 %attr(755,root,root) %{_bindir}/VirtualBox
-%{_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
+%{_libdir}/VirtualBox/VBox*.so
+%{_libdir}/VirtualBox/*.xpt
+%{_libdir}/VirtualBox/components/*
+%attr(754,root,root) /etc/rc.d/init.d/virtualbox
 
+%if %{with up} || %{without dist_kernel}
 %files	-n kernel%{_alt_kernel}-misc-vboxdrv
 %defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}/misc/vboxdrv.ko.gz
+%endif
 
 %if %{with smp} && %{with dist_kernel}
 %files	-n kernel%{_alt_kernel}-smp-misc-vboxdrv
 %defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}smp/misc/vboxdrv.ko.gz
 %endif
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
@@ -242,6 +306,12 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.13  2007/03/13 17:04:45  pascalek
+- Release 0.2
+- Req kernel module
+- initial init script
+- fixed build and install so it started its basic work
+
 Revision 1.12  2007/02/27 23:29:29  aflinta
 - fixed build dir
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/VirtualBox.spec?r1=1.12&r2=1.13&f=u



More information about the pld-cvs-commit mailing list