VirtualBox

source: vbox/trunk/debian/rules@ 4168

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

sync

  • 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
53# Debian sarge: libhal-devel 0.4.7 is too old
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 _Debian_sarge,$(debrel)),--without-hal,) $(if \
61 $(filter _xandros4.1,$(debrel)),--build-xalan,) $(if \
62 $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
63 $(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/$(if \
78 $(HEADLESS),LocalConfig-headless.kmk,LocalConfig.kmk) \
79 PATH_OUT=$(current)/debian/builddir \
80 all
81 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
82 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
83 mkdir -p $(builddir)/bin/additions
84 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
85 . debian/env.sh && kmk -C $(vboxroot) $(if \
86 $(VERBOSE),--print-directory,--no-print-directory) $(if \
87 $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
88 $(STAGEDISO),\
89 VBOX_WITH_LINUX_ADDITIONS= VBOX_WITH_WIN32_ADDITIONS=,) \
90 AUTOCFG=$(current)/debian/AutoConfig.kmk \
91 LOCALCFG=$(current)/debian/$(if \
92 $(HEADLESS),LocalConfig-headless.kmk,LocalConfig.kmk) \
93 PATH_OUT=$(current)/debian/builddir \
94 packing
95 touch debian/build-stamp
96
97# Build modules for every kernel we find in /lib/modules/*
98modules: debian/build-stamp debian/modules-stamp
99debian/modules-stamp:
100 rm -rf $(moddir)
101 mkdir $(moddir)
102 make -C $(builddir)/bin/src clean
103 for d in $(wildcard /lib/modules/*); do \
104 make -C $(builddir)/bin/src KERN_DIR=$$d/build MODULE_DIR=$$d clean all && \
105 install -D -m 0644 -g 0 -o 0 \
106 $(builddir)/bin/src/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko; \
107 done
108 make -C $(builddir)/bin/src clean
109 touch debian/modules-stamp
110
111clean:
112 dh_testdir
113 dh_testroot
114 rm -f debian/virtualbox.init debian/vboxdrv.init
115 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
116 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
117 rm -rf $(builddir) $(moddir)
118 dh_clean
119
120ifeq ($(VBOX_VERSION_MAJOR),)
121binary binary-arch binary-indep: build $(verfile)
122 $(MAKE) -f debian/rules binary
123else
124# Build architecture-dependent files here.
125binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
126 dh_testdir
127 dh_testroot
128 dh_clean -k
129 dh_installdirs
130 tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
131 install -d -g 0 -o 0 $(prefix)/usr/share/applications
132 install -d -g 0 -o 0 $(prefix)/usr/lib
133 install -d -g 0 -o 0 $(prefix)/usr/bin
134 install -d -g 0 -o 0 $(prefix)/usr/lib/virtualbox
135 install -d -g 0 -o 0 $(prefix)/usr/share/virtualbox
136 install -d -g 0 -o 0 $(prefix)/usr/share/doc/virtualbox
137 $(if $(HEADLESS),,mv $(prefix)/opt/VirtualBox-$(ver)/VirtualBox.desktop \
138 $(prefix)/usr/share/applications/VirtualBox.desktop)
139 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
140 install -D -g 0 -o 0 -m 644 debian/lintian-override \
141 debian/virtualbox/usr/share/lintian/overrides/virtualbox
142 mv $(prefix)/opt/VirtualBox-$(ver)/VBox.png \
143 $(prefix)/usr/share/pixmaps/VBox.png
144 mv $(prefix)/opt/VirtualBox-$(ver)/*.gc $(prefix)/usr/lib/virtualbox
145 mv $(prefix)/opt/VirtualBox-$(ver)/*.r0 $(prefix)/usr/lib/virtualbox
146 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxXPCOMIPCD $(prefix)/usr/lib/virtualbox
147 mv $(prefix)/opt/VirtualBox-$(ver)/components $(prefix)/usr/lib/virtualbox/components
148 mv $(prefix)/opt/VirtualBox-$(ver)/*.so $(prefix)/usr/lib
149 mv $(prefix)/opt/VirtualBox-$(ver)/sdk $(prefix)/usr/share/virtualbox
150 mv $(prefix)/opt/VirtualBox-$(ver)/nls $(prefix)/usr/share/virtualbox
151 mv $(prefix)/opt/VirtualBox-$(ver)/src $(prefix)/usr/share/virtualbox
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/virtualbox; 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 mv $(prefix)/opt/VirtualBox-$(ver)/kchmviewer $(prefix)/usr/lib/virtualbox
164 for i in UserManual.pdf VirtualBox.chm LICENSE; do \
165 mv $(prefix)/opt/VirtualBox-$(ver)/$$i $(prefix)/usr/share/doc/virtualbox; done
166 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
167 mv $(prefix)/opt/VirtualBox-$(ver)/$$i $(prefix)/usr/share/virtualbox; done
168 rmdir $(prefix)/opt/VirtualBox-$(ver)/additions
169endif
170 rmdir $(prefix)/opt/VirtualBox-$(ver)
171 rmdir $(prefix)/opt
172 dh_link \
173 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VirtualBox) \
174 usr/bin/VBox usr/bin/VBoxManage \
175 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
176 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
177 usr/bin/VBoxTAP usr/bin/VBoxAddIF \
178 usr/bin/VBoxTAP usr/bin/VBoxDeleteIF
179 dh_desktop
180 dh_installmenu
181 $(if $(NOMODS),,dh_installmodules)
182 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g;' \
183 debian/vboxdrv.init.tmpl > debian/vboxdrv.init
184# sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge,$(debrel)),yes,)|g;' \
185 debian/vboxnet.init.tmpl > debian/vboxnet.init
186 dh_installinit --name=vboxdrv
187# dh_installinit --name=vboxnet
188 if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
189 cat debian/postrm.dapper > debian/postrm; fi
190 dh_installdebconf
191 dh_installchangelogs
192 dh_link
193 [ -n "$(DEBUG)" ] || dh_strip
194 dh_compress -X.pdf -X.chm
195 dh_fixperms
196 dh_makeshlibs
197 dh_installdeb
198 dh_perl
199 dh_shlibdeps
200 dh_gencontrol
201 dh_md5sums
202 dh_builddeb
203endif
204
205.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