VirtualBox

source: vbox/trunk/debian/rules@ 3851

最後變更 在這個檔案從3851是 3851,由 vboxsync 提交於 17 年 前

OSE debian fixes

  • 屬性 svn:executable 設為 *
檔案大小: 6.9 KB
 
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# HEADLESS=1 build the headless version
16# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
17
18package := virtualbox
19current := $(shell pwd)
20vboxroot := $(shell pwd)
21builddir := $(current)/debian/builddir
22moddir := $(current)/debian/modules
23prefix := $(current)/debian/$(package)
24arch := $(shell dpkg --print-architecture)
25verfile := $(builddir)/version-generated.mk
26ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/Devices/USB),,1))
27
28ifneq ($(wildcard $(verfile)),)
29include $(verfile)
30ver := $(VBOX_VERSION_STRING)
31endif
32
33ifneq ($(STAGEDISO),)
34ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
35$(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
36endif
37endif
38
39# Hack: Xandros is actually Debian/sarge ... :(
40ifneq ($(wildcard /etc/xandros-desktop-version),)
41debrel := _xandros4.1
42else
43ifneq ($(wildcard /etc/univention),)
44debrel := _ucs1.3
45else
46debrel := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),)
47endif
48endif
49deblib := $(shell if [ `uname -m` = "x86_64" ]; then echo "lib64"; else echo "lib"; fi)
50
51# Ubuntu dapper: gcc-4.0 does not work with recompiler, use gcc-3.4 instead
52# Debian sarge: libhal-devel 0.4.7 is too old
53configure: debian/configure-stamp
54debian/configure-stamp:
55 dh_testdir
56 cd $(vboxroot) && ./configure --odir=$(current)/debian $(if \
57 $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) $(if \
58 $(filter _Ubuntu_dapper,$(debrel)),--with-gcc=gcc-3.4 --with-g++=g++-3.4,) $(if \
59 $(filter _xandros4.1 _Debian_sarge,$(debrel)),--without-hal,) $(if \
60 $(filter _xandros4.1,$(debrel)),--build-xalan,) $(if \
61 $(filter _xandros4.1 _ucs1.3,$(debrel)),--disable-sdl-ttf,) $(if \
62 $(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/$(if \
77 $(HEADLESS),LocalConfig-headless.kmk,LocalConfig.kmk) \
78 PATH_OUT=$(current)/debian/builddir \
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/$(if \
91 $(HEADLESS),LocalConfig-headless.kmk,LocalConfig.kmk) \
92 PATH_OUT=$(current)/debian/builddir \
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:
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/virtualbox.init debian/vboxdrv.init
114 rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
115 rm -f 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 $(ose),,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 echo "# VirtualBox installation directory" > $(prefix)/etc/vbox/vbox.cfg
131 echo "INSTALL_DIR=\"/opt/VirtualBox-$(ver)\"" >> $(prefix)/etc/vbox/vbox.cfg
132 install -d -g 0 -o 0 $(prefix)/usr/share/applications
133 install -d -g 0 -o 0 $(prefix)/usr/$(deblib)
134 install -d -g 0 -o 0 $(prefix)/usr/bin
135 install -d -g 0 -o 0 $(prefix)/usr/lib/virtualbox
136 $(if $(HEADLESS),,mv $(prefix)/opt/VirtualBox-$(ver)/VirtualBox.desktop \
137 $(prefix)/usr/share/applications/VirtualBox.desktop)
138 install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
139 mv $(prefix)/opt/VirtualBox-$(ver)/VBox.png \
140 $(prefix)/usr/share/pixmaps/VBox.png
141 mv $(prefix)/opt/VirtualBox-$(ver)/*.gc $(prefix)/usr/lib/virtualbox
142 mv $(prefix)/opt/VirtualBox-$(ver)/*.r0 $(prefix)/usr/lib/virtualbox
143 mv $(prefix)/opt/VirtualBox-$(ver)/*.so $(prefix)/usr/$(deblib)
144 $(if $(ose),,for d in $(moddir)/*; do \
145 install -D -g 0 -o 0 -m 0644 \
146 $$d/vboxdrv.ko $(prefix)/lib/modules/$$(basename $$d)/misc/vboxdrv.ko; done)
147 mv $(prefix)/opt/VirtualBox-$(ver)/VBoxTunctl $(prefix)/usr/bin
148 dh_link \
149 $(if $(HEADLESS),,opt/VirtualBox-$(ver)/VBox.sh usr/bin/VirtualBox) \
150 opt/VirtualBox-$(ver)/VBox.sh usr/bin/VBoxManage \
151 $(if $(HEADLESS),,opt/VirtualBox-$(ver)/VBox.sh usr/bin/VBoxSDL) \
152 opt/VirtualBox-$(ver)/VBox.sh usr/bin/VBoxVRDP \
153 opt/VirtualBox-$(ver)/VBoxAddIF.sh usr/bin/VBoxAddIF \
154 opt/VirtualBox-$(ver)/VBoxAddIF.sh usr/bin/VBoxDeleteIF
155 dh_desktop
156 dh_installmenu
157 $(if $(ose),,dh_installmodules)
158 sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge ucs1.3,$(debrel)),yes,)|g;' \
159 debian/vboxdrv.init.tmpl > debian/vboxdrv.init
160# sed -e 's|%NOLSB%|$(if $(filter _Debian_sarge,$(debrel)),yes,)|g;' \
161 debian/vboxnet.init.tmpl > debian/vboxnet.init
162 dh_installinit --name=vboxdrv
163# dh_installinit --name=vboxnet
164 if [ "$(debrel)" = "_Ubuntu_dapper" -o "$(debrel)" = "_Debian_sarge" ]; then \
165 cat debian/postrm.dapper > debian/postrm; fi
166 dh_installdebconf
167 dh_installchangelogs
168 dh_link
169 [ -n "$(DEBUG)" ] || dh_strip
170 dh_compress
171 dh_fixperms
172 dh_makeshlibs
173 dh_installdeb
174 dh_perl
175 dh_shlibdeps
176 dh_gencontrol
177 dh_md5sums
178 dh_builddeb
179endif
180
181.PHONY: binary modules binary-arch binary-indep clean checkroot
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette