VirtualBox

source: vbox/trunk/debian/rules@ 91627

Last change on this file since 91627 was 90414, checked in by vboxsync, 3 years ago

debian/control, src/VBox/Installer/linux/debian/control: Remove dependency on python (intentionally left out!), and add comments making clear that this shouldn't re-added even if it fixes a warning.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 15.0 KB
Line 
1#!/usr/bin/make -f
2# $Id: rules 90414 2021-07-29 17:45:26Z vboxsync $
3## @file
4# VirtualBox rules.
5#
6
7#
8# Copyright (C) 2006-2020 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18
19#export DH_VERBOSE=1
20
21# possible overrides:
22# OSE=1 force VBOX_OSE
23# NOPARALLEL=1 compile with -j1
24# LINUX=<dir> compile vboxdrv against Linux found in <dir>
25# VERBOSE=1 verbose build
26# DEBUG=1 debug build
27# NOSUBVER=1 disable generation of the sub-version field (which is
28# either the subversion rev [if available] or the build date)
29# NODOCS=1 don't build docs, use precompiled UserManual*.pdf and
30# maybe UserManual*.qch and UserManual*.qhc from $(vboxroot)/prebuild
31# NOMODS=1 don't build any module
32# NOQT=1 don't build the Qt GUI
33# NOSDL=1 don't build VBoxSDL
34# EFI=1 include the EFI binary from prebuild
35# HEADLESS=1 build the headless version
36# VNC=1 build VNC code
37# NOWEBSVC=1 don't build the webservice API
38# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
39# PKGDIR=<path> where to store the final package(s)
40# svn_revision=xxx do not depend on subversion being available, but use this
41# hard-coded revision number instead
42#
43# NODOCS will be set if UserManual*.pdf, UserManual*.qch and UserManual*.qhc are
44# placed in $(vboxroot)/prebuild.
45# STAGEDISO will be set if VBoxGuestAdditions.iso is placed there.
46#
47# Wine will not be required if STAGEDISO is set.
48
49package := virtualbox
50verpkg := virtualbox-ose
51vboxroot := $(shell while ! test -r configure && ! test "$$PWD" = "/"; do cd ..; done; pwd)
52debroot := $(vboxroot)
53instlin := $(vboxroot)/src/VBox/Installer/linux
54pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd $(vboxroot)/..; pwd))
55outdir := $(if $(PATH_OUT_BASE),$(PATH_OUT_BASE),$(vboxroot))/out
56bldbase := $(outdir)/debian
57builddir := $(bldbase)/builddir
58moddir := $(bldbase)/modules
59prefix := $(bldbase)/$(verpkg)
60arch := $(shell dpkg --print-architecture)
61verfile := $(builddir)/version-generated.mk
62ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
63
64NOMODS ?= $(ose)
65NOQT ?= $(HEADLESS)
66NOSDL ?= $(HEADLESS)
67NOWEBSVC ?=
68EFI ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxEFI32.fd $(vboxroot)/prebuild/VBoxEFI64.fd),1,)
69NODOCS ?= $(if $(wildcard $(addprefix $(vboxroot)/prebuild/,UserManual*.pdf UserManual*.qch UserManual*.qhc)),1,)
70STAGEDISO ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxGuestAdditions.iso),$(vboxroot)/prebuild,)
71NOWINE := $(if $(STAGEDISO),1,$(ose))
72PYTHON := $(firstword $(shell which python3) $(shell which python))
73
74DEBPKGFILES := changelog compat control dirs postinst postrm preinst prerm rules templates
75
76ifneq ($(STAGEDISO),)
77 ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
78 $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
79 endif
80endif
81
82# Replicate debian package buildfiles to $(bldbase)
83ifneq ($(shell pwd),$(outdir))
84cmd := $(filter-out all Makefile,$(MAKECMDGOALS))
85all:
86 mkdir -p $(bldbase)
87 ln -sf $(addprefix $(debroot)/debian/,$(DEBPKGFILES)) $(bldbase)
88 +$(MAKE) -C $(outdir) -f debian/rules $(cmd)
89
90Makefile:
91
92$(cmd): all
93
94.PHONY: all $(MAKECMDGOALS)
95
96else
97 ifneq ($(wildcard $(verfile)),)
98include $(verfile)
99ver := $(VBOX_VERSION_STRING)
100archdir := $(prefix)/opt/VirtualBox-$(ver)
101 endif
102
103cfg_flags := $(if $(NOQT),--disable-qt,) \
104 $(if $(NOSDL),--disable-vboxsdl,) \
105 $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
106 $(if $(HEADLESS),--build-headless,) \
107 $(if $(DEBUG),--build-debug,) \
108 $(if $(NOWINE),,--setup-wine) \
109 $(if $(VNC),--enable-vnc,) \
110 $(if $(PATH_OUT_BASE),--out-base-dir=$(PATH_OUT_BASE),) \
111 --disable-extpack
112
113bld_flags := AUTOCFG=$(bldbase)/AutoConfig.kmk \
114 LOCALCFG=$(debroot)/debian/LocalConfig.kmk \
115 PATH_OUT=$(builddir) \
116 VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
117 VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
118 VBOX_WITH_VMSVGA3D=1 \
119 VBOX_DO_STRIP= \
120 VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
121 $(if $(svn_revision),VBOX_SVN_REV=$(svn_revision),) \
122 $(if $(NODOCS),VBOX_WITH_DOCS=,) \
123 $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
124 $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,)
125
126configure: $(bldbase)/configure-stamp
127$(bldbase)/configure-stamp:
128 dh_testdir
129 mkdir -p $(bldbase)
130 cd $(vboxroot) && ./configure --odir=$(bldbase) $(cfg_flags)
131 touch $@
132
133build: $(bldbase)/configure-stamp $(bldbase)/build-stamp
134$(bldbase)/build-stamp $(verfile): $(bldbase)/configure-stamp
135 dh_testdir
136 . $(bldbase)/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
137 # Files from prebuild go to (builddir)/bin to be used during the
138 # packing stage, overriding what the build did/would produce.
139 $(if $(NODOCS),cp $(addprefix $(vboxroot)/prebuild/,UserManual*.pdf UserManual*.qch UserManual*.qhc) $(builddir)/bin,)
140 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
141 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
142 mkdir -p $(builddir)/bin/additions
143 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
144 . $(bldbase)/env.sh && kmk -C $(vboxroot) $(bld_flags) \
145 VBOX_NO_LINUX_RUN_INSTALLER=1 \
146 VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
147 VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
148 VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
149 VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
150 packing
151 touch $(bldbase)/build-stamp
152
153# Build modules for every kernel we find in /lib/modules/*
154$(bldbase)/modules-stamp: $(bldbase)/build-stamp
155 rm -rf $(moddir)
156 mkdir $(moddir)
157 for d in $(wildcard /lib/modules/*); do \
158 if [ -L $$d/build ]; then \
159 make -C $(builddir)/bin/src/vboxdrv KERN_VER=$$(basename $$d) clean && \
160 make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_VER=$$(basename $$d) all; \
161 make -C $(builddir)/bin/src/vboxnetflt KERN_VER=$$(basename $$d) clean && \
162 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
163 make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxnetflt/Module.symvers all; \
164 make -C $(builddir)/bin/src/vboxnetadp KERN_VER=$$(basename $$d) clean && \
165 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
166 make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxnetadp/Module.symvers all; \
167 make -C $(builddir)/bin/src/vboxpci KERN_VER=$$(basename $$d) clean && \
168 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
169 make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxpci/Module.symvers all; \
170 make -C $(builddir)/bin/src/vboxpci KERN_VER=$$(basename $$d) clean; true; \
171 fi; \
172 done
173 touch $@
174
175clean:
176 dh_testdir
177 dh_testroot
178 dh_clean
179 rm -rf $(archdir)
180 rm -rf $(builddir)
181 rm -rf $(moddir)
182 rm -rf $(bldbase)/wine.*
183 rm -rf $(bldbase)/VirtualBox-*
184 rm -f $(bldbase)/VirtualBox.tar $(bldbase)/VirtualBox.tar.bz2
185 rm -f $(bldbase)/virtualbox-*.substvars $(bldbase)/virtualbox*.debhelper
186 rm -f $(bldbase)/$(verpkg).mime $(bldbase)/$(verpkg).sharedmimeinfo
187 rm -f $(bldbase)/modules-stamp $(bldbase)/build-stamp $(bldbase)/configure-stamp
188 rm -f $(bldbase)/AutoConfig.kmk $(bldbase)/configure.log $(bldbase)/env.sh
189 rm -f $(addprefix $(bldbase)/,$(DEBPKGFILES))
190 if [ -d $(bldbase) ]; then rmdir $(bldbase); fi
191
192 ifeq ($(VBOX_VERSION_MAJOR),)
193binary: build $(verfile)
194 +$(MAKE) -f debian/rules binary
195
196 else
197# Build architecture-dependent files here.
198binary: build $(if $(NOMODS),,$(bldbase)/modules-stamp)
199 dh_testdir
200 dh_testroot
201 dh_prep
202 dh_installdirs
203 tar -xC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar
204 install -d -g 0 -o 0 $(prefix)/usr/share/applications
205 install -d -g 0 -o 0 $(prefix)/usr/lib
206 install -d -g 0 -o 0 $(prefix)/usr/bin
207 install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
208 install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
209 $(if $(NOQT),,mv $(archdir)/virtualbox.desktop \
210 $(prefix)/usr/share/applications/virtualbox.desktop)
211 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
212 $(if $(NOQT),,install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor)
213 $(if $(NOQT),,cp $(archdir)/icons/128x128/virtualbox.png \
214 $(prefix)/usr/share/pixmaps/virtualbox.png)
215 $(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
216 $(if $(NOQT),,cd $(archdir)/icons; for i in *; do \
217 for j in $$i/virtualbox.*; do \
218 if [ -f $$j ]; then \
219 if [ ! -d $(prefix)/usr/share/icons/hicolor/$$i/apps ]; then \
220 install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/apps; \
221 fi; \
222 mv $$j $(prefix)/usr/share/icons/hicolor/$$i/apps; \
223 fi; \
224 done; \
225 install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/mimetypes; \
226 mv $$i/* $(prefix)/usr/share/icons/hicolor/$$i/mimetypes || true; \
227 rmdir $$i; \
228 done)
229 $(if $(NOQT),,rmdir $(archdir)/icons)
230 $(if $(NOQT),,mv $(archdir)/virtualbox.xml $(bldbase)/$(verpkg).sharedmimeinfo)
231 install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
232 sed \
233 -e 's|%VERPKG%|$(verpkg)|g' \
234 $(vboxroot)/debian/lintian-override.in > \
235 $(prefix)/usr/share/lintian/overrides/$(verpkg)
236 mv $(archdir)/VBox.png \
237 $(prefix)/usr/share/pixmaps/VBox.png
238 mv $(archdir)/src $(prefix)/usr/share/$(package)
239 rm $(archdir)/VBox.sh
240 install -D -g 0 -o 0 -m 644 $(instlin)/VBox.sh $(prefix)/usr/bin/VBox
241 mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
242 if [ -r $(archdir)/VBoxDTrace ]; then \
243 mv $(archdir)/VBoxDTrace $(prefix)/usr/bin; \
244 fi
245 mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
246 $(if $(NOMODS),,for d in $(moddir)/*; do \
247 if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko ]; then \
248 install -D -g 0 -o 0 -m 0644 \
249 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
250 install -D -g 0 -o 0 -m 0644 \
251 $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
252 install -D -g 0 -o 0 -m 0644 \
253 $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
254 if [ -f $$d/vboxpci.ko ]; then \
255 install -D -g 0 -o 0 -m 0644 \
256 $$d/vboxpci.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxpci.ko; \
257 fi \
258 fi \
259 done)
260 dh_installdocs $(addprefix $(archdir)/,UserManual*.pdf LICENSE)
261 mv $(addprefix $(archdir)/,$(if $(HEADLESS),,rdesktop-vrdp.tar.gz) additions/VBoxGuestAdditions.iso) $(prefix)/usr/share/$(package)
262 $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp $(prefix)/usr/bin)
263 $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp-keymaps $(prefix)/usr/share/$(package))
264 mv $(archdir) $(prefix)/usr/lib/$(package)
265 if [ -f $(prefix)/usr/lib/$(package)/libQt5CoreVBox.so.5 ]; then \
266 $(vboxroot)/tools/linux.$(chrarch)/bin/chrpath \
267 --keepgoing --replace /usr/lib/$(package) \
268 $(prefix)/usr/lib/$(package)/*.so.5 \
269 $(prefix)/usr/lib/$(package)/plugins/platforms/*.so; \
270 $(prefix)/usr/lib/$(package)/plugins/platformthemes/*.so; \
271 $(prefix)/usr/lib/$(package)/plugins/sqldrivers/*.so; \
272 $(prefix)/usr/lib/$(package)/plugins/styles/*.so; \
273 $(prefix)/usr/lib/$(package)/plugins/xcbglintegrations/*.so; \
274 echo "[Paths]" > $(prefix)/usr/lib/$(package)/qt.conf; \
275 echo "Plugins = /usr/lib/$(package)/plugins" >> $(prefix)/usr/lib/$(package)/qt.conf; \
276 fi
277 export VBOX_INSTALL_PATH=/usr/lib/$(package) && \
278 cd $(builddir)/bin/sdk/installer && \
279 $(PYTHON) ./vboxapisetup.py install --root $(prefix)
280 rm -rf $(prefix)/usr/lib/$(package)/sdk/installer
281 ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
282 rmdir $(prefix)/opt
283 dh_link \
284 $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBox) \
285 $(if $(NOQT),,usr/bin/VBox usr/bin/virtualbox) \
286 $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBoxVM) \
287 $(if $(NOQT),,usr/bin/VBox usr/bin/virtualboxvm) \
288 usr/bin/VBox usr/bin/VBoxManage \
289 usr/bin/VBox usr/bin/vboxmanage \
290 $(if $(NOSDL),,usr/bin/VBox usr/bin/VBoxSDL) \
291 $(if $(NOSDL),,usr/bin/VBox usr/bin/vboxsdl) \
292 usr/bin/VBox usr/bin/VBoxHeadless \
293 usr/bin/VBox usr/bin/vboxheadless \
294 usr/bin/VBox usr/bin/VBoxBugReport \
295 usr/bin/VBox usr/bin/vboxbugreport \
296 usr/bin/VBox usr/bin/VBoxBalloonCtrl \
297 usr/bin/VBox usr/bin/vboxballoonctrl \
298 usr/bin/VBox usr/bin/VBoxAutostart \
299 usr/bin/VBox usr/bin/vboxautostart \
300 $(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
301 $(if $(NOVBOXIMG),,usr/lib/virtualbox/vbox-img usr/bin/vbox-img) \
302 $(if $(NOVBOXIMGMOUNT),,usr/lib/virtualbox/vboximg-mount usr/bin/vboximg-mount) \
303 usr/share/virtualbox/src/vboxhost usr/src/vboxhost-$(ver)
304 $(if $(NOMODS),,dh_installmodules)
305 dh_installdebconf
306 dh_installchangelogs
307 dh_installmenu
308 dh_installmime
309 dh_link
310 ifeq ($(DEBUG),)
311 dh_strip --keep-debug \
312 $(addprefix --exclude=lib,$(addsuffix VBox.so.5,\
313 Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport Qt5OpenGL Qt5DBus Qt5XcbQpa Qt5X11Extras))
314 endif
315 mkdir -p $(bldbase)/$(verpkg)-dbg/usr/lib/$(package)
316 mv $(prefix)/usr/lib/$(package)/*.debug $(bldbase)/$(verpkg)-dbg/usr/lib/$(package)
317 ifeq ($(DEBUG),)
318 mv $(prefix)/usr/lib/debug $(bldbase)/$(verpkg)-dbg/usr/lib
319 endif
320 $(firstword $(shell which dh_python3) $(shell which dh_python2))
321 dh_compress -X.pdf -X.qch -X.qhc -X LICENSE -X.py
322 dh_fixperms
323 dh_makeshlibs
324 dh_installdeb
325 dh_perl
326 # For some reason, the Qt libraries couldn't be found on newer releases (e.g. Ubuntu hardy).
327 # Python is deliberately not listed as a dependency (see also comment in the "control" file.
328 # It is expected that dh_gencontrol shows a warning "substitution variable ${python:Versions}
329 # used, but is not defined" because of this.
330 LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps --exclude=VBoxPython
331 dh_gencontrol -- \
332 -Valsa=$(if $(HEADLESS),,libasound2) \
333 -Vpulse=$(if $(HEADLESS),,libpulse0) \
334 -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0)
335 dh_md5sums
336 dh_builddeb --destdir $(pkgdir) -- -Zxz
337 endif
338
339.PHONY: binary configure build clean
340endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette