rules revision 24713061a674af34286ac48ad1433329cdd404f2
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# Copyright (C) 2006-2010 Oracle Corporation
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# This file is part of VirtualBox Open Source Edition (OSE), as
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# available from http://www.virtualbox.org. This file is free software;
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# you can redistribute it and/or modify it under the terms of the GNU
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# General Public License as published by the Free Software Foundation,
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# distribution. VirtualBox OSE is distributed in the hope that it will
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# be useful, but WITHOUT ANY WARRANTY of any kind.
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes#export DH_VERBOSE=1
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# possible overrides:
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# OSE=1 force VBOX_OSE
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# NOPARALLEL=1 compile with -j1
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# LINUX=<dir> compile vboxdrv against Linux found in <dir>
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# VERBOSE=1 verbose build
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# DEBUG=1 debug build
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# NOSUBVER=1 disable generation of the sub-version field (which is
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# either the subversion rev [if available] or the build date)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# NOMODS=1 don't build any module
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# NOQT=1 don't build the Qt GUI
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# HEADLESS=1 build the headless version
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# NOWEBSVC=1 don't build the webservice API, default for OSE
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# BLEEDING_EDGE=xyz
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholesose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholesNOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholesdebrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# shipping Linux kernel modules with bleeding-edge releases doesn't make sense
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholesinstmod := $(if $(filter _Ubuntu_lucid _Debian_sid,$(debrel)),,1)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# Locations of custom built Qt libraries (see below)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(filter _Debian_etch,$(debrel)),$(if $(ose),,--build-libcurl),) \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(filter _Debian_etch _Ubuntu_hardy,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholesbld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(filter _Debian_etch _Ubuntu_hardy,$(debrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86-r$(svnrev).tar.bz2 \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64-r$(svnrev).tar.bz2 \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# Build modules for every kernel we find in /lib/modules/*
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko); \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes rm -f debian/$(package).init debian/vboxdrv.init debian/vboxweb-service.init
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes# Build architecture-dependent files here.
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholesbinary binary-arch binary-indep: build $(if $(NOMODS),,modules)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes install -d -g 0 -o 0 $(prefix)/usr/share/applications
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(prefix)/usr/share/applications/virtualbox.desktop)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes -e 's|%VERPKG%|$(verpkg)|g' \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/VBoxEFI32.fd $(prefix)/usr/lib/$(package)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/VBoxEFI64.fd $(prefix)/usr/lib/$(package)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/*.rel $(prefix)/usr/lib/$(package) || true
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/VBoxNetDHCP $(prefix)/usr/lib/$(package)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/VBoxNetAdpCtl $(prefix)/usr/lib/$(package)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(NOQT),,mv $(archdir)/VBoxTestOGL $(prefix)/usr/lib/$(package))
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/vboxshell.py $(prefix)/usr/lib/$(package)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko ]; then \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes install -D -g 0 -o 0 -m 0644 \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes install -D -g 0 -o 0 -m 0644 \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes install -D -g 0 -o 0 -m 0644 \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(NOQT),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(addprefix $(archdir)/, $(if $(HEADLESS),,License-*.html) LICENSE)
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes $(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
3c937b528ca923d5b51e63def9f888af4a77bb40bnicholes usr/share/virtualbox/src/vboxdrv usr/src/vboxdrv-$(ver) \
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 \
dh_gencontrol -- \