[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
|
---|
| 15 | export 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)
|
---|
[22634] | 35 | # BLEEDING_EDGE=xyz
|
---|
[3848] | 36 |
|
---|
[13540] | 37 | package := virtualbox
|
---|
| 38 | verpkg := virtualbox-ose
|
---|
[3848] | 39 | current := $(shell pwd)
|
---|
| 40 | vboxroot := $(shell pwd)
|
---|
[40390] | 41 | pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ..; pwd))
|
---|
[44750] | 42 | builddir := $(vboxroot)/out/debian/builddir
|
---|
| 43 | moddir := $(vboxroot)/out/debian/modules
|
---|
[13540] | 44 | prefix := $(current)/debian/$(verpkg)
|
---|
[3848] | 45 | arch := $(shell dpkg --print-architecture)
|
---|
| 46 | verfile := $(builddir)/version-generated.mk
|
---|
[32014] | 47 | ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
|
---|
[3869] | 48 | NOMODS ?= $(ose)
|
---|
[14552] | 49 | NOQT ?= $(HEADLESS)
|
---|
[20621] | 50 | NOWEBSVC ?= $(ose)
|
---|
[20642] | 51 | NOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
|
---|
[3848] | 52 |
|
---|
| 53 | ifneq ($(wildcard $(verfile)),)
|
---|
| 54 | include $(verfile)
|
---|
| 55 | ver := $(VBOX_VERSION_STRING)
|
---|
[20621] | 56 | archdir := $(prefix)/opt/VirtualBox-$(ver)
|
---|
[3848] | 57 | endif
|
---|
| 58 |
|
---|
| 59 | ifneq ($(STAGEDISO),)
|
---|
[14379] | 60 | ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
|
---|
| 61 | $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
|
---|
| 62 | endif
|
---|
[3848] | 63 | endif
|
---|
| 64 |
|
---|
[31999] | 65 | debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
|
---|
[3848] | 66 |
|
---|
[23991] | 67 | # shipping Linux kernel modules with bleeding-edge releases doesn't make sense
|
---|
[38984] | 68 | instmod := $(if $(filter _Ubuntu_lucid _Ubuntu_maverick _Ubuntu_natty _Ubuntu_oneiric _Debian_sid,$(debrel)),,1)
|
---|
[23991] | 69 |
|
---|
[36782] | 70 | # Location of custom built Qt libraries (see below)
|
---|
[39266] | 71 | qtstdc6 := /home/vbox/Qt-4.7.4-stdc++6-$(arch)
|
---|
[20621] | 72 |
|
---|
[23106] | 73 | cfg_flags := $(if $(NOQT),--disable-qt,) \
|
---|
[45933] | 74 | $(if $(filter _Debian_squeeze,$(debrel)),--build-libvpx,) \
|
---|
[23106] | 75 | $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
|
---|
| 76 | $(if $(HEADLESS),--build-headless,) \
|
---|
| 77 | $(if $(DEBUG),--build-debug,) \
|
---|
| 78 | $(if $(NOWINE),,--setup-wine) \
|
---|
[45615] | 79 | $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
|
---|
[40390] | 80 | $(if $(VNC),--enable-vnc,) \
|
---|
[40217] | 81 | --disable-extpack
|
---|
[23106] | 82 |
|
---|
| 83 | bld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
|
---|
| 84 | LOCALCFG=$(current)/debian/LocalConfig.kmk \
|
---|
[40390] | 85 | PATH_OUT=$(builddir) \
|
---|
[36554] | 86 | VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
|
---|
[40390] | 87 | VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
|
---|
[23106] | 88 | VBOX_DO_STRIP= \
|
---|
| 89 | VBOX_WITH_MULTIVERSION_PYTHON= \
|
---|
| 90 | VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
|
---|
[32029] | 91 | $(if $(ose),,VBOX_WITH_DOCS_CHM=1) \
|
---|
[44993] | 92 | $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
|
---|
[40390] | 93 | $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
|
---|
[23106] | 94 | $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
|
---|
| 95 | $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
|
---|
[45933] | 96 | $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),)
|
---|
[23106] | 97 |
|
---|
[3848] | 98 | configure: debian/configure-stamp
|
---|
| 99 | debian/configure-stamp:
|
---|
| 100 | dh_testdir
|
---|
[23106] | 101 | cd $(vboxroot) && ./configure --odir=$(current)/debian $(cfg_flags)
|
---|
[3848] | 102 | touch debian/configure-stamp
|
---|
| 103 |
|
---|
| 104 | build: debian/configure-stamp debian/build-stamp
|
---|
| 105 | debian/build-stamp $(verfile):
|
---|
| 106 | dh_testdir
|
---|
[23112] | 107 | . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
|
---|
[20621] | 108 | $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
|
---|
| 109 | $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
|
---|
[40390] | 110 | $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
|
---|
| 111 | $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
|
---|
[3848] | 112 | mkdir -p $(builddir)/bin/additions
|
---|
| 113 | $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
|
---|
[23112] | 114 | . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
|
---|
[23106] | 115 | VBOX_NO_LINUX_RUN_INSTALLER=1 \
|
---|
[44993] | 116 | VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
|
---|
| 117 | VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
|
---|
[32044] | 118 | VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
|
---|
| 119 | VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
|
---|
[3848] | 120 | packing
|
---|
| 121 | touch debian/build-stamp
|
---|
| 122 |
|
---|
| 123 | # Build modules for every kernel we find in /lib/modules/*
|
---|
| 124 | modules: debian/build-stamp debian/modules-stamp
|
---|
[5255] | 125 | debian/modules-stamp: debian/build-stamp
|
---|
[3848] | 126 | rm -rf $(moddir)
|
---|
| 127 | mkdir $(moddir)
|
---|
[14379] | 128 | make -C $(builddir)/bin/src/vboxdrv clean
|
---|
[3848] | 129 | for d in $(wildcard /lib/modules/*); do \
|
---|
[10349] | 130 | if [ -L $$d/build ]; then \
|
---|
[14379] | 131 | make -C $(builddir)/bin/src/vboxdrv KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
|
---|
[23991] | 132 | make -j4 -C $(builddir)/bin/src/vboxdrv KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
|
---|
| 133 | $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
|
---|
| 134 | $(builddir)/bin/src/vboxdrv/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko); \
|
---|
[14436] | 135 | make -C $(builddir)/bin/src/vboxnetflt KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
|
---|
| 136 | (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetflt || true) && \
|
---|
[23991] | 137 | make -j4 -C $(builddir)/bin/src/vboxnetflt KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
|
---|
| 138 | $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
|
---|
| 139 | $(builddir)/bin/src/vboxnetflt/vboxnetflt.ko $(moddir)/$$(basename $$d)/vboxnetflt.ko); \
|
---|
[19208] | 140 | make -C $(builddir)/bin/src/vboxnetadp KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
|
---|
| 141 | (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxnetadp || true) && \
|
---|
[23991] | 142 | make -j4 -C $(builddir)/bin/src/vboxnetadp KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
|
---|
| 143 | $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
|
---|
| 144 | $(builddir)/bin/src/vboxnetadp/vboxnetadp.ko $(moddir)/$$(basename $$d)/vboxnetadp.ko); \
|
---|
[36888] | 145 | make -C $(builddir)/bin/src/vboxpci KERN_DIR=$$d/build MODULE_DIR=$$d clean && \
|
---|
| 146 | (cp $(builddir)/bin/src/vboxdrv/Module.symvers $(builddir)/bin/src/vboxpci || true) && \
|
---|
| 147 | make -j4 -C $(builddir)/bin/src/vboxpci KBUILD_VERBOSE= KERN_DIR=$$d/build MODULE_DIR=$$d all \
|
---|
| 148 | $(if $(instmod),&& install -D -m 0644 -g 0 -o 0 \
|
---|
| 149 | $(builddir)/bin/src/vboxpci/vboxpci.ko $(moddir)/$$(basename $$d)/vboxpci.ko); \
|
---|
[10349] | 150 | fi; \
|
---|
| 151 | done
|
---|
[14379] | 152 | make -C $(builddir)/bin/src/vboxdrv clean
|
---|
[14436] | 153 | make -C $(builddir)/bin/src/vboxnetflt clean
|
---|
[19208] | 154 | make -C $(builddir)/bin/src/vboxnetadp clean
|
---|
[36888] | 155 | make -C $(builddir)/bin/src/vboxpci clean
|
---|
[3848] | 156 | touch debian/modules-stamp
|
---|
| 157 |
|
---|
| 158 | clean:
|
---|
| 159 | dh_testdir
|
---|
| 160 | dh_testroot
|
---|
[32029] | 161 | rm -f debian/preinst debian/postinst debian/prerm
|
---|
[36782] | 162 | rm -f debian/$(package).init debian/vboxdrv.init
|
---|
[43316] | 163 | rm -f debian/vboxballoonctrl-service.init debian/vboxautostart-service.init debian/vboxweb-service.init
|
---|
[23991] | 164 | rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
|
---|
[3890] | 165 | rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
|
---|
[34603] | 166 | rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
|
---|
| 167 | rm -f debian/$(verpkg).mime
|
---|
[3848] | 168 | rm -rf $(builddir) $(moddir)
|
---|
[40390] | 169 | rm -rf debian/wine.*
|
---|
[3848] | 170 | dh_clean
|
---|
| 171 |
|
---|
| 172 | ifeq ($(VBOX_VERSION_MAJOR),)
|
---|
| 173 | binary binary-arch binary-indep: build $(verfile)
|
---|
| 174 | $(MAKE) -f debian/rules binary
|
---|
| 175 | else
|
---|
| 176 | # Build architecture-dependent files here.
|
---|
[3869] | 177 | binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
|
---|
[3848] | 178 | dh_testdir
|
---|
| 179 | dh_testroot
|
---|
| 180 | dh_clean -k
|
---|
| 181 | dh_installdirs
|
---|
| 182 | tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
|
---|
[44969] | 183 | $(if $(NOQT),,mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo)
|
---|
| 184 | $(archdir)/scripts/install.sh --package $(package) --root $(prefix) \
|
---|
| 185 | --prefix /usr $(if $(NOQT),--no-qt) $(if $(ose),--ose) \
|
---|
| 186 | $(if $(HEADLESS),--headless) $(if $(NOWEBSVC),--no-web-service) \
|
---|
| 187 | --install-folder /lib/$(package) --no-helpers
|
---|
[13540] | 188 | install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
|
---|
[15569] | 189 | install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
|
---|
| 190 | sed \
|
---|
| 191 | -e 's|%VERPKG%|$(verpkg)|g' \
|
---|
| 192 | debian/lintian-override.in > \
|
---|
| 193 | $(prefix)/usr/share/lintian/overrides/$(verpkg)
|
---|
[3869] | 194 | $(if $(NOMODS),,for d in $(moddir)/*; do \
|
---|
[36888] | 195 | if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko -a -f $$d/vboxpci.ko ]; then \
|
---|
[23991] | 196 | install -D -g 0 -o 0 -m 0644 \
|
---|
| 197 | $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; \
|
---|
| 198 | install -D -g 0 -o 0 -m 0644 \
|
---|
| 199 | $$d/vboxnetflt.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetflt.ko; \
|
---|
| 200 | install -D -g 0 -o 0 -m 0644 \
|
---|
| 201 | $$d/vboxnetadp.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxnetadp.ko; \
|
---|
[36888] | 202 | install -D -g 0 -o 0 -m 0644 \
|
---|
| 203 | $$d/vboxpci.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxpci.ko; \
|
---|
[23991] | 204 | fi \
|
---|
[14436] | 205 | done)
|
---|
[3869] | 206 | ifeq ($(ose),)
|
---|
[14379] | 207 | dh_installdocs \
|
---|
[14436] | 208 | $(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
|
---|
[36782] | 209 | $(addprefix $(archdir)/, LICENSE)
|
---|
[31999] | 210 | rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
|
---|
[36782] | 211 | LICENSE)
|
---|
[4310] | 212 | else
|
---|
[32014] | 213 | dh_installdocs \
|
---|
| 214 | $(archdir)/UserManual*.pdf
|
---|
| 215 | rm $(addprefix $(archdir)/,UserManual*.pdf)
|
---|
[3869] | 216 | endif
|
---|
[44969] | 217 | mv $(archdir) $(prefix)/usr/lib/$(package)
|
---|
[47931] | 218 | ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
|
---|
[3862] | 219 | rmdir $(prefix)/opt
|
---|
[3848] | 220 | dh_desktop
|
---|
[3869] | 221 | $(if $(NOMODS),,dh_installmodules)
|
---|
[14379] | 222 | sed \
|
---|
[31999] | 223 | -e 's|%NOLSB%||g' \
|
---|
[23889] | 224 | -e 's|%DEBIAN%|yes|g' \
|
---|
[14379] | 225 | -e 's|%PACKAGE%|virtualbox|g' \
|
---|
[40390] | 226 | -e "s|%VERSION%|$(VBOX_VERSION_STRING)|g" \
|
---|
[36782] | 227 | -e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
|
---|
[31999] | 228 | $(vboxroot)/src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
|
---|
| 229 | dh_installinit --name=vboxdrv --noscripts
|
---|
[43613] | 230 | cp $(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh debian/vboxballoonctrl-service.init
|
---|
[36782] | 231 | dh_installinit --name=vboxballoonctrl-service --noscripts
|
---|
[43613] | 232 | cp $(vboxroot)/src/VBox/Installer/linux/vboxautostart-service.sh debian/vboxautostart-service.init
|
---|
[43316] | 233 | dh_installinit --name=vboxautostart-service --noscripts
|
---|
[43613] | 234 | cp $(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh debian/vboxweb-service.init
|
---|
[31999] | 235 | dh_installinit --name=vboxweb-service --noscripts
|
---|
[38404] | 236 | sed -e 's|%VER%|$(ver)|g' \
|
---|
| 237 | debian/preinst.in > debian/preinst
|
---|
| 238 | sed -e 's|%VER%|$(ver)|g' \
|
---|
| 239 | debian/prerm.in > debian/prerm
|
---|
| 240 | sed -e 's|%VER%|$(ver)|g' \
|
---|
[39266] | 241 | -e '/#include installer-common.sh/ {' \
|
---|
| 242 | -e "r $(vboxroot)/src/VBox/Installer/linux/installer-common.sh" \
|
---|
| 243 | -e 'd' \
|
---|
| 244 | -e '}' \
|
---|
[38404] | 245 | debian/postinst.in > debian/postinst
|
---|
[3848] | 246 | dh_installdebconf
|
---|
| 247 | dh_installchangelogs
|
---|
[32045] | 248 | dh_installmenu
|
---|
[34603] | 249 | dh_installmime
|
---|
[3848] | 250 | dh_link
|
---|
[20621] | 251 | ifeq ($(DEBUG),)
|
---|
[23106] | 252 | dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
|
---|
[20621] | 253 | endif
|
---|
[13540] | 254 | mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib
|
---|
[20621] | 255 | ifeq ($(DEBUG),)
|
---|
[13540] | 256 | mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
|
---|
[20621] | 257 | endif
|
---|
[48676] | 258 | $(if $(filter _Ubuntu_hardy _Ubuntu_lucid,$(debrel)),dh_pycentral,dh_python2)
|
---|
[20202] | 259 | dh_compress -X.pdf -X.chm -X LICENSE -X.py
|
---|
[3848] | 260 | dh_fixperms
|
---|
| 261 | dh_makeshlibs
|
---|
| 262 | dh_installdeb
|
---|
| 263 | dh_perl
|
---|
[40390] | 264 | LD_LIBRARY_PATH=$(prefix)/usr/lib/virtualbox dh_shlibdeps
|
---|
[5255] | 265 | dh_gencontrol -- \
|
---|
| 266 | -Valsa=$(if $(HEADLESS),,libasound2) \
|
---|
[6205] | 267 | -Vpulse=$(if $(HEADLESS),,libpulse0) \
|
---|
[10349] | 268 | -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0) \
|
---|
[39266] | 269 | -Vdkms=$(if $(filter _Debian_lenny,$(debrel)),,dkms)
|
---|
[3848] | 270 | dh_md5sums
|
---|
[43316] | 271 | dh_builddeb --destdir $(pkgdir) -- -Zxz
|
---|
[3848] | 272 | endif
|
---|
| 273 |
|
---|
| 274 | .PHONY: binary modules binary-arch binary-indep clean checkroot
|
---|