rules revision 03e380b03da26ad4a2309190f35ba86843d3d824
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Copyright (C) 2006-2008 Sun Microsystems, Inc.
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#export DH_VERBOSE=1
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# 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 $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Hack: Xandros is actually Debian/sarge ... :(
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkdebcfgs := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\""
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
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 $(VERBOSE),--print-directory,--no-print-directory) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(VERBOSE),--print-directory,--no-print-directory) $(if \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk# Build modules for every kernel we find in /lib/modules/*
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 $(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 $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko; \
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# Build architecture-dependent files here.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkbinary binary-arch binary-indep: build $(if $(NOMODS),,modules)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
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.4 $(prefix)/usr/lib/$(package) || true
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(if $(HEADLESS),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
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 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 $(if $(HEADLESS),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm LICENSE)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk usr/share/virtualbox/src/vboxdrv usr/src/vboxdrv-$(ver) \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk usr/share/virtualbox/src/vboxnetflt usr/src/vboxnetflt-$(ver)
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 cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
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 $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk -Vdkms=$(if $(filter _Ubuntu_gutsy _Ubuntu_hardy _Ubuntu_intrepid,$(debrel)),dkms,)