VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/debian/rules@ 89669

Last change on this file since 89669 was 89486, checked in by vboxsync, 4 years ago

Config.kmk, Installer/linux and Installer/solaris: Passing gtk2 style/theme plugins from recent Qt 5.15.2 tool r353 to self-built VBox and Linux/Solaris packages; This should fix missed GTK2 style support.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 16.0 KB
Line 
1#!/usr/bin/make -f
2# $Id: rules 89486 2021-06-03 15:51:10Z 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#
20# NOTE: if you make changes to this file, please check if the updates should
21# be also applied to the publicly visible debian/rules file.
22#
23
24#export DH_VERBOSE=1
25export DH_COMPAT=5
26
27# possible overrides:
28# OSE=1 force VBOX_OSE
29# NOPARALLEL=1 compile with -j1
30# LINUX=<dir> compile vboxdrv against Linux found in <dir>
31# VERBOSE=1 verbose build
32# DEBUG=1 debug build
33# NOSUBVER=1 disable generation of the sub-version field (which is
34# either the subversion rev [if available] or the build date)
35# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
36# maybe VirtualBox.chm from $(vboxroot)/prebuild
37# NOMODS=1 don't build any module
38# NOQT=1 don't build the Qt GUI
39# NOSDL=1 don't build VBoxSDL
40# EFI=1 include the EFI binary from prebuild
41# VERSUFFIX=<suffix> set a particular package version suffix (e.g. _customer)
42# HEADLESS=1 build the headless version
43# VNC=1 build VNC code
44# NOWEBSVC=1 don't build the webservice API, default for OSE
45# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
46# STAGEDCHM=<path> use VirtualBox*.chm from this directory
47# PKGDIR=<path> where to store the final package(s)
48#
49# NODOCS will be set if UserManual*.pdf is placed in $(vboxroot)/prebuild.
50# STAGEDISO will be set if VBoxGuestAdditions.iso is placed there.
51# STAGEDCHM will be set if VirtualBox*.chm is placed there.
52# VirtualBox*.chm is used if it is provided, but never attempted to be built.
53#
54# Wine will not be required if either NODOCS or STAGEDISO are set.
55
56package := virtualbox
57verpkg := virtualbox-6.1
58current := $(shell pwd)
59vboxroot := $(shell while ! test -r configure && ! test "$PWD" = "/"; do cd ..; done; pwd)
60pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd $(vboxroot)/..; pwd))
61builddir := $(vboxroot)/out/debian/builddir
62moddir := $(vboxroot)/out/debian/modules
63prefix := $(current)/debian/$(verpkg)
64arch := $(shell dpkg --print-architecture)
65verfile := $(builddir)/version-generated.mk
66ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
67chrarch := $(shell if [ `uname -m` = "x86_64" ]; then echo "amd64"; else echo "x86"; fi)
68-include $(vboxroot)/SVN_REVISION
69svnrev :=$(if $(svn_revision),$(svn_revision),)
70
71NOMODS ?= $(ose)
72NOQT ?= $(HEADLESS)
73NOSDL ?= $(HEADLESS)
74NOWEBSVC ?= $(ose)
75NODOCS ?= $(if $(wildcard $(vboxroot)/prebuild/UserManual*.pdf),1,)
76STAGEDISO ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxGuestAdditions.iso),$(vboxroot)/prebuild,)
77STAGEDCHM ?= $(if $(wildcard $(vboxroot)/prebuild/VirtualBox*.chm),$(vboxroot)/prebuild,)
78NOWINE := $(if $(NODOCS),1,$(if $(STAGEDISO),1,$(ose)))
79PYTHON := $(firstword $(shell which python) $(shell which python3))
80
81ifneq ($(wildcard $(verfile)),)
82include $(verfile)
83ver := $(VBOX_VERSION_STRING)
84svnver := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
85 svn info > /dev/null 2>&1; then \
86 svn info|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
87 date +"-%Y%m%d"; fi)))
88debver :=$(subst _ALPHA,~alpha,$(subst _BETA,~beta,$(subst _RC,~rc,$(subst _OSE,~ose,$(ver)))))$(svnver)$(VERSUFFIX)$(if $(HEADLESS),~headless,)$(if $(DEBUG),~dbg,)
89archdir := $(prefix)/opt/VirtualBox-$(ver)
90endif
91
92ifneq ($(STAGEDISO),)
93 ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
94 $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
95 endif
96endif
97
98debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
99
100ifneq ($(MAKECMDGOALS),clean)
101 debdist := $(strip $(shell grep $(debrel) $(current)/distributions_deb | cut -d'=' -f2))
102 ifeq ($(debdist),)
103 debdist := $(if $(shell which lsb_release),_$(shell lsb_release -si | tr a-z A-Z)_$(shell lsb_release -sr | sed -e 's/\./_/g' -e 's/\([^_]*\)\(_[^_]*\).*/\1\2/'),unknown)
104 # $(error package distribution not detected (debrel=$(debrel)))
105 endif
106endif
107
108cfg_flags := $(if $(NOQT),--disable-qt,) \
109 $(if $(NOSDL),--disable-vboxsdl,) \
110 $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
111 $(if $(HEADLESS),--build-headless,) \
112 $(if $(DEBUG),--build-debug,) \
113 $(if $(NOWINE),,--setup-wine) \
114 $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
115 $(if $(VNC),--enable-vnc,) \
116 --disable-extpack
117
118bld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
119 LOCALCFG=$(current)/debian/LocalConfig.kmk \
120 PATH_OUT=$(builddir) \
121 VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
122 VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
123 VBOX_WITH_VMSVGA3D=1 \
124 VBOX_DO_STRIP= \
125 VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
126 $(if $(STAGEDCHM),VBOX_WITH_DOCS_CHM=1,VBOX_WITH_KCHMVIEWER=) \
127 VBOX_PACKAGE_DIST=$(debdist) \
128 $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
129 $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
130 $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
131 $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,)
132
133configure: debian/configure-stamp
134debian/configure-stamp:
135 dh_testdir
136 cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
137 touch debian/configure-stamp
138
139build: debian/configure-stamp debian/build-stamp
140debian/build-stamp $(verfile):
141 dh_testdir
142 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
143 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
144 $(if $(STAGEDCHM),cp $(STAGEDCHM)/VirtualBox*.chm $(builddir)/bin,)
145 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
146 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
147 mkdir -p $(builddir)/bin/additions
148 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
149 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
150 VBOX_NO_LINUX_RUN_INSTALLER=1 \
151 VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
152 VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
153 VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
154 VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
155 packing
156 touch debian/build-stamp
157
158# Build modules for every kernel we find in /lib/modules/*
159modules: debian/build-stamp debian/modules-stamp
160debian/modules-stamp: debian/build-stamp
161 rm -rf $(moddir)
162 mkdir $(moddir)
163 for d in $(wildcard /lib/modules/*); do \
164 if [ -L $$d/build ]; then \
165 make -C $(builddir)/bin/src/vboxdrv KERN_VER=$$(basename $$d) clean && \
166 make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_VER=$$(basename $$d) all; \
167 make -C $(builddir)/bin/src/vboxnetflt KERN_VER=$$(basename $$d) clean && \
168 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
169 make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxnetflt/Module.symvers all; \
170 make -C $(builddir)/bin/src/vboxnetadp KERN_VER=$$(basename $$d) clean && \
171 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
172 make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxnetadp/Module.symvers all; \
173 make -C $(builddir)/bin/src/vboxpci KERN_VER=$$(basename $$d) clean && \
174 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
175 make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_VER=$$(basename $$d) KBUILD_EXTRA_SYMBOLS=$(builddir)/bin/src/vboxpci/Module.symvers all; \
176 make -C $(builddir)/bin/src/vboxpci KERN_VER=$$(basename $$d) clean; true; \
177 fi; \
178 done
179 touch debian/modules-stamp
180
181clean:
182 dh_testdir
183 dh_testroot
184 rm -f debian/changelog
185 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
186 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
187 rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
188 rm -f debian/$(verpkg).mime
189 rm -rf $(builddir) $(moddir)
190 rm -rf debian/wine.*
191 dh_clean
192
193ifeq ($(VBOX_VERSION_MAJOR),)
194binary binary-arch binary-indep: build $(verfile)
195 $(MAKE) -f debian/rules binary
196else
197# Build architecture-dependent files here.
198binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
199 dh_testdir
200 dh_testroot
201 dh_clean -k
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 debian/$(verpkg).sharedmimeinfo)
231 install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
232 sed \
233 -e 's|%VERPKG%|$(verpkg)|g' \
234 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 $(vboxroot)/src/VBox/Installer/linux/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)
260ifeq ($(ose),)
261 dh_installdocs \
262 $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
263 $(addprefix $(archdir)/, LICENSE)
264 rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
265 LICENSE)
266 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
267 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
268 $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp $(prefix)/usr/bin)
269 $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp-keymaps $(prefix)/usr/share/$(package))
270else
271 dh_installdocs \
272 $(archdir)/UserManual*.pdf
273 rm $(addprefix $(archdir)/,UserManual*.pdf)
274 for i in additions/VBoxGuestAdditions.iso; do \
275 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
276endif
277 mv $(archdir) $(prefix)/usr/lib/$(package)
278 if [ -f $(prefix)/usr/lib/$(package)/libQt5CoreVBox.so.5 ]; then \
279 ../../../../tools/linux.$(chrarch)/bin/chrpath \
280 --keepgoing --replace /usr/lib/$(package) \
281 $(prefix)/usr/lib/$(package)/*.so.5 \
282 $(prefix)/usr/lib/$(package)/plugins/platforms/*.so; \
283 $(prefix)/usr/lib/$(package)/plugins/platformthemes/*.so; \
284 $(prefix)/usr/lib/$(package)/plugins/sqldrivers/*.so; \
285 $(prefix)/usr/lib/$(package)/plugins/styles/*.so; \
286 $(prefix)/usr/lib/$(package)/plugins/xcbglintegrations/*.so; \
287 echo "[Paths]" > $(prefix)/usr/lib/$(package)/qt.conf; \
288 echo "Plugins = /usr/lib/$(package)/plugins" >> $(prefix)/usr/lib/$(package)/qt.conf; \
289 fi
290 export VBOX_INSTALL_PATH=/usr/lib/$(package) && \
291 cd $(builddir)/bin/sdk/installer && \
292 $(PYTHON) ./vboxapisetup.py install --root $(prefix)
293 rm -rf $(prefix)/usr/lib/$(package)/sdk/installer
294 ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
295 rmdir $(prefix)/opt
296 dh_link \
297 $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBox) \
298 $(if $(NOQT),,usr/bin/VBox usr/bin/virtualbox) \
299 $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBoxVM) \
300 $(if $(NOQT),,usr/bin/VBox usr/bin/virtualboxvm) \
301 usr/bin/VBox usr/bin/VBoxManage \
302 usr/bin/VBox usr/bin/vboxmanage \
303 $(if $(NOSDL),,usr/bin/VBox usr/bin/VBoxSDL) \
304 $(if $(NOSDL),,usr/bin/VBox usr/bin/vboxsdl) \
305 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
306 usr/bin/VBox usr/bin/VBoxHeadless \
307 usr/bin/VBox usr/bin/vboxheadless \
308 usr/bin/VBox usr/bin/VBoxBugReport \
309 usr/bin/VBox usr/bin/vboxbugreport \
310 usr/bin/VBox usr/bin/VBoxBalloonCtrl \
311 usr/bin/VBox usr/bin/vboxballoonctrl \
312 usr/bin/VBox usr/bin/VBoxAutostart \
313 usr/bin/VBox usr/bin/vboxautostart \
314 $(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
315 $(if $(NOVBOXIMG),,usr/lib/virtualbox/vbox-img usr/bin/vbox-img) \
316 $(if $(NOVBOXIMGMOUNT),,usr/lib/virtualbox/vboximg-mount usr/bin/vboximg-mount) \
317 usr/share/virtualbox/src/vboxhost usr/src/vboxhost-$(ver)
318 $(if $(NOMODS),,dh_installmodules)
319 sed -e 's|%VER%|$(debver)|g' \
320 -e 's|%DATE%|$(shell date -R)|g' \
321 -e 's|%DEBREL%|$(subst _,~,$(debrel))|g' \
322 -e 's|%VERPKG%|$(verpkg)|g' \
323 debian/changelog.in > debian/changelog
324 dh_installdebconf
325 dh_installchangelogs
326 dh_installmenu
327 dh_installmime
328 dh_link
329ifeq ($(DEBUG),)
330 dh_strip --keep-debug \
331 $(addprefix --exclude=lib,$(addsuffix VBox.so.5,\
332 Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport Qt5OpenGL Qt5DBus Qt5XcbQpa Qt5X11Extras)) \
333 --exclude=libqxcb.so --exclude=libqsqlite.so --exclude=libqxcb-glx-integration.so
334endif
335 mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib/$(package)
336 mv $(prefix)/usr/lib/$(package)/*.debug $(current)/debian/$(verpkg)-dbg/usr/lib/$(package)
337ifeq ($(DEBUG),)
338 mv $(prefix)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
339endif
340 $(firstword $(shell which dh_python2) $(shell which dh_python3))
341 dh_compress -X.pdf -X.chm -X LICENSE -X.py
342 dh_fixperms
343 dh_makeshlibs
344 dh_installdeb
345 dh_perl
346 # for some reason, the Qt libraries couldn't be found on newer releases (e.g. Ubuntu hardy)
347 LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps --exclude=VBoxPython
348 dh_gencontrol -- \
349 -Valsa=$(if $(HEADLESS),,libasound2) \
350 -Vpulse=$(if $(HEADLESS),,libpulse0) \
351 -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0)
352 dh_md5sums
353 dh_builddeb --destdir $(pkgdir) -- -Zxz
354endif
355
356.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