VirtualBox

source: vbox/trunk/debian/rules@ 89843

Last change on this file since 89843 was 84968, checked in by vboxsync, 4 years ago

Installer/linux: Bring DEB build/package to same functionality as the recent changes for RPM (needing WINE less often, due to not building the CHM docs). Additionally a very crude (manually specified package deps are still present) way of suppressing the build of VBoxSDL, as another measure to make the functionality as identical as possible.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 14.3 KB
Line 
1#!/usr/bin/make -f
2# $Id: rules 84968 2020-06-26 11:51:54Z 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
20export DH_COMPAT=5
21
22# possible overrides:
23# OSE=1 force VBOX_OSE
24# NOPARALLEL=1 compile with -j1
25# LINUX=<dir> compile vboxdrv against Linux found in <dir>
26# VERBOSE=1 verbose build
27# DEBUG=1 debug build
28# NOSUBVER=1 disable generation of the sub-version field (which is
29# either the subversion rev [if available] or the build date)
30# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
31# maybe VirtualBox.chm from $(vboxroot)/prebuild
32# NOMODS=1 don't build any module
33# NOQT=1 don't build the Qt GUI
34# NOSDL=1 don't build VBoxSDL
35# EFI=1 include the EFI binary from prebuild
36# HEADLESS=1 build the headless version
37# VNC=1 build VNC code
38# NOWEBSVC=1 don't build the webservice API, default for OSE
39# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
40# STAGEDCHM=<path> use VirtualBox*.chm from this directory
41# PKGDIR=<path> where to store the final package(s)
42#
43# NODOCS will be set if UserManual*.pdf is placed in $(vboxroot)/prebuild.
44# STAGEDISO will be set if VBoxGuestAdditions.iso is placed there.
45# STAGEDCHM will be set if VirtualBox*.chm is placed there.
46# VirtualBox*.chm is used if it is provided, but never attempted to be built.
47#
48# Wine will not be required if either NODOCS or STAGEDISO are set.
49
50package := virtualbox
51verpkg := virtualbox-ose
52current := $(shell pwd)
53vboxroot := $(shell pwd)
54pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ..; pwd))
55builddir := $(vboxroot)/out/debian/builddir
56moddir := $(vboxroot)/out/debian/modules
57prefix := $(current)/debian/$(verpkg)
58arch := $(shell dpkg --print-architecture)
59verfile := $(builddir)/version-generated.mk
60ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
61
62NOMODS ?= $(ose)
63NOQT ?= $(HEADLESS)
64NOSDL ?= $(HEADLESS)
65NOWEBSVC ?= $(ose)
66NODOCS ?= $(if $(wildcard $(vboxroot)/prebuild/UserManual*.pdf),1,)
67STAGEDISO ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxGuestAdditions.iso),$(vboxroot)/prebuild,)
68STAGEDCHM ?= $(if $(wildcard $(vboxroot)/prebuild/VirtualBox*.chm),$(vboxroot)/prebuild,)
69NOWINE := $(if $(NODOCS),1,$(if $(STAGEDISO),1,$(ose)))
70PYTHON := $(firstword $(shell which python) $(shell which python3))
71
72ifneq ($(wildcard $(verfile)),)
73include $(verfile)
74ver := $(VBOX_VERSION_STRING)
75archdir := $(prefix)/opt/VirtualBox-$(ver)
76endif
77
78ifneq ($(STAGEDISO),)
79 ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
80 $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
81 endif
82endif
83
84debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
85
86cfg_flags := $(if $(NOQT),--disable-qt,) \
87 $(if $(NOSDL),--disable-vboxsdl,) \
88 $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
89 $(if $(HEADLESS),--build-headless,) \
90 $(if $(DEBUG),--build-debug,) \
91 $(if $(NOWINE),,--setup-wine) \
92 $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
93 $(if $(VNC),--enable-vnc,) \
94 --disable-extpack
95
96bld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
97 LOCALCFG=$(current)/debian/LocalConfig.kmk \
98 PATH_OUT=$(builddir) \
99 VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
100 VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
101 VBOX_WITH_VMSVGA3D=1 \
102 VBOX_DO_STRIP= \
103 VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
104 $(if $(STAGEDCHM),VBOX_WITH_DOCS_CHM=1,VBOX_WITH_KCHMVIEWER=) \
105 $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
106 $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
107 $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
108 $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,)
109
110configure: debian/configure-stamp
111debian/configure-stamp:
112 dh_testdir
113 cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
114 touch debian/configure-stamp
115
116build: debian/configure-stamp debian/build-stamp
117debian/build-stamp $(verfile):
118 dh_testdir
119 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
120 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
121 $(if $(STAGEDCHM),cp $(STAGEDCHM)/VirtualBox*.chm $(builddir)/bin,)
122 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
123 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
124 mkdir -p $(builddir)/bin/additions
125 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
126 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
127 VBOX_NO_LINUX_RUN_INSTALLER=1 \
128 VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
129 VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
130 VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
131 VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
132 packing
133 touch debian/build-stamp
134
135# Build modules for every kernel we find in /lib/modules/*
136modules: debian/build-stamp debian/modules-stamp
137debian/modules-stamp: debian/build-stamp
138 rm -rf $(moddir)
139 mkdir $(moddir)
140 for d in $(wildcard /lib/modules/*); do \
141 if [ -L $$d/build ]; then \
142 make -C $(builddir)/bin/src/vboxdrv KERN_VER=$$(basename $$d) clean && \
143 make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_VER=$$(basename $$d) all; \
144 make -C $(builddir)/bin/src/vboxnetflt KERN_VER=$$(basename $$d) clean && \
145 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
146 make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxnetflt/Module.symvers all; \
147 make -C $(builddir)/bin/src/vboxnetadp KERN_VER=$$(basename $$d) clean && \
148 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
149 make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxnetadp/Module.symvers all; \
150 make -C $(builddir)/bin/src/vboxpci KERN_VER=$$(basename $$d) clean && \
151 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
152 make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxpci/Module.symvers all; \
153 make -C $(builddir)/bin/src/vboxpci KERN_VER=$$(basename $$d) clean; true; \
154 fi; \
155 done
156 touch debian/modules-stamp
157
158clean:
159 dh_testdir
160 dh_testroot
161 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
162 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
163 rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
164 rm -f debian/$(verpkg).mime
165 rm -rf $(builddir) $(moddir)
166 rm -rf debian/wine.*
167 dh_clean
168
169ifeq ($(VBOX_VERSION_MAJOR),)
170binary binary-arch binary-indep: build $(verfile)
171 $(MAKE) -f debian/rules binary
172else
173# Build architecture-dependent files here.
174binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
175 dh_testdir
176 dh_testroot
177 dh_clean -k
178 dh_installdirs
179 tar -xC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar
180 install -d -g 0 -o 0 $(prefix)/usr/share/applications
181 install -d -g 0 -o 0 $(prefix)/usr/lib
182 install -d -g 0 -o 0 $(prefix)/usr/bin
183 install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
184 install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
185 $(if $(NOQT),,mv $(archdir)/virtualbox.desktop \
186 $(prefix)/usr/share/applications/virtualbox.desktop)
187 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
188 $(if $(NOQT),,install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor)
189 $(if $(NOQT),,cp $(archdir)/icons/128x128/virtualbox.png \
190 $(prefix)/usr/share/pixmaps/virtualbox.png)
191 $(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
192 $(if $(NOQT),,cd $(archdir)/icons; for i in *; do \
193 for j in $$i/virtualbox.*; do \
194 if [ -f $$j ]; then \
195 if [ ! -d $(prefix)/usr/share/icons/hicolor/$$i/apps ]; then \
196 install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/apps; \
197 fi; \
198 mv $$j $(prefix)/usr/share/icons/hicolor/$$i/apps; \
199 fi; \
200 done; \
201 install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/mimetypes; \
202 mv $$i/* $(prefix)/usr/share/icons/hicolor/$$i/mimetypes || true; \
203 rmdir $$i; \
204 done)
205 $(if $(NOQT),,rmdir $(archdir)/icons)
206 $(if $(NOQT),,mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo)
207 install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
208 sed \
209 -e 's|%VERPKG%|$(verpkg)|g' \
210 debian/lintian-override.in > \
211 $(prefix)/usr/share/lintian/overrides/$(verpkg)
212 mv $(archdir)/VBox.png \
213 $(prefix)/usr/share/pixmaps/VBox.png
214 mv $(archdir)/src $(prefix)/usr/share/$(package)
215 rm $(archdir)/VBox.sh
216 install -D -g 0 -o 0 -m 644 $(vboxroot)/src/VBox/Installer/linux/VBox.sh $(prefix)/usr/bin/VBox
217 mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
218 if [ -r $(archdir)/VBoxDTrace ]; then \
219 mv $(archdir)/VBoxDTrace $(prefix)/usr/bin; \
220 fi
221 mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
222 $(if $(NOMODS),,for d in $(moddir)/*; do \
223 if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko ]; then \
224 install -D -g 0 -o 0 -m 0644 \
225 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
226 install -D -g 0 -o 0 -m 0644 \
227 $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
228 install -D -g 0 -o 0 -m 0644 \
229 $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
230 if [ -f $$d/vboxpci.ko ]; then \
231 install -D -g 0 -o 0 -m 0644 \
232 $$d/vboxpci.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxpci.ko; \
233 fi \
234 fi \
235 done)
236ifeq ($(ose),)
237 dh_installdocs \
238 $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
239 $(addprefix $(archdir)/, LICENSE)
240 rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
241 LICENSE)
242 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
243 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
244 $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp $(prefix)/usr/bin)
245 $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp-keymaps $(prefix)/usr/share/$(package))
246else
247 dh_installdocs \
248 $(archdir)/UserManual*.pdf
249 rm $(addprefix $(archdir)/,UserManual*.pdf)
250 for i in additions/VBoxGuestAdditions.iso; do \
251 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
252endif
253 mv $(archdir) $(prefix)/usr/lib/$(package)
254 if [ -f $(prefix)/usr/lib/$(package)/libQt5CoreVBox.so.5 ]; then \
255 ../../../../tools/linux.$(chrarch)/bin/chrpath \
256 --keepgoing --replace /usr/lib/$(package) \
257 $(prefix)/usr/lib/$(package)/*.so.5 \
258 $(prefix)/usr/lib/$(package)/plugins/platforms/*.so; \
259 $(prefix)/usr/lib/$(package)/plugins/xcbglintegrations/*.so; \
260 echo "[Paths]" > $(prefix)/usr/lib/$(package)/qt.conf; \
261 echo "Plugins = /usr/lib/$(package)/plugins" >> $(prefix)/usr/lib/$(package)/qt.conf; \
262 fi
263 export VBOX_INSTALL_PATH=/usr/lib/$(package) && \
264 cd $(builddir)/bin/sdk/installer && \
265 $(PYTHON) ./vboxapisetup.py install --root $(prefix)
266 rm -rf $(prefix)/usr/lib/$(package)/sdk/installer
267 ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
268 rmdir $(prefix)/opt
269 dh_link \
270 $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBox) \
271 $(if $(NOQT),,usr/bin/VBox usr/bin/virtualbox) \
272 $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBoxVM) \
273 $(if $(NOQT),,usr/bin/VBox usr/bin/virtualboxvm) \
274 usr/bin/VBox usr/bin/VBoxManage \
275 usr/bin/VBox usr/bin/vboxmanage \
276 $(if $(NOSDL),,usr/bin/VBox usr/bin/VBoxSDL) \
277 $(if $(NOSDL),,usr/bin/VBox usr/bin/vboxsdl) \
278 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
279 usr/bin/VBox usr/bin/VBoxHeadless \
280 usr/bin/VBox usr/bin/vboxheadless \
281 usr/bin/VBox usr/bin/VBoxBugReport \
282 usr/bin/VBox usr/bin/vboxbugreport \
283 usr/bin/VBox usr/bin/VBoxBalloonCtrl \
284 usr/bin/VBox usr/bin/vboxballoonctrl \
285 usr/bin/VBox usr/bin/VBoxAutostart \
286 usr/bin/VBox usr/bin/vboxautostart \
287 $(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
288 $(if $(NOVBOXIMG),,usr/lib/virtualbox/vbox-img usr/bin/vbox-img) \
289 $(if $(NOVBOXIMGMOUNT),,usr/lib/virtualbox/vboximg-mount usr/bin/vboximg-mount) \
290 usr/share/virtualbox/src/vboxhost usr/src/vboxhost-$(ver)
291 $(if $(NOMODS),,dh_installmodules)
292 dh_installdebconf
293 dh_installchangelogs
294 dh_installmenu
295 dh_installmime
296 dh_link
297ifeq ($(DEBUG),)
298 dh_strip --keep-debug \
299 $(addprefix --exclude=lib,$(addsuffix VBox.so.5,\
300 Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport Qt5OpenGL Qt5DBus Qt5XcbQpa Qt5X11Extras)) \
301 --exclude=libqxcb.so --exclude=libqxcb-glx-integration.so
302endif
303 mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib/$(package)
304 mv $(prefix)/usr/lib/$(package)/*.debug $(current)/debian/$(verpkg)-dbg/usr/lib/$(package)
305ifeq ($(DEBUG),)
306 mv $(prefix)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
307endif
308 $(firstword $(shell which dh_python2) $(shell which dh_python3))
309 dh_compress -X.pdf -X.chm -X LICENSE -X.py
310 dh_fixperms
311 dh_makeshlibs
312 dh_installdeb
313 dh_perl
314 # for some reason, the Qt libraries couldn't be found on newer releases (e.g. Ubuntu hardy)
315 LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps --exclude=VBoxPython
316 dh_gencontrol -- \
317 -Valsa=$(if $(HEADLESS),,libasound2) \
318 -Vpulse=$(if $(HEADLESS),,libpulse0) \
319 -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0)
320 dh_md5sums
321 dh_builddeb --destdir $(pkgdir) -- -Zxz
322endif
323
324.PHONY: binary modules binary-arch binary-indep clean checkroot
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