VirtualBox

source: vbox/trunk/debian/rules@ 5773

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

.deb: sync

  • Property svn:executable set to *
File size: 8.7 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)
33archdir := $(prefix)/opt/VirtualBox-$(ver)
34endif
35
36ifneq ($(STAGEDISO),)
37ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
38$(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
39endif
40endif
41
42# Hack: Xandros is actually Debian/sarge ... :(
43ifneq ($(wildcard /etc/xandros-desktop-version),)
44debrel := _xandros4.1
45else
46ifneq ($(wildcard /etc/univention),)
47debrel := _ucs1.3
48else
49debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),)
50endif
51endif
52
53debdocs := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/virtualbox\""
54
55# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
56configure: debian/configure-stamp
57debian/configure-stamp:
58 dh_testdir
59 cd $(vboxroot) && ./configure --odir=$(current)/debian $(if \
60 $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) $(if \
61 $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) $(if \
62 $(filter _xandros4.1,$(debrel)),--build-xalan,) $(if \
63 $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
64 $(HEADLESS),--build-headless,) $(if $(DEBUG),--build-debug,)
65 touch debian/configure-stamp
66
67build: debian/configure-stamp debian/build-stamp
68debian/build-stamp $(verfile):
69 dh_testdir
70 . debian/env.sh && kmk -C $(vboxroot) $(if \
71 $(VERBOSE),--print-directory,--no-print-directory) $(if \
72 $(NOPARALLEL),-j1,-j2) $(if \
73 $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
74 $(NODOCS),VBOX_WITH_DOCS=,)\
75 $(if $(STAGEDISO),\
76 VBOX_WITH_LINUX_ADDITIONS= VBOX_WITH_WIN32_ADDITIONS=,) \
77 AUTOCFG=$(current)/debian/AutoConfig.kmk \
78 LOCALCFG=$(current)/debian/LocalConfig.kmk \
79 PATH_OUT=$(current)/debian/builddir \
80 VBOX_DO_STRIP= VBOX_DO_STRIP_MODULES= \
81 $(debdocs) \
82 all
83 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
84 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
85 mkdir -p $(builddir)/bin/additions
86 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
87 . debian/env.sh && kmk -C $(vboxroot) $(if \
88 $(VERBOSE),--print-directory,--no-print-directory) $(if \
89 $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
90 $(STAGEDISO),\
91 VBOX_WITH_LINUX_ADDITIONS= VBOX_WITH_WIN32_ADDITIONS=,) \
92 AUTOCFG=$(current)/debian/AutoConfig.kmk \
93 LOCALCFG=$(current)/debian/LocalConfig.kmk \
94 PATH_OUT=$(current)/debian/builddir \
95 VBOX_DO_STRIP= VBOX_DO_STRIP_MODULES= \
96 $(debdocs) \
97 packing
98 touch debian/build-stamp
99
100# Build modules for every kernel we find in /lib/modules/*
101modules: debian/build-stamp debian/modules-stamp
102debian/modules-stamp: debian/build-stamp
103 rm -rf $(moddir)
104 mkdir $(moddir)
105 make -C $(builddir)/bin/src clean
106 for d in $(wildcard /lib/modules/*); do \
107 make -C $(builddir)/bin/src KERN_DIR=$$d/build MODULE_DIR=$$d clean all && \
108 install -D -m 0644 -g 0 -o 0 \
109 $(builddir)/bin/src/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko; \
110 done
111 make -C $(builddir)/bin/src clean
112 touch debian/modules-stamp
113
114clean:
115 dh_testdir
116 dh_testroot
117 rm -f debian/$(package).init debian/vboxdrv.init debian/vboxnet.init
118 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
119 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
120 rm -rf $(builddir) $(moddir)
121 dh_clean
122
123ifeq ($(VBOX_VERSION_MAJOR),)
124binary binary-arch binary-indep: build $(verfile)
125 $(MAKE) -f debian/rules binary
126else
127# Build architecture-dependent files here.
128binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
129 dh_testdir
130 dh_testroot
131 dh_clean -k
132 dh_installdirs
133 tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
134 install -d -g 0 -o 0 $(prefix)/usr/share/applications
135 install -d -g 0 -o 0 $(prefix)/usr/lib
136 install -d -g 0 -o 0 $(prefix)/usr/bin
137 install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
138 install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
139 install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(package)
140 $(if $(HEADLESS),,mv $(archdir)/VirtualBox.desktop \
141 $(prefix)/usr/share/applications/VirtualBox.desktop)
142 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
143 install -D -g 0 -o 0 -m 644 debian/lintian-override \
144 $(prefix)/usr/share/lintian/overrides/$(package)
145 mv $(archdir)/VBox.png \
146 $(prefix)/usr/share/pixmaps/VBox.png
147 mv $(archdir)/*.gc $(prefix)/usr/lib/$(package)
148 mv $(archdir)/*.r0 $(prefix)/usr/lib/$(package)
149 $(if $(filter amd64,$(arch)),\
150 mv $(archdir)/VBoxREM2.rel $(prefix)/usr/lib/$(package),)
151 mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
152 mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
153 mv $(archdir)/*.so $(prefix)/usr/lib
154 mv $(archdir)/sdk $(prefix)/usr/share/$(package)
155 $(if $(HEADLESS),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
156 mv $(archdir)/src $(prefix)/usr/share/$(package)
157 rm $(archdir)/VBox.sh
158 install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
159 mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
160 mv $(archdir)/VBoxAddIF.sh $(prefix)/usr/bin/VBoxTAP
161 for i in VBoxManage VBoxSVC tstVMM $(if $(HEADLESS),,VBoxSDL) \
162 $(if $(HEADLESS),,VirtualBox) $(if $(ose),,VBoxVRDP); do \
163 mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
164 mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
165 $(if $(NOMODS),,for d in $(moddir)/*; do \
166 install -D -g 0 -o 0 -m 0644 \
167 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; done)
168ifeq ($(ose),)
169 $(if $(HEADLESS),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
170 dh_installdocs $(addprefix $(archdir)/,\
171 UserManual.pdf VirtualBox.chm LICENSE)
172 rm $(addprefix $(archdir)/,UserManual.pdf VirtualBox.chm LICENSE)
173 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
174 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
175 rmdir $(archdir)/additions
176else
177 dh_installdocs
178endif
179 rmdir $(archdir)
180 rmdir $(prefix)/opt
181 dh_link \
182 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VirtualBox) \
183 usr/bin/VBox usr/bin/VBoxManage \
184 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
185 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
186 usr/bin/VBoxTAP usr/bin/VBoxAddIF \
187 usr/bin/VBoxTAP usr/bin/VBoxDeleteIF
188 dh_desktop
189 dh_installmenu
190 $(if $(NOMODS),,dh_installmodules)
191 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g;' \
192 debian/vboxdrv.init.tmpl > debian/vboxdrv.init
193 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge,$(debrel)),yes,)|g;' \
194 debian/vboxnet.init.tmpl > debian/vboxnet.init
195 dh_installinit --name=vboxdrv
196 dh_installinit --name=vboxnet
197 if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
198 cat debian/postrm.dapper > debian/postrm; fi
199 dh_installdebconf
200 dh_installchangelogs
201 dh_link
202 dh_strip --keep-debug
203 # manually strip our R0/GC modules, dh_strip cannot handle them
204 for f in \
205 $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
206 objcopy --only-keep-debug \
207 $$f \
208 $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
209 strip -S --remove-section=.comment $$f; \
210 objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
211 done
212 mkdir -p $(current)/debian/$(package)-dbg/usr/lib
213 mv $(current)/debian/$(package)/usr/lib/debug $(current)/debian/$(package)-dbg/usr/lib
214 dh_compress -X.pdf -X.chm -X LICENSE
215 dh_fixperms
216 dh_makeshlibs
217 dh_installdeb
218 dh_perl
219 dh_shlibdeps
220 dh_gencontrol -- \
221 -Valsa=$(if $(HEADLESS),,libasound2) \
222 -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0)
223 dh_md5sums
224 dh_builddeb
225endif
226
227.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