rules revision 79dc091db288c096b6e03888a095477ded84f503
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#!/usr/bin/make -f
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# Copyright (C) 2006-2012 Oracle Corporation
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#
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#
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#
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#
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#export DH_VERBOSE=1
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncexport DH_COMPAT=4
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
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# VirtualBox.chm from $HOME
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
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncpackage := virtualbox
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncverpkg := virtualbox-4.2
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccurrent := $(shell pwd)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvboxroot := $(shell cd ../../../..; pwd)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncpkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncbuilddir := $(current)/debian/builddir
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncmoddir := $(current)/debian/modules
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncprefix := $(current)/debian/$(verpkg)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncarch := $(shell dpkg --print-architecture)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncverfile := $(builddir)/version-generated.mk
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync-include $(vboxroot)/SVN_REVISION
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncsvnrev :=$(if $(svn_revision),$(svn_revision),0)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncNOMODS ?= $(ose)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncNOQT ?= $(HEADLESS)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncNOWEBSVC ?= $(ose)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncNOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncifneq ($(wildcard $(verfile)),)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncinclude $(verfile)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncver := $(VBOX_VERSION_STRING)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncsvnver := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync svn info > /dev/null 2>&1; then \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync svn info|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync date +"-%Y%m%d"; fi)))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncdebver :=$(subst _ALPHA,~alpha,$(subst _BETA,~beta,$(subst _OSE,~ose,$(ver))))$(svnver)$(if \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(BLEEDING_EDGE),-$(BLEEDING_EDGE),)$(VERSUFFIX)$(if \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(HEADLESS),~headless,)$(if $(DEBUG),~dbg,)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncarchdir := $(prefix)/opt/VirtualBox-$(ver)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncendif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncifneq ($(STAGEDISO),)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncendif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncdebrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
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
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncifneq ($(MAKECMDGOALS),clean)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync debdist := $(strip $(shell grep $(debrel) $(current)/distributions_deb | cut -d'=' -f2))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ifeq ($(debdist),)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(error package distribution not detected (debrel=$(debrel)))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncendif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# Location of custom built Qt libraries (see below)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncqtstdc6 := /home/vbox/Qt-4.7.4-stdc++6-$(arch)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccfg_flags := $(if $(NOQT),--disable-qt,) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(filter _Ubuntu_hardy _Debian_lenny,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(HEADLESS),--build-headless,) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(DEBUG),--build-debug,) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(NOWINE),,--setup-wine) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(NOWEBSVC),,--enable-webservice) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(VNC),--enable-vnc,) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync --disable-extpack
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncbld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync LOCALCFG=$(current)/debian/LocalConfig.kmk \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync PATH_OUT=$(builddir) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_DO_STRIP= \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_DO_STRIP_MODULES= \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_WITH_MULTIVERSION_PYTHON= \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(ose),,VBOX_WITH_DOCS_CHM=1) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_PACKAGE_DIST=$(debdist) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_SVN_REV=$(svnrev) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(filter _Ubuntu_hardy,$(debrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncconfigure: debian/configure-stamp
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncdebian/configure-stamp:
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync dh_testdir
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync touch debian/configure-stamp
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncbuild: debian/configure-stamp debian/build-stamp
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncdebian/build-stamp $(verfile):
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync dh_testdir
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 mkdir -p $(builddir)/bin/additions
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync VBOX_NO_LINUX_RUN_INSTALLER=1 \
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 packing
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync touch debian/build-stamp
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync# Build modules for every kernel we find in /lib/modules/*
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsyncmodules: debian/build-stamp debian/modules-stamp
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsyncdebian/modules-stamp: debian/build-stamp
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync rm -rf $(moddir)
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync mkdir $(moddir)
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync make -C $(builddir)/bin/src/vboxdrv clean
8a5e0b7c43d7ee861689984edc2abd86b9ed4456vboxsync for d in $(wildcard /lib/modules/*); do \
a4ae8b6f30e62ce1edef9e5edf7c215b1f69915cvboxsync if [ -L $$d/build ]; then \
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 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
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 \
d68511fc6827e32ca38d7bbaed520c34b6c9f050vboxsync $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
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 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
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 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
4b7babecff1c8fd1421ffc2d0b3df33fda523b42vboxsync $(builddir)/bin/src/vboxpci/vboxpci.ko $(moddir)/$$(basename $$d)/vboxpci.ko); \
4b7babecff1c8fd1421ffc2d0b3df33fda523b42vboxsync fi; \
4b7babecff1c8fd1421ffc2d0b3df33fda523b42vboxsync done
4b7babecff1c8fd1421ffc2d0b3df33fda523b42vboxsync make -C $(builddir)/bin/src/vboxdrv clean
4b7babecff1c8fd1421ffc2d0b3df33fda523b42vboxsync make -C $(builddir)/bin/src/vboxnetflt clean
7b6926b2bf44f326f40e1d9d1ce33a4dff0a2c67vboxsync make -C $(builddir)/bin/src/vboxnetadp clean
7b6926b2bf44f326f40e1d9d1ce33a4dff0a2c67vboxsync make -C $(builddir)/bin/src/vboxpci clean
7b6926b2bf44f326f40e1d9d1ce33a4dff0a2c67vboxsync touch debian/modules-stamp
7b6926b2bf44f326f40e1d9d1ce33a4dff0a2c67vboxsync
f3f69e0e8d6a713566e129aa3ab321b1e6b07fbcvboxsyncclean:
f3f69e0e8d6a713566e129aa3ab321b1e6b07fbcvboxsync dh_testdir
dh_testroot
rm -f debian/changelog
rm -f debian/preinst debian/postinst debian/prerm
rm -f debian/$(package).init debian/vboxdrv.init
rm -f debian/vboxballoonctrl-service.init debian/vboxweb-service.init
rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
rm -f debian/$(verpkg).mime
rm -rf $(builddir) $(moddir)
rm -rf debian/wine.*
dh_clean
ifeq ($(VBOX_VERSION_MAJOR),)
binary binary-arch binary-indep: build $(verfile)
$(MAKE) -f debian/rules binary
else
# Build architecture-dependent files here.
binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
install -d -g 0 -o 0 $(prefix)/usr/share/applications
install -d -g 0 -o 0 $(prefix)/usr/lib
install -d -g 0 -o 0 $(prefix)/usr/bin
install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
$(if $(NOQT),,mv $(archdir)/virtualbox.desktop \
$(prefix)/usr/share/applications/virtualbox.desktop)
install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor
cp $(archdir)/icons/128x128/virtualbox.png \
$(prefix)/usr/share/pixmaps/virtualbox.png
cd $(archdir)/icons; for i in *; do \
if [ -f $$i/virtualbox.png ]; then \
install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/apps; \
mv $$i/virtualbox.png $(prefix)/usr/share/icons/hicolor/$$i/apps; \
fi; \
install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/mimetypes; \
mv $$i/* $(prefix)/usr/share/icons/hicolor/$$i/mimetypes || true; \
rmdir $$i; \
done
rmdir $(archdir)/icons
install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)/ExtensionPacks
mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo
install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
sed \
-e 's|%VERPKG%|$(verpkg)|g' \
debian/lintian-override.in > \
$(prefix)/usr/share/lintian/overrides/$(verpkg)
mv $(archdir)/VBoxEFI32.fd $(prefix)/usr/lib/$(package)
mv $(archdir)/VBoxEFI64.fd $(prefix)/usr/lib/$(package)
mv $(archdir)/VBox.png \
$(prefix)/usr/share/pixmaps/VBox.png
mv $(archdir)/*.gc $(prefix)/usr/lib/$(package)
mv $(archdir)/*.r0 $(prefix)/usr/lib/$(package)
mv $(archdir)/*.rel $(prefix)/usr/lib/$(package) || true
mv $(archdir)/VBoxNetDHCP $(prefix)/usr/lib/$(package)
mv $(archdir)/VBoxNetAdpCtl $(prefix)/usr/lib/$(package)
mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
mv $(archdir)/*.so $(prefix)/usr/lib/$(package)
mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
$(if $(NOQT),,mv $(archdir)/VBoxTestOGL $(prefix)/usr/lib/$(package))
$(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
mv $(archdir)/src $(prefix)/usr/share/$(package)
rm $(archdir)/VBox.sh
export VBOX_INSTALL_PATH=/usr/lib/$(package) && \
cd ./debian/builddir/bin/sdk/installer && \
python ./vboxapisetup.py install --root $(prefix)
rm -rf $(archdir)/sdk/installer
mv $(archdir)/vboxshell.py $(prefix)/usr/lib/$(package)
mv $(archdir)/sdk $(prefix)/usr/lib/$(package)
install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
mv $(archdir)/VBoxCreateUSBNode.sh $(prefix)/usr/share/$(package)
for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
$(if $(NOQT),,VirtualBox) VBoxHeadless \
VBoxExtPackHelperApp VBoxBalloonCtrl VBoxAutostart \
$(if $(NOWEBSVC),,vboxwebsrv webtest); do \
mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
$(if $(VNC),mv $(archdir)/ExtensionPacks/VNC $(prefix)/usr/lib/$(package)/ExtensionPacks,)
mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
$(if $(NOMODS),,for d in $(moddir)/*; do \
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 \
$$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
install -D -g 0 -o 0 -m 0644 \
$$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
install -D -g 0 -o 0 -m 0644 \
$$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
install -D -g 0 -o 0 -m 0644 \
$$d/vboxpci.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxpci.ko; \
fi \
done)
ifeq ($(ose),)
$(if $(NOQT),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
dh_installdocs \
$(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
$(addprefix $(archdir)/, LICENSE)
rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
LICENSE)
for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
$(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp $(prefix)/usr/bin)
$(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp-keymaps $(prefix)/usr/share/$(package))
if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
else
dh_installdocs \
$(archdir)/UserManual*.pdf
rm $(addprefix $(archdir)/,UserManual*.pdf)
for i in additions/VBoxGuestAdditions.iso; do \
mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
endif
rmdir $(archdir)/additions
$(if $(VNC),rmdir $(archdir)/ExtensionPacks)
rmdir $(archdir)
rmdir $(prefix)/opt
dh_link \
$(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBox) \
$(if $(NOQT),,usr/bin/VBox usr/bin/virtualbox) \
usr/bin/VBox usr/bin/VBoxManage \
usr/bin/VBox usr/bin/vboxmanage \
$(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
$(if $(HEADLESS),,usr/bin/VBox usr/bin/vboxsdl) \
$(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
usr/bin/VBox usr/bin/VBoxHeadless \
usr/bin/VBox usr/bin/vboxheadless \
usr/bin/VBox usr/bin/VBoxBalloonCtrl \
usr/bin/VBox usr/bin/vboxballoonctrl \
usr/bin/VBox usr/bin/VBoxAutostart \
usr/bin/VBox usr/bin/vboxautostart \
$(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
usr/share/virtualbox/src/vboxhost usr/src/vboxhost-$(ver)
dh_desktop
$(if $(NOMODS),,dh_installmodules)
sed \
-e 's|%NOLSB%||g' \
-e 's|%DEBIAN%|yes|g' \
-e 's|%PACKAGE%|virtualbox|g' \
-e "s|%VERSION%|$(VBOX_VERSION_STRING)|g" \
-e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
$(vboxroot)/src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
dh_installinit --name=vboxdrv --noscripts
sed \
-e 's|%NOLSB%||g' \
-e 's|%DEBIAN%|yes|g' \
-e 's|%PACKAGE%|virtualbox|g' \
$(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh.in > debian/vboxballoonctrl-service.init
dh_installinit --name=vboxballoonctrl-service --noscripts
sed \
-e 's|%NOLSB%||g' \
-e 's|%DEBIAN%|yes|g' \
-e 's|%PACKAGE%|virtualbox|g' \
$(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh.in > debian/vboxweb-service.init
dh_installinit --name=vboxweb-service --noscripts
sed -e 's|%VER%|$(debver)|g' \
-e 's|%DATE%|$(shell date -R)|g' \
-e 's|%DEBREL%|$(subst _,~,$(debrel))|g' \
-e 's|%VERPKG%|$(verpkg)|g' \
debian/changelog.in > debian/changelog
sed -e 's|%VER%|$(ver)|g' \
debian/preinst.in > debian/preinst
sed -e 's|%VER%|$(ver)|g' \
debian/prerm.in > debian/prerm
sed -e 's|%VER%|$(ver)|g' \
-e '/#include installer-common.sh/ {' \
-e "r $(vboxroot)/src/VBox/Installer/linux/installer-common.sh" \
-e 'd' \
-e '}' \
debian/postinst.in > debian/postinst
dh_installdebconf
dh_installchangelogs
dh_installmenu
dh_installmime
dh_link
ifeq ($(DEBUG),)
dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
# manually strip our R0/GC modules, dh_strip cannot handle them
for f in \
$(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
objcopy --only-keep-debug \
$$f \
$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
strip -S --remove-section=.comment $$f; \
objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
done
endif
mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib
ifeq ($(DEBUG),)
mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
endif
dh_pycentral
dh_compress -X.pdf -X.chm -X LICENSE -X.py
dh_fixperms
dh_makeshlibs
dh_installdeb
dh_perl
# for some reason, the Qt libraries couldn't be found on newer releases (e.g. Ubuntu hardy)
LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps
dh_gencontrol -- \
-Valsa=$(if $(HEADLESS),,libasound2) \
-Vpulse=$(if $(HEADLESS),,libpulse0) \
-Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0) \
-Vdkms=$(if $(filter _Debian_lenny,$(debrel)),,dkms)
dh_md5sums
dh_builddeb --destdir $(pkgdir) -- \
$(if $(filter _Ubuntu_hardy _Ubuntu_lucid,$(debrel)),,-Zxz)
endif
.PHONY: binary modules binary-arch binary-indep clean checkroot