VirtualBox

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

Last change on this file since 58400 was 58400, checked in by vboxsync, 9 years ago

#8051: Installers: unify Linux host installers as far as possible: removed scripts and helper folders from the archive which forms the basis of the different installers instead of deleting them in individual installer scripts after unpacking the archive.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 15.2 KB
Line 
1#!/usr/bin/make -f
2#
3# Copyright (C) 2006-2015 Oracle Corporation
4#
5# This file is part of VirtualBox Open Source Edition (OSE), as
6# available from http://www.virtualbox.org. This file is free software;
7# you can redistribute it and/or modify it under the terms of the GNU
8# General Public License (GPL) as published by the Free Software
9# Foundation, in version 2 as it comes in the "COPYING" file of the
10# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
11# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
12#
13
14#
15# NOTE: if you make changes to this file, please check if the updates should
16# be also applied to the publicly visible debian/rules file.
17#
18
19#export DH_VERBOSE=1
20export DH_COMPAT=4
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# VirtualBox.chm from $HOME
32# NOMODS=1 don't build any module
33# NOQT=1 don't build the Qt GUI
34# EFI=1 include the EFI binary from prebuild
35# VERSUFFIX=<suffix> set a particular package version suffix (e.g. _customer)
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# PKGDIR=<path> where to store the final package(s)
41# BLEEDING_EDGE=xyz
42#
43# NODOCS will also be set if UserManual*.pdf and VirtualBox*.chm are placed in
44# $(vboxroot)/prebuild. STAGEDISO will be set if VBoxGuestAdditions.iso is
45# placed there. Wine will not be required to be available if both NODOCS and
46# STAGEDISO are set.
47
48package := virtualbox
49verpkg := virtualbox-5.0
50current := $(shell pwd)
51vboxroot := $(shell cd ../../../..; pwd)
52pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
53builddir := $(vboxroot)/out/debian/builddir
54moddir := $(vboxroot)/out/debian/modules
55prefix := $(current)/debian/$(verpkg)
56arch := $(shell dpkg --print-architecture)
57verfile := $(builddir)/version-generated.mk
58ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
59-include $(vboxroot)/SVN_REVISION
60svnrev :=$(if $(svn_revision),$(svn_revision),)
61
62NOMODS ?= $(ose)
63NOQT ?= $(HEADLESS)
64NOWEBSVC ?= $(ose)
65NODOCS ?= $(if $(wildcard $(vboxroot)/prebuild/UserManual*.pdf),$(if $(wildcard $(vboxroot)/prebuild/VirtualBox*.chm),1,),)
66STAGEDISO ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxGuestAdditions.iso),$(vboxroot)/prebuild,)
67NOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
68
69ifneq ($(wildcard $(verfile)),)
70include $(verfile)
71ver := $(VBOX_VERSION_STRING)
72svnver := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
73 svn info > /dev/null 2>&1; then \
74 svn info|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
75 date +"-%Y%m%d"; fi)))
76debver :=$(subst _ALPHA,~alpha,$(subst _BETA,~beta,$(subst _RC,~rc,$(subst _OSE,~ose,$(ver)))))$(svnver)$(if \
77 $(BLEEDING_EDGE),-$(BLEEDING_EDGE),)$(VERSUFFIX)$(if \
78 $(HEADLESS),~headless,)$(if $(DEBUG),~dbg,)
79archdir := $(prefix)/opt/VirtualBox-$(ver)
80endif
81
82ifneq ($(STAGEDISO),)
83 ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
84 $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
85 endif
86endif
87
88debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
89
90ifneq ($(MAKECMDGOALS),clean)
91 debdist := $(strip $(shell grep $(debrel) $(current)/distributions_deb | cut -d'=' -f2))
92 ifeq ($(debdist),)
93 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)
94 # $(error package distribution not detected (debrel=$(debrel)))
95 endif
96endif
97
98# Location of custom built Qt libraries (see below)
99qtstdc6 := /home/vbox/Qt-4.8.6-stdc++6-$(arch)
100
101cfg_flags := $(if $(NOQT),--disable-qt,) \
102 $(if $(filter _Debian_squeeze,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
103 $(if $(filter _Debian_squeeze,$(debrel)),--build-libvpx,) \
104 $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
105 $(if $(HEADLESS),--build-headless,) \
106 $(if $(DEBUG),--build-debug,) \
107 $(if $(NOWINE),,--setup-wine) \
108 $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
109 $(if $(VNC),--enable-vnc,) \
110 --disable-extpack
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 $(if $(filter _Debian_squeeze _Ubuntu_lucid,$(debrel)),,VBOX_WITH_VMSVGA3D=1) \
118 VBOX_DO_STRIP= \
119 VBOX_WITH_MULTIVERSION_PYTHON= \
120 VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
121 $(if $(ose),,VBOX_WITH_DOCS_CHM=1) \
122 VBOX_PACKAGE_DIST=$(debdist) \
123 $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
124 $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
125 $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
126 $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
127 $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),)
128
129configure: debian/configure-stamp
130debian/configure-stamp:
131 dh_testdir
132 cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
133 touch debian/configure-stamp
134
135build: debian/configure-stamp debian/build-stamp
136debian/build-stamp $(verfile):
137 dh_testdir
138 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
139 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
140 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
141 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
142 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
143 mkdir -p $(builddir)/bin/additions
144 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
145 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
146 VBOX_NO_LINUX_RUN_INSTALLER=1 \
147 VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
148 VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
149 VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
150 VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
151 packing
152 touch debian/build-stamp
153
154# Build modules for every kernel we find in /lib/modules/*
155modules: debian/build-stamp debian/modules-stamp
156debian/modules-stamp: debian/build-stamp
157 rm -rf $(moddir)
158 mkdir $(moddir)
159 make -C $(builddir)/bin/src/vboxdrv clean
160 for d in $(wildcard /lib/modules/*); do \
161 if [ -L $$d/build ]; then \
162 make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
163 make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
164 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
165 $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
166 make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
167 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
168 make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
169 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
170 $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
171 make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
172 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
173 make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
174 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
175 $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko); \
176 make -C $(builddir)/bin/src/vboxpci KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
177 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
178 make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
179 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
180 $(builddir)/bin/src/vboxpci/vboxpci.ko $(moddir)/$$(basename $$d)/vboxpci.ko); \
181 fi; \
182 done
183 make -C $(builddir)/bin/src/vboxdrv clean
184 make -C $(builddir)/bin/src/vboxnetflt clean
185 make -C $(builddir)/bin/src/vboxnetadp clean
186 make -C $(builddir)/bin/src/vboxpci clean
187 touch debian/modules-stamp
188
189clean:
190 dh_testdir
191 dh_testroot
192 rm -f debian/changelog
193 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
194 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
195 rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
196 rm -f debian/$(verpkg).mime
197 rm -rf $(builddir) $(moddir)
198 rm -rf debian/wine.*
199 dh_clean
200
201ifeq ($(VBOX_VERSION_MAJOR),)
202binary binary-arch binary-indep: build $(verfile)
203 $(MAKE) -f debian/rules binary
204else
205# Build architecture-dependent files here.
206binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
207 dh_testdir
208 dh_testroot
209 dh_clean -k
210 dh_installdirs
211 tar -xC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar
212 install -d -g 0 -o 0 $(prefix)/usr/share/applications
213 install -d -g 0 -o 0 $(prefix)/usr/lib
214 install -d -g 0 -o 0 $(prefix)/usr/bin
215 install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
216 install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
217 $(if $(NOQT),,mv $(archdir)/virtualbox.desktop \
218 $(prefix)/usr/share/applications/virtualbox.desktop)
219 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
220 $(if $(NOQT),,install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor)
221 $(if $(NOQT),,cp $(archdir)/icons/128x128/virtualbox.png \
222 $(prefix)/usr/share/pixmaps/virtualbox.png)
223 $(if $(NOQT),,cd $(archdir)/icons; for i in *; do \
224 for j in $$i/virtualbox.*; do \
225 if [ -f $$j ]; then \
226 if [ -d $(prefix)/usr/share/icons/hicolor/$$i/apps ]; then \
227 install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/apps; \
228 fi; \
229 mv $$j $(prefix)/usr/share/icons/hicolor/$$i/apps; \
230 fi; \
231 done; \
232 install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/mimetypes; \
233 mv $$i/* $(prefix)/usr/share/icons/hicolor/$$i/mimetypes || true; \
234 rmdir $$i; \
235 done)
236 $(if $(NOQT),,rmdir $(archdir)/icons)
237 $(if $(NOQT),,mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo)
238 install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
239 sed \
240 -e 's|%VERPKG%|$(verpkg)|g' \
241 debian/lintian-override.in > \
242 $(prefix)/usr/share/lintian/overrides/$(verpkg)
243 mv $(archdir)/VBox.png \
244 $(prefix)/usr/share/pixmaps/VBox.png
245 mv $(archdir)/src $(prefix)/usr/share/$(package)
246 rm $(archdir)/VBox.sh
247 install -D -g 0 -o 0 -m 644 VBox.sh $(prefix)/usr/bin/VBox
248 mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
249 if [ -r $(archdir)/VBoxDTrace ]; then \
250 mv $(archdir)/VBoxDTrace $(prefix)/usr/bin; \
251 fi
252 mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
253 $(if $(NOMODS),,for d in $(moddir)/*; do \
254 if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko -a -f $$d/vboxpci.ko ]; then \
255 install -D -g 0 -o 0 -m 0644 \
256 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
257 install -D -g 0 -o 0 -m 0644 \
258 $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
259 install -D -g 0 -o 0 -m 0644 \
260 $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
261 install -D -g 0 -o 0 -m 0644 \
262 $$d/vboxpci.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxpci.ko; \
263 fi \
264 done)
265ifeq ($(ose),)
266 dh_installdocs \
267 $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
268 $(addprefix $(archdir)/, LICENSE)
269 rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
270 LICENSE)
271 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
272 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
273 $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp $(prefix)/usr/bin)
274 $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp-keymaps $(prefix)/usr/share/$(package))
275else
276 dh_installdocs \
277 $(archdir)/UserManual*.pdf
278 rm $(addprefix $(archdir)/,UserManual*.pdf)
279 for i in additions/VBoxGuestAdditions.iso; do \
280 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
281endif
282 mv $(archdir) $(prefix)/usr/lib/$(package)
283 export VBOX_INSTALL_PATH=/usr/lib/$(package) && \
284 cd $(builddir)/bin/sdk/installer && \
285 python ./vboxapisetup.py install --root $(prefix)
286 rm -rf $(prefix)/usr/lib/$(package)/sdk/installer
287 ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
288 rmdir $(prefix)/opt
289 dh_link \
290 $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBox) \
291 $(if $(NOQT),,usr/bin/VBox usr/bin/virtualbox) \
292 usr/bin/VBox usr/bin/VBoxManage \
293 usr/bin/VBox usr/bin/vboxmanage \
294 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
295 $(if $(HEADLESS),,usr/bin/VBox usr/bin/vboxsdl) \
296 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
297 usr/bin/VBox usr/bin/VBoxHeadless \
298 usr/bin/VBox usr/bin/vboxheadless \
299 usr/bin/VBox usr/bin/VBoxBalloonCtrl \
300 usr/bin/VBox usr/bin/vboxballoonctrl \
301 usr/bin/VBox usr/bin/VBoxAutostart \
302 usr/bin/VBox usr/bin/vboxautostart \
303 $(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
304 $(if $(NOVBOXIMG),,usr/lib/virtualbox/vbox-img usr/bin/vboxwebsrv) \
305 usr/share/virtualbox/src/vboxhost usr/src/vboxhost-$(ver)
306 dh_desktop
307 $(if $(NOMODS),,dh_installmodules)
308 sed -e 's|%VER%|$(debver)|g' \
309 -e 's|%DATE%|$(shell date -R)|g' \
310 -e 's|%DEBREL%|$(subst _,~,$(debrel))|g' \
311 -e 's|%VERPKG%|$(verpkg)|g' \
312 debian/changelog.in > debian/changelog
313 dh_installdebconf
314 dh_installchangelogs
315 dh_installmenu
316 dh_installmime
317 dh_link
318ifeq ($(DEBUG),)
319 dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
320endif
321 mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib
322ifeq ($(DEBUG),)
323 mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
324endif
325 $(if $(filter _Ubuntu_hardy _Ubuntu_lucid,$(debrel)),dh_pycentral,dh_python2)
326 dh_compress -X.pdf -X.chm -X LICENSE -X.py
327 dh_fixperms
328 dh_makeshlibs
329 dh_installdeb
330 dh_perl
331 # for some reason, the Qt libraries couldn't be found on newer releases (e.g. Ubuntu hardy)
332 LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps
333 dh_gencontrol -- \
334 -Valsa=$(if $(HEADLESS),,libasound2) \
335 -Vpulse=$(if $(HEADLESS),,libpulse0) \
336 -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0)
337 dh_md5sums
338 dh_builddeb --destdir $(pkgdir) -- \
339 $(if $(filter _Ubuntu_lucid,$(debrel)),,-Zxz)
340endif
341
342.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