VirtualBox

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

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

debian/rules, rpm/rules: Forgotten wildcard for .qhc file.

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