VirtualBox

source: vbox/trunk/debian/rules@ 74942

Last change on this file since 74942 was 68922, checked in by vboxsync, 7 years ago

debian/rules: adjust kernel module building to recent Make file changes.
bugref:4567:Linux kernel driver maintenance

When the Linux kernel module Make files were reworked recently we switched
from specifying the kernel to use via a build folder path to specifying
a version and deducing the path. The Debian rules file did not get updated
though, so this change does that.

  • Property svn:executable set to *
File size: 10.7 KB
RevLine 
[3848]1#!/usr/bin/make -f
[6316]2#
[40390]3# Copyright (C) 2006-2012 Oracle Corporation
[6316]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
[43119]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.
[6316]12#
13
[3848]14#export DH_VERBOSE=1
15export DH_COMPAT=4
16
17# possible overrides:
18# OSE=1 force VBOX_OSE
[14379]19# NOPARALLEL=1 compile with -j1
[3848]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
[3869]27# NOMODS=1 don't build any module
[14552]28# NOQT=1 don't build the Qt GUI
[40390]29# EFI=1 include the EFI binary from prebuild
[3848]30# HEADLESS=1 build the headless version
[40390]31# VNC=1 build VNC code
[20621]32# NOWEBSVC=1 don't build the webservice API, default for OSE
[3848]33# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
[40390]34# PKGDIR=<path> where to store the final package(s)
[3848]35
[13540]36package := virtualbox
37verpkg := virtualbox-ose
[3848]38current := $(shell pwd)
39vboxroot := $(shell pwd)
[40390]40pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ..; pwd))
[44750]41builddir := $(vboxroot)/out/debian/builddir
42moddir := $(vboxroot)/out/debian/modules
[13540]43prefix := $(current)/debian/$(verpkg)
[3848]44arch := $(shell dpkg --print-architecture)
45verfile := $(builddir)/version-generated.mk
[32014]46ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
[3869]47NOMODS ?= $(ose)
[14552]48NOQT ?= $(HEADLESS)
[20621]49NOWEBSVC ?= $(ose)
[20642]50NOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
[3848]51
52ifneq ($(wildcard $(verfile)),)
53include $(verfile)
54ver := $(VBOX_VERSION_STRING)
[20621]55archdir := $(prefix)/opt/VirtualBox-$(ver)
[3848]56endif
57
58ifneq ($(STAGEDISO),)
[14379]59 ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
60 $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
61 endif
[3848]62endif
63
[31999]64debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
[3848]65
[23106]66cfg_flags := $(if $(NOQT),--disable-qt,) \
67 $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
68 $(if $(HEADLESS),--build-headless,) \
69 $(if $(DEBUG),--build-debug,) \
70 $(if $(NOWINE),,--setup-wine) \
[45615]71 $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
[40390]72 $(if $(VNC),--enable-vnc,) \
[40217]73 --disable-extpack
[23106]74
75bld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
76 LOCALCFG=$(current)/debian/LocalConfig.kmk \
[40390]77 PATH_OUT=$(builddir) \
[36554]78 VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
[40390]79 VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
[56181]80 $(if $(filter _Debian_squeeze _Ubuntu_lucid,$(debrel)),,VBOX_WITH_VMSVGA3D=1) \
[23106]81 VBOX_DO_STRIP= \
[68000]82 VBOX_WITH_MULTIVERSION_PYTHON= \
[23106]83 VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
[32029]84 $(if $(ose),,VBOX_WITH_DOCS_CHM=1) \
[44993]85 $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
[40390]86 $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
[23106]87 $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
[63946]88 $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,)
[23106]89
[3848]90configure: debian/configure-stamp
91debian/configure-stamp:
92 dh_testdir
[23106]93 cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
[3848]94 touch debian/configure-stamp
95
96build: debian/configure-stamp debian/build-stamp
97debian/build-stamp $(verfile):
98 dh_testdir
[23112]99 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
[20621]100 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
101 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
[40390]102 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
103 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
[3848]104 mkdir -p $(builddir)/bin/additions
105 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
[23112]106 . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
[23106]107 VBOX_NO_LINUX_RUN_INSTALLER=1 \
[44993]108 VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
109 VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
[32044]110 VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
111 VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
[3848]112 packing
113 touch debian/build-stamp
114
115# Build modules for every kernel we find in /lib/modules/*
116modules: debian/build-stamp debian/modules-stamp
[5255]117debian/modules-stamp: debian/build-stamp
[3848]118 rm -rf $(moddir)
119 mkdir $(moddir)
[14379]120 make -C $(builddir)/bin/src/vboxdrv clean
[3848]121 for d in $(wildcard /lib/modules/*); do \
[10349]122 if [ -L $$d/build ]; then \
[68922]123 make -C $(builddir)/bin/src/vboxdrv KERN_VER=$$(basename $$d) clean && \
124 make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_VER=$$(basename $$d) all \
125 make -C $(builddir)/bin/src/vboxnetflt KERN_VER=$$(basename $$d) clean && \
[14436]126 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
[68922]127 make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_VER=$$(basename $$d) all \
128 make -C $(builddir)/bin/src/vboxnetadp KERN_VER=$$(basename $$d) clean && \
[19208]129 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
[68922]130 make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_VER=$$(basename $$d) all \
131 make -C $(builddir)/bin/src/vboxpci KERN_VER=$$(basename $$d) clean && \
[36888]132 (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
[68922]133 make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_VER=$$(basename $$d) all \
[10349]134 fi; \
135 done
[14379]136 make -C $(builddir)/bin/src/vboxdrv clean
[14436]137 make -C $(builddir)/bin/src/vboxnetflt clean
[19208]138 make -C $(builddir)/bin/src/vboxnetadp clean
[36888]139 make -C $(builddir)/bin/src/vboxpci clean
[3848]140 touch debian/modules-stamp
141
142clean:
143 dh_testdir
144 dh_testroot
[32029]145 rm -f debian/preinst debian/postinst debian/prerm
[36782]146 rm -f debian/$(package).init debian/vboxdrv.init
[43316]147 rm -f debian/vboxballoonctrl-service.init debian/vboxautostart-service.init debian/vboxweb-service.init
[23991]148 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
[3890]149 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
[34603]150 rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
151 rm -f debian/$(verpkg).mime
[3848]152 rm -rf $(builddir) $(moddir)
[40390]153 rm -rf debian/wine.*
[3848]154 dh_clean
155
156ifeq ($(VBOX_VERSION_MAJOR),)
157binary binary-arch binary-indep: build $(verfile)
158 $(MAKE) -f debian/rules binary
159else
160# Build architecture-dependent files here.
[3869]161binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
[3848]162 dh_testdir
163 dh_testroot
164 dh_clean -k
165 dh_installdirs
[56856]166 tar -xC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar
[44969]167 $(if $(NOQT),,mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo)
168 $(archdir)/scripts/install.sh --package $(package) --root $(prefix) \
169 --prefix /usr $(if $(NOQT),--no-qt) $(if $(ose),--ose) \
170 $(if $(HEADLESS),--headless) $(if $(NOWEBSVC),--no-web-service) \
171 --install-folder /lib/$(package) --no-helpers
[13540]172 install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
[15569]173 install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
174 sed \
175 -e 's|%VERPKG%|$(verpkg)|g' \
176 debian/lintian-override.in > \
177 $(prefix)/usr/share/lintian/overrides/$(verpkg)
[3869]178 $(if $(NOMODS),,for d in $(moddir)/*; do \
[36888]179 if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko -a -f $$d/vboxpci.ko ]; then \
[23991]180 install -D -g 0 -o 0 -m 0644 \
181 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
182 install -D -g 0 -o 0 -m 0644 \
183 $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
184 install -D -g 0 -o 0 -m 0644 \
185 $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
[36888]186 install -D -g 0 -o 0 -m 0644 \
187 $$d/vboxpci.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxpci.ko; \
[23991]188 fi \
[14436]189 done)
[3869]190ifeq ($(ose),)
[14379]191 dh_installdocs \
[14436]192 $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
[36782]193 $(addprefix $(archdir)/, LICENSE)
[31999]194 rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
[36782]195 LICENSE)
[4310]196else
[32014]197 dh_installdocs \
198 $(archdir)/UserManual*.pdf
199 rm $(addprefix $(archdir)/,UserManual*.pdf)
[3869]200endif
[44969]201 mv $(archdir) $(prefix)/usr/lib/$(package)
[47931]202 ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
[3862]203 rmdir $(prefix)/opt
[3869]204 $(if $(NOMODS),,dh_installmodules)
[14379]205 sed \
[31999]206 -e 's|%NOLSB%||g' \
[23889]207 -e 's|%DEBIAN%|yes|g' \
[14379]208 -e 's|%PACKAGE%|virtualbox|g' \
[40390]209 -e "s|%VERSION%|$(VBOX_VERSION_STRING)|g" \
[36782]210 -e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
[31999]211 $(vboxroot)/src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
212 dh_installinit --name=vboxdrv --noscripts
[43613]213 cp $(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh debian/vboxballoonctrl-service.init
[36782]214 dh_installinit --name=vboxballoonctrl-service --noscripts
[43613]215 cp $(vboxroot)/src/VBox/Installer/linux/vboxautostart-service.sh debian/vboxautostart-service.init
[43316]216 dh_installinit --name=vboxautostart-service --noscripts
[43613]217 cp $(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh debian/vboxweb-service.init
[31999]218 dh_installinit --name=vboxweb-service --noscripts
[38404]219 sed -e 's|%VER%|$(ver)|g' \
220 debian/preinst.in > debian/preinst
221 sed -e 's|%VER%|$(ver)|g' \
222 debian/prerm.in > debian/prerm
223 sed -e 's|%VER%|$(ver)|g' \
[39266]224 -e '/#include installer-common.sh/ {' \
225 -e "r $(vboxroot)/src/VBox/Installer/linux/installer-common.sh" \
226 -e 'd' \
227 -e '}' \
[38404]228 debian/postinst.in > debian/postinst
[3848]229 dh_installdebconf
230 dh_installchangelogs
[32045]231 dh_installmenu
[34603]232 dh_installmime
[3848]233 dh_link
[20621]234ifeq ($(DEBUG),)
[60575]235 dh_strip --keep-debug \
236 $(addprefix --exclude=lib,$(addsuffix VBox.so.5,\
237 Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport Qt5OpenGL Qt5DBus Qt5XcbQpa Qt5X11Extras)) \
238 --exclude=libqxcb.so
[20621]239endif
[13540]240 mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib
[20621]241ifeq ($(DEBUG),)
[13540]242 mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
[20621]243endif
[64072]244 $(firstword $(shell which dh_python2) $(shell which dh_python3))
[20202]245 dh_compress -X.pdf -X.chm -X LICENSE -X.py
[3848]246 dh_fixperms
247 dh_makeshlibs
248 dh_installdeb
249 dh_perl
[40390]250 LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps
[5255]251 dh_gencontrol -- \
252 -Valsa=$(if $(HEADLESS),,libasound2) \
[6205]253 -Vpulse=$(if $(HEADLESS),,libpulse0) \
[63946]254 -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0)
[3848]255 dh_md5sums
[43316]256 dh_builddeb --destdir $(pkgdir) -- -Zxz
[3848]257endif
258
259.PHONY: binary modules binary-arch binary-indep clean checkroot
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use