rules revision 03e380b03da26ad4a2309190f35ba86843d3d824
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# Copyright (C) 2006-2008 Sun Microsystems, Inc.
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# This file is part of VirtualBox Open Source Edition (OSE), as
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# available from http://www.virtualbox.org. This file is free software;
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# you can redistribute it and/or modify it under the terms of the GNU
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# General Public License as published by the Free Software Foundation,
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# distribution. VirtualBox OSE is distributed in the hope that it will
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# be useful, but WITHOUT ANY WARRANTY of any kind.
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny#export DH_VERBOSE=1
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# possible overrides:
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# OSE=1 force VBOX_OSE
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# NOPARALLEL=1 compile with -j1
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# LINUX=<dir> compile vboxdrv against Linux found in <dir>
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# VERBOSE=1 verbose build
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# DEBUG=1 debug build
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# NOSUBVER=1 disable generation of the sub-version field (which is
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# either the subversion rev [if available] or the build date)
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# NOMODS=1 don't build any module
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher# HEADLESS=1 build the headless version
fae99bfe4bfc8b4a12e9c2a0ad01b3684c22f934Simo Sorce# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
684d1b48b5582a1bf7812b8c3c663592dc6dfed9Pavel Březina $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# Hack: Xandros is actually Debian/sarge ... :(
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
f26c954658dfd7461f290f0b5d924951a6db219aJan Zelenydebcfgs := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\""
4c08db0fb0dda3d27b1184248ca5c800d7ce23f0Michal Zidek# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
e0243c7f3638c819051b7235097a0bb2d06374fbJakub Hrozek cd $(vboxroot) && ./configure --odir=$(current)/debian --disable-qt3 $(if \
83bf46f4066e3d5e838a32357c201de9bd6ecdfdNikolai Kondrashov $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) $(if \
15b5d885e28afcd6c3c19f900eea2a8e00c3e6d3Sumit Bose $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) $(if \
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov $(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 \
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny $(HEADLESS),--build-headless,) $(if $(DEBUG),--build-debug,)
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashovbuild: debian/configure-stamp debian/build-stamp
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny $(VERBOSE),--print-directory,--no-print-directory) $(if \
326f4fc3125e155ee2d484fe921aafddd6b5a49dPavel Březina $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
b56b06e199f15a8a840b36bc7cb8010e39ae761dSumit Bose $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
21d485184df986e1a123f70c689517386e51a5ceMichal Zidek $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
21d485184df986e1a123f70c689517386e51a5ceMichal Zidek $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov . debian/env.sh && kmk -C $(vboxroot) $(if \
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov $(VERBOSE),--print-directory,--no-print-directory) $(if \
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny# Build modules for every kernel we find in /lib/modules/*
bfd59d1a2d0d45125e5164ef12c425690d519f61Jakub Hrozekmodules: debian/build-stamp debian/modules-stamp
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
75dd4b05e1dacc76dc9d5f16be31978f84a71dc5Sumit Bose make -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
75dd4b05e1dacc76dc9d5f16be31978f84a71dc5Sumit Bose $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko && \
75dd4b05e1dacc76dc9d5f16be31978f84a71dc5Sumit Bose make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
75dd4b05e1dacc76dc9d5f16be31978f84a71dc5Sumit Bose (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
75dd4b05e1dacc76dc9d5f16be31978f84a71dc5Sumit Bose make -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all && \
75dd4b05e1dacc76dc9d5f16be31978f84a71dc5Sumit Bose $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko; \
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov make -C $(builddir)/bin/src/vboxdrv clean
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher rm -f debian/$(package).init debian/vboxdrv.init
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh debian/preinst
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
8be5e4497e5008f7807178acdfcbf97365ec4e73Stephen Gallagherbinary binary-arch binary-indep: build $(verfile)
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov# Build architecture-dependent files here.
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashovbinary binary-arch binary-indep: build $(if $(NOMODS),,modules)
c20a339d54b39120b4051f690ca759e6d079f177Stephen Gallagher tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov install -d -g 0 -o 0 $(prefix)/usr/share/applications
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher $(if $(HEADLESS),,mv $(archdir)/VirtualBox.desktop \
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher $(prefix)/usr/share/applications/VirtualBox.desktop)
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher install -D -g 0 -o 0 -m 644 debian/lintian-override \
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov $(prefix)/usr/share/lintian/overrides/$(package)
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov mv $(archdir)/*.gc $(prefix)/usr/lib/$(package)
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov mv $(archdir)/*.r0 $(prefix)/usr/lib/$(package)
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher mv $(archdir)/VBoxREM2.rel $(prefix)/usr/lib/$(package),)
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
83bf46f4066e3d5e838a32357c201de9bd6ecdfdNikolai Kondrashov mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
83bf46f4066e3d5e838a32357c201de9bd6ecdfdNikolai Kondrashov mv $(archdir)/*.so $(prefix)/usr/lib/$(package)
21d485184df986e1a123f70c689517386e51a5ceMichal Zidek mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
58d02e0d3d6d48c97fccdb2ad7212e065671ad6dStephen Gallagher $(if $(HEADLESS),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny $(if $(HEADLESS),,VirtualBox) $(if $(ose),,VBoxVRDP) \
108db0e3b9e06e530364ef8228634f5e3f6bd3b5Jakub Hrozek mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny install -D -g 0 -o 0 -m 0644 \
1d93029624d708119bbf803e6647a2cbb271f001Sumit Bose $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
1d93029624d708119bbf803e6647a2cbb271f001Sumit Bose install -D -g 0 -o 0 -m 0644 \
1d93029624d708119bbf803e6647a2cbb271f001Sumit Bose $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
56e88cd5f3501566778b138e4934ee8e7f3fa674Lukas Slebodnik $(if $(HEADLESS),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
56e88cd5f3501566778b138e4934ee8e7f3fa674Lukas Slebodnik $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
56e88cd5f3501566778b138e4934ee8e7f3fa674Lukas Slebodnik rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm LICENSE)
56e88cd5f3501566778b138e4934ee8e7f3fa674Lukas Slebodnik for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
108db0e3b9e06e530364ef8228634f5e3f6bd3b5Jakub Hrozek mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
108db0e3b9e06e530364ef8228634f5e3f6bd3b5Jakub Hrozek if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
b9fbeb75e7a4f50f98d979a70a710f9221892483Lukas Slebodnik $(if $(HEADLESS),,usr/bin/VBox usr/bin/VirtualBox) \
b9fbeb75e7a4f50f98d979a70a710f9221892483Lukas Slebodnik $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
b9fbeb75e7a4f50f98d979a70a710f9221892483Lukas Slebodnik $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
b9fbeb75e7a4f50f98d979a70a710f9221892483Lukas Slebodnik usr/share/virtualbox/src/vboxdrv usr/src/vboxdrv-$(ver) \
b9fbeb75e7a4f50f98d979a70a710f9221892483Lukas Slebodnik usr/share/virtualbox/src/vboxnetflt usr/src/vboxnetflt-$(ver)
bfd59d1a2d0d45125e5164ef12c425690d519f61Jakub Hrozek -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g' \
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov -e 's|%PACKAGE%|virtualbox|g' \
d115f40c7a3999e3cbe705a2ff9cf0fd493f80fbMichal Zidek src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
108db0e3b9e06e530364ef8228634f5e3f6bd3b5Jakub Hrozek cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny dh_strip --keep-debug --exclude=libVBoxQtCore.so.4 --exclude=libVBoxQtGui.so.4 --exclude=libVBoxQtNetwork.so.4 --exclude=libqtaccessiblewidgets.so
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny # manually strip our R0/GC modules, dh_strip cannot handle them
83bf46f4066e3d5e838a32357c201de9bd6ecdfdNikolai Kondrashov $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
21d485184df986e1a123f70c689517386e51a5ceMichal Zidek $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
f26c954658dfd7461f290f0b5d924951a6db219aJan Zeleny mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov -Vdkms=$(if $(filter _Ubuntu_gutsy _Ubuntu_hardy _Ubuntu_intrepid,$(debrel)),dkms,)