SPECS: VirtualBox.spec - improved module build, - fixed kernel/use...

kosmo kosmo at pld-linux.org
Sat Sep 29 22:40:02 CEST 2007


Author: kosmo                        Date: Sat Sep 29 20:40:02 2007 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- improved module build,
- fixed kernel/userpsace bconds,
- dropped libstdc++ static linking,
- please read TODO and think about it ...

---- Files affected:
SPECS:
   VirtualBox.spec (1.27 -> 1.28) 

---- Diffs:

================================================================
Index: SPECS/VirtualBox.spec
diff -u SPECS/VirtualBox.spec:1.27 SPECS/VirtualBox.spec:1.28
--- SPECS/VirtualBox.spec:1.27	Sat Sep 22 13:39:13 2007
+++ SPECS/VirtualBox.spec	Sat Sep 29 22:39:57 2007
@@ -1,22 +1,17 @@
 # $Revision$, $Date$
 #
 # TODO:
-# - 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?
-# - 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.
-# - use %kernel_build macros
+# - Find how to compile with PLD CFLAGS/CXXFLAGS/LDFLAGS.
+# - How to package video and mouse drivers for Guest OS ?
+#   (There are binaries for multiple versions of X11)
+# - Package SDK.
 #
 # Conditional build:
 %bcond_without	dist_kernel	# without distribution kernel
 %bcond_without	kernel		# don't build kernel module
 %bcond_without	userspace	# don't build userspace package
 
-%define		_rel		0.4
+%define		_rel		1
 
 Summary:	VirtualBox - x86 hardware virtualizer
 Summary(pl.UTF-8):	VirtualBox - wirtualizator sprzętu x86
@@ -34,6 +29,7 @@
 Source4:	%{name}.sh
 Patch0:		%{name}-configure.patch
 Patch1:		%{name}-qt-paths.patch
+Patch2:		%{name}-shared-libstdc++.patch
 URL:		http://www.virtualbox.org/
 BuildRequires:	SDL-devel
 BuildRequires:	bash
@@ -43,7 +39,6 @@
 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
@@ -111,6 +106,25 @@
 lokalnej maszyny. Dzięki temu można szybko i łatwo przenieść
 konfigurację maszyny wirtualnej na inny komputer.
 
+%package -n kernel%{_alt_kernel}-misc-vboxadd
+Summary:	Linux kernel module for VirtualBox
+Summary(pl.UTF-8):	Moduł jądra Linuksa 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
+Requires(postun):	%releq_kernel
+%endif
+Provides:	kernel(vboxadd) = %{version}-%{_rel}
+
+%description -n kernel%{_alt_kernel}-misc-vboxadd
+Linux kernel module vboxadd for VirtualBox.
+
+%description -n kernel%{_alt_kernel}-misc-vboxadd -l pl.UTF-8
+Moduł jądra Linuksa vboxadd dla VirtualBoksa.
+
 %package -n kernel%{_alt_kernel}-misc-vboxdrv
 Summary:	Linux kernel module for VirtualBox
 Summary(pl.UTF-8):	Moduł jądra Linuksa dla VirtualBoksa
@@ -130,62 +144,71 @@
 %description -n kernel%{_alt_kernel}-misc-vboxdrv -l pl.UTF-8
 Moduł jądra Linuksa vboxdrv dla VirtualBoksa.
 
+%package -n kernel%{_alt_kernel}-misc-vboxvfs
+Summary:	Linux kernel module for VirtualBox
+Summary(pl.UTF-8):	Moduł jądra Linuksa 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
+Requires(postun):	%releq_kernel
+%endif
+Provides:	kernel(vboxvfs) = %{version}-%{_rel}
+
+%description -n kernel%{_alt_kernel}-misc-vboxvfs
+Linux kernel module vboxvfs for VirtualBox.
+
+%description -n kernel%{_alt_kernel}-misc-vboxvfs -l pl.UTF-8
+Moduł jądra Linuksa vboxvfs dla VirtualBoksa.
+
 %prep
 %setup -q -n %{name}-%{version}_OSE
 %patch0 -p0
 %patch1 -p0
+%patch2 -p1
 install %{SOURCE2} .
 
 %build
 KDIR="%{_builddir}/%{buildsubdir}/kernel"
 mkdir -p $KDIR
-cp -a %{_kernelsrcdir}/include $KDIR
+cp -Ra %{_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
+
+%if %{with dist_kernel}
+[ ! -f $KDIR/include/linux/autoconf.h ] && \
+    ln -sf $KDIR/include/linux/autoconf-dist.h $KDIR/include/linux/autoconf.h
+%else
+[ ! -f $KDIR/include/linux/autoconf.h ] && \
+    ln -sf $KDIR/include/linux/autoconf-nondist.h $KDIR/include/linux/autoconf.h
+%endif
 
 ./configure \
 	--with-gcc="%{__cc}" \
 	--with-g++="%{__cxx}" \
 	--with-linux="$KDIR"
-. ./env.sh
-kmk -j1
 
-%if %{with kernel}
-cd out/linux.%{_outdir}/release/bin/src
-for cfg in %{?with_dist_kernel:dist}%{!?with_dist_kernel:nondist}; do
-	if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
-		exit 1
-	fi
-	rm -rf o
-	install -d o/include/linux
-	ln -sf %{_kernelsrcdir}/config-$cfg o/.config
-	ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers
-	ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h
-%if %{with dist_kernel}
-	%{__make} -j1 -C %{_kernelsrcdir} O=$PWD/o prepare scripts
-%else
-	touch o/include/config/MARKER
-	ln -sf %{_kernelsrcdir}/scripts o/scripts
+%if %{with userspace}
+. ./env.sh && kmk -j1
 %endif
-	ln -sf ../../include/VBox o/include/VBox
-	ln -sf ../../include/iprt o/include/iprt
-	%{__make} -C %{_kernelsrcdir} clean \
-		SYSSRC=%{_kernelsrcdir} \
-		SYSOUT=$PWD/o \
-		M=$PWD O=$PWD/o \
-		%{?with_verbose:V=1}
-	%{__make} -C %{_kernelsrcdir} modules \
-		CC="%{__cc}" CPP="%{__cpp}" \
-		SYSSRC=%{_kernelsrcdir} \
-		SYSOUT=$PWD/o \
-		M=$PWD O=$PWD/o \
-		%{?with_verbose:V=1}
-	mv vboxdrv.ko ../../../../../vboxdrv-$cfg.ko
-done
+
+%if %{with kernel}
+rm -rf PLD-MODULE-BUILD && mkdir PLD-MODULE-BUILD && cd PLD-MODULE-BUILD
+
+../src/VBox/HostDrivers/Support/linux/export_modules modules.tar.gz && \
+	tar -zxf modules.tar.gz && rm -f modules.tar.gz
+../src/VBox/Additions/linux/export_modules modules.tar.gz
+	tar -zxf modules.tar.gz && rm -f modules.tar.gz
+
+%build_kernel_modules -m vboxadd -C vboxadd
+%build_kernel_modules -m vboxdrv -C vboxdrv
+%build_kernel_modules -m vboxvfs -C vboxvfs
+cd ..
 %endif
 
 %install
@@ -215,8 +238,15 @@
 %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
+cd PLD-MODULE-BUILD
+for MODULE in *; do
+	[ ! -d $MODULE ] && continue;
+
+	cd $MODULE
+	%install_kernel_modules -m $MODULE -d misc
+	cd ..
+done
+cd ..
 %endif
 
 %clean
@@ -247,12 +277,24 @@
 	%groupremove vbox
 fi
 
+%post	-n kernel%{_alt_kernel}-misc-vboxadd
+%depmod %{_kernel_ver}
+
+%postun	-n kernel%{_alt_kernel}-misc-vboxadd
+%depmod %{_kernel_ver}
+
 %post	-n kernel%{_alt_kernel}-misc-vboxdrv
 %depmod %{_kernel_ver}
 
 %postun	-n kernel%{_alt_kernel}-misc-vboxdrv
 %depmod %{_kernel_ver}
 
+%post	-n kernel%{_alt_kernel}-misc-vboxvfs
+%depmod %{_kernel_ver}
+
+%postun	-n kernel%{_alt_kernel}-misc-vboxvfs
+%depmod %{_kernel_ver}
+
 %if %{with userspace}
 %files
 %defattr(644,root,root,755)
@@ -278,9 +320,17 @@
 %endif
 
 %if %{with kernel}
+%files -n kernel%{_alt_kernel}-misc-vboxadd
+%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}/misc/vboxadd.ko*
+
 %files -n kernel%{_alt_kernel}-misc-vboxdrv
 %defattr(644,root,root,755)
 /lib/modules/%{_kernel_ver}/misc/vboxdrv.ko*
+
+%files -n kernel%{_alt_kernel}-misc-vboxvfs
+%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}/misc/vboxvfs.ko*
 %endif
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
@@ -289,6 +339,12 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.28  2007/09/29 20:39:57  kosmo
+- improved module build,
+- fixed kernel/userpsace bconds,
+- dropped libstdc++ static linking,
+- please read TODO and think about it ...
+
 Revision 1.27  2007/09/22 11:39:13  aflinta
  - added -j1 do kmk, otherwise build will fail on SMP
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/VirtualBox.spec?r1=1.27&r2=1.28&f=u



More information about the pld-cvs-commit mailing list