rules revision e2a0570d35035f00c593417795f2e37b1d4a3242
0887a65d2e1f7d938381bed11e859caed56cb47evboxsync# 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
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# 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
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync# NOQT=1 don't build the Qt GUI
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# HEADLESS=1 build the headless version
1deb4de12fed2ad1932401517862e6b5dc5466a3vboxsync# NOWEBSVC=1 don't build the webservice API, default for OSE
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
3e66da17d5b68a6f1a06c60e88a7c9967b0ab2a4vboxsync# BLEEDING_EDGE=xyz
e1f397485a50a958c625b4d709c052aa2687a4fbvboxsyncNOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Hack: Xandros is actually Debian/sarge ... :(
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# shipping Linux kernel modules with bleeding-edge releases doesn't make sense
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsyncinstmod := $(if $(filter _Ubuntu_karmic _Debian_sid,$(debrel)),,1)
1deb4de12fed2ad1932401517862e6b5dc5466a3vboxsync# Locations of custom built Qt libraries (see below)
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(filter _Ubuntu_gutsy,$(debrel)),--with-gcc=gcc-4.2 --with-g++=g++-4.2,) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(filter _xandros4.1 _ucs1.3 _Debian_sarge _Ubuntu_dapper,$(debrel)),--build-libxml2,) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(filter _xandros4.1 _ucs1.3 _Debian_sarge _Ubuntu_dapper,$(debrel)),--build-libxslt,) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(filter _Debian_etch,$(debrel)),$(if $(ose),,--build-libcurl),) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(filter _Debian_sarge _xandros4.1 _ucs1.3,$(debrel)),--with-qt4-dir=$(qtstdc5)) \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync $(if $(filter _Debian_etch _Ubuntu_dapper _Ubuntu_edgy _Ubuntu_feisty _Ubuntu_gutsy _Ubuntu_hardy,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(filter _Debian_sarge _Ubuntu_dapper _Ubuntu_edgy _xandros4.1 _ucs1.3,$(debrel)),--disable-pulse,) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsyncbld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
9448344dffd6329c43c735ae1ed5f45995e445e6vboxsync $(if $(filter _Debian_sarge _xandros4.1 _ucs1.3,$(debrel)),VBOX_LD_as_needed= ,) \
9448344dffd6329c43c735ae1ed5f45995e445e6vboxsync $(if $(filter _Debian_etch _Ubuntu_hardy,$(debrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
13c94cb9d95cf4865646e86b944c09e1af2fe48cvboxsync# Ubuntu gutsy: gcc-4.1 does not work for the webservices, use gcc-4.2 instead
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
9448344dffd6329c43c735ae1ed5f45995e445e6vboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
1deb4de12fed2ad1932401517862e6b5dc5466a3vboxsync $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
1deb4de12fed2ad1932401517862e6b5dc5466a3vboxsync $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
9448344dffd6329c43c735ae1ed5f45995e445e6vboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
1deb4de12fed2ad1932401517862e6b5dc5466a3vboxsync VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Build modules for every kernel we find in /lib/modules/*
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko); \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
69f57565f5243a46f1df060b63d0fd830de3be04vboxsync rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Build architecture-dependent files here.
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsyncbinary binary-arch binary-indep: build $(if $(NOMODS),,modules)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync install -d -g 0 -o 0 $(prefix)/usr/share/applications
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
10aa2d962b3a99120bb34c055fd5ba35da31bbb1vboxsync $(prefix)/usr/share/applications/virtualbox.desktop)
097b3079a919c94052ca642306232b856949c755vboxsync install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
097b3079a919c94052ca642306232b856949c755vboxsync -e 's|%VERPKG%|$(verpkg)|g' \
cb1c9aee152f51cd97c07794ca4e0441b2444b0cvboxsync mv $(archdir)/VBoxEFI32.fd $(prefix)/usr/lib/$(package)
cb1c9aee152f51cd97c07794ca4e0441b2444b0cvboxsync mv $(archdir)/VBoxEFI64.fd $(prefix)/usr/lib/$(package)
6e2490fe643cb292ee8e37f9e1d7171e9315129cvboxsync mv $(archdir)/*.rel $(prefix)/usr/lib/$(package) || true
917d66601860f75830cb684385ba7b4d73458bcavboxsync mv $(archdir)/VBoxNetDHCP $(prefix)/usr/lib/$(package)
917d66601860f75830cb684385ba7b4d73458bcavboxsync mv $(archdir)/VBoxNetAdpCtl $(prefix)/usr/lib/$(package)
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
e2a0570d35035f00c593417795f2e37b1d4a3242vboxsync mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
9c3bee32a5fb0decbd644a998a3d37035bb9800dvboxsync $(if $(NOQT),,mv $(archdir)/VBoxTestOGL $(prefix)/usr/lib/$(package))
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync $(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
b32ffdb7bf463438d3ca07e4089957284c9908c7vboxsync mv $(archdir)/vboxshell.py $(prefix)/usr/lib/$(package)
9d473abea9a9b6597b2b20bedc950ba33a2e73a5vboxsync install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
7e958a4329e4f9d83f597e26c72121969091e87bvboxsync mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
f3f687b00a9f7c98dc0b81899090bc5f659ae7bdvboxsync for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko ]; then \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync install -D -g 0 -o 0 -m 0644 \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync install -D -g 0 -o 0 -m 0644 \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync install -D -g 0 -o 0 -m 0644 \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync $(if $(NOQT),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm LICENSE)
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsync for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
61ad2dd000a26df2101176cc74bd531bb18020devboxsync $(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync usr/share/virtualbox/src/vboxdrv usr/src/vboxdrv-$(ver) \
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync usr/share/virtualbox/src/vboxnetflt usr/src/vboxnetflt-$(ver) \
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync usr/share/virtualbox/src/vboxnetadp usr/src/vboxnetadp-$(ver)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g' \
ed5e4f6195dae44fd45ec21052b1931eb8c5d313vboxsync -e 's|%DEBIAN%|yes|g' \
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync -e 's|%PACKAGE%|virtualbox|g' \
5b802b5e11fed6e163afca32e9118d2599d312fbvboxsync src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
bcc2356dccf06ea3fdd1f3e4d4e62b04e95673d0vboxsync cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync cat debian/postinst.in | sed -e 's|%VER%|$(ver)|g' > debian/postinst
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync # manually strip our R0/GC modules, dh_strip cannot handle them
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync -Vdkms=$(if $(filter _Ubuntu_gutsy _Ubuntu_hardy _Ubuntu_intrepid _Ubuntu_jaunty _Ubuntu_karmic,$(debrel)),dkms,)