VirtualBox

source: vbox/trunk/debian/rules@ 6351

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

sync deb

  • Property svn:executable set to *
File size: 9.2 KB
Line 
1#!/usr/bin/make -f
2#
3# Copyright (C) 2006-2008 innotek GmbH
4#
5# This file is part of VirtualBox Open Source Edition (OSE), as
6# available from http://www.virtualbox.org. This file is free software;
7# you can redistribute it and/or modify it under the terms of the GNU
8# General Public License as published by the Free Software Foundation,
9# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
10# distribution. VirtualBox OSE is distributed in the hope that it will
11# be useful, but WITHOUT ANY WARRANTY of any kind.
12#
13
14#export DH_VERBOSE=1
15export DH_COMPAT=4
16
17# possible overrides:
18# OSE=1 force VBOX_OSE
19# NOPARALLEL=1 compile with -j1 (-j2 is default)
20# LINUX=<dir> compile vboxdrv against Linux found in <dir>
21# VERBOSE=1 verbose build
22# DEBUG=1 debug build
23# NOSUBVER=1 disable generation of the sub-version field (which is
24# either the subversion rev [if available] or the build date)
25# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
26# VirtualBox.chm from $HOME
27# NOMODS=1 don't build any module
28# HEADLESS=1 build the headless version
29# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
30
31package := virtualbox-ose
32current := $(shell pwd)
33vboxroot := $(shell pwd)
34builddir := $(current)/debian/builddir
35moddir := $(current)/debian/modules
36prefix := $(current)/debian/$(package)
37arch := $(shell dpkg --print-architecture)
38verfile := $(builddir)/version-generated.mk
39ose := 1
40NOMODS ?= $(ose)
41
42ifneq ($(wildcard $(verfile)),)
43include $(verfile)
44ver := $(VBOX_VERSION_STRING)
45archdir := $(prefix)/opt/VirtualBox-$(ver)
46endif
47
48ifneq ($(STAGEDISO),)
49ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
50$(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
51endif
52endif
53
54# Hack: Xandros is actually Debian/sarge ... :(
55ifneq ($(wildcard /etc/xandros-desktop-version),)
56debrel := _xandros4.1
57else
58ifneq ($(wildcard /etc/univention),)
59debrel := _ucs1.3
60else
61debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),)
62endif
63endif
64
65debdocs := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/virtualbox\""
66
67# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
68configure: debian/configure-stamp
69debian/configure-stamp:
70 dh_testdir
71 cd $(vboxroot) && ./configure --odir=$(current)/debian $(if \
72 $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) $(if \
73 $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) $(if \
74 $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
75 $(HEADLESS),--build-headless,) $(if $(DEBUG),--build-debug,)
76 touch debian/configure-stamp
77
78build: debian/configure-stamp debian/build-stamp
79debian/build-stamp $(verfile):
80 dh_testdir
81 . debian/env.sh && kmk -C $(vboxroot) $(if \
82 $(VERBOSE),--print-directory,--no-print-directory) $(if \
83 $(NOPARALLEL),-j1,-j2) $(if \
84 $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
85 $(NODOCS),VBOX_WITH_DOCS=,)\
86 $(if $(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 $(debdocs) \
93 all
94 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual.pdf $(builddir)/bin,)
95 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox.chm $(builddir)/bin,)
96 mkdir -p $(builddir)/bin/additions
97 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
98 . debian/env.sh && kmk -C $(vboxroot) $(if \
99 $(VERBOSE),--print-directory,--no-print-directory) $(if \
100 $(VERBOSE),KBUILD_VERBOSE=2,) $(if \
101 $(STAGEDISO),\
102 VBOX_WITH_LINUX_ADDITIONS= VBOX_WITH_WIN32_ADDITIONS=,) \
103 AUTOCFG=$(current)/debian/AutoConfig.kmk \
104 LOCALCFG=$(current)/debian/LocalConfig.kmk \
105 PATH_OUT=$(current)/debian/builddir \
106 VBOX_DO_STRIP= VBOX_DO_STRIP_MODULES= \
107 $(debdocs) \
108 packing
109 touch debian/build-stamp
110
111# Build modules for every kernel we find in /lib/modules/*
112modules: debian/build-stamp debian/modules-stamp
113debian/modules-stamp: debian/build-stamp
114 rm -rf $(moddir)
115 mkdir $(moddir)
116 make -C $(builddir)/bin/src clean
117 for d in $(wildcard /lib/modules/*); do \
118 make -C $(builddir)/bin/src KERN_DIR=$$d/build MODULE_DIR=$$d clean all && \
119 install -D -m 0644 -g 0 -o 0 \
120 $(builddir)/bin/src/vboxdrv.ko $(moddir)/$$(basename $$d)/vboxdrv.ko; \
121 done
122 make -C $(builddir)/bin/src clean
123 touch debian/modules-stamp
124
125clean:
126 dh_testdir
127 dh_testroot
128 rm -f debian/$(package).init debian/vboxdrv.init debian/vboxnet.init
129 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
130 rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
131 rm -rf $(builddir) $(moddir)
132 dh_clean
133
134ifeq ($(VBOX_VERSION_MAJOR),)
135binary binary-arch binary-indep: build $(verfile)
136 $(MAKE) -f debian/rules binary
137else
138# Build architecture-dependent files here.
139binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
140 dh_testdir
141 dh_testroot
142 dh_clean -k
143 dh_installdirs
144 tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
145 install -d -g 0 -o 0 $(prefix)/usr/share/applications
146 install -d -g 0 -o 0 $(prefix)/usr/lib
147 install -d -g 0 -o 0 $(prefix)/usr/bin
148 install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
149 install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
150 install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(package)
151 $(if $(HEADLESS),,mv $(archdir)/VirtualBox.desktop \
152 $(prefix)/usr/share/applications/VirtualBox.desktop)
153 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
154 install -D -g 0 -o 0 -m 644 debian/lintian-override \
155 $(prefix)/usr/share/lintian/overrides/$(package)
156 mv $(archdir)/VBox.png \
157 $(prefix)/usr/share/pixmaps/VBox.png
158 mv $(archdir)/*.gc $(prefix)/usr/lib/$(package)
159 mv $(archdir)/*.r0 $(prefix)/usr/lib/$(package)
160 $(if $(filter amd64,$(arch)),\
161 mv $(archdir)/VBoxREM2.rel $(prefix)/usr/lib/$(package),)
162 mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
163 mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
164 mv $(archdir)/*.so $(prefix)/usr/lib
165 mv $(archdir)/sdk $(prefix)/usr/share/$(package)
166 $(if $(HEADLESS),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
167 mv $(archdir)/src $(prefix)/usr/share/$(package)
168 rm $(archdir)/VBox.sh
169 install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
170 mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
171 mv $(archdir)/VBoxAddIF.sh $(prefix)/usr/bin/VBoxTAP
172 for i in VBoxManage VBoxSVC tstVMM $(if $(HEADLESS),,VBoxSDL) \
173 $(if $(HEADLESS),,VirtualBox) $(if $(ose),,VBoxVRDP) \
174 VBoxHeadless; do \
175 mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
176 mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
177 $(if $(NOMODS),,for d in $(moddir)/*; do \
178 install -D -g 0 -o 0 -m 0644 \
179 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; done)
180ifeq ($(ose),)
181 $(if $(HEADLESS),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
182 dh_installdocs $(addprefix $(archdir)/,\
183 UserManual.pdf VirtualBox.chm LICENSE)
184 rm $(addprefix $(archdir)/,UserManual.pdf VirtualBox.chm LICENSE)
185 for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
186 mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
187 rmdir $(archdir)/additions
188else
189 dh_installdocs
190endif
191 rmdir $(archdir)
192 rmdir $(prefix)/opt
193 dh_link \
194 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VirtualBox) \
195 usr/bin/VBox usr/bin/VBoxManage \
196 $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
197 $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
198 usr/bin/VBox usr/bin/VBoxHeadless \
199 usr/bin/VBoxTAP usr/bin/VBoxAddIF \
200 usr/bin/VBoxTAP usr/bin/VBoxDeleteIF
201 dh_desktop
202 dh_installmenu
203 $(if $(NOMODS),,dh_installmodules)
204 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g;' \
205 debian/vboxdrv.init.in > debian/vboxdrv.init
206 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge,$(debrel)),yes,)|g;' \
207 debian/vboxnet.init.in > debian/vboxnet.init
208 dh_installinit --name=vboxdrv
209 dh_installinit --name=vboxnet
210 cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
211 if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
212 cat debian/postrm.dapper > debian/postrm; fi
213 dh_installdebconf
214 dh_installchangelogs
215 dh_link
216 dh_strip --keep-debug
217 # manually strip our R0/GC modules, dh_strip cannot handle them
218 for f in \
219 $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
220 objcopy --only-keep-debug \
221 $$f \
222 $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
223 strip -S --remove-section=.comment $$f; \
224 objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
225 done
226 mkdir -p $(current)/debian/$(package)-dbg/usr/lib
227 mv $(current)/debian/$(package)/usr/lib/debug $(current)/debian/$(package)-dbg/usr/lib
228 dh_compress -X.pdf -X.chm -X LICENSE
229 dh_fixperms
230 dh_makeshlibs
231 dh_installdeb
232 dh_perl
233 dh_shlibdeps
234 dh_gencontrol -- \
235 -Valsa=$(if $(HEADLESS),,libasound2) \
236 -Vpulse=$(if $(HEADLESS),,libpulse0) \
237 -Vsdlttf=$(if $(HEADLESS),,libsdl-ttf2.0-0)
238 dh_md5sums
239 dh_builddeb
240endif
241
242.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