rules revision cc4463d266cc5b433b63b2231570a9f77c126ab6
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# Copyright (C) 2006-2012 Oracle Corporation
d67d8d3162b0d9cac99842fc7da74e8371453046vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# available from http://www.virtualbox.org. This file is free software;
ac2f8170e087931242786c8fe40ba16f457e18e0vboxsync# you can redistribute it and/or modify it under the terms of the GNU
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# General Public License (GPL) as published by the Free Software
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync#export DH_VERBOSE=1
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# possible overrides:
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync# OSE=1 force VBOX_OSE
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync# NOPARALLEL=1 compile with -j1
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync# LINUX=<dir> compile vboxdrv against Linux found in <dir>
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# VERBOSE=1 verbose build
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync# DEBUG=1 debug build
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# NOSUBVER=1 disable generation of the sub-version field (which is
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync# either the subversion rev [if available] or the build date)
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
058e9c6d97c5306126f83d934148c658804f1d6cvboxsync# NOMODS=1 don't build any module
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# NOQT=1 don't build the Qt GUI
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# EFI=1 include the EFI binary from prebuild
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# HEADLESS=1 build the headless version
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# VNC=1 build VNC code
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# NOWEBSVC=1 don't build the webservice API, default for OSE
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# PKGDIR=<path> where to store the final package(s)
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync# BLEEDING_EDGE=xyz
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsyncpkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ..; pwd))
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsyncose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsyncNOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
d67d8d3162b0d9cac99842fc7da74e8371453046vboxsync ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
d67d8d3162b0d9cac99842fc7da74e8371453046vboxsync $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
d67d8d3162b0d9cac99842fc7da74e8371453046vboxsyncdebrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
b6cc138b99f86c2d29ecfe32cecf9f68ba5e73afvboxsync# shipping Linux kernel modules with bleeding-edge releases doesn't make sense
0e5731ab59b4ecead38375f26eeea698f00b19fdvboxsyncinstmod := $(if $(filter _Ubuntu_lucid _Ubuntu_maverick _Ubuntu_natty _Ubuntu_oneiric _Debian_sid,$(debrel)),,1)
0e5731ab59b4ecead38375f26eeea698f00b19fdvboxsync# Location of custom built Qt libraries (see below)
e91f2a55ed5a30342ec79ce273f3f4bad8283336vboxsync $(if $(filter _Ubuntu_hardy _Debian_lenny,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
32bf313cd8c0de52ef27b486f15945c55c94b038vboxsync $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
bec9452711598b56e648192360cab88a6c3535e8vboxsyncbld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
ab455939477d81b7bb500586f88029d3a3c0b34cvboxsync VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
d67d8d3162b0d9cac99842fc7da74e8371453046vboxsync $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
d67d8d3162b0d9cac99842fc7da74e8371453046vboxsync $(if $(filter _Ubuntu_hardy,$(debrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86-r$(svnrev).tar.bz2 \
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64-r$(svnrev).tar.bz2 \
b39c3fa81cadaec00ebb2e7170a8db96998b7032vboxsync VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
b39c3fa81cadaec00ebb2e7170a8db96998b7032vboxsync VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync# Build modules for every kernel we find in /lib/modules/*
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
37136b5ecb07042e5ba50f86849a79d1cba5d5f1vboxsync make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
c14daac2bac51584dd4b94bf9ab51ed5b6f654aavboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
715e49c31b15c23c17a9ce3be42a75e7c48d4b78vboxsync make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
715e49c31b15c23c17a9ce3be42a75e7c48d4b78vboxsync $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
715e49c31b15c23c17a9ce3be42a75e7c48d4b78vboxsync make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
715e49c31b15c23c17a9ce3be42a75e7c48d4b78vboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
715e49c31b15c23c17a9ce3be42a75e7c48d4b78vboxsync make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
dh_clean -k
rmdir $$i; \
sed \
install -D -g 0 -o 0 -m 644 $(vboxroot)/src/VBox/Installer/linux/debian/VBox.sh $(prefix)/usr/bin/VBox
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 \
dh_gencontrol -- \