1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# Copyright (C) 2006-2012 Oracle Corporation
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# available from http://www.virtualbox.org. This file is free software;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# you can redistribute it and/or modify it under the terms of the GNU
d63de4508a08b11f57c307a15eda3cd95485bf2cvboxsync# General Public License (GPL) as published by the Free Software
d63de4508a08b11f57c307a15eda3cd95485bf2cvboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
d63de4508a08b11f57c307a15eda3cd95485bf2cvboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
d63de4508a08b11f57c307a15eda3cd95485bf2cvboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# NOTE: if you make changes to this file, please check if the updates should
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# be also applied to the publicly visible debian/rules file.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#export DH_VERBOSE=1
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# possible overrides:
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# OSE=1 force VBOX_OSE
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# NOPARALLEL=1 compile with -j1
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# LINUX=<dir> compile vboxdrv against Linux found in <dir>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# VERBOSE=1 verbose build
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# DEBUG=1 debug build
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# NOSUBVER=1 disable generation of the sub-version field (which is
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# either the subversion rev [if available] or the build date)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# NOMODS=1 don't build any module
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# NOQT=1 don't build the Qt GUI
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# EFI=1 include the EFI binary from prebuild
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# VERSUFFIX=<suffix> set a particular package version suffix (e.g. _customer)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# HEADLESS=1 build the headless version
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# VNC=1 build VNC code
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# NOWEBSVC=1 don't build the webservice API, default for OSE
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
2c691730ab202620fe427110841aa4e0075b7ccavboxsync# PKGDIR=<path> where to store the final package(s)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# BLEEDING_EDGE=xyz
2c691730ab202620fe427110841aa4e0075b7ccavboxsyncpkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
d02610fd604cc8ab4cccf7e3fa510c06cb728ff2vboxsyncose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsyncNOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncsvnver := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync svn info|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
f03d2f859a6661088b765809ff4feb39bdd7a311vboxsyncdebver :=$(subst _ALPHA,~alpha,$(subst _BETA,~beta,$(subst _RC,~rc,$(subst _OSE,~ose,$(ver)))))$(svnver)$(if \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(BLEEDING_EDGE),-$(BLEEDING_EDGE),)$(VERSUFFIX)$(if \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncdebrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# shipping Linux kernel modules with bleeding-edge releases doesn't make sense
3baadeafd9922582dad9b32431362e6296417dd8vboxsyncinstmod := $(if $(filter _Ubuntu_lucid _Ubuntu_maverick _Ubuntu_natty _Ubuntu_oneiric _Debian_sid,$(debrel)),,1)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync debdist := $(strip $(shell grep $(debrel) $(current)/distributions_deb | cut -d'=' -f2))
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(error package distribution not detected (debrel=$(debrel)))
f2ca52afeb0baed982c05e9d8591e0e4c7539dbdvboxsync# Location of custom built Qt libraries (see below)
08879243dd70cdd8c01c3a5941c82c96c45a7e32vboxsync $(if $(filter _Debian_squeeze,$(debrel)),--build-libvpx,) \
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
080867566ec24e954aac5664d20a8fb364be2ed1vboxsync $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncbld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
a55e600e6aa5a0ba3c6e6da0f5840dc98271b0dcvboxsync $(if $(filter _Debian_squeeze _Ubuntu_lucid,$(debrel)),,VBOX_WITH_VMSVGA3D=1) \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
08879243dd70cdd8c01c3a5941c82c96c45a7e32vboxsync $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
b1212d1cdc6c9396aa851ef0a5388edce69806advboxsync VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
b1212d1cdc6c9396aa851ef0a5388edce69806advboxsync VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
24713061a674af34286ac48ad1433329cdd404f2vboxsync VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
24713061a674af34286ac48ad1433329cdd404f2vboxsync VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# Build modules for every kernel we find in /lib/modules/*
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko); \
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync make -C $(builddir)/bin/src/vboxpci KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync $(builddir)/bin/src/vboxpci/vboxpci.ko $(moddir)/$$(basename $$d)/vboxpci.ko); \
87c50c527af59e43745475c4b8ac907c5f9bc204vboxsync rm -f debian/vboxballoonctrl-service.init debian/vboxautostart-service.init debian/vboxweb-service.init
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# Build architecture-dependent files here.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncbinary binary-arch binary-indep: build $(if $(NOMODS),,modules)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
9d96c11f5e0d0a674be9a3ac26357aba66f24c15vboxsync $(if $(NOQT),,mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo)
61c35c2bbfa3caf6ca8b21f6c11f45c5a796581fvboxsync $(archdir)/scripts/install.sh --package $(package) --root $(prefix) \
61c35c2bbfa3caf6ca8b21f6c11f45c5a796581fvboxsync --prefix /usr $(if $(NOQT),--no-qt) $(if $(ose),--ose) \
61c35c2bbfa3caf6ca8b21f6c11f45c5a796581fvboxsync $(if $(HEADLESS),--headless) $(if $(NOWEBSVC),--no-web-service) \
61c35c2bbfa3caf6ca8b21f6c11f45c5a796581fvboxsync install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync -e 's|%VERPKG%|$(verpkg)|g' \
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko -a -f $$d/vboxpci.ko ]; then \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync install -D -g 0 -o 0 -m 0644 \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync install -D -g 0 -o 0 -m 0644 \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync install -D -g 0 -o 0 -m 0644 \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync install -D -g 0 -o 0 -m 0644 \
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync $$d/vboxpci.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxpci.ko; \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
a48f6e21f8737ef47d30d716171ae2bcb10c3382vboxsync ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync -e 's|%NOLSB%||g' \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync -e 's|%DEBIAN%|yes|g' \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync -e 's|%PACKAGE%|virtualbox|g' \
b723b174d7132ab6bbff3abcd83c92530065f7davboxsync -e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $(vboxroot)/src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
fe7115bba580b609cb1a233f8e08947d0ee0af8dvboxsync cp $(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh debian/vboxballoonctrl-service.init
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync dh_installinit --name=vboxballoonctrl-service --noscripts
fe7115bba580b609cb1a233f8e08947d0ee0af8dvboxsync cp $(vboxroot)/src/VBox/Installer/linux/vboxautostart-service.sh debian/vboxautostart-service.init
87c50c527af59e43745475c4b8ac907c5f9bc204vboxsync dh_installinit --name=vboxautostart-service --noscripts
fe7115bba580b609cb1a233f8e08947d0ee0af8dvboxsync cp $(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh debian/vboxweb-service.init
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync -e 's|%DATE%|$(shell date -R)|g' \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync -e 's|%DEBREL%|$(subst _,~,$(debrel))|g' \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync -e 's|%VERPKG%|$(verpkg)|g' \
f1acc1e99894e016bd1a6ee65c56b3fc064fa4ebvboxsync -e '/#include installer-common.sh/ {' \
f1acc1e99894e016bd1a6ee65c56b3fc064fa4ebvboxsync -e "r $(vboxroot)/src/VBox/Installer/linux/installer-common.sh" \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
f8cec848855143b787264c5456f9015e576b59d8vboxsync $(if $(filter _Ubuntu_hardy _Ubuntu_lucid,$(debrel)),dh_pycentral,dh_python2)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync # for some reason, the Qt libraries couldn't be found on newer releases (e.g. Ubuntu hardy)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps
faa254427e497bb7ee255b22581f40112025e92bvboxsync -Vdkms=$(if $(filter _Debian_lenny,$(debrel)),,dkms)