rules revision 2b66a097b19f31e00af3abc508a3ff8c74ca1f8a
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd# Copyright (C) 2006-2008 Sun Microsystems, Inc.
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd# This file is part of VirtualBox Open Source Edition (OSE), as
252b32956857ad89fc9ee708c4c6eb36097a647cerikabele# available from http://www.virtualbox.org. This file is free software;
252b32956857ad89fc9ee708c4c6eb36097a647cerikabele# you can redistribute it and/or modify it under the terms of the GNU
252b32956857ad89fc9ee708c4c6eb36097a647cerikabele# General Public License as published by the Free Software Foundation,
5a58787efeb02a1c3f06569d019ad81fd2efa06end# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc# distribution. VirtualBox OSE is distributed in the hope that it will
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim# be useful, but WITHOUT ANY WARRANTY of any kind.
2e545ce2450a9953665f701bb05350f0d3f26275nd#export DH_VERBOSE=1
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim# possible overrides:
5a58787efeb02a1c3f06569d019ad81fd2efa06end# OSE=1 force VBOX_OSE
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen# NOPARALLEL=1 compile with -j1
3f08db06526d6901aa08c110b5bc7dde6bc39905nd# LINUX=<dir> compile vboxdrv against Linux found in <dir>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim# VERBOSE=1 verbose build
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim# DEBUG=1 debug build
5a58787efeb02a1c3f06569d019ad81fd2efa06end# NOSUBVER=1 disable generation of the sub-version field (which is
3f08db06526d6901aa08c110b5bc7dde6bc39905nd# either the subversion rev [if available] or the build date)
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim# NOMODS=1 don't build any module
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim# NOQT=1 don't build the Qt GUI
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd# HEADLESS=1 build the headless version
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
c220c423f3f52b735e1139bfd6509c470f0680e6wrowe ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
9022cb0c6e36ea5146f2da78780c6b4e43064445kess# Hack: Xandros is actually Debian/sarge ... :(
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
e50df6c711553f98103f1e0802f7de8c59be7cddslivedebcfgs := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\""
91dbfe27f56a07b53ec19068fdb47581476d5c3brbowen# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen# Ubuntu gutsy: gcc-4.1 does not work for the webservices, use gcc-4.2 instead
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen cd $(vboxroot) && ./configure --odir=$(current)/debian $(if \
91dbfe27f56a07b53ec19068fdb47581476d5c3brbowen $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) $(if \
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) $(if \
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen $(filter _Ubuntu_gutsy,$(debrel)),--with-gcc=gcc-4.2 --with-g++=g++-4.2,) $(if \
f3d26cfe4b5162a4dcbff933d74798b16806548alars $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
f3d26cfe4b5162a4dcbff933d74798b16806548alars $(HEADLESS),--build-headless,) $(if $(DEBUG),--build-debug,)
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen $(VERBOSE),--print-directory,--no-print-directory) $(if \
9022cb0c6e36ea5146f2da78780c6b4e43064445kess $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
9022cb0c6e36ea5146f2da78780c6b4e43064445kess $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
c220c423f3f52b735e1139bfd6509c470f0680e6wrowe $(VERBOSE),--print-directory,--no-print-directory) $(if \
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim# Build modules for every kernel we find in /lib/modules/*
9022cb0c6e36ea5146f2da78780c6b4e43064445kess make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
c220c423f3f52b735e1139bfd6509c470f0680e6wrowe make -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
9022cb0c6e36ea5146f2da78780c6b4e43064445kess $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko && \
c220c423f3f52b735e1139bfd6509c470f0680e6wrowe make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
e50df6c711553f98103f1e0802f7de8c59be7cddslive (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
e50df6c711553f98103f1e0802f7de8c59be7cddslive make -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
91dbfe27f56a07b53ec19068fdb47581476d5c3brbowen $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko; \
e50df6c711553f98103f1e0802f7de8c59be7cddslive make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
e50df6c711553f98103f1e0802f7de8c59be7cddslive (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
e50df6c711553f98103f1e0802f7de8c59be7cddslive make -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko; \
6ec3b97fc9c9f163cfaae67fc448eea3f887f34dslive rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh debian/preinst
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
91dbfe27f56a07b53ec19068fdb47581476d5c3brbowen# Build architecture-dependent files here.
e50df6c711553f98103f1e0802f7de8c59be7cddslivebinary binary-arch binary-indep: build $(if $(NOMODS),,modules)
91dbfe27f56a07b53ec19068fdb47581476d5c3brbowen tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
91dbfe27f56a07b53ec19068fdb47581476d5c3brbowen -e 's|%VERPKG%|$(verpkg)|g' \
91dbfe27f56a07b53ec19068fdb47581476d5c3brbowen mv $(archdir)/*.rel $(prefix)/usr/lib/$(package) || true
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen mv $(archdir)/VBoxNetDHCP $(prefix)/usr/lib/$(package)
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim mv $(archdir)/VBoxNetAdpCtl $(prefix)/usr/lib/$(package)
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
91dbfe27f56a07b53ec19068fdb47581476d5c3brbowen mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
e50df6c711553f98103f1e0802f7de8c59be7cddslive mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
f424f8ab092d3a97ceb8ff61144fb313d467fa41slive $(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
e50df6c711553f98103f1e0802f7de8c59be7cddslive install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
e50df6c711553f98103f1e0802f7de8c59be7cddslive mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
e50df6c711553f98103f1e0802f7de8c59be7cddslive for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
9022cb0c6e36ea5146f2da78780c6b4e43064445kess mv $(archdir)/vboxwebsrv $(prefix)/usr/lib/$(package); \
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim install -D -g 0 -o 0 -m 0644 \
252b32956857ad89fc9ee708c4c6eb36097a647cerikabele $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
252b32956857ad89fc9ee708c4c6eb36097a647cerikabele install -D -g 0 -o 0 -m 0644 \
252b32956857ad89fc9ee708c4c6eb36097a647cerikabele $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
252b32956857ad89fc9ee708c4c6eb36097a647cerikabele install -D -g 0 -o 0 -m 0644 \
252b32956857ad89fc9ee708c4c6eb36097a647cerikabele $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
c220c423f3f52b735e1139bfd6509c470f0680e6wrowe $(if $(NOQT),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
c220c423f3f52b735e1139bfd6509c470f0680e6wrowe $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
c220c423f3f52b735e1139bfd6509c470f0680e6wrowe rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm LICENSE)
c220c423f3f52b735e1139bfd6509c470f0680e6wrowe for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
f424f8ab092d3a97ceb8ff61144fb313d467fa41slive if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen usr/share/virtualbox/src/vboxdrv usr/src/vboxdrv-$(ver) \
5a58787efeb02a1c3f06569d019ad81fd2efa06end usr/share/virtualbox/src/vboxnetflt usr/src/vboxnetflt-$(ver) \
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd usr/share/virtualbox/src/vboxnetadp usr/src/vboxnetadp-$(ver)
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g' \
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim -e 's|%PACKAGE%|virtualbox|g' \
794694a8414fd0e0cdd534906995648ff5f3532crpluem src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
727872d18412fc021f03969b8641810d8896820bhumbedooh cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
0d0ba3a410038e179b695446bb149cce6264e0abnd if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
727872d18412fc021f03969b8641810d8896820bhumbedooh dh_strip --keep-debug --exclude=libVBoxQtCore.so.4 --exclude=libVBoxQtGui.so.4 --exclude=libVBoxQtNetwork.so.4 --exclude=libqtaccessiblewidgets.so
0d0ba3a410038e179b695446bb149cce6264e0abnd # manually strip our R0/GC modules, dh_strip cannot handle them
0d0ba3a410038e179b695446bb149cce6264e0abnd $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
0d0ba3a410038e179b695446bb149cce6264e0abnd $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
727872d18412fc021f03969b8641810d8896820bhumbedooh objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \