1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
|
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# This version is for a hypothetical package that can build a kernel modules
# architecture-dependant package via make-kpkg, as well as an
# architecture-independent module source package, and other packages
# either dep/indep for things like common files or userspace components
# needed for the kernel modules.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# where all bios and other support files are installed
sharedir := /usr/share
confsuffix := /kvm
bdir := ${sharedir}${confsuffix}
tdir := debian/qemu-kvm
tbdir := ${tdir}$(bdir)
# where various other packages keeps their data files
ipxe := /usr/lib/ipxe
seabios := /usr/share/seabios
vgabios := /usr/share/vgabios
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
BASE_ARCH := $(DEB_BUILD_ARCH)
DEB_VERSION := $(shell sed -n -e 's/^[^(]* (\([^)]*\)) .*/\1/p' -e1q debian/changelog)
ifeq (i386,$(DEB_BUILD_ARCH))
BASE_ARCH := x86
endif
ifeq (amd64,$(DEB_BUILD_ARCH))
BASE_ARCH := x86
endif
ifeq (x86,$(BASE_ARCH))
QEMU_TARGET = x86_64-softmmu
QEMU_EXE = $(QEMU_TARGET)/qemu-system-x86_64
endif
ifeq (powerpc,$(DEB_BUILD_ARCH))
QEMU_TARGET = XXXfixme
QEMU_EXE = $(QEMU_TAEGET)/qemu-system-ppcemb
endif
CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
CFLAGS += $(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS += -Wall
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
#export DH_OPTIONS = --with=quilt --parallel
.PHONY: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep
binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep:
# "+" in front of dh is to work around dh completely ignoring
# --parallel and DEB_BUILD_OPTIONS=parallel=NN
+dh $@
override_dh_auto_configure config:
mkdir -p build/
cd build && ../configure \
--with-pkgversion="qemu-kvm-$(DEB_VERSION), Debian" \
--target-list=$(QEMU_TARGET) \
--prefix=/usr \
--with-confsuffix=${confsuffix} \
--datadir=${sharedir} \
--sysconfdir=/etc \
--libexecdir=/usr/lib \
--extra-cflags="$(CFLAGS)" \
--extra-ldflags="$(LDFLAGS)" \
--enable-kvm \
--disable-strip \
--disable-xen \
--disable-blobs \
--disable-guest-agent \
--audio-drv-list="alsa oss sdl pa" \
--audio-card-list="ac97 es1370 sb16 cs4231a adlib gus hda" \
`sed 's/#.*//' ../debian/optional-features` \
$(QEMU_KVM_CONFIGURE_OPTIONS) \
|| { echo == config.log ==; cat config.log; echo == config.log end ==; exit 1; }
cat build/config-host.mak
override_dh_auto_build:
# main executable and support tools
$(MAKE) -C build/ ROMS= TOOLS=
# arch-specific stuff
ifeq (powerpc,$(BASE_ARCH))
$(MAKE) -C build/pc-bios bamboo.dtd
endif
override_dh_auto_test:
override_dh_auto_clean:
rm -rf build/
rm -f scripts/*.pyc
rm -f scripts/tracetool/*.pyc
rm -f scripts/tracetool/backend/*.pyc
rm -f scripts/tracetool/format/*.pyc
override_dh_auto_install:
# qemu builds only a few files and we will rename them all anyway,
# so install it all here manually.
install -Dp build/$(QEMU_EXE) ${tdir}/usr/bin/kvm
install -Dp build/qemu.1 ${tdir}/usr/share/man/man1/kvm.1
sed 's|@@|img|g' debian/kvm-utils.run > ${tdir}/usr/bin/kvm-img
sed 's|@@|nbd|g' debian/kvm-utils.run > ${tdir}/usr/bin/kvm-nbd
sed 's|@@|io|g' debian/kvm-utils.run > ${tdir}/usr/bin/kvm-io
chmod 0755 ${tdir}/usr/bin/kvm-*
dh_installman debian/kvm-img.1 debian/kvm-nbd.8
install -Dp -m 0755 debian/kvm-ifup ${tdir}/etc/kvm/kvm-ifup
install -Dp -m 0755 debian/kvm-ifdown ${tdir}/etc/kvm/kvm-ifdown
# Install the userspace utilities
install -m 0755 scripts/kvm/kvm_stat ${tdir}/usr/bin/
# use keymaps from qemu-keymaps package
dh_link /usr/share/qemu/keymaps ${bdir}/keymaps
# install the icon
install -m 0644 pc-bios/qemu-icon.bmp ${tbdir}/
ifeq (x86,$(BASE_ARCH))
# link appropriate bios files from seabios package
dh_link ${seabios}/bios.bin ${bdir}/bios.bin \
${seabios}/optionrom/extboot.bin ${bdir}/extboot.bin \
${seabios}/optionrom/linuxboot.bin ${bdir}/linuxboot.bin \
${seabios}/optionrom/multiboot.bin ${bdir}/multiboot.bin \
${seabios}/optionrom/kvmvapic.bin ${bdir}/kvmvapic.bin \
# link to vgabios files and vgabios.bin too, for now
dh_link \
${vgabios}/vgabios.cirrus.bin ${bdir}/vgabios-cirrus.bin \
${vgabios}/vgabios.stdvga.bin ${bdir}/vgabios-stdvga.bin \
${vgabios}/vgabios.vmware.bin ${bdir}/vgabios-vmware.bin \
${vgabios}/vgabios.qxl.bin ${bdir}/vgabios-qxl.bin \
${vgabios}/vgabios.bin ${bdir}/vgabios.bin
# pxe roms are x86-specific. package ipxe.
dh_link \
$(ipxe)/e1000_82540.rom $(bdir)/pxe-e1000.rom \
$(ipxe)/eepro100.rom $(bdir)/pxe-eepro100.rom \
$(ipxe)/ns8390.rom $(bdir)/pxe-ne2k_pci.rom \
$(ipxe)/pcnet32.rom $(bdir)/pxe-pcnet.rom \
$(ipxe)/rtl8139.rom $(bdir)/pxe-rtl8139.rom \
$(ipxe)/virtio-net.rom $(bdir)/pxe-virtio.rom \
# x86 cpu definitions
install -Dpm 0644 sysconfigs/target/target-x86_64.conf ${tdir}/etc/kvm/
install -Dpm 0644 sysconfigs/target/cpus-x86_64.conf ${tbdir}/
endif
ifeq (powerpc,$(BASE_ARCH))
cp build/pc-bios/bamboo.dtd ${tbdir}/bamboo.dtd
endif
override_dh_installinit:
dh_installinit --noscripts
override_dh_strip:
dh_strip --dbg-package=qemu-kvm-dbg
override_dh_gencontrol:
dh_gencontrol -Nkvm
dh_gencontrol -pkvm -- -v1:$(DEB_VERSION)
.PHONY: config
.PHONY: override_dh_auto_configure override_dh_auto_build override_dh_auto_test override_dh_auto_clean override_dh_auto_install override_dh_installinit override_dh_strip override_dh_gencontrol
# get-orig-source adapted from /usr/share/gnome-pkg-tools/1/rules/sf-get-source.mk from the gnome-pkg-tools package
# copied from CDBS' buildvars
DEB_SOURCE_PACKAGE ?= $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
DEB_VERSION ?= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
DEB_NOEPOCH_VERSION ?= $(shell echo $(DEB_VERSION) | cut -d: -f2-)
DEB_UPSTREAM_VERSION ?= $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/+[^-]*-[^-]*$$//')
# where to store the resulting .orig tarball
DEB_TARBALL_DOWNLOAD_DIR ?= ../tarballs
TARBALL_EXT ?= tar.gz
#SF_PROJECT ?= $(DEB_SOURCE_PACKAGE)
SF_PROJECT = kvm
SF_MODULE ?= $(DEB_SOURCE_PACKAGE)
SF_TARBALL ?= $(SF_MODULE)-$(DEB_UPSTREAM_VERSION).$(TARBALL_EXT)
SF_DOWNLOAD_URL ?= http://$$sf_mirror.dl.sourceforge.net/$(SF_PROJECT)/$(SF_TARBALL)
SF_MIRRORS ?= dfn heanet internap jaist kent mesh nchc ovh puzzle superb-east superb-west surfnet switch ufpr waix
SF_TARBALL_DESTINATION = $(DEB_TARBALL_DOWNLOAD_DIR)/$(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.$(TARBALL_EXT)
SF_DOWNLOAD_COMMAND ?= for sf_mirror in $(SF_MIRRORS); do wget -nv -T10 -t1 -O $(SF_TARBALL_DESTINATION).tmp $(SF_DOWNLOAD_URL) && break; done
get-orig-tarball: $(SF_TARBALL_DESTINATION)
$(SF_TARBALL_DESTINATION):
dh_testdir
@@echo 'Source package: $(DEB_SOURCE_PACKAGE)'
@@echo 'Source package: $(DEB_VERSION)'
@@echo 'Source version without epoch: $(DEB_NOEPOCH_VERSION)'
@@echo 'Upstream version (for orig tarball): $(DEB_UPSTREAM_VERSION)'
mkdir -p $(DEB_TARBALL_DOWNLOAD_DIR)
$(SF_DOWNLOAD_COMMAND)
mv $(SF_TARBALL_DESTINATION).tmp $(SF_TARBALL_DESTINATION)
get-orig-source: $(SF_TARBALL_DESTINATION)
case "$(TARBALL_EXT)" in \
tar.bz2|tbz) \
bzcat $(DEB_TARBALL_DOWNLOAD_DIR)/$(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.$(TARBALL_EXT) | \
gzip -9 >$(DEB_TARBALL_DOWNLOAD_DIR)/$(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.tar.gz ; \
rm -f $(DEB_TARBALL_DOWNLOAD_DIR)/$(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.$(TARBALL_EXT) \
;;\
esac
cd $(DEB_TARBALL_DOWNLOAD_DIR) && \
tar xzf $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.tar.gz
cd $(DEB_TARBALL_DOWNLOAD_DIR)/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION) && \
rm -f \
pc-bios/*.bin \
pc-bios/*.rom \
pc-bios/openbios-* \
pc-bios/*.dtb \
pc-bios/palcode-clipper \
pc-bios/optionrom/*.bin \
.git?*
cd $(DEB_TARBALL_DOWNLOAD_DIR) && \
tar c $(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION) | \
gzip -9 >$(DEB_TARBALL_DOWNLOAD_DIR)/$(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION)+dfsg.orig.tar.gz
.PHONY: get-orig-tarball get-orig-source
|