VirtualBox

source: vbox/trunk/debian/rules@ 26201

Last change on this file since 26201 was 24860, checked in by vboxsync, 15 years ago

EFI images were renamed, adjust the installers

  • Property svn:executable set to *
File size: 13.4 KB
Line 
1#!/usr/bin/make -f
2#
3# Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 as published by the Free Software Foundation,
9# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
10# distribution. VirtualBox OSE is distributed in the hope that it will
11# be useful, but WITHOUT ANY WARRANTY of any kind.
12#
13
14#export DH_VERBOSE=1
15export DH_COMPAT=4
16
17# possible overrides:
18# OSE=1 force VBOX_OSE
19# NOPARALLEL=1 compile with -j1
20# LINUX=<dir> compile vboxdrv against Linux found in <dir>
21# VERBOSE=1 verbose build
22# DEBUG=1 debug build
23# NOSUBVER=1 disable generation of the sub-version field (which is
24# either the subversion rev [if available] or the build date)
25# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
26# VirtualBox.chm from $HOME
27# NOMODS=1 don't build any module
28# NOQT=1 don't build the Qt GUI
29# HEADLESS=1 build the headless version
30# NOWEBSVC=1 don't build the webservice API, default for OSE
31# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
32# BLEEDING_EDGE=xyz
33
34package := virtualbox
35verpkg := virtualbox-ose
36current := $(shell pwd)
37vboxroot := $(shell pwd)
38pkgdir := ..
39builddir := $(current)/debian/builddir
40moddir := $(current)/debian/modules
41prefix := $(current)/debian/$(verpkg)
42arch := $(shell dpkg --print-architecture)
43verfile := $(builddir)/version-generated.mk
44ose := 1
45NOMODS ?= $(ose)
46NOQT ?= $(HEADLESS)
47NOWEBSVC ?= $(ose)
48NOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
49
50ifneq ($(wildcard $(verfile)),)
51include $(verfile)
52ver := $(VBOX_VERSION_STRING)
53archdir := $(prefix)/opt/VirtualBox-$(ver)
54endif
55
56ifneq ($(STAGEDISO),)
57 ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
58 $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
59 endif
60endif
61
62# Hack: Xandros is actually Debian/sarge ... :(
63ifneq ($(wildcard /etc/xandros-desktop-version),)
64 debrel := _xandros4.1
65else
66ifneq ($(wildcard /etc/univention),)
67 debrel := _ucs1.3
68else
69 debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
70endif
71endif
72
73# shipping Linux kernel modules with bleeding-edge releases doesn't make sense
74instmod := $(if $(filter _Ubuntu_karmic _Debian_sid,$(debrel)),,1)
75
76# Locations of custom built Qt libraries (see below)
77qtstdc5 := /home/vbox/Qt-4.4.3-stdc++5-$(arch)
78qtstdc6 := /home/vbox/Qt-4.4.3-stdc++6-$(arch)
79
80cfg_flags := $(if $(NOQT),--disable-qt,) \
81 $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
82 $(if $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) \
83 $(if $(filter _Ubuntu_gutsy,$(debrel)),--with-gcc=gcc-4.2 --with-g++=g++-4.2,) \
84 $(if $(filter _xandros4.1 _ucs1.3 _Debian_sarge _Ubuntu_dapper,$(debrel)),--build-libxml2,) \
85 $(if $(filter _xandros4.1 _ucs1.3 _Debian_sarge _Ubuntu_dapper,$(debrel)),--build-libxslt,) \
86 $(if $(filter _Debian_etch,$(debrel)),$(if $(ose),,--build-libcurl),) \
87 $(if $(filter _Debian_sarge _xandros4.1 _ucs1.3,$(debrel)),--with-qt4-dir=$(qtstdc5)) \
88 $(if $(filter _Debian_etch _Ubuntu_dapper _Ubuntu_edgy _Ubuntu_feisty _Ubuntu_gutsy _Ubuntu_hardy,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
89 $(if $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) \
90 $(if $(filter _Debian_sarge _Ubuntu_dapper _Ubuntu_edgy _xandros4.1 _ucs1.3,$(debrel)),--disable-pulse,) \
91 $(if $(HEADLESS),--build-headless,) \
92 $(if $(DEBUG),--build-debug,) \
93 $(if $(NOWINE),,--setup-wine) \
94 $(if $(NOWEBSVC),,--enable-webservice)
95
96bld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
97 LOCALCFG=$(current)/debian/LocalConfig.kmk \
98 PATH_OUT=$(current)/debian/builddir \
99 VBOX_DO_STRIP= \
100 VBOX_DO_STRIP_MODULES= \
101 VBOX_WITH_MULTIVERSION_PYTHON= \
102 VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
103 $(if $(NODOCS),VBOX_WITH_DOCS= ,)\
104 $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
105 $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
106 $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
107 $(if $(filter _Debian_sarge _xandros4.1 _ucs1.3,$(debrel)),VBOX_LD_as_needed= ,) \
108 $(if $(filter _Debian_etch _Ubuntu_hardy,$(debrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
109
110# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
111# Ubuntu gutsy: gcc-4.1 does not work for the webservices, use gcc-4.2 instead
112configure: debian/configure-stamp
113debian/configure-stamp:
114 dh_testdir
115 cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
116 touch debian/configure-stamp
117
118build: debian/configure-stamp debian/build-stamp
119debian/build-stamp $(verfile):
120 dh_testdir
121 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
122 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
123 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
124 mkdir -p $(builddir)/bin/additions
125 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
126 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
127 VBOX_NO_LINUX_RUN_INSTALLER=1 \
128 VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
129 packing
130 touch debian/build-stamp
131
132# Build modules for every kernel we find in /lib/modules/*
133modules: debian/build-stamp debian/modules-stamp
134debian/modules-stamp: debian/build-stamp
135 rm -rf $(moddir)
136 mkdir $(moddir)
137 make -C $(builddir)/bin/src/vboxdrv clean
138 for d in $(wildcard /lib/modules/*); do \
139 if [ -L $$d/build ]; then \
140 make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
141 make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
142 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
143 $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
144 make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
145 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
146 make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
147 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
148 $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
149 make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
150 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
151 make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
152 $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
153 $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko); \
154 fi; \
155 done
156 make -C $(builddir)/bin/src/vboxdrv clean
157 make -C $(builddir)/bin/src/vboxnetflt clean
158 make -C $(builddir)/bin/src/vboxnetadp clean
159 touch debian/modules-stamp
160
161clean:
162 dh_testdir
163 dh_testroot
164 rm -f debian/preinst debian/postinst
165 rm -f debian/$(package).init debian/vboxdrv.init
166 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
167 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
168 rm -rf $(builddir) $(moddir)
169 dh_clean
170
171ifeq ($(VBOX_VERSION_MAJOR),)
172binary binary-arch binary-indep: build $(verfile)
173 $(MAKE) -f debian/rules binary
174else
175# Build architecture-dependent files here.
176binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
177 dh_testdir
178 dh_testroot
179 dh_clean -k
180 dh_installdirs
181 tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
182 install -d -g 0 -o 0 $(prefix)/usr/share/applications
183 install -d -g 0 -o 0 $(prefix)/usr/lib
184 install -d -g 0 -o 0 $(prefix)/usr/bin
185 install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
186 install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
187 install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
188 $(if $(NOQT),,mv $(archdir)/virtualbox.desktop \
189 $(prefix)/usr/share/applications/virtualbox.desktop)
190 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
191 install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
192 sed \
193 -e 's|%VERPKG%|$(verpkg)|g' \
194 debian/lintian-override.in > \
195 $(prefix)/usr/share/lintian/overrides/$(verpkg)
196 mv $(archdir)/VBoxEFI32.fd $(prefix)/usr/lib/$(package)
197 mv $(archdir)/VBoxEFI64.fd $(prefix)/usr/lib/$(package)
198 mv $(archdir)/VBox.png \
199 $(prefix)/usr/share/pixmaps/VBox.png
200 mv $(archdir)/*.gc $(prefix)/usr/lib/$(package)
201 mv $(archdir)/*.r0 $(prefix)/usr/lib/$(package)
202 mv $(archdir)/*.rel $(prefix)/usr/lib/$(package) || true
203 mv $(archdir)/VBoxNetDHCP $(prefix)/usr/lib/$(package)
204 mv $(archdir)/VBoxNetAdpCtl $(prefix)/usr/lib/$(package)
205 mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
206 mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
207 mv $(archdir)/*.so $(prefix)/usr/lib/$(package)
208 mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
209 mv $(archdir)/VBoxTestOGL $(prefix)/usr/lib/$(package)
210 $(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
211 mv $(archdir)/src $(prefix)/usr/share/$(package)
212 rm $(archdir)/VBox.sh
213 export VBOX_INSTALL_PATH=/usr/lib/$(package) && \
214 cd ./debian/builddir/bin/sdk/installer && \
215 python ./vboxapisetup.py install --root $(prefix)
216 rm -rf $(archdir)/sdk/installer
217 mv $(archdir)/vboxshell.py $(prefix)/usr/lib/$(package)
218 mv $(archdir)/sdk $(prefix)/usr/lib/$(package)
219 install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
220 mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
221 for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
222 $(if $(NOQT),,VirtualBox) VBoxHeadless \
223 $(if $(NOWEBSVC),,vboxwebsrv webtest); do \
224 mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
225 mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
226 $(if $(NOMODS),,for d in $(moddir)/*; do \
227 if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko ]; then \
228 install -D -g 0 -o 0 -m 0644 \
229 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
230 install -D -g 0 -o 0 -m 0644 \
231 $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
232 install -D -g 0 -o 0 -m 0644 \
233 $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
234 fi \
235 done)
236ifeq ($(ose),)
237 $(if $(NOQT),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
238 dh_installdocs \
239 $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
240 LICENSE
241 rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm LICENSE)
242 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
243 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
244 rmdir $(archdir)/additions
245 if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
246else
247 dh_installdocs
248endif
249 rmdir $(archdir)
250 rmdir $(prefix)/opt
251 dh_link \
252 $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBox) \
253 usr/bin/VBox usr/bin/VBoxManage \
254 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
255 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
256 usr/bin/VBox usr/bin/VBoxHeadless \
257 $(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
258 usr/share/virtualbox/src/vboxdrv usr/src/vboxdrv-$(ver) \
259 usr/share/virtualbox/src/vboxnetflt usr/src/vboxnetflt-$(ver) \
260 usr/share/virtualbox/src/vboxnetadp usr/src/vboxnetadp-$(ver)
261 dh_desktop
262 dh_installmenu
263 $(if $(NOMODS),,dh_installmodules)
264 sed \
265 -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g' \
266 -e 's|%DEBIAN%|yes|g' \
267 -e 's|%PACKAGE%|virtualbox|g' \
268 src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
269 dh_installinit --name=vboxdrv
270 cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
271 cat debian/postinst.in | sed -e 's|%VER%|$(ver)|g' > debian/postinst
272 if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
273 cat debian/postrm.dapper > debian/postrm; fi
274 dh_installdebconf
275 dh_installchangelogs
276 dh_link
277ifeq ($(DEBUG),)
278 dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
279 # manually strip our R0/GC modules, dh_strip cannot handle them
280 for f in \
281 $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
282 objcopy --only-keep-debug \
283 $$f \
284 $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
285 strip -S --remove-section=.comment $$f; \
286 objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
287 done
288endif
289 mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib
290ifeq ($(DEBUG),)
291 mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
292endif
293 dh_pycentral
294 dh_compress -X.pdf -X.chm -X LICENSE -X.py
295 dh_fixperms
296 dh_makeshlibs
297 dh_installdeb
298 dh_perl
299 dh_shlibdeps
300 dh_gencontrol -- \
301 -Valsa=$(if $(HEADLESS),,libasound2) \
302 -Vpulse=$(if $(HEADLESS),,libpulse0) \
303 -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0) \
304 -Vdkms=$(if $(filter _Ubuntu_gutsy _Ubuntu_hardy _Ubuntu_intrepid _Ubuntu_jaunty _Ubuntu_karmic,$(debrel)),dkms,)
305 dh_md5sums
306 dh_builddeb --destdir $(pkgdir)
307endif
308
309.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