rules revision 79dc091db288c096b6e03888a095477ded84f503
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# Copyright (C) 2006-2012 Oracle Corporation
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# available from http://www.virtualbox.org. This file is free software;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# you can redistribute it and/or modify it under the terms of the GNU
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# General Public License as published by the Free Software Foundation,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# distribution. VirtualBox OSE is distributed in the hope that it will
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# be useful, but WITHOUT ANY WARRANTY of any kind.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# NOTE: if you make changes to this file, please check if the updates should
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# be also applied to the publicly visible debian/rules file.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#export DH_VERBOSE=1
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# possible overrides:
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# OSE=1 force VBOX_OSE
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# NOPARALLEL=1 compile with -j1
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# LINUX=<dir> compile vboxdrv against Linux found in <dir>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# VERBOSE=1 verbose build
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# DEBUG=1 debug build
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# NOSUBVER=1 disable generation of the sub-version field (which is
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# either the subversion rev [if available] or the build date)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# NOMODS=1 don't build any module
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# NOQT=1 don't build the Qt GUI
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# EFI=1 include the EFI binary from prebuild
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# VERSUFFIX=<suffix> set a particular package version suffix (e.g. _customer)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# HEADLESS=1 build the headless version
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# VNC=1 build VNC code
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# NOWEBSVC=1 don't build the webservice API, default for OSE
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# PKGDIR=<path> where to store the final package(s)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# BLEEDING_EDGE=xyz
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncpkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncNOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncsvnver := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync svn info|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncdebver :=$(subst _ALPHA,~alpha,$(subst _BETA,~beta,$(subst _OSE,~ose,$(ver))))$(svnver)$(if \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(BLEEDING_EDGE),-$(BLEEDING_EDGE),)$(VERSUFFIX)$(if \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncdebrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# shipping Linux kernel modules with bleeding-edge releases doesn't make sense
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncinstmod := $(if $(filter _Ubuntu_lucid _Ubuntu_maverick _Ubuntu_natty _Ubuntu_oneiric _Debian_sid,$(debrel)),,1)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync debdist := $(strip $(shell grep $(debrel) $(current)/distributions_deb | cut -d'=' -f2))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(error package distribution not detected (debrel=$(debrel)))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# Location of custom built Qt libraries (see below)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(filter _Ubuntu_hardy _Debian_lenny,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncbld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(filter _Ubuntu_hardy,$(debrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86-r$(svnrev).tar.bz2 \
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64-r$(svnrev).tar.bz2 \
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync# Build modules for every kernel we find in /lib/modules/*
d68511fc6827e32ca38d7bbaed520c34b6c9f050vboxsync make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
d68511fc6827e32ca38d7bbaed520c34b6c9f050vboxsync make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
d68511fc6827e32ca38d7bbaed520c34b6c9f050vboxsync $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
d68511fc6827e32ca38d7bbaed520c34b6c9f050vboxsync make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
d68511fc6827e32ca38d7bbaed520c34b6c9f050vboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
d68511fc6827e32ca38d7bbaed520c34b6c9f050vboxsync make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
7e032664d31552364e83b411950d6e7c96b0b880vboxsync $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
7e032664d31552364e83b411950d6e7c96b0b880vboxsync make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
4aef33e90cfa798b2e6db5b45f02c2a6c8bbc4aevboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
befdf0665bb07332302fed3ded8f2bc6a9695c52vboxsync make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko); \
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync make -C $(builddir)/bin/src/vboxpci KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
13f76705071cb6db2cd84c495ccb53e0daebd308vboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
716eca86fb214d6bf59f8837d35f5e812729940avboxsync make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
4b7babecff1c8fd1421ffc2d0b3df33fda523b42vboxsync $(builddir)/bin/src/vboxpci/vboxpci.ko $(moddir)/$$(basename $$d)/vboxpci.ko); \
dh_clean -k
rmdir $$i; \
sed \
if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko -a -f $$d/vboxpci.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 \
install -D -g 0 -o 0 -m 0644 \
dh_link \
sed \
sed \
$(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh.in > debian/vboxballoonctrl-service.init
sed \
-e '/#include installer-common.sh/ {' \
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 -- \