rules revision 24df09922f68ca6b53d3b8052e589d3b790f7c17
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# Copyright (C) 2006-2010 Oracle Corporation
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# This file is part of VirtualBox Open Source Edition (OSE), as
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# available from http://www.virtualbox.org. This file is free software;
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# you can redistribute it and/or modify it under the terms of the GNU
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# General Public License as published by the Free Software Foundation,
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
7abe86bacd7821fb83a784398037defc64060a2emanoj# distribution. VirtualBox OSE is distributed in the hope that it will
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# be useful, but WITHOUT ANY WARRANTY of any kind.
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus# NOTE: if you make changes to this file, please check if the updates should
d0d2b68569112607968abda07d2d8b8a95e6a40amanoj# be also applied to the publicly visible debian/rules file.
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj#export DH_VERBOSE=1
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# possible overrides:
7abe86bacd7821fb83a784398037defc64060a2emanoj# OSE=1 force VBOX_OSE
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# NOPARALLEL=1 compile with -j1
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# LINUX=<dir> compile vboxdrv against Linux found in <dir>
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# VERBOSE=1 verbose build
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# DEBUG=1 debug build
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# NOSUBVER=1 disable generation of the sub-version field (which is
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# either the subversion rev [if available] or the build date)
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# NOMODS=1 don't build any module
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# NOQT=1 don't build the Qt GUI
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# EFI include the EFI binary from prebuild
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# VERSUFFIX=<suffix> set a particular package version suffix (e.g. _customer)
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# HEADLESS=1 build the headless version
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# NOWEBSVC=1 don't build the webservice API, default for OSE
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# BLEEDING_EDGE=xyz
aa811cad2eb3fc01d17a5c8eba274b915ab8cd20manojose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
aa811cad2eb3fc01d17a5c8eba274b915ab8cd20manojsvnver := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
aa811cad2eb3fc01d17a5c8eba274b915ab8cd20manoj svn info|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
aa811cad2eb3fc01d17a5c8eba274b915ab8cd20manojdebver :=$(subst _ALPHA,~alpha,$(subst _BETA,~beta,$(ver)))$(svnver)$(if \
aa811cad2eb3fc01d17a5c8eba274b915ab8cd20manoj $(BLEEDING_EDGE),-$(BLEEDING_EDGE),)$(VERSUFFIX)$(if \
aa811cad2eb3fc01d17a5c8eba274b915ab8cd20manoj ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
aa811cad2eb3fc01d17a5c8eba274b915ab8cd20manoj $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
b9e4a86f22b3e8666186b9fe08e9241cdaf50d26manojdebrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
d6baa4df51dd4759e4a7d26d3c864d7ef20e08bcmanoj# shipping Linux kernel modules with bleeding-edge releases doesn't make sense
aa811cad2eb3fc01d17a5c8eba274b915ab8cd20manojinstmod := $(if $(filter _Ubuntu_lucid _Debian_sid,$(debrel)),,1)
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj debdist := $(strip $(shell grep $(debrel) $(current)/distributions_deb | cut -d'=' -f2))
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj $(error package distribution not detected (debrel=$(debrel)))
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj# Locations of custom built Qt libraries (see below)
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
22ad84685642948ad15cc1e881ecbc4ac8cbf98cmanoj $(if $(filter _Debian_etch,$(debrel)),$(if $(ose),,--build-libcurl),) \
999427a131afb3fc1c14ab092119bdae541a6d55rbb $(if $(filter _Debian_etch _Ubuntu_hardy,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
999427a131afb3fc1c14ab092119bdae541a6d55rbb $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
999427a131afb3fc1c14ab092119bdae541a6d55rbb $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
572157c17a74e41b43712abda7a7e3c8f1bbd4b1rbb $(if $(filter _Debian_etch _Ubuntu_hardy,$(debrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
999427a131afb3fc1c14ab092119bdae541a6d55rbb cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
572157c17a74e41b43712abda7a7e3c8f1bbd4b1rbb . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
999427a131afb3fc1c14ab092119bdae541a6d55rbb $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
999427a131afb3fc1c14ab092119bdae541a6d55rbb $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
999427a131afb3fc1c14ab092119bdae541a6d55rbb $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
572157c17a74e41b43712abda7a7e3c8f1bbd4b1rbb $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
999427a131afb3fc1c14ab092119bdae541a6d55rbb $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
999427a131afb3fc1c14ab092119bdae541a6d55rbb VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86-r$(svnrev).tar.bz2 \
999427a131afb3fc1c14ab092119bdae541a6d55rbb VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64-r$(svnrev).tar.bz2 \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus# Build modules for every kernel we find in /lib/modules/*
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
0f47ee3ae8ede113e11f21bf34f3b11161d3e61drasmus $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
dh_clean -k
sed \
if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko ]; then \
install -D -g 0 -o 0 -m 0644 \
install -D -g 0 -o 0 -m 0644 \
install -D -g 0 -o 0 -m 0644 \
dh_link \
sed \
sed \
dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
for f in \
# for some reason, the Qt libraries couldn't be found on newer releases (e.g. Ubuntu hardy)
dh_gencontrol -- \