VirtualBox

source: vbox/trunk/debian/rules@ 4310

Last change on this file since 4310 was 4310, checked in by vboxsync, 17 years ago

use dh_installdocs, some more merge between rules files

  • Property svn:executable set to *
File size: 8.1 KB
Line 
1#!/usr/bin/make -f
2#export DH_VERBOSE=1
3export DH_COMPAT=4
4
5# possible overrides:
6# OSE=1 force VBOX_OSE
7# NOPARALLEL=1 compile with -j1 (-j2 is default)
8# LINUX=<dir> compile vboxdrv against Linux found in <dir>
9# VERBOSE=1 verbose build
10# DEBUG=1 debug build
11# NOSUBVER=1 disable generation of the sub-version field (which is
12# either the subversion rev [if available] or the build date)
13# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
14# VirtualBox.chm from $HOME
15# NOMODS=1 don't build any module
16# HEADLESS=1 build the headless version
17# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
18
19package := virtualbox
20current := $(shell pwd)
21vboxroot := $(shell pwd)
22builddir := $(current)/debian/builddir
23moddir := $(current)/debian/modules
24prefix := $(current)/debian/$(package)
25arch := $(shell dpkg --print-architecture)
26verfile := $(builddir)/version-generated.mk
27ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/Devices/USB),,1))
28NOMODS ?= $(ose)
29
30ifneq ($(wildcard $(verfile)),)
31include $(verfile)
32ver := $(VBOX_VERSION_STRING)
33endif
34
35ifneq ($(STAGEDISO),)
36ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
37$(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
38endif
39endif
40
41# Hack: Xandros is actually Debian/sarge ... :(
42ifneq ($(wildcard /etc/xandros-desktop-version),)
43debrel := _xandros4.1
44else
45ifneq ($(wildcard /etc/univention),)
46debrel := _ucs1.3
47else
48debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),)
49endif
50endif
51
52# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
53configure: debian/configure-stamp
54debian/configure-stamp:
55 dh_testdir
56 cd $(vboxroot) && ./configure --odir=$(current)/debian $(if \
57 $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) $(if \
58 $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) $(if \
59 $(filter _xandros4.1,$(debrel)),--build-xalan,) $(if \
60 $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
61 $(HEADLESS),--build-headless,) $(if $(DEBUG),--build-debug,)
62 touch debian/configure-stamp
63
64build: debian/configure-stamp debian/build-stamp
65debian/build-stamp $(verfile):
66 dh_testdir
67 . debian/env.sh && kmk -C $(vboxroot) $(if \
68 $(VERBOSE),--print-directory,--no-print-directory) $(if \
69 $(NOPARALLEL),-j1,-j2) $(if \
70 $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
71 $(NODOCS),VBOX_WITH_DOCS=,)\
72 $(if $(STAGEDISO),\
73 VBOX_WITH_LINUX_ADDITIONS= VBOX_WITH_WIN32_ADDITIONS=,) \
74 AUTOCFG=$(current)/debian/AutoConfig.kmk \
75 LOCALCFG=$(current)/debian/LocalConfig.kmk \
76 PATH_OUT=$(current)/debian/builddir \
77 all
78 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
79 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
80 mkdir -p $(builddir)/bin/additions
81 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
82 . debian/env.sh && kmk -C $(vboxroot) $(if \
83 $(VERBOSE),--print-directory,--no-print-directory) $(if \
84 $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
85 $(STAGEDISO),\
86 VBOX_WITH_LINUX_ADDITIONS= VBOX_WITH_WIN32_ADDITIONS=,) \
87 AUTOCFG=$(current)/debian/AutoConfig.kmk \
88 LOCALCFG=$(current)/debian/LocalConfig.kmk \
89 PATH_OUT=$(current)/debian/builddir \
90 packing
91 touch debian/build-stamp
92
93# Build modules for every kernel we find in /lib/modules/*
94modules: debian/build-stamp debian/modules-stamp
95debian/modules-stamp:
96 rm -rf $(moddir)
97 mkdir $(moddir)
98 make -C $(builddir)/bin/src clean
99 for d in $(wildcard /lib/modules/*); do \
100 make -C $(builddir)/bin/src KERN_DIR=$$d/build MODULE_DIR=$$d clean all && \
101 install -D -m 0644 -g 0 -o 0 \
102 $(builddir)/bin/src/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko; \
103 done
104 make -C $(builddir)/bin/src clean
105 touch debian/modules-stamp
106
107clean:
108 dh_testdir
109 dh_testroot
110 rm -f debian/virtualbox.init debian/vboxdrv.init
111 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
112 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
113 rm -rf $(builddir) $(moddir)
114 dh_clean
115
116ifeq ($(VBOX_VERSION_MAJOR),)
117binary binary-arch binary-indep: build $(verfile)
118 $(MAKE) -f debian/rules binary
119else
120# Build architecture-dependent files here.
121binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
122 dh_testdir
123 dh_testroot
124 dh_clean -k
125 dh_installdirs
126 tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
127 install -d -g 0 -o 0 $(prefix)/usr/share/applications
128 install -d -g 0 -o 0 $(prefix)/usr/lib
129 install -d -g 0 -o 0 $(prefix)/usr/bin
130 install -d -g 0 -o 0 $(prefix)/usr/lib/virtualbox
131 install -d -g 0 -o 0 $(prefix)/usr/share/virtualbox
132 install -d -g 0 -o 0 $(prefix)/usr/share/doc/virtualbox
133 $(if $(HEADLESS),,mv $(prefix)/opt/VirtualBox-$(ver)/VirtualBox.desktop \
134 $(prefix)/usr/share/applications/VirtualBox.desktop)
135 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
136 install -D -g 0 -o 0 -m 644 debian/lintian-override \
137 $(prefix)/usr/share/lintian/overrides/virtualbox
138 mv $(prefix)/opt/VirtualBox-$(ver)/VBox.png \
139 $(prefix)/usr/share/pixmaps/VBox.png
140 mv $(prefix)/opt/VirtualBox-$(ver)/*.gc $(prefix)/usr/lib/virtualbox
141 mv $(prefix)/opt/VirtualBox-$(ver)/*.r0 $(prefix)/usr/lib/virtualbox
142 $(if $(filter amd64,$(arch)),\
143 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxREM2.rel $(prefix)/usr/lib/virtualbox,)
144 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxXPCOMIPCD $(prefix)/usr/lib/virtualbox
145 mv $(prefix)/opt/VirtualBox-$(ver)/components $(prefix)/usr/lib/virtualbox/components
146 mv $(prefix)/opt/VirtualBox-$(ver)/*.so $(prefix)/usr/lib
147 mv $(prefix)/opt/VirtualBox-$(ver)/sdk $(prefix)/usr/share/virtualbox
148 $(if $(HEADLESS),,mv $(prefix)/opt/VirtualBox-$(ver)/nls $(prefix)/usr/share/virtualbox)
149 mv $(prefix)/opt/VirtualBox-$(ver)/src $(prefix)/usr/share/virtualbox
150 rm $(prefix)/opt/VirtualBox-$(ver)/VBox.sh
151 install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
152 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxAddIF.sh $(prefix)/usr/bin/VBoxTAP
153 for i in VBoxManage VBoxSVC tstVMM $(if $(HEADLESS),,VBoxSDL) \
154 $(if $(HEADLESS),,VirtualBox) $(if $(ose),,VBoxVRDP); do \
155 mv $(prefix)/opt/VirtualBox-$(ver)/$$i $(prefix)/usr/lib/virtualbox; done
156 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxTunctl $(prefix)/usr/bin
157 $(if $(NOMODS),,for d in $(moddir)/*; do \
158 install -D -g 0 -o 0 -m 0644 \
159 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; done)
160ifeq ($(ose),)
161 $(if $(HEADLESS),,mv $(prefix)/opt/VirtualBox-$(ver)/kchmviewer $(prefix)/usr/lib/virtualbox)
162 dh_installdocs $(addprefix $(prefix)/opt/VirtualBox-$(ver)/,\
163 UserManual.pdf VirtualBox.chm LICENSE)
164 rm $(addprefix $(prefix)/opt/VirtualBox-$(ver)/,UserManual.pdf VirtualBox.chm LICENSE)
165 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
166 mv $(prefix)/opt/VirtualBox-$(ver)/$$i $(prefix)/usr/share/virtualbox; done
167 rmdir $(prefix)/opt/VirtualBox-$(ver)/additions
168else
169 dh_installdocs
170endif
171 rmdir $(prefix)/opt/VirtualBox-$(ver)
172 rmdir $(prefix)/opt
173 dh_link \
174 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VirtualBox) \
175 usr/bin/VBox usr/bin/VBoxManage \
176 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
177 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
178 usr/bin/VBoxTAP usr/bin/VBoxAddIF \
179 usr/bin/VBoxTAP usr/bin/VBoxDeleteIF
180 dh_desktop
181 dh_installmenu
182 $(if $(NOMODS),,dh_installmodules)
183 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g;' \
184 debian/vboxdrv.init.tmpl > debian/vboxdrv.init
185# sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge,$(debrel)),yes,)|g;' \
186 debian/vboxnet.init.tmpl > debian/vboxnet.init
187 dh_installinit --name=vboxdrv
188# dh_installinit --name=vboxnet
189 if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
190 cat debian/postrm.dapper > debian/postrm; fi
191 dh_installdebconf
192 dh_installchangelogs
193 dh_link
194 [ -n "$(DEBUG)" ] || dh_strip
195 dh_compress -X.pdf -X.chm -X LICENSE
196 dh_fixperms
197 dh_makeshlibs
198 dh_installdeb
199 dh_perl
200 dh_shlibdeps
201 dh_gencontrol
202 dh_md5sums
203 dh_builddeb
204endif
205
206.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