rules revision 03e380b03da26ad4a2309190f35ba86843d3d824
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk#!/usr/bin/make -f
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk#
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Copyright (C) 2006-2008 Sun Microsystems, Inc.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk#
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# This file is part of VirtualBox Open Source Edition (OSE), as
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# available from http://www.virtualbox.org. This file is free software;
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# you can redistribute it and/or modify it under the terms of the GNU
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# General Public License as published by the Free Software Foundation,
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# distribution. VirtualBox OSE is distributed in the hope that it will
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# be useful, but WITHOUT ANY WARRANTY of any kind.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk#
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk#export DH_VERBOSE=1
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkexport DH_COMPAT=4
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# possible overrides:
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# OSE=1 force VBOX_OSE
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# NOPARALLEL=1 compile with -j1
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# LINUX=<dir> compile vboxdrv against Linux found in <dir>
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# VERBOSE=1 verbose build
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# DEBUG=1 debug build
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# NOSUBVER=1 disable generation of the sub-version field (which is
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# either the subversion rev [if available] or the build date)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# VirtualBox.chm from $HOME
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# NOMODS=1 don't build any module
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# HEADLESS=1 build the headless version
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkpackage := virtualbox
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkverpkg := virtualbox-ose
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkcurrent := $(shell pwd)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkvboxroot := $(shell pwd)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkbuilddir := $(current)/debian/builddir
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkmoddir := $(current)/debian/modules
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkprefix := $(current)/debian/$(verpkg)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkarch := $(shell dpkg --print-architecture)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkverfile := $(builddir)/version-generated.mk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkose := 1
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkNOMODS ?= $(ose)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkifneq ($(wildcard $(verfile)),)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkinclude $(verfile)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkver := $(VBOX_VERSION_STRING)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkarchdir := $(prefix)/opt/VirtualBox-$(ver)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkendif
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkifneq ($(STAGEDISO),)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk endif
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkendif
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Hack: Xandros is actually Debian/sarge ... :(
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkifneq ($(wildcard /etc/xandros-desktop-version),)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk debrel := _xandros4.1
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkelse
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkifneq ($(wildcard /etc/univention),)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk debrel := _ucs1.3
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkelse
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkendif
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkendif
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkgccver := $(subst ., ,$(shell gcc -dumpversion))
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkgccvmaj := $(word 1,$(gccver))
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkgccvmin := $(word 2,$(gccver))
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkdebcfgs := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\""
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkconfigure: debian/configure-stamp
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkdebian/configure-stamp:
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_testdir
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk cd $(vboxroot) && ./configure --odir=$(current)/debian --disable-qt3 $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(shell test $(gccvmaj) -eq 4 -a $(gccvmin) -gt 2 -o $(gccvmaj) -gt 4 && echo "yes"),--with-gcc=gcc-4.2 --with-g++=g++-4.2,) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(HEADLESS),--build-headless,) $(if $(DEBUG),--build-debug,)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk touch debian/configure-stamp
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkbuild: debian/configure-stamp debian/build-stamp
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkdebian/build-stamp $(verfile):
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_testdir
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk . debian/env.sh && kmk -C $(vboxroot) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(VERBOSE),--print-directory,--no-print-directory) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(NOPARALLEL),-j1,) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(NODOCS),VBOX_WITH_DOCS= ,)\
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk AUTOCFG=$(current)/debian/AutoConfig.kmk \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk LOCALCFG=$(current)/debian/LocalConfig.kmk \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk PATH_OUT=$(current)/debian/builddir \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk VBOX_DO_STRIP= VBOX_DO_STRIP_MODULES= \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(debcfgs) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk all
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mkdir -p $(builddir)/bin/additions
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk . debian/env.sh && kmk -C $(vboxroot) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(VERBOSE),--print-directory,--no-print-directory) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk AUTOCFG=$(current)/debian/AutoConfig.kmk \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk LOCALCFG=$(current)/debian/LocalConfig.kmk \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk PATH_OUT=$(current)/debian/builddir \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk VBOX_DO_STRIP= VBOX_DO_STRIP_MODULES= \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk VBOX_NO_LINUX_RUN_INSTALLER=1 \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(debcfgs) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk packing
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk touch debian/build-stamp
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Build modules for every kernel we find in /lib/modules/*
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkmodules: debian/build-stamp debian/modules-stamp
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkdebian/modules-stamp: debian/build-stamp
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rm -rf $(moddir)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mkdir $(moddir)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk make -C $(builddir)/bin/src/vboxdrv clean
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk for d in $(wildcard /lib/modules/*); do \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if [ -L $$d/build ]; then \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk make -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -D -m 0644 -g 0 -o 0 \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko && \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk make -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -D -m 0644 -g 0 -o 0 \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk fi; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk done
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk make -C $(builddir)/bin/src/vboxdrv clean
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk make -C $(builddir)/bin/src/vboxnetflt clean
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk touch debian/modules-stamp
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkclean:
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_testdir
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_testroot
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rm -f debian/$(package).init debian/vboxdrv.init
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh debian/preinst
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rm -rf $(builddir) $(moddir)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_clean
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkifeq ($(VBOX_VERSION_MAJOR),)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkbinary binary-arch binary-indep: build $(verfile)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(MAKE) -f debian/rules binary
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkelse
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Build architecture-dependent files here.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkbinary binary-arch binary-indep: build $(if $(NOMODS),,modules)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_testdir
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_testroot
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_clean -k
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_installdirs
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -d -g 0 -o 0 $(prefix)/usr/share/applications
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -d -g 0 -o 0 $(prefix)/usr/lib
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -d -g 0 -o 0 $(prefix)/usr/bin
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(HEADLESS),,mv $(archdir)/VirtualBox.desktop \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(prefix)/usr/share/applications/VirtualBox.desktop)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -D -g 0 -o 0 -m 644 debian/lintian-override \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(prefix)/usr/share/lintian/overrides/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/VBox.png \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(prefix)/usr/share/pixmaps/VBox.png
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/*.gc $(prefix)/usr/lib/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/*.r0 $(prefix)/usr/lib/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(filter amd64,$(arch)),\
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/VBoxREM2.rel $(prefix)/usr/lib/$(package),)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/*.so $(prefix)/usr/lib/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(HEADLESS),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/src $(prefix)/usr/share/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rm $(archdir)/VBox.sh
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(HEADLESS),,VirtualBox) $(if $(ose),,VBoxVRDP) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk VBoxHeadless; do \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(NOMODS),,for d in $(moddir)/*; do \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -D -g 0 -o 0 -m 0644 \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk install -D -g 0 -o 0 -m 0644 \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk done)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkifeq ($(ose),)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(HEADLESS),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_installdocs \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk LICENSE
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm LICENSE)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rmdir $(archdir)/additions
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkelse
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_installdocs
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkendif
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rmdir $(archdir)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rmdir $(prefix)/opt
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_link \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(HEADLESS),,usr/bin/VBox usr/bin/VirtualBox) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk usr/bin/VBox usr/bin/VBoxManage \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk usr/bin/VBox usr/bin/VBoxHeadless \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk usr/share/virtualbox/src/vboxdrv usr/src/vboxdrv-$(ver) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk usr/share/virtualbox/src/vboxnetflt usr/src/vboxnetflt-$(ver)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_desktop
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_installmenu
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(NOMODS),,dh_installmodules)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk sed \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g' \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk -e 's|%PACKAGE%|virtualbox|g' \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_installinit --name=vboxdrv
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk cat debian/postrm.dapper > debian/postrm; fi
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_installdebconf
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_installchangelogs
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_link
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_strip --keep-debug --exclude=libVBoxQtCore.so.4 --exclude=libVBoxQtGui.so.4 --exclude=libVBoxQtNetwork.so.4 --exclude=libqtaccessiblewidgets.so
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk # manually strip our R0/GC modules, dh_strip cannot handle them
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk for f in \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk objcopy --only-keep-debug \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $$f \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk strip -S --remove-section=.comment $$f; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk done
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_compress -X.pdf -X.chm -X LICENSE
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_fixperms
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_makeshlibs
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_installdeb
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_perl
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_shlibdeps
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_gencontrol -- \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk -Valsa=$(if $(HEADLESS),,libasound2) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk -Vpulse=$(if $(HEADLESS),,libpulse0) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk -Vdkms=$(if $(filter _Ubuntu_gutsy _Ubuntu_hardy _Ubuntu_intrepid,$(debrel)),dkms,)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_md5sums
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk dh_builddeb
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkendif
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk.PHONY: binary modules binary-arch binary-indep clean checkroot
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk