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
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# Copyright (C) 2006-2012 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
cc4463d266cc5b433b63b2231570a9f77c126ab6vboxsync# General Public License (GPL) as published by the Free Software
cc4463d266cc5b433b63b2231570a9f77c126ab6vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
cc4463d266cc5b433b63b2231570a9f77c126ab6vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
cc4463d266cc5b433b63b2231570a9f77c126ab6vboxsync# hope that it will 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
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# EFI=1 include the EFI binary from prebuild
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# HEADLESS=1 build the headless version
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# VNC=1 build VNC code
1deb4de12fed2ad1932401517862e6b5dc5466a3vboxsync# NOWEBSVC=1 don't build the webservice API, default for OSE
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# PKGDIR=<path> where to store the final package(s)
3e66da17d5b68a6f1a06c60e88a7c9967b0ab2a4vboxsync# BLEEDING_EDGE=xyz
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsyncpkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ..; pwd))
d02610fd604cc8ab4cccf7e3fa510c06cb728ff2vboxsyncose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
e1f397485a50a958c625b4d709c052aa2687a4fbvboxsyncNOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsyncdebrel := $(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
3baadeafd9922582dad9b32431362e6296417dd8vboxsyncinstmod := $(if $(filter _Ubuntu_lucid _Ubuntu_maverick _Ubuntu_natty _Ubuntu_oneiric _Debian_sid,$(debrel)),,1)
f2ca52afeb0baed982c05e9d8591e0e4c7539dbdvboxsync# Location of custom built Qt libraries (see below)
7844117ae695bae70a2f8f67fcbf5d44a74dce41vboxsync $(if $(filter _Debian_squeeze,$(debrel)),--build-libvpx,) \
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
080867566ec24e954aac5664d20a8fb364be2ed1vboxsync $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
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) \
7844117ae695bae70a2f8f67fcbf5d44a74dce41vboxsync $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),)
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,)
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
9448344dffd6329c43c735ae1ed5f45995e445e6vboxsync . 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 \
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); \
f5253a692b2a71d484d5daff564934d85501ae28vboxsync make -C $(builddir)/bin/src/vboxpci KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
f5253a692b2a71d484d5daff564934d85501ae28vboxsync (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
f5253a692b2a71d484d5daff564934d85501ae28vboxsync make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
f5253a692b2a71d484d5daff564934d85501ae28vboxsync $(builddir)/bin/src/vboxpci/vboxpci.ko $(moddir)/$$(basename $$d)/vboxpci.ko); \
6898070acb4aa64f0a0f79deb1825578504f70c4vboxsync rm -f debian/vboxballoonctrl-service.init debian/vboxautostart-service.init debian/vboxweb-service.init
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
69f57565f5243a46f1df060b63d0fd830de3be04vboxsync rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
60b3bb99d58c291474ef79573ae7738ce769fdbbvboxsync rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
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
d9ac61b943b6e9f8a1c79a40c0c19d6a1479c218vboxsync $(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)
097b3079a919c94052ca642306232b856949c755vboxsync install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
097b3079a919c94052ca642306232b856949c755vboxsync -e 's|%VERPKG%|$(verpkg)|g' \
f5253a692b2a71d484d5daff564934d85501ae28vboxsync if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko -a -f $$d/vboxpci.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; \
f5253a692b2a71d484d5daff564934d85501ae28vboxsync install -D -g 0 -o 0 -m 0644 \
f5253a692b2a71d484d5daff564934d85501ae28vboxsync $$d/vboxpci.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxpci.ko; \
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
d15ded1860cf912f2cc68494b6ba42691a40ebd4vboxsync ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync -e 's|%NOLSB%||g' \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync -e 's|%DEBIAN%|yes|g' \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync -e 's|%PACKAGE%|virtualbox|g' \
f2ca52afeb0baed982c05e9d8591e0e4c7539dbdvboxsync -e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync $(vboxroot)/src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
8dae68786113603556a96d329c751a3367849f70vboxsync cp $(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh debian/vboxballoonctrl-service.init
f2ca52afeb0baed982c05e9d8591e0e4c7539dbdvboxsync dh_installinit --name=vboxballoonctrl-service --noscripts
8dae68786113603556a96d329c751a3367849f70vboxsync cp $(vboxroot)/src/VBox/Installer/linux/vboxautostart-service.sh debian/vboxautostart-service.init
6898070acb4aa64f0a0f79deb1825578504f70c4vboxsync dh_installinit --name=vboxautostart-service --noscripts
8dae68786113603556a96d329c751a3367849f70vboxsync cp $(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh debian/vboxweb-service.init
4a4856069da3a44c647c802b7df4f0c9ae1ea179vboxsync -e '/#include installer-common.sh/ {' \
4a4856069da3a44c647c802b7df4f0c9ae1ea179vboxsync -e "r $(vboxroot)/src/VBox/Installer/linux/installer-common.sh" \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
46888b0c9f72cc9089f1a92b0476a1e8d637efcevboxsync $(if $(filter _Ubuntu_hardy _Ubuntu_lucid,$(debrel)),dh_pycentral,dh_python2)
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps
4a4856069da3a44c647c802b7df4f0c9ae1ea179vboxsync -Vdkms=$(if $(filter _Debian_lenny,$(debrel)),,dkms)