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