VirtualBox

source: vbox/trunk/debian/rules@ 90038

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

debian/rules, rpm/rules: Change from CHM help file to QHelp. bugref:9831

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