VirtualBox

source: vbox/trunk/debian/rules@ 5287

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

sync

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