VirtualBox

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

Last change on this file since 78425 was 76758, checked in by vboxsync, 6 years ago

Installers/Linux: add VirtualBoxVM symbolic links for RPM and Deb packages too.
bugref:9347: VirtualBox suggests VirtualBoxVM but this does not exist.
Now VirtualBoxVM can be accessed in the path from the command line for
distribution package builds too.

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