VirtualBox

source: vbox/trunk/debian/rules@ 6202

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

removed the remaining VBoxXML part

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