| 1 | #!/usr/bin/make -f |
|---|
| 2 | |
|---|
| 3 | include /usr/share/dpatch/dpatch.make |
|---|
| 4 | |
|---|
| 5 | # Name of the source packages |
|---|
| 6 | psource:=virtualbox-ose-source |
|---|
| 7 | gsource:=virtualbox-ose-guest-source |
|---|
| 8 | |
|---|
| 9 | # The short upstream name |
|---|
| 10 | sname:=virtualbox-ose |
|---|
| 11 | sxname:=virtualbox-ose-qt |
|---|
| 12 | gname:=virtualbox-ose-guest |
|---|
| 13 | uname:=virtualbox-ose-guest-utils |
|---|
| 14 | uxname:=virtualbox-ose-guest-x11 |
|---|
| 15 | |
|---|
| 16 | # Some defines needed for X |
|---|
| 17 | SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null) |
|---|
| 18 | VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null) |
|---|
| 19 | INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null) |
|---|
| 20 | SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS)) |
|---|
| 21 | VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI) |
|---|
| 22 | INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI) |
|---|
| 23 | |
|---|
| 24 | MAKE:=kmk |
|---|
| 25 | |
|---|
| 26 | upstreamversion := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\([^-]\+\)-.\+/\1/p') |
|---|
| 27 | |
|---|
| 28 | DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) |
|---|
| 29 | |
|---|
| 30 | # Generate README.Debian as text/html ... |
|---|
| 31 | debian/README.Debian.html: debian/virtualbox-ose.files/README.Debian.xml |
|---|
| 32 | xsltproc --nonet --stringparam section.autolabel 1 \ |
|---|
| 33 | -o $@ \ |
|---|
| 34 | /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl \ |
|---|
| 35 | $< |
|---|
| 36 | |
|---|
| 37 | # ... and text/plain |
|---|
| 38 | debian/virtualbox-ose.README.Debian: debian/README.Debian.html |
|---|
| 39 | chmod 755 debian/lynx-dump-postprocess |
|---|
| 40 | export LC_ALL=C; lynx -force_html -dump $< | ./debian/lynx-dump-postprocess > $@.tmp |
|---|
| 41 | mv $@.tmp $@ |
|---|
| 42 | |
|---|
| 43 | env.sh: patch-stamp |
|---|
| 44 | dh_testdir |
|---|
| 45 | ./configure \ |
|---|
| 46 | --with-linux="/usr" \ |
|---|
| 47 | --disable-kmods \ |
|---|
| 48 | --with-gcc=/usr/bin/gcc-4.2 \ |
|---|
| 49 | --with-g++=/usr/bin/g++-4.2 \ |
|---|
| 50 | --enable-webservice |
|---|
| 51 | |
|---|
| 52 | build: build-stamp |
|---|
| 53 | build-stamp: env.sh |
|---|
| 54 | dh_testdir |
|---|
| 55 | # Building package |
|---|
| 56 | . ./env.sh; $(MAKE) \ |
|---|
| 57 | BUILD_TYPE=release \ |
|---|
| 58 | PATH_OUT=$(abspath out) |
|---|
| 59 | # and vboxdrv.sh |
|---|
| 60 | $(MAKE) -C src/VBox/Installer/linux $(abspath out/obj/Installer/linux/vboxdrv.sh) \ |
|---|
| 61 | PATH_OUT=$(abspath out) |
|---|
| 62 | touch $@ |
|---|
| 63 | |
|---|
| 64 | clean: unpatch |
|---|
| 65 | dh_testdir |
|---|
| 66 | dh_testroot |
|---|
| 67 | # Cleaning package |
|---|
| 68 | rm -rf out |
|---|
| 69 | rm -f AutoConfig.kmk configure.log env.sh LocalConfig.kmk |
|---|
| 70 | rm -f debian/$(sname).init build-stamp |
|---|
| 71 | rm -f debian/virtualbox-ose.README.Debian debian/README.Debian.html |
|---|
| 72 | find . -name "*.pyc" -exec rm -f {} \; |
|---|
| 73 | dh_clean |
|---|
| 74 | |
|---|
| 75 | #Rebuild the orig.tar.gz |
|---|
| 76 | dfsg-free: clean |
|---|
| 77 | rm -rf ./kBuild |
|---|
| 78 | rm -rf ./tools |
|---|
| 79 | rm -rf ./src/VBox/Additions/os2 |
|---|
| 80 | rm -rf ./src/VBox/Additions/WINNT |
|---|
| 81 | rm -f ./src/VBox/HostDrivers/VBoxTAP/VBoxTAP.rc |
|---|
| 82 | rm -f ./src/VBox/HostDrivers/Support/darwin/load.sh |
|---|
| 83 | rm -f ./include/VBox/VBoxGuest.inc |
|---|
| 84 | rm -f ./include/VBox/VBoxGuest16.h |
|---|
| 85 | rm -f ./include/VBox/VBoxGuest.mac |
|---|
| 86 | rm -f ./src/libs/xpcom18a4/xpcom/MoreFiles/FSCopyObject.c |
|---|
| 87 | rm -f ./src/libs/xpcom18a4/xpcom/MoreFiles/FSCopyObject.h |
|---|
| 88 | rm -rf ./src/libs/ffmpeg-20060710 |
|---|
| 89 | rm -rf ./src/libs/libpng* |
|---|
| 90 | rm -rf ./src/libs/libxml2* |
|---|
| 91 | rm -rf ./src/libs/libxslt* |
|---|
| 92 | rm -rf ./src/libs/zlib* |
|---|
| 93 | rm -f ./src/VBox/HostServices/SharedClipboard/linux-stub.cpp |
|---|
| 94 | rm -f ./src/VBox/Additions/linux/xmouse/Imakefile |
|---|
| 95 | rm -rf ./src/VBox/Additions/linux/selinux-fedora |
|---|
| 96 | cd ..; mv $(CURDIR) virtualbox-ose-$(upstreamversion)-dfsg; \ |
|---|
| 97 | tar --exclude .svn --exclude '.git*' --exclude debian \ |
|---|
| 98 | -czf virtualbox-ose_$(upstreamversion)-dfsg.orig.tar.gz \ |
|---|
| 99 | virtualbox-ose-$(upstreamversion)-dfsg |
|---|
| 100 | |
|---|
| 101 | # install: DH_OPTIONS= |
|---|
| 102 | install: build debian/virtualbox-ose.README.Debian debian/README.Debian.html |
|---|
| 103 | dh_testdir |
|---|
| 104 | dh_testroot |
|---|
| 105 | dh_clean -k |
|---|
| 106 | dh_installdirs |
|---|
| 107 | # This will get installed into the package by dh_installinit |
|---|
| 108 | install -m 644 out/obj/Installer/linux/vboxdrv.sh debian/$(sname).init |
|---|
| 109 | # Install helper scripts for vbox* interfaces |
|---|
| 110 | dh_installifupdown -p$(sname) |
|---|
| 111 | |
|---|
| 112 | serverabi: install |
|---|
| 113 | ifeq ($(SERVERMINVERS),) |
|---|
| 114 | @echo error: xserver-xorg-dev needs to be installed |
|---|
| 115 | @exit 1 |
|---|
| 116 | else |
|---|
| 117 | echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(uxname).substvars |
|---|
| 118 | echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(uxname).substvars |
|---|
| 119 | echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(uxname).substvars |
|---|
| 120 | endif |
|---|
| 121 | |
|---|
| 122 | binary-arch: build install serverabi |
|---|
| 123 | dh_testdir -s |
|---|
| 124 | dh_testroot -s |
|---|
| 125 | dh_installchangelogs -s |
|---|
| 126 | dh_installdocs -s |
|---|
| 127 | dh_installmenu -s |
|---|
| 128 | dh_install -s |
|---|
| 129 | -chmod 755 debian/$(uxname)/usr/share/virtualbox/x11config.pl |
|---|
| 130 | -install -m 755 src/VBox/Additions/x11/Installer/VBoxRandR.sh debian/$(uxname)/usr/bin/VBoxRandR |
|---|
| 131 | -chrpath -d debian/$(uxname)/usr/bin/VBoxClient |
|---|
| 132 | -chrpath -d debian/$(uxname)/usr/lib/xorg/modules/drivers/vboxvideo_drv.so |
|---|
| 133 | -chrpath -d debian/$(uxname)/usr/lib/xorg/modules/input/vboxmouse_drv.so |
|---|
| 134 | -install -m 755 out/bin/additions/mountvboxsf debian/$(uname)/sbin/mount.vboxsf |
|---|
| 135 | -chrpath -d debian/$(uname)/sbin/mount.vboxsf |
|---|
| 136 | -chrpath -d debian/$(uname)/usr/sbin/vboxadd-timesync |
|---|
| 137 | -chmod 755 debian/$(sname)/usr/share/virtualbox/VBox.sh |
|---|
| 138 | dh_strip -s --dbg-package=$(sname)-dbg |
|---|
| 139 | dh_link -s |
|---|
| 140 | dh_compress -s |
|---|
| 141 | dh_fixperms -s |
|---|
| 142 | chmod +s debian/$(sname)/usr/lib/virtualbox/VBoxSDL |
|---|
| 143 | chmod +s debian/$(sname)/usr/lib/virtualbox/VBoxBFE |
|---|
| 144 | chmod +s debian/$(sname)/usr/lib/virtualbox/VBoxHeadless |
|---|
| 145 | chmod +s debian/$(sxname)/usr/lib/virtualbox/VirtualBox |
|---|
| 146 | dh_installudev -s |
|---|
| 147 | dh_installdebconf -s |
|---|
| 148 | dh_installinit -s |
|---|
| 149 | dh_installdeb -s |
|---|
| 150 | dh_shlibdeps -s |
|---|
| 151 | dh_gencontrol -s |
|---|
| 152 | dh_md5sums -s |
|---|
| 153 | dh_builddeb -s |
|---|
| 154 | |
|---|
| 155 | binary-indep: build install |
|---|
| 156 | dh_testdir -i |
|---|
| 157 | dh_testroot -i |
|---|
| 158 | dh_installchangelogs -i |
|---|
| 159 | dh_installdocs -i |
|---|
| 160 | dh_install -i |
|---|
| 161 | # These files have incorrect permissions, fixing it. |
|---|
| 162 | chmod 755 debian/$(psource)/usr/src/modules/$(sname)/debian/rules |
|---|
| 163 | chmod 755 debian/$(gsource)/usr/src/modules/$(gname)/debian/rules |
|---|
| 164 | dh_link -i |
|---|
| 165 | # Create .tar.bz2 for virtualbox*source |
|---|
| 166 | cd debian/$(psource)/usr/src && \ |
|---|
| 167 | tar -cjf $(sname).tar.bz2 modules && \ |
|---|
| 168 | rm -rf modules |
|---|
| 169 | cd debian/$(gsource)/usr/src && \ |
|---|
| 170 | tar -cjf $(gname).tar.bz2 modules && \ |
|---|
| 171 | rm -rf modules |
|---|
| 172 | dh_compress -i |
|---|
| 173 | dh_fixperms -i |
|---|
| 174 | dh_gencontrol -i |
|---|
| 175 | dh_md5sums -i |
|---|
| 176 | dh_builddeb -i |
|---|
| 177 | |
|---|
| 178 | binary: binary-arch binary-indep |
|---|
| 179 | .PHONY: patch unpatch serverabi \ |
|---|
| 180 | build clean binary-arch binary-indep binary install \ |
|---|
| 181 | binary-modules kdist kdist_configure kdist_image kdist_clean |
|---|