rules revision aaae4f8728f4fbd3ef97b8798350ddc6abbc79f0
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# Copyright (C) 2006-2008 Sun Microsystems, Inc.
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# This file is part of VirtualBox Open Source Edition (OSE), as
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# available from http://www.virtualbox.org. This file is free software;
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# you can redistribute it and/or modify it under the terms of the GNU
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# General Public License as published by the Free Software Foundation,
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# distribution. VirtualBox OSE is distributed in the hope that it will
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# be useful, but WITHOUT ANY WARRANTY of any kind.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt#export DH_VERBOSE=1
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# possible overrides:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# OSE=1 force VBOX_OSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# NOPARALLEL=1 compile with -j1
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# LINUX=<dir> compile vboxdrv against Linux found in <dir>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# VERBOSE=1 verbose build
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews# DEBUG=1 debug build
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# NOSUBVER=1 disable generation of the sub-version field (which is
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# either the subversion rev [if available] or the build date)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# NOMODS=1 don't build any module
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# NOQT=1 don't build the Qt GUI
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# HEADLESS=1 build the headless version
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
9c6a5d1f22f972232d7a9fd5c5fa64f10bacbdffAutomatic Updater ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Hack: Xandros is actually Debian/sarge ... :(
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinifneq ($(wildcard /etc/xandros-desktop-version),)
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userdebcfgs := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\""
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# Ubuntu gutsy: gcc-4.1 does not work for the webservices, use gcc-4.2 instead
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User cd $(vboxroot) && ./configure --odir=$(current)/debian $(if \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) $(if \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) $(if \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(filter _Ubuntu_gutsy,$(debrel)),--with-gcc=gcc-4.2 --with-g++=g++-4.2,) $(if \
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater $(HEADLESS),--build-headless,) $(if $(DEBUG),--build-debug,)
77dccf2a5d9327d16b4374a135cdb99bdd48620eAutomatic Updaterbuild: debian/configure-stamp debian/build-stamp
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater $(VERBOSE),--print-directory,--no-print-directory) $(if \
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
47012ae6dbf18a2503d7b33c1c9583dc38625cb7Mark Andrews $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce $(VERBOSE),--print-directory,--no-print-directory) $(if \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# Build modules for every kernel we find in /lib/modules/*
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Usermodules: debian/build-stamp debian/modules-stamp
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User make -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User make -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko; \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User make -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko; \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User rm -f debian/$(package).init debian/vboxdrv.init
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh debian/preinst
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userbinary binary-arch binary-indep: build $(verfile)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# Build architecture-dependent files here.
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userbinary binary-arch binary-indep: build $(if $(NOMODS),,modules)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User install -d -g 0 -o 0 $(prefix)/usr/share/applications
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(if $(NOQT),,mv $(archdir)/VirtualBox.desktop \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(prefix)/usr/share/applications/VirtualBox.desktop)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User -e 's|%VERPKG%|$(verpkg)|g' \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(prefix)/usr/share/lintian/overrides/$(verpkg)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/*.gc $(prefix)/usr/lib/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/*.r0 $(prefix)/usr/lib/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/*.rel $(prefix)/usr/lib/$(package) || true
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/VBoxNetDHCP $(prefix)/usr/lib/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/VBoxNetAdpCtl $(prefix)/usr/lib/$(package)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User mv $(archdir)/*.so $(prefix)/usr/lib/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/VBoxTestOGL $(prefix)/usr/lib/$(package)
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/src $(prefix)/usr/share/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User export VBOX_INSTALL_PATH=/usr/lib/$(package) && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User python ./vboxapisetup.py install --root $(prefix)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/vboxshell.py $(prefix)/usr/lib/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/sdk $(prefix)/usr/lib/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt mv $(archdir)/vboxwebsrv $(prefix)/usr/lib/$(package); \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/webtest $(prefix)/usr/lib/$(package); \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -D -g 0 -o 0 -m 0644 \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -D -g 0 -o 0 -m 0644 \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User install -D -g 0 -o 0 -m 0644 \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $(if $(NOQT),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm LICENSE)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBox) \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
af40ebed6257e4ac1996144530b3de317cf4da11Tinderbox User $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $(if $(ose),,usr/bin/VBox usr/bin/vboxwebsrv) \
9c6a5d1f22f972232d7a9fd5c5fa64f10bacbdffAutomatic Updater usr/share/virtualbox/src/vboxdrv usr/src/vboxdrv-$(ver) \
9c6a5d1f22f972232d7a9fd5c5fa64f10bacbdffAutomatic Updater usr/share/virtualbox/src/vboxnetflt usr/src/vboxnetflt-$(ver) \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt usr/share/virtualbox/src/vboxnetadp usr/src/vboxnetadp-$(ver)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g' \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User -e 's|%PACKAGE%|virtualbox|g' \
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein dh_strip --keep-debug --exclude=libVBoxQtCore.so.4 --exclude=libVBoxQtGui.so.4 --exclude=libVBoxQtNetwork.so.4 --exclude=libqtaccessiblewidgets.so
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User # manually strip our R0/GC modules, dh_strip cannot handle them
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
af40ebed6257e4ac1996144530b3de317cf4da11Tinderbox User $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
56bd026e6c96482dccab83778bf8f9c92c36bf11Tinderbox User mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib
56bd026e6c96482dccab83778bf8f9c92c36bf11Tinderbox User mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -Vdkms=$(if $(filter _Ubuntu_gutsy _Ubuntu_hardy _Ubuntu_intrepid _Ubuntu_jaunty,$(debrel)),dkms,)