VirtualBox

source: vbox/trunk/debian/rules@ 4616

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

unification, dbg packages

  • Property svn:executable set to *
File size: 8.8 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-ose
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 VBOX_DO_STRIP= VBOX_DO_STRIP_MODULES= \
78 all
79 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
80 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
81 mkdir -p $(builddir)/bin/additions
82 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
83 . debian/env.sh && kmk -C $(vboxroot) $(if \
84 $(VERBOSE),--print-directory,--no-print-directory) $(if \
85 $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
86 $(STAGEDISO),\
87 VBOX_WITH_LINUX_ADDITIONS= VBOX_WITH_WIN32_ADDITIONS=,) \
88 AUTOCFG=$(current)/debian/AutoConfig.kmk \
89 LOCALCFG=$(current)/debian/LocalConfig.kmk \
90 PATH_OUT=$(current)/debian/builddir \
91 VBOX_DO_STRIP= VBOX_DO_STRIP_MODULES= \
92 packing
93 touch debian/build-stamp
94
95# Build modules for every kernel we find in /lib/modules/*
96modules: debian/build-stamp debian/modules-stamp
97debian/modules-stamp:
98 rm -rf $(moddir)
99 mkdir $(moddir)
100 make -C $(builddir)/bin/src clean
101 for d in $(wildcard /lib/modules/*); do \
102 make -C $(builddir)/bin/src KERN_DIR=$$d/build MODULE_DIR=$$d clean all && \
103 install -D -m 0644 -g 0 -o 0 \
104 $(builddir)/bin/src/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko; \
105 done
106 make -C $(builddir)/bin/src clean
107 touch debian/modules-stamp
108
109clean:
110 dh_testdir
111 dh_testroot
112 rm -f debian/$(package).init debian/vboxdrv.init
113 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
114 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
115 rm -rf $(builddir) $(moddir)
116 dh_clean
117
118ifeq ($(VBOX_VERSION_MAJOR),)
119binary binary-arch binary-indep: build $(verfile)
120 $(MAKE) -f debian/rules binary
121else
122# Build architecture-dependent files here.
123binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
124 dh_testdir
125 dh_testroot
126 dh_clean -k
127 dh_installdirs
128 tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
129 install -d -g 0 -o 0 $(prefix)/usr/share/applications
130 install -d -g 0 -o 0 $(prefix)/usr/lib
131 install -d -g 0 -o 0 $(prefix)/usr/bin
132 install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
133 install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
134 install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(package)
135 $(if $(HEADLESS),,mv $(prefix)/opt/VirtualBox-$(ver)/VirtualBox.desktop \
136 $(prefix)/usr/share/applications/VirtualBox.desktop)
137 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
138 install -D -g 0 -o 0 -m 644 debian/lintian-override \
139 $(prefix)/usr/share/lintian/overrides/$(package)
140 mv $(prefix)/opt/VirtualBox-$(ver)/VBox.png \
141 $(prefix)/usr/share/pixmaps/VBox.png
142 mv $(prefix)/opt/VirtualBox-$(ver)/*.gc $(prefix)/usr/lib/$(package)
143 mv $(prefix)/opt/VirtualBox-$(ver)/*.r0 $(prefix)/usr/lib/$(package)
144 $(if $(filter amd64,$(arch)),\
145 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxREM2.rel $(prefix)/usr/lib/$(package),)
146 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
147 mv $(prefix)/opt/VirtualBox-$(ver)/components $(prefix)/usr/lib/$(package)/components
148 mv $(prefix)/opt/VirtualBox-$(ver)/*.so $(prefix)/usr/lib
149 mv $(prefix)/opt/VirtualBox-$(ver)/sdk $(prefix)/usr/share/$(package)
150 $(if $(HEADLESS),,mv $(prefix)/opt/VirtualBox-$(ver)/nls $(prefix)/usr/share/$(package))
151 mv $(prefix)/opt/VirtualBox-$(ver)/src $(prefix)/usr/share/$(package)
152 rm $(prefix)/opt/VirtualBox-$(ver)/VBox.sh
153 install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
154 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxAddIF.sh $(prefix)/usr/bin/VBoxTAP
155 for i in VBoxManage VBoxSVC tstVMM $(if $(HEADLESS),,VBoxSDL) \
156 $(if $(HEADLESS),,VirtualBox) $(if $(ose),,VBoxVRDP); do \
157 mv $(prefix)/opt/VirtualBox-$(ver)/$$i $(prefix)/usr/lib/$(package); done
158 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxTunctl $(prefix)/usr/bin
159 $(if $(NOMODS),,for d in $(moddir)/*; do \
160 install -D -g 0 -o 0 -m 0644 \
161 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; done)
162ifeq ($(ose),)
163 $(if $(HEADLESS),,mv $(prefix)/opt/VirtualBox-$(ver)/kchmviewer $(prefix)/usr/lib/$(package))
164 dh_installdocs $(addprefix $(prefix)/opt/VirtualBox-$(ver)/,\
165 UserManual.pdf VirtualBox.chm LICENSE)
166 rm $(addprefix $(prefix)/opt/VirtualBox-$(ver)/,UserManual.pdf VirtualBox.chm LICENSE)
167 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
168 mv $(prefix)/opt/VirtualBox-$(ver)/$$i $(prefix)/usr/share/$(package); done
169 rmdir $(prefix)/opt/VirtualBox-$(ver)/additions
170else
171 dh_installdocs
172endif
173 rmdir $(prefix)/opt/VirtualBox-$(ver)
174 rmdir $(prefix)/opt
175 dh_link \
176 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VirtualBox) \
177 usr/bin/VBox usr/bin/VBoxManage \
178 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
179 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
180 usr/bin/VBoxTAP usr/bin/VBoxAddIF \
181 usr/bin/VBoxTAP usr/bin/VBoxDeleteIF
182 dh_desktop
183 dh_installmenu
184 $(if $(NOMODS),,dh_installmodules)
185 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g;' \
186 debian/vboxdrv.init.tmpl > debian/vboxdrv.init
187 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge,$(debrel)),yes,)|g;' \
188 debian/vboxnet.init.tmpl > debian/vboxnet.init
189 dh_installinit --name=vboxdrv
190 dh_installinit --name=vboxnet
191 if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
192 cat debian/postrm.dapper > debian/postrm; fi
193 dh_installdebconf
194 dh_installchangelogs
195 dh_link
196 dh_strip --keep-debug
197 # manually strip our R0/GC modules, dh_strip cannot handle them
198 for f in \
199 $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
200 objcopy --only-keep-debug \
201 $$f \
202 $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
203 strip -S --remove-section=.comment $$f; \
204 objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
205 done
206 mkdir -p $(current)/debian/$(package)-dbg/usr/lib
207 mv $(current)/debian/$(package)/usr/lib/debug $(current)/debian/$(package)-dbg/usr/lib
208 dh_compress -X.pdf -X.chm -X LICENSE
209 dh_fixperms
210 dh_makeshlibs
211 dh_installdeb
212 dh_perl
213 dh_shlibdeps
214 dh_gencontrol
215 dh_md5sums
216 dh_builddeb
217endif
218
219.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