public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ian Delaney" <della5@iinet.com.au>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/virtualization:master commit in: app-emulation/xen-tools/files/, app-emulation/xen-tools/
Date: Sun, 20 Nov 2011 19:57:43 +0000 (UTC)	[thread overview]
Message-ID: <271eb7f83e63aca3efc009a074b9077e2d327c3d.ian_delaney@gentoo> (raw)

commit:     271eb7f83e63aca3efc009a074b9077e2d327c3d
Author:     Ian Delaney <johneed <AT> hotmail <DOT> com>
AuthorDate: Sat Nov 19 05:38:10 2011 +0000
Commit:     Ian Delaney <della5 <AT> iinet <DOT> com <DOT> au>
CommitDate: Sat Nov 19 05:38:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/virtualization.git;a=commit;h=271eb7f8

"EAPI4 tp xen-tools [4.1.2 -9999]"

---
 app-emulation/xen-tools/Manifest                   |   38 ++
 app-emulation/xen-tools/files/ipxe-nopie.patch     |   27 ++
 .../xen-tools/files/xen-consoles.logrotate         |    5 +
 .../xen-tools/files/xen-tools-3.3.0-nostrip.patch  |   26 ++
 .../files/xen-tools-3.3.1-sandbox-fix.patch        |   21 +
 .../xen-tools-3.4.0-network-bridge-broadcast.patch |   11 +
 .../files/xen-tools-3.4.2-as-needed.patch          |   13 +
 .../files/xen-tools-3.4.2-fix-definitions.patch    |   16 +
 .../files/xen-tools-3.4.2-fix-include.patch        |   28 ++
 .../files/xen-tools-3.4.2-ldflags-respect.patch    |   31 ++
 .../xen-tools-3.4.2-remove-default-cflags.patch    |  257 ++++++++++++
 .../files/xen-tools-3.4.2-werror-idiocy-v2.patch   |  429 ++++++++++++++++++++
 .../xen-tools/files/xen-tools-4.1.1-bridge.patch   |   12 +
 .../xen-tools/files/xen-tools-4.1.1-curl.patch     |   10 +
 .../files/xen-tools-4.1.1-libxl-tap.patch          |   37 ++
 .../xen-tools/files/xen-tools-4.1.2-pyxml.patch    |   12 +
 app-emulation/xen-tools/files/xenconsoled.confd    |    2 +
 app-emulation/xen-tools/files/xenconsoled.initd    |   25 ++
 app-emulation/xen-tools/files/xend.initd-r1        |   71 ++++
 app-emulation/xen-tools/files/xend.initd-r2        |   52 +++
 .../xen-tools/files/xendomains-screen.confd        |   15 +
 app-emulation/xen-tools/files/xendomains.confd     |    9 +
 app-emulation/xen-tools/files/xendomains.initd-r1  |  117 ++++++
 app-emulation/xen-tools/files/xendomains.initd-r2  |  117 ++++++
 app-emulation/xen-tools/files/xenstored.confd      |    2 +
 app-emulation/xen-tools/files/xenstored.initd      |   29 ++
 app-emulation/xen-tools/metadata.xml               |   20 +
 app-emulation/xen-tools/xen-tools-3.4.2-r5.ebuild  |  250 ++++++++++++
 app-emulation/xen-tools/xen-tools-4.1.2-r1.ebuild  |  344 ++++++++++++++++
 app-emulation/xen-tools/xen-tools-9999.ebuild      |  319 +++++++++++++++
 30 files changed, 2345 insertions(+), 0 deletions(-)

diff --git a/app-emulation/xen-tools/Manifest b/app-emulation/xen-tools/Manifest
new file mode 100644
index 0000000..b28974f
--- /dev/null
+++ b/app-emulation/xen-tools/Manifest
@@ -0,0 +1,38 @@
+AUX ipxe-nopie.patch 952 RMD160 243c65b1e9e27fde14b10c5f605cce635de88032 SHA1 06870bb3bb063aabe16e721f487f0756a5889e8f SHA256 22d1e84568e4bdf204404c45cd4d323a78a1b5a5a29cc4a0707894e22f40bd48
+AUX xen-consoles.logrotate 63 RMD160 035bd8baf1ba68a5525bab4379c0c4e350001a74 SHA1 6f88a4da3349aade6070dfc5c4465e2c00f3e68c SHA256 0da87a4b9094f934e3de937e8ef8d3afc752e76793aa3d730182d0241e118b19
+AUX xen-tools-3.3.0-nostrip.patch 1021 RMD160 f702b588596dfdebf71fafbf866d270ac5bb549e SHA1 bb4db097af6e206ed68bcc1a1c3ef48b02e9a4c5 SHA256 2debac718c01a7eac4daf3182a7ae04aa562137d791cd510ecf1848d7eaccebd
+AUX xen-tools-3.3.1-sandbox-fix.patch 828 RMD160 6c637b0883b72f12ce33b9c6d2dc7cf5267fc85a SHA1 51b35f096c0ad5c83e9654cfe0267b8efc51367e SHA256 519236a71e81e1da1c9a7616745422e6f205f4f7901abba7af0e0aef665af343
+AUX xen-tools-3.4.0-network-bridge-broadcast.patch 496 RMD160 3a8c57fe70837861f6f69d1d260c6fa6adad43e3 SHA1 cc02643eee7a39e97b53674066516c80ec0c3b38 SHA256 d00a1954447fc29500ab2f1a8c7900310e0dee81942be5c922ad66b6b42dfb74
+AUX xen-tools-3.4.2-as-needed.patch 765 RMD160 dbb5ad2ec52e96c40f109e28c91b566e88cb6220 SHA1 9e38f5c06153b5293daa55abe00106404ff6555f SHA256 91f9bf0723462a70d025c8b7ce0dee50e170b68f1a22092f28d92b140a4e5772
+AUX xen-tools-3.4.2-fix-definitions.patch 358 RMD160 d9cbf9cacb780f5de2ad7f05d981d292aa7dc994 SHA1 1a6163deb6b177b00e013fdfc6f1faf0bf20769e SHA256 0e43548bb3727beff625050fadacd04c1b2a0bec315531f793928a6808654aa8
+AUX xen-tools-3.4.2-fix-include.patch 894 RMD160 c1c17e63f4296b175159cae579b9d25f8654d7d3 SHA1 f7549495b1cecf8142c98ea4601d77e5f69619ec SHA256 3095dc197c48d0e4bf3ee122e427e00bfdd8e52f4e2b421fdca30ce32886d476
+AUX xen-tools-3.4.2-ldflags-respect.patch 1057 RMD160 d463f678e845e1d92012ec7013e211f52489839b SHA1 54916dd7f1d2c83df0219a5a092fcb2db8d2f71b SHA256 d1afe208eab5b00f5c3204b231b8f68a2d2335699a42b913f1ea9101f280736c
+AUX xen-tools-3.4.2-remove-default-cflags.patch 10646 RMD160 cc8175c33251310645fd6cc400c6180a7fcdcf75 SHA1 5e94fce8db6b67df6264e92a69f9f3802610b93f SHA256 f234c45b0a96c4eb5c97e7a8d76fb1f4a3dff110c4ea2ec68e8db71e03044d98
+AUX xen-tools-3.4.2-werror-idiocy-v2.patch 16827 RMD160 80fe78d3fd5f2d23d4852cf8608c616ae7e4e8b6 SHA1 619f42bf7ac7886a4b214bf813ad3369265f424b SHA256 45dfc85ea28c7a70bfcf94986758370e27c32698d78b90a2066335dd378f3669
+AUX xen-tools-4.1.1-bridge.patch 449 RMD160 165524a3a92014f79e886b0a20dba8b1c1920cc2 SHA1 32db884422a48819d71003860f99779b7b82540a SHA256 71eea5408e3600c3c6f7ce4e8363ea2c19db36c1882e20cf0ef8143af527782b
+AUX xen-tools-4.1.1-curl.patch 550 RMD160 87e09f92f292d89c86416036d4207b0460a3dc6e SHA1 dec0e47d62d85cb21d9fb6d097ab183f02b80310 SHA256 4bdb2875b36e7dbb0bd8d61b697da78007bb22922f56e020795c91ebb9ddd50b
+AUX xen-tools-4.1.1-libxl-tap.patch 1071 RMD160 a345fab381af82ffdf7a4206d9db30f6845e5867 SHA1 bbe2ddd9eb8119ae172fd9671fe58bda80bf9095 SHA256 ee03a5b68a9edf5d4fe78a322ff261e13f6ded879f3898b0ea72c407f678f885
+AUX xen-tools-4.1.1-upstream-23104-1976adbf2b80.patch 26848 RMD160 7d3bd028c5da4b2a48f1e992900bbf1866c9c4ea SHA1 55c5476e632649d4d635db1023193216455d076d SHA256 8654c4b587b350baaaea12cde3ef1737dc80088fba281556bf4c714fa4d8111f
+AUX xen-tools-4.1.2-pyxml.patch 408 RMD160 131ff6e6a1b3bd71ff584d3cbfca4b078abd77b1 SHA1 5fa6ce64ef125e97df65ed357e1c40964a7a3619 SHA256 6a8d8ca5478bc68850fd930749ca22207807c87f8624c0c3596a8cd70bc06c65
+AUX xenconsoled.confd 44 RMD160 0134f85258cf524807c4e2eae94739a70808c20d SHA1 6435bba449e9cffd3f99c5afdeb3cc37ecbd744d SHA256 2a74be03eb74f6013242a4a5d721df6cb9b959b43c405de1e32813f52d749060
+AUX xenconsoled.initd 652 RMD160 5aa785e9c73c5eb8460863af2c1bc50d2a07faf4 SHA1 dceffade1f3f5f2503fc6c3ccb4b9f9788365d00 SHA256 1a5594e4e924b94490c5c942b1b63e5fe857b8ad8061060e5d8a3bdfc9f0f1b7
+AUX xend.initd-r1 1664 RMD160 8d7ea19e96c49631a8f432dd93ae91ca4f37d26b SHA1 bd3a8f083288cd89624d31f3c7932e1a831d99a3 SHA256 6ea8848ca1203c5ef8490014ded86ec67100385c217660d393b25dc6519d254d
+AUX xend.initd-r2 1064 RMD160 07b94d60a9c93577864086945389ef9821913522 SHA1 60f246da00f829776f1bb9a16ec07a6f91cbd24e SHA256 b9dcd925856eb5213b9052169492492d686b5d1ccae65b1c94a8ac944708d155
+AUX xendomains-screen.confd 594 RMD160 79c7a3546cf1d3f8558c2120d6e8c93c753e66b9 SHA1 7f9ed2986495d5fa4a6f8b050cd632fde6a19994 SHA256 c4d7ffcdbeccc5e93460e2abbf70d642a78a363d79ccbbce0407f50cace54e0a
+AUX xendomains.confd 291 RMD160 75d55db5360da12fc3d721c37001ccbfbb844e52 SHA1 e7be8973a4bcbfc7680258e369b07e2ed097ef49 SHA256 2fac318bb96b357dd185f7729d83c0a0b941799cdb89c24ed83051bb085735dc
+AUX xendomains.initd-r1 2930 RMD160 9a1c467d63043ce04c5f3c268745a30e4db1d006 SHA1 e649a34fae4cfc25f9f904008a79603c47df9836 SHA256 cf03eb7d8eb6d79bce02e857a4a6bcff68a6a63c55ff283f18ebb8d013a27111
+AUX xendomains.initd-r2 2933 RMD160 31d35c58d0286a34bebd636e85a9368054b8f6c0 SHA1 5e9cbdb5f2b1770bf30ba99ca7c67dbf38b78e84 SHA256 da69c146e5213df5376bd9b2758d9d5957c802e5513c6ea510e604d00f1d9e40
+AUX xenstored.confd 42 RMD160 3407e1ff0958d5797e257da284798a21fe31a5db SHA1 c18f64d2a41de25695b7dfb924478e3fa64ed0c3 SHA256 afcc14f014fe4ec478f85d230efefba9ffad024bf8c83b30074e8a3712cc7831
+AUX xenstored.initd 812 RMD160 57a880e0024f3733bb3ebe945389eed6474b96f5 SHA1 9837c052afac31ee623ef02280a43114866869c8 SHA256 8f9df8ad835e45f9c995244e9e80d1a9ee630787bf2da88b7c4a73354d056fd8
+DIST ipxe-git-v1.0.0.tar.gz 1996881 RMD160 dcd9b6eaafa1ce05c1ebf2a15f2f73ad7a8c5547 SHA1 da052c8de5f3485fe0253c19cf52ed6d72528485 SHA256 d3128bfda9a1542049c278755f85bbcbb8441da7bfd702d511ce237fcf86a723
+DIST xen-3.4.2.tar.gz 11187726 RMD160 2ef81df1f44356d60e04e21df2173ce5357d8509 SHA1 3cd2cafacd52bbac2e2da1cfd846ee6260b43455 SHA256 d17c33136041cc8da69214ccf527fc48637bee7a9ab4d68a88ec50e6a9d20b0b
+DIST xen-4.1.1.tar.gz 10355625 RMD160 4b3c0641b0f098889f627662aa6b8fea00c5b636 SHA1 f1b5ef4b663c339faf9c77fc895327cfbcc9776c SHA256 246289227507466b5da8b2d0da84a5b0e68a392527b16cde38898d0348890f5b
+DIST xen-4.1.2.tar.gz 10365786 RMD160 457797ec4be286afbbcad940a9ce04e44f3f40d6 SHA1 db584cb0a0cc614888d7df3b196d514fdb2edd6e SHA256 7d9c93057cf480d3f1efa792b19285a84fa3c06060ea5c5c453be00887389b0d
+EBUILD xen-tools-3.4.2-r3.ebuild 7049 RMD160 05ffd0fdba6761df2d59f3bd7421599e1f20f4a1 SHA1 e36b7900c84de2ca1f861af081678ff3c7eb943a SHA256 d1513d443231dd27cb0267acac47c00c9bf95c25aa296e90ee6bb21a134e1e51
+EBUILD xen-tools-3.4.2-r5.ebuild 7383 RMD160 b31318f590f2d563c036a7acffe65cecc9bf677f SHA1 34312c51b92c28dc7d7ab718c1b5f67b1554be61 SHA256 0ae0c406503dbc8342d5a4abc72d896ec0205317c9e6ec8690f71a40bd7bb8c4
+EBUILD xen-tools-4.1.1-r5.ebuild 10316 RMD160 92450a0dba081cda3e23e94072953b858538d31e SHA1 f1af2fba3958c0813b37adc16c82d69d720f2458 SHA256 80485abdbcaf256d21289f0cf260de671d72bbcc023bf49df3bd99db99b23720
+EBUILD xen-tools-4.1.1-r6.ebuild 10651 RMD160 993111049c34acbbf59857b3794e68319a50e301 SHA1 4af2c578e12f6f9b29490dc04488a956d526af4c SHA256 4147a0918b80cda6c22cfe4219c4767a5b2a50b65790852de9f33ce0c16122fd
+EBUILD xen-tools-4.1.2-r1.ebuild 10661 RMD160 e6d79f599d28ba19f8452f2cd953e537ca263a31 SHA1 9c5858944006f46cf53234a83867de8889ce44ea SHA256 e80e19f6fb1feebd4f52c55de17564792b32e2c8da89b5a6bc7eceee10f4d9f7
+EBUILD xen-tools-9999.ebuild 9797 RMD160 a295e2bc881a274318a8c1c047c5eb7f0d3c9873 SHA1 064ff777ba534f689303c4b89bfd23b9add7d1df SHA256 795b2d62d02001ee304880e0c9fa1611e12e969e7c94fb0e4aecb1a850ba7e13
+MISC ChangeLog 26416 RMD160 9dedc8200cef808e17460fc462dfa58b4697a00b SHA1 527ac5a862ec32895ab6b1bc476721a6564a929b SHA256 6177a750826abbe6084535a884b47bf43d5109c037a36bd320db079f54edffa3
+MISC metadata.xml 947 RMD160 96890462f83ee4a47c9c77993ba76ef82a732af5 SHA1 7ff424eead47cb6ce81930c10d3b22b0d8f73d61 SHA256 74f0e5bea356989a42fd4086d87271ed7c25331306acb333707476f53cac4d60

diff --git a/app-emulation/xen-tools/files/ipxe-nopie.patch b/app-emulation/xen-tools/files/ipxe-nopie.patch
new file mode 100644
index 0000000..0663eaa
--- /dev/null
+++ b/app-emulation/xen-tools/files/ipxe-nopie.patch
@@ -0,0 +1,27 @@
+2011-10-22	Ralf Glauberman	<ralfglauberman@gmx.de>
+
+		#360805 Don't compile ipxe with pie on hardened.
+		* /tools/firmware/etherboot/patches/ipxe-nopie.patche		New patch
+		* /tools/firmware/etherboot/patches/series				Add ipxe-nopie.patch
+
+--- a/tools/firmware/etherboot/patches/ipxe-nopie.patch	1970-01-01 01:00:00.000000000 +0100
++++ b/tools/firmware/etherboot/patches/ipxe-nopie.patch	2011-03-27 17:45:13.929697782 +0200
+@@ -0,0 +1,11 @@
++--- ipxe/src/Makefile~	2011-03-27 17:41:52.000000000 +0200
+++++ ipxe/src/Makefile	2011-03-27 17:43:20.869446433 +0200
++@@ -4,7 +4,7 @@
++ #
++ 
++ CLEANUP		:=
++-CFLAGS		:=
+++CFLAGS		:= -nopie
++ ASFLAGS		:=
++ LDFLAGS		:=
++ MAKEDEPS	:= Makefile
+--- a/tools/firmware/etherboot/patches/series	2011-03-25 11:42:50.000000000 +0100
++++ b/tools/firmware/etherboot/patches/series	2011-03-27 17:45:45.140446216 +0200
+@@ -1,3 +1,4 @@
+ boot_prompt_option.patch
+ gpxe-git-0edf2405b457
+ gpxe-git-a803ef3dfeac
++ipxe-nopie.patch

diff --git a/app-emulation/xen-tools/files/xen-consoles.logrotate b/app-emulation/xen-tools/files/xen-consoles.logrotate
new file mode 100644
index 0000000..c644523
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-consoles.logrotate
@@ -0,0 +1,5 @@
+/var/log/xen-consoles/*.log {
+	rotate 7
+	missingok
+	compress
+}

diff --git a/app-emulation/xen-tools/files/xen-tools-3.3.0-nostrip.patch b/app-emulation/xen-tools/files/xen-tools-3.3.0-nostrip.patch
new file mode 100644
index 0000000..48e7cd5
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.3.0-nostrip.patch
@@ -0,0 +1,26 @@
+Index: xen-3.3.0/tools/ioemu-qemu-xen/Makefile
+===================================================================
+--- xen-3.3.0.orig/tools/ioemu-qemu-xen/Makefile
++++ xen-3.3.0/tools/ioemu-qemu-xen/Makefile
+@@ -205,7 +205,7 @@ endif
+ install: all $(if $(BUILD_DOCS),install-doc)
+ 	mkdir -p "$(DESTDIR)$(bindir)"
+ ifneq ($(TOOLS),)
+-	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
++	$(INSTALL) -m 755 $(TOOLS) "$(DESTDIR)$(bindir)"
+ endif
+ 	mkdir -p "$(DESTDIR)$(datadir)"
+ 	set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
+Index: xen-3.3.0/tools/ioemu-qemu-xen/Makefile.target
+===================================================================
+--- xen-3.3.0.orig/tools/ioemu-qemu-xen/Makefile.target
++++ xen-3.3.0/tools/ioemu-qemu-xen/Makefile.target
+@@ -707,7 +707,7 @@ clean:
+ 
+ install: all install-hook
+ ifneq ($(PROGS),)
+-	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
++	$(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
+ endif
+ 
+ # Include automatically generated dependency files

diff --git a/app-emulation/xen-tools/files/xen-tools-3.3.1-sandbox-fix.patch b/app-emulation/xen-tools/files/xen-tools-3.3.1-sandbox-fix.patch
new file mode 100644
index 0000000..be0527a
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.3.1-sandbox-fix.patch
@@ -0,0 +1,21 @@
+diff -urN xen-3.3.1/tools/ioemu-qemu-xen/xen-setup xen-3.3.1-fix/tools/ioemu-qemu-xen/xen-setup
+--- xen-3.3.1/tools/ioemu-qemu-xen/xen-setup	2009-01-05 04:36:22.000000000 -0700
++++ xen-3.3.1-fix/tools/ioemu-qemu-xen/xen-setup	2009-04-25 17:55:03.000000000 -0600
+@@ -3,6 +3,8 @@
+ 
+ # git-clean -x -d && ./xen-setup && make prefix=/usr CMDLINE_CFLAGS='-O0 -g' -j4 && make install DESTDIR=`pwd`/dist/ prefix=/usr && rsync -a --stats --delete . thule:shadow/qemu-iwj.git/ && rsync -a --stats dist/. root@thule:/
+ 
++target=i386-dm
++
+ rm -f $target/Makefile
+ rm -f $target/config.mak
+ rm -f config-host.mak
+@@ -11,8 +13,6 @@
+ 
+ ./configure --disable-gfx-check --disable-gcc-check --disable-curses --disable-slirp "$@" --prefix=/usr
+ 
+-target=i386-dm
+-
+ if [ "x$XEN_ROOT" != x ]; then
+ 	echo "XEN_ROOT=$XEN_ROOT" >>config-host.mak
+ fi

diff --git a/app-emulation/xen-tools/files/xen-tools-3.4.0-network-bridge-broadcast.patch b/app-emulation/xen-tools/files/xen-tools-3.4.0-network-bridge-broadcast.patch
new file mode 100644
index 0000000..c926510
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.4.0-network-bridge-broadcast.patch
@@ -0,0 +1,11 @@
+--- xen-3.4.0/tools/hotplug/Linux/network-bridge.orig	2009-05-18 15:05:38.000000000 +0400
++++ xen-3.4.0/tools/hotplug/Linux/network-bridge	2009-06-09 23:16:05.000000000 +0400
+@@ -101,7 +101,7 @@
+ tdev=tmpbridge
+ 
+ get_ip_info() {
+-    addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e 's/ .*//'`
++    addr_pfx=`ip addr show dev $1 | egrep '^ *inet ' | sed -e 's/ *inet //' -e "s/$1//"`
+     gateway=`ip route show dev $1 | fgrep default | sed 's/default via //'`
+ }
+     

diff --git a/app-emulation/xen-tools/files/xen-tools-3.4.2-as-needed.patch b/app-emulation/xen-tools/files/xen-tools-3.4.2-as-needed.patch
new file mode 100644
index 0000000..5d97373
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.4.2-as-needed.patch
@@ -0,0 +1,13 @@
+--- xen-3.4.2.orig/tools/libxc/Makefile	2009-11-10 16:12:56.000000000 +0100
++++ xen-3.4.2/tools/libxc/Makefile	2009-12-12 18:46:27.547714651 +0100
+@@ -167,9 +167,8 @@
+ xc_dom_bzimageloader.o: CFLAGS += $(call zlib-options,D)
+ xc_dom_bzimageloader.opic: CFLAGS += $(call zlib-options,D)
+ 
+-libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
+ libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
+-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(PTHREAD_LIBS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(PTHREAD_LIBS) $(call zlib-options,l)
+ 
+ -include $(DEPS)
+ 

diff --git a/app-emulation/xen-tools/files/xen-tools-3.4.2-fix-definitions.patch b/app-emulation/xen-tools/files/xen-tools-3.4.2-fix-definitions.patch
new file mode 100644
index 0000000..403d612
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.4.2-fix-definitions.patch
@@ -0,0 +1,16 @@
+--- tools/blktap/lib/blktaplib.h.orig	2011-09-21 19:29:30.240868534 +0800
++++ tools/blktap/lib/blktaplib.h	2011-09-21 19:34:21.184868372 +0800
+@@ -195,8 +195,13 @@
+ 	pid_t     pid;
+ } msg_pid_t;
+ 
++#ifndef READ
+ #define READ 0
++#endif
++
++#ifndef WRITE
+ #define WRITE 1
++#endif
+ 
+ /*Control Messages between manager and tapdev*/
+ #define CTLMSG_PARAMS      1

diff --git a/app-emulation/xen-tools/files/xen-tools-3.4.2-fix-include.patch b/app-emulation/xen-tools/files/xen-tools-3.4.2-fix-include.patch
new file mode 100644
index 0000000..2fe3f05
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.4.2-fix-include.patch
@@ -0,0 +1,28 @@
+--- ./tools/blktap/drivers/blktapctrl.c	2011-09-20 00:27:01.846896986 +0800
++++ ./tools/blktap/drivers/blktapctrl.c	2011-09-20 00:29:09.910897067 +0800
+@@ -40,6 +40,7 @@
+ #include <err.h>
+ #include <errno.h>
+ #include <sys/types.h>
++#include <sys/stat.h>
+ #include <sys/wait.h>
+ #include <signal.h>
+ #include <fcntl.h>
+--- ./tools/blktap/drivers/block-qcow2.c     2011-09-22 04:15:49.339854677 +0800
++++ ./tools/blktap/drivers/block-qcow2.c  2009-11-10 23:12:55.000000000 +0800
+@@ -26,6 +26,7 @@
+ #include "aes.h"
+ #include <assert.h>
+ #include <stdint.h>
++#include <sys/stat.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+--- ./tools/ioemu-qemu-xen/block-qcow2.c	2011-09-19 23:43:40.005898352 +0800
++++ ./tools/ioemu-qemu-xen/block-qcow2.c	2011-09-19 23:26:53.979898723 +0800
+@@ -26,6 +26,7 @@
+ #include <zlib.h>
+ #include "aes.h"
+ #include <assert.h>
++#include <sys/stat.h>
+

diff --git a/app-emulation/xen-tools/files/xen-tools-3.4.2-ldflags-respect.patch b/app-emulation/xen-tools/files/xen-tools-3.4.2-ldflags-respect.patch
new file mode 100644
index 0000000..fd77712
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.4.2-ldflags-respect.patch
@@ -0,0 +1,31 @@
+--- ./tools/fs-back/Makefile	2011-09-26 23:14:30.454759297 +0800
++++ ./tools/fs-back/Makefile	2011-09-27 16:37:57.445748680 +0800
+@@ -23,7 +23,7 @@ 
+ all: $(IBIN)
+ 
+ fs-backend: $(OBJS) fs-backend.c
+-	$(CC) $(CFLAGS) -o fs-backend $(OBJS) $(LIBS) fs-backend.c
++	$(CC) $(CFLAGS) $(LDFLAGS) -o fs-backend $(OBJS) $(LIBS) fs-backend.c
+ 
+ install: all
+ 	$(INSTALL_PROG) $(IBIN) $(DESTDIR)$(SBINDIR)
+--- ./tools/libfsimage/common/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ ./tools/libfsimage/common/Makefile	2011-09-27 16:41:16.516748626 +0800
+@@ -6,7 +6,7 @@ 
+ 
+ LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS
+ LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
+-LDFLAGS = $(LDFLAGS-y)
++#LDFLAGS = $(LDFLAGS-y)
+ 
+ LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
+ 
+--- ./tools/misc/lomount/Makefile	2011-09-27 14:23:26.596752233 +0800
++++ ./tools/misc/lomount/Makefile	2011-09-27 16:37:57.445748680 +0800
+@@ -23,5 +23,5 @@ 
+ 	$(RM) *.a *.so *.o *.rpm $(BIN)
+ 
+ %: %.c $(HDRS) Makefile
+-	$(CC) $(CFLAGS) -o $@ $< 
++	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< 
+ 

diff --git a/app-emulation/xen-tools/files/xen-tools-3.4.2-remove-default-cflags.patch b/app-emulation/xen-tools/files/xen-tools-3.4.2-remove-default-cflags.patch
new file mode 100644
index 0000000..8ca546b
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.4.2-remove-default-cflags.patch
@@ -0,0 +1,257 @@
+Only in xen-3.4.2/: cflags.sh
+diff -ur xen-3.4.2.orig//config/StdGNU.mk xen-3.4.2//config/StdGNU.mk
+--- xen-3.4.2.orig//config/StdGNU.mk	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//config/StdGNU.mk	2011-09-26 02:18:14.630771549 +0800
+@@ -48,7 +48,7 @@
+ SHLIB_CFLAGS = -shared
+ 
+ ifneq ($(debug),y)
+-CFLAGS += -O2 -fomit-frame-pointer
++CFLAGS += -fomit-frame-pointer
+ else
+ # Less than -O1 produces bad code and large stack frames
+ CFLAGS += -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls
+diff -ur xen-3.4.2.orig//config/SunOS.mk xen-3.4.2//config/SunOS.mk
+--- xen-3.4.2.orig//config/SunOS.mk	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//config/SunOS.mk	2011-09-26 02:18:14.640771549 +0800
+@@ -45,7 +45,7 @@
+ SHLIB_CFLAGS = -R $(SunOS_LIBDIR) -shared
+ 
+ ifneq ($(debug),y)
+-CFLAGS += -O2 -fno-omit-frame-pointer
++CFLAGS += -fno-omit-frame-pointer
+ else
+ # Less than -O1 produces bad code and large stack frames
+ CFLAGS += -O1 -fno-omit-frame-pointer
+diff -ur xen-3.4.2.orig//Config.mk xen-3.4.2//Config.mk
+--- xen-3.4.2.orig//Config.mk	2011-09-26 02:17:29.221771569 +0800
++++ xen-3.4.2//Config.mk	2011-09-26 02:18:14.686771549 +0800
+@@ -14,7 +14,7 @@
+ 
+ # Tools to run on system hosting the build
+ HOSTCC      = gcc
+-HOSTCFLAGS  = -Wall  -Wstrict-prototypes -O2 -fomit-frame-pointer
++HOSTCFLAGS  = -Wall  -Wstrict-prototypes -fomit-frame-pointer
+ HOSTCFLAGS += -fno-strict-aliasing
+ 
+ DISTDIR     ?= $(XEN_ROOT)/dist
+diff -ur xen-3.4.2.orig//extras/mini-os/arch/ia64/arch.mk xen-3.4.2//extras/mini-os/arch/ia64/arch.mk
+--- xen-3.4.2.orig//extras/mini-os/arch/ia64/arch.mk	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//extras/mini-os/arch/ia64/arch.mk	2011-09-26 02:18:14.689771549 +0800
+@@ -1,8 +1,8 @@
+ 
+ ARCH_CFLAGS := -mfixed-range=f2-f5,f12-f15,f32-f127 -mconstant-gp
+-ARCH_CFLAGS += -O2
++#ARCH_CFLAGS += -O2
+ ARCH_ASFLAGS := -x assembler-with-cpp
+-ARCH_ASFLAGS += -mfixed-range=f2-f5,f12-f15,f32-f127 -fomit-frame-pointer
++ARCH_ASFLAGS += -mfixed-range=f2-f5,f12-f15,f32-f127
+ ARCH_ASFLAGS += -fno-builtin -fno-common -fno-strict-aliasing -mconstant-gp
+ 
+ ARCH_LDFLAGS = -warn-common
+diff -ur xen-3.4.2.orig//stubdom/grub.patches/00cvs xen-3.4.2//stubdom/grub.patches/00cvs
+--- xen-3.4.2.orig//stubdom/grub.patches/00cvs	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//stubdom/grub.patches/00cvs	2011-09-26 02:18:14.549771549 +0800
+@@ -223,8 +223,8 @@
+ +++ grub/configure.ac	2008-04-10 23:26:50.000000000 +0100
+ @@ -86,13 +86,13 @@ if test "x$ac_cv_prog_gcc" = xyes; then
+      fi
+-     STAGE1_CFLAGS="-O2"
+-     GRUB_CFLAGS="-O2"
++     STAGE1_CFLAGS=""
++     GRUB_CFLAGSS=""
+ -    AC_CACHE_CHECK([whether optimization for size works], size_flag, [
+ +    AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
+        saved_CFLAGS=$CFLAGS
+@@ -237,7 +237,7 @@
+ +    if test "x$grub_cv_cc_Os" = xyes; then
+        STAGE2_CFLAGS="-Os"
+      else
+-       STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops"
++       STAGE2_CFLAGS=" -fno-strength-reduce -fno-unroll-loops"
+ @@ -100,16 +100,16 @@ if test "x$ac_cv_prog_gcc" = xyes; then
+      # OpenBSD has a GCC extension for protecting applications from
+      # stack smashing attacks, but GRUB doesn't want this feature.
+diff -ur xen-3.4.2.orig//tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure xen-3.4.2//tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure
+--- xen-3.4.2.orig//tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure	2011-09-26 02:24:37.261771380 +0800
+@@ -1849,7 +1849,7 @@
+ GCC=`test $ac_compiler_gnu = yes && echo yes`
+ ac_test_CFLAGS=${CFLAGS+set}
+ ac_save_CFLAGS=$CFLAGS
+-CFLAGS="-g"
++CFLAGS=""
+ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+ echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+ if test "${ac_cv_prog_cc_g+set}" = set; then
+@@ -1898,15 +1898,15 @@
+   CFLAGS=$ac_save_CFLAGS
+ elif test $ac_cv_prog_cc_g = yes; then
+   if test "$GCC" = yes; then
+-    CFLAGS="-g -O2"
++    CFLAGS=""
+   else
+-    CFLAGS="-g"
++    CFLAGS=""
+   fi
+ else
+   if test "$GCC" = yes; then
+-    CFLAGS="-O2"
++#    CFLAGS="-O2"
+   else
+-    CFLAGS=
++    CFLAGS=""
+   fi
+ fi
+ echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+Only in xen-3.4.2//tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver: configure~
+diff -ur xen-3.4.2.orig//tools/ioemu-qemu-xen/configure xen-3.4.2//tools/ioemu-qemu-xen/configure
+--- xen-3.4.2.orig//tools/ioemu-qemu-xen/configure	2011-09-26 02:17:29.223771569 +0800
++++ xen-3.4.2//tools/ioemu-qemu-xen/configure	2011-09-26 02:22:14.583771444 +0800
+@@ -464,7 +464,7 @@
+ 
+ 
+ # default flags for all hosts
+-CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
++CFLAGS="$CFLAGS -g -fno-strict-aliasing"
+ CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
+ LDFLAGS="$LDFLAGS -g"
+ if test "$werror" = "yes" ; then
+diff -ur xen-3.4.2.orig//tools/ioemu-qemu-xen/tests/cris/Makefile xen-3.4.2//tools/ioemu-qemu-xen/tests/cris/Makefile
+--- xen-3.4.2.orig//tools/ioemu-qemu-xen/tests/cris/Makefile	2009-11-05 19:44:56.000000000 +0800
++++ xen-3.4.2//tools/ioemu-qemu-xen/tests/cris/Makefile	2011-09-26 02:18:14.264771549 +0800
+@@ -12,7 +12,7 @@
+ OBJCOPY = $(CROSS)objcopy
+ 
+ # we rely on GCC inline:ing the stuff we tell it to in many places here.
+-CFLAGS  = -Winline -Wall -g -O2 -static
++CFLAGS  = -Winline -Wall -g -static
+ NOSTDFLAGS = -nostartfiles -nostdlib
+ ASFLAGS += -g -Wa,-I,$(SRC_PATH)/tests/cris/
+ LDLIBS  =
+diff -ur xen-3.4.2.orig//tools/ioemu-qemu-xen/tests/hello-mips.c xen-3.4.2//tools/ioemu-qemu-xen/tests/hello-mips.c
+--- xen-3.4.2.orig//tools/ioemu-qemu-xen/tests/hello-mips.c	2009-11-05 19:44:56.000000000 +0800
++++ xen-3.4.2//tools/ioemu-qemu-xen/tests/hello-mips.c	2011-09-26 02:18:14.669771549 +0800
+@@ -6,7 +6,7 @@
+ * http://www.linux.com/howtos/Assembly-HOWTO/mips.shtml
+ *
+ * mipsel-linux-gcc -nostdlib -mno-abicalls -fno-PIC -mabi=32 \
+-*                  -O2 -static -o hello-mips hello-mips.c
++*                  -static -o hello-mips hello-mips.c
+ *
+ */
+ #define __NR_SYSCALL_BASE	4000
+diff -ur xen-3.4.2.orig//tools/ioemu-qemu-xen/tests/Makefile xen-3.4.2//tools/ioemu-qemu-xen/tests/Makefile
+--- xen-3.4.2.orig//tools/ioemu-qemu-xen/tests/Makefile	2009-11-05 19:44:56.000000000 +0800
++++ xen-3.4.2//tools/ioemu-qemu-xen/tests/Makefile	2011-09-26 02:18:14.262771549 +0800
+@@ -2,7 +2,7 @@
+ -include ../config-host.mak
+ VPATH=$(SRC_PATH)/tests
+ 
+-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
++CFLAGS=-Wall -g -fno-strict-aliasing
+ #CFLAGS+=-msse2
+ LDFLAGS=
+ 
+@@ -52,7 +52,7 @@
+ 
+ .PHONY: test-mmap
+ test-mmap: test-mmap.c
+-	$(CC) $(CFLAGS) -Wall -static -O2 $(LDFLAGS) -o $@ $<
++	$(CC) $(CFLAGS) -Wall -static $(LDFLAGS) -o $@ $<
+ 	-./test-mmap
+ 	-$(QEMU) ./test-mmap
+ 	-$(QEMU) -p 8192 ./test-mmap 8192
+@@ -88,17 +88,17 @@
+ 	arm-linux-ld -o $@ $<
+ 
+ hello-arm.o: hello-arm.c
+-	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
++	arm-linux-gcc -Wall -g -c -o $@ $<
+ 
+ test-arm-iwmmxt: test-arm-iwmmxt.s
+ 	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
+ 
+ # MIPS test
+ hello-mips: hello-mips.c
+-	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
++	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -o $@ $<
+ 
+ hello-mipsel: hello-mips.c
+-	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
++	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -o $@ $<
+ 
+ # testsuite for the CRIS port.
+ test-cris:
+diff -ur xen-3.4.2.orig//tools/libaio/src/Makefile xen-3.4.2//tools/libaio/src/Makefile
+--- xen-3.4.2.orig//tools/libaio/src/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/libaio/src/Makefile	2011-09-26 02:18:14.288771549 +0800
+@@ -6,7 +6,7 @@
+ libdir=$(prefix)/lib
+ 
+ ARCH := $(shell uname -m | sed -e s/i.86/i386/)
+-CFLAGS = -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -O2 -fPIC
++CFLAGS = -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -fPIC
+ SO_CFLAGS=-shared $(CFLAGS)
+ L_CFLAGS=$(CFLAGS)
+ LINK_FLAGS=
+diff -ur xen-3.4.2.orig//tools/libxen/Makefile.dist xen-3.4.2//tools/libxen/Makefile.dist
+--- xen-3.4.2.orig//tools/libxen/Makefile.dist	2011-09-26 02:17:29.223771569 +0800
++++ xen-3.4.2//tools/libxen/Makefile.dist	2011-09-26 02:18:14.553771549 +0800
+@@ -22,7 +22,7 @@
+ CFLAGS = -Iinclude                     \
+          $(shell xml2-config --cflags) \
+          $(shell curl-config --cflags) \
+-         -W -Wall -Wmissing-prototypes  -std=c99 -O2 -fPIC
++         -W -Wall -Wmissing-prototypes  -std=c99 -fPIC
+ 
+ LDFLAGS = $(shell xml2-config --libs) \
+           $(shell curl-config --libs)
+diff -ur xen-3.4.2.orig//tools/vnet/vnet-module/Makefile-2.4 xen-3.4.2//tools/vnet/vnet-module/Makefile-2.4
+--- xen-3.4.2.orig//tools/vnet/vnet-module/Makefile-2.4	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/vnet/vnet-module/Makefile-2.4	2011-09-26 02:18:14.659771549 +0800
+@@ -62,7 +62,7 @@
+ CFLAGS += -Wno-unused-parameter 
+ 
+ CFLAGS += -g
+-CFLAGS += -O2
++#CFLAGS += -O2
+ CFLAGS += -fno-strict-aliasing 
+ CFLAGS += -fno-common 
+ #CFLAGS += -fomit-frame-pointer
+diff -ur xen-3.4.2.orig//extras/mini-os/minios.mk xen-3.4.2//extras/mini-os/minios.mk
+--- xen-3.4.2.orig//extras/mini-os/minios.mk	2011-09-26 02:29:41.869771248 +0800
++++ xen-3.4.2//extras/mini-os/minios.mk	2011-09-26 02:33:55.708771108 +0800
+@@ -23,7 +23,7 @@
+ DEF_CFLAGS += -DGNT_DEBUG
+ DEF_CFLAGS += -DGNTMAP_DEBUG
+ else
+-DEF_CFLAGS += -O3
++#DEF_CFLAGS += -O3
+ endif
+ 
+ # Make the headers define our internal stuff
+diff -ur xen-3.4.2.orig//tools/vnet/libxutil/Makefile xen-3.4.2//tools/vnet/libxutil/Makefile
+--- xen-3.4.2.orig//tools/vnet/libxutil/Makefile	2011-09-26 02:29:41.872771248 +0800
++++ xen-3.4.2//tools/vnet/libxutil/Makefile	2011-09-26 02:37:59.835771029 +0800
+@@ -26,7 +26,7 @@
+ 
+ $(call cc-option-add,CFLAGS,CC,-fgnu89-inline)
+ CFLAGS   +=  -fno-strict-aliasing
+-CFLAGS   += -O3
++#CFLAGS   += -O3
+ #CFLAGS   += -g
+ 
+ MAJOR    := 3.0
+diff -ur xen-3.4.2.orig//tools/vnet/vnetd/Makefile xen-3.4.2//tools/vnet/vnetd/Makefile
+--- xen-3.4.2.orig//tools/vnet/vnetd/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/vnet/vnetd/Makefile	2011-09-26 02:37:59.834771029 +0800
+@@ -44,7 +44,7 @@
+ CPPFLAGS += -D __ARCH_I386_ATOMIC__
+ 
+ #----------------------------------------------------------------------------
+-CFLAGS += -O3
++#CFLAGS += -O3
+ CFLAGS += $(INCLUDES) $(LIBS)
+ 
+ LDFLAGS += $(LIBS)
\ No newline at end of file

diff --git a/app-emulation/xen-tools/files/xen-tools-3.4.2-werror-idiocy-v2.patch b/app-emulation/xen-tools/files/xen-tools-3.4.2-werror-idiocy-v2.patch
new file mode 100644
index 0000000..f9c746d
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-3.4.2-werror-idiocy-v2.patch
@@ -0,0 +1,429 @@
+diff -ur xen-3.4.2.orig//Config.mk xen-3.4.2//Config.mk
+--- xen-3.4.2.orig//Config.mk	2009-11-10 23:16:03.000000000 +0800
++++ xen-3.4.2//Config.mk	2011-09-25 02:34:11.605793042 +0800
+@@ -14,7 +14,7 @@
+ 
+ # Tools to run on system hosting the build
+ HOSTCC      = gcc
+-HOSTCFLAGS  = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
++HOSTCFLAGS  = -Wall  -Wstrict-prototypes -O2 -fomit-frame-pointer
+ HOSTCFLAGS += -fno-strict-aliasing
+ 
+ DISTDIR     ?= $(XEN_ROOT)/dist
+diff -ur xen-3.4.2.orig//extras/mini-os/minios.mk xen-3.4.2//extras/mini-os/minios.mk
+--- xen-3.4.2.orig//extras/mini-os/minios.mk	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//extras/mini-os/minios.mk	2011-09-25 02:34:11.855793042 +0800
+@@ -6,7 +6,7 @@
+ 
+ # Define some default flags.
+ # NB. '-Wcast-qual' is nasty, so I omitted it.
+-DEF_CFLAGS += -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format -Wno-redundant-decls
++DEF_CFLAGS += -fno-builtin -Wall  -Wredundant-decls -Wno-format -Wno-redundant-decls
+ DEF_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
+ DEF_CFLAGS += $(call cc-option,$(CC),-fgnu89-inline)
+ DEF_CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
+diff -ur xen-3.4.2.orig//tools/blktap/drivers/Makefile xen-3.4.2//tools/blktap/drivers/Makefile
+--- xen-3.4.2.orig//tools/blktap/drivers/Makefile	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//tools/blktap/drivers/Makefile	2011-09-25 02:34:11.750793042 +0800
+@@ -5,7 +5,7 @@
+ QCOW_UTIL    = img2qcow qcow2raw qcow-create
+ LIBAIO_DIR   = ../../libaio/src
+ 
+-CFLAGS   += -Werror
++CFLAGS   += 
+ CFLAGS   += -Wno-unused
+ CFLAGS   += -I../lib
+ CFLAGS   += $(CFLAGS_libxenctrl)
+diff -ur xen-3.4.2.orig//tools/blktap/lib/Makefile xen-3.4.2//tools/blktap/lib/Makefile
+--- xen-3.4.2.orig//tools/blktap/lib/Makefile	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//tools/blktap/lib/Makefile	2011-09-25 02:34:11.748793042 +0800
+@@ -13,7 +13,7 @@
+ SRCS     :=
+ SRCS     += xenbus.c blkif.c xs_api.c
+ 
+-CFLAGS   += -Werror
++CFLAGS   += 
+ CFLAGS   += -Wno-unused
+ CFLAGS   += -fPIC
+ # get asprintf():
+diff -ur xen-3.4.2.orig//tools/console/Makefile xen-3.4.2//tools/console/Makefile
+--- xen-3.4.2.orig//tools/console/Makefile	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//tools/console/Makefile	2011-09-25 02:34:11.704793042 +0800
+@@ -2,7 +2,7 @@
+ XEN_ROOT=../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS  += -Werror
++CFLAGS  += 
+ 
+ CFLAGS  += $(CFLAGS_libxenctrl)
+ CFLAGS  += $(CFLAGS_libxenstore)
+diff -ur xen-3.4.2.orig//tools/debugger/xenitp/Makefile xen-3.4.2//tools/debugger/xenitp/Makefile
+--- xen-3.4.2.orig//tools/debugger/xenitp/Makefile	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//tools/debugger/xenitp/Makefile	2011-09-25 02:34:11.744793042 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=../../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-#CFLAGS  += -Werror -g -O0
++#CFLAGS  +=  -g -O0
+ 
+ CFLAGS  += $(CFLAGS_libxenctrl)
+ 
+diff -ur xen-3.4.2.orig//tools/firmware/Rules.mk xen-3.4.2//tools/firmware/Rules.mk
+--- xen-3.4.2.orig//tools/firmware/Rules.mk	2009-11-10 23:12:55.000000000 +0800
++++ xen-3.4.2//tools/firmware/Rules.mk	2011-09-25 02:34:11.565793045 +0800
+@@ -10,7 +10,7 @@
+ CFLAGS += -DNDEBUG
+ endif
+ 
+-CFLAGS += -Werror
++CFLAGS += 
+ 
+ # Disable PIE/SSP if GCC supports them. They can break us.
+ $(call cc-option-add,CFLAGS,CC,-nopie)
+diff -ur xen-3.4.2.orig//tools/flask/libflask/Makefile xen-3.4.2//tools/flask/libflask/Makefile
+--- xen-3.4.2.orig//tools/flask/libflask/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/flask/libflask/Makefile	2011-09-25 02:34:11.657793042 +0800
+@@ -9,7 +9,7 @@
+ SRCS       :=
+ SRCS       += flask_op.c
+ 
+-CFLAGS   += -Werror
++CFLAGS   += 
+ CFLAGS   += -fno-strict-aliasing
+ CFLAGS   += $(INCLUDES) -I./include -I$(XEN_LIBXC) -I$(XEN_INCLUDE)
+ 
+diff -ur xen-3.4.2.orig//tools/flask/loadpolicy/Makefile xen-3.4.2//tools/flask/loadpolicy/Makefile
+--- xen-3.4.2.orig//tools/flask/loadpolicy/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/flask/loadpolicy/Makefile	2011-09-25 02:34:11.660793042 +0800
+@@ -6,7 +6,7 @@
+ LIBFLASK_ROOT = $(XEN_ROOT)/tools/flask/libflask
+ 
+ PROFILE=#-pg
+-BASECFLAGS=-Wall -g -Werror
++BASECFLAGS=-Wall -g 
+ BASECFLAGS+= $(PROFILE)
+ #BASECFLAGS+= -I$(XEN_ROOT)/tools
+ BASECFLAGS+= $(CFLAGS_libxenctrl)
+diff -ur xen-3.4.2.orig//tools/fs-back/Makefile xen-3.4.2//tools/fs-back/Makefile
+--- xen-3.4.2.orig//tools/fs-back/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/fs-back/Makefile	2011-09-25 02:34:11.637793042 +0800
+@@ -5,7 +5,7 @@
+ 
+ IBIN         = fs-backend 
+ 
+-CFLAGS   += -Werror
++CFLAGS   += 
+ CFLAGS   += -Wno-unused
+ CFLAGS   += -fno-strict-aliasing
+ CFLAGS   += $(CFLAGS_libxenctrl)
+diff -ur xen-3.4.2.orig//tools/ioemu-qemu-xen/configure xen-3.4.2//tools/ioemu-qemu-xen/configure
+--- xen-3.4.2.orig//tools/ioemu-qemu-xen/configure	2009-11-05 19:44:56.000000000 +0800
++++ xen-3.4.2//tools/ioemu-qemu-xen/configure	2011-09-25 02:34:11.888793042 +0800
+@@ -468,7 +468,7 @@
+ CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
+ LDFLAGS="$LDFLAGS -g"
+ if test "$werror" = "yes" ; then
+-CFLAGS="$CFLAGS -Werror"
++CFLAGS="$CFLAGS"
+ fi
+ 
+ if test "$solaris" = "no" ; then
+@@ -1150,7 +1150,7 @@
+ echo "sparse enabled    $sparse"
+ echo "profiler          $profiler"
+ echo "static build      $static"
+-echo "-Werror enabled   $werror"
++
+ if test "$darwin" = "yes" ; then
+     echo "Cocoa support     $cocoa"
+ fi
+diff -ur xen-3.4.2.orig//tools/ioemu-qemu-xen/Makefile.target xen-3.4.2//tools/ioemu-qemu-xen/Makefile.target
+--- xen-3.4.2.orig//tools/ioemu-qemu-xen/Makefile.target	2011-09-25 02:33:23.946793064 +0800
++++ xen-3.4.2//tools/ioemu-qemu-xen/Makefile.target	2011-09-25 02:34:11.584793042 +0800
+@@ -26,7 +26,7 @@
+ TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
+ VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
+ CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
+-#CFLAGS+=-Werror
++#CFLAGS+=
+ LIBS=
+ # user emulator name
+ ifndef TARGET_ARCH2
+diff -ur xen-3.4.2.orig//tools/libaio/harness/Makefile xen-3.4.2//tools/libaio/harness/Makefile
+--- xen-3.4.2.orig//tools/libaio/harness/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/libaio/harness/Makefile	2011-09-25 02:34:11.674793042 +0800
+@@ -4,7 +4,7 @@
+ HARNESS_SRCS:=main.c
+ # io_queue.c
+ 
+-CFLAGS=-Wall -Werror -g -O -laio
++CFLAGS=-Wall  -g -O -laio
+ #-lpthread -lrt
+ 
+ all: $(PROGS)
+diff -ur xen-3.4.2.orig//tools/libfsimage/Rules.mk xen-3.4.2//tools/libfsimage/Rules.mk
+--- xen-3.4.2.orig//tools/libfsimage/Rules.mk	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/libfsimage/Rules.mk	2011-09-25 02:34:11.566793044 +0800
+@@ -1,6 +1,6 @@
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS += -I$(XEN_ROOT)/tools/libfsimage/common/ -Werror
++CFLAGS += -I$(XEN_ROOT)/tools/libfsimage/common/ 
+ LDFLAGS += -L../common/
+ 
+ PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
+diff -ur xen-3.4.2.orig//tools/libxc/Makefile xen-3.4.2//tools/libxc/Makefile
+--- xen-3.4.2.orig//tools/libxc/Makefile	2011-09-25 02:33:23.987793064 +0800
++++ xen-3.4.2//tools/libxc/Makefile	2011-09-25 02:34:11.687793042 +0800
+@@ -52,7 +52,7 @@
+ 
+ -include $(XEN_TARGET_ARCH)/Makefile
+ 
+-CFLAGS   += -Werror -Wmissing-prototypes
++CFLAGS   +=  -Wmissing-prototypes
+ CFLAGS   += $(INCLUDES) -I. -I../xenstore -I../include
+ 
+ # Needed for posix_fadvise64() in xc_linux.c
+diff -ur xen-3.4.2.orig//tools/libxen/Makefile.dist xen-3.4.2//tools/libxen/Makefile.dist
+--- xen-3.4.2.orig//tools/libxen/Makefile.dist	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/libxen/Makefile.dist	2011-09-25 02:34:11.593793042 +0800
+@@ -22,7 +22,7 @@
+ CFLAGS = -Iinclude                     \
+          $(shell xml2-config --cflags) \
+          $(shell curl-config --cflags) \
+-         -W -Wall -Wmissing-prototypes -Werror -std=c99 -O2 -fPIC
++         -W -Wall -Wmissing-prototypes  -std=c99 -O2 -fPIC
+ 
+ LDFLAGS = $(shell xml2-config --libs) \
+           $(shell curl-config --libs)
+diff -ur xen-3.4.2.orig//tools/misc/lomount/Makefile xen-3.4.2//tools/misc/lomount/Makefile
+--- xen-3.4.2.orig//tools/misc/lomount/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/misc/lomount/Makefile	2011-09-25 02:34:11.666793042 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=../../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS  += -Werror
++CFLAGS  += 
+ 
+ HDRS     = $(wildcard *.h)
+ OBJS     = $(patsubst %.c,%.o,$(wildcard *.c))
+diff -ur xen-3.4.2.orig//tools/misc/Makefile xen-3.4.2//tools/misc/Makefile
+--- xen-3.4.2.orig//tools/misc/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/misc/Makefile	2011-09-25 02:34:11.669793042 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS   += -Werror
++CFLAGS   += 
+ 
+ INCLUDES += -I $(XEN_XC)
+ INCLUDES += -I $(XEN_LIBXC)
+diff -ur xen-3.4.2.orig//tools/pygrub/setup.py xen-3.4.2//tools/pygrub/setup.py
+--- xen-3.4.2.orig//tools/pygrub/setup.py	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/pygrub/setup.py	2011-09-25 02:34:11.901793042 +0800
+@@ -3,7 +3,7 @@
+ import os
+ import sys
+ 
+-extra_compile_args  = [ "-fno-strict-aliasing", "-Werror" ]
++extra_compile_args  = [ "-fno-strict-aliasing" ]
+ 
+ XEN_ROOT = "../.."
+ 
+diff -ur xen-3.4.2.orig//tools/python/setup.py xen-3.4.2//tools/python/setup.py
+--- xen-3.4.2.orig//tools/python/setup.py	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/python/setup.py	2011-09-25 02:34:11.897793042 +0800
+@@ -4,7 +4,7 @@
+ 
+ XEN_ROOT = "../.."
+ 
+-extra_compile_args  = [ "-fno-strict-aliasing", "-Werror" ]
++extra_compile_args  = [ "-fno-strict-aliasing" ]
+ 
+ include_dirs = [ XEN_ROOT + "/tools/libxc",
+                  XEN_ROOT + "/tools/xenstore",
+diff -ur xen-3.4.2.orig//tools/security/Makefile xen-3.4.2//tools/security/Makefile
+--- xen-3.4.2.orig//tools/security/Makefile	2009-11-10 23:12:56.000000000 +0800
++++ xen-3.4.2//tools/security/Makefile	2011-09-25 02:34:11.701793042 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT = ../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS   += -Werror
++CFLAGS   += 
+ CFLAGS   += -fno-strict-aliasing
+ CFLAGS   += -I. $(CFLAGS_libxenctrl)
+ 
+diff -ur xen-3.4.2.orig//tools/vnet/libxutil/Makefile xen-3.4.2//tools/vnet/libxutil/Makefile
+--- xen-3.4.2.orig//tools/vnet/libxutil/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/vnet/libxutil/Makefile	2011-09-25 02:34:11.694793042 +0800
+@@ -25,7 +25,7 @@
+ PIC_OBJS := $(LIB_SRCS:.c=.opic)
+ 
+ $(call cc-option-add,CFLAGS,CC,-fgnu89-inline)
+-CFLAGS   += -Werror -fno-strict-aliasing
++CFLAGS   +=  -fno-strict-aliasing
+ CFLAGS   += -O3
+ #CFLAGS   += -g
+ 
+diff -ur xen-3.4.2.orig//tools/vtpm/Rules.mk xen-3.4.2//tools/vtpm/Rules.mk
+--- xen-3.4.2.orig//tools/vtpm/Rules.mk	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/vtpm/Rules.mk	2011-09-25 02:34:11.563793044 +0800
+@@ -9,7 +9,7 @@
+ TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
+ 
+ # General compiler flags
+-CFLAGS   = -Werror -g3 -I.
++CFLAGS   =  -g3 -I.
+ 
+ # Generic project files
+ HDRS	= $(wildcard *.h)
+diff -ur xen-3.4.2.orig//tools/vtpm_manager/Rules.mk xen-3.4.2//tools/vtpm_manager/Rules.mk
+--- xen-3.4.2.orig//tools/vtpm_manager/Rules.mk	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/vtpm_manager/Rules.mk	2011-09-25 02:34:11.562793042 +0800
+@@ -9,7 +9,7 @@
+ TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
+ 
+ # General compiler flags
+-CFLAGS	= -Werror -g3 -I.
++CFLAGS	=  -g3 -I.
+ 
+ # Generic project files
+ HDRS	= $(wildcard *.h)
+diff -ur xen-3.4.2.orig//tools/xcutils/Makefile xen-3.4.2//tools/xcutils/Makefile
+--- xen-3.4.2.orig//tools/xcutils/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/xcutils/Makefile	2011-09-25 02:34:11.636793042 +0800
+@@ -11,7 +11,7 @@
+ XEN_ROOT	= ../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS += -Werror
++CFLAGS += 
+ CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore)
+ 
+ PROGRAMS = xc_restore xc_save readnotes lsevtchn
+diff -ur xen-3.4.2.orig//tools/xenmon/Makefile xen-3.4.2//tools/xenmon/Makefile
+--- xen-3.4.2.orig//tools/xenmon/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/xenmon/Makefile	2011-09-25 02:34:11.641793042 +0800
+@@ -13,7 +13,7 @@
+ XEN_ROOT=../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS  += -Werror
++CFLAGS  += 
+ CFLAGS  += -I $(XEN_XC)
+ CFLAGS  += $(CFLAGS_libxenctrl)
+ LDFLAGS += $(LDFLAGS_libxenctrl)
+diff -ur xen-3.4.2.orig//tools/xenpmd/Makefile xen-3.4.2//tools/xenpmd/Makefile
+--- xen-3.4.2.orig//tools/xenpmd/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/xenpmd/Makefile	2011-09-25 02:34:11.656793042 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS  += -Werror
++CFLAGS  += 
+ CFLAGS  += $(CFLAGS_libxenstore)
+ LDFLAGS += $(LDFLAGS_libxenstore)
+ 
+diff -ur xen-3.4.2.orig//tools/xenstat/libxenstat/Makefile xen-3.4.2//tools/xenstat/libxenstat/Makefile
+--- xen-3.4.2.orig//tools/xenstat/libxenstat/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/xenstat/libxenstat/Makefile	2011-09-25 02:34:11.681793042 +0800
+@@ -34,7 +34,7 @@
+ OBJECTS-$(CONFIG_NetBSD) += src/xenstat_netbsd.o
+ SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(MAJOR)
+ 
+-WARN_FLAGS=-Wall -Werror
++WARN_FLAGS=-Wall 
+ 
+ CFLAGS+=-Isrc -I$(XEN_LIBXC) -I$(XEN_XENSTORE) -I$(XEN_INCLUDE)
+ LDFLAGS+=-Lsrc -L$(XEN_XENSTORE)/ -L$(XEN_LIBXC)/
+diff -ur xen-3.4.2.orig//tools/xenstat/xentop/Makefile xen-3.4.2//tools/xenstat/xentop/Makefile
+--- xen-3.4.2.orig//tools/xenstat/xentop/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/xenstat/xentop/Makefile	2011-09-25 02:34:11.684793042 +0800
+@@ -18,7 +18,7 @@
+ all install xentop:
+ else
+ 
+-CFLAGS += -DGCC_PRINTF -Wall -Werror -I$(XEN_LIBXENSTAT)
++CFLAGS += -DGCC_PRINTF -Wall  -I$(XEN_LIBXENSTAT)
+ LDFLAGS += -L$(XEN_LIBXENSTAT)
+ LDLIBS += -lxenstat $(CURSES_LIBS) $(SOCKET_LIBS)
+ CFLAGS += -DHOST_$(XEN_OS)
+diff -ur xen-3.4.2.orig//tools/xenstore/Makefile xen-3.4.2//tools/xenstore/Makefile
+--- xen-3.4.2.orig//tools/xenstore/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/xenstore/Makefile	2011-09-25 02:34:11.640793042 +0800
+@@ -4,7 +4,7 @@
+ MAJOR = 3.0
+ MINOR = 0
+ 
+-CFLAGS += -Werror
++CFLAGS += 
+ CFLAGS += -I.
+ CFLAGS += $(CFLAGS_libxenctrl)
+ 
+diff -ur xen-3.4.2.orig//tools/xenstore/xenstored_core.c xen-3.4.2//tools/xenstore/xenstored_core.c
+--- xen-3.4.2.orig//tools/xenstore/xenstored_core.c	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/xenstore/xenstored_core.c	2011-09-25 02:34:11.845793042 +0800
+@@ -865,7 +865,7 @@
+ {
+ 	unsigned int offset, datalen;
+ 	struct node *node;
+-	char *vec[1] = { NULL }; /* gcc4 + -W + -Werror fucks code. */
++	char *vec[1] = { NULL }; /* gcc4 + -W +  fucks code. */
+ 	char *name;
+ 
+ 	/* Extra "strings" can be created by binary data. */
+diff -ur xen-3.4.2.orig//tools/xentrace/Makefile xen-3.4.2//tools/xentrace/Makefile
+--- xen-3.4.2.orig//tools/xentrace/Makefile	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//tools/xentrace/Makefile	2011-09-25 02:34:11.745793042 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=../..
+ include $(XEN_ROOT)/tools/Rules.mk
+ 
+-CFLAGS  += -Werror
++CFLAGS  += 
+ 
+ CFLAGS  += $(CFLAGS_libxenctrl)
+ LDFLAGS += $(LDFLAGS_libxenctrl)
+Only in xen-3.4.2/: Werror.sh
+diff -ur xen-3.4.2.orig//xen/arch/ia64/Rules.mk xen-3.4.2//xen/arch/ia64/Rules.mk
+--- xen-3.4.2.orig//xen/arch/ia64/Rules.mk	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//xen/arch/ia64/Rules.mk	2011-09-25 02:34:11.570793042 +0800
+@@ -68,7 +68,7 @@
+ CFLAGS += -DCONFIG_XEN_IA64_TLBFLUSH_CLOCK
+ endif
+ ifeq ($(no_warns),y)
+-CFLAGS	+= -Wa,--fatal-warnings -Werror -Wno-uninitialized
++CFLAGS	+= -Wa,--fatal-warnings  -Wno-uninitialized
+ endif
+ ifneq ($(vhpt_disable),y)
+ CFLAGS += -DVHPT_ENABLED=1
+diff -ur xen-3.4.2.orig//xen/arch/x86/boot/build32.mk xen-3.4.2//xen/arch/x86/boot/build32.mk
+--- xen-3.4.2.orig//xen/arch/x86/boot/build32.mk	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//xen/arch/x86/boot/build32.mk	2011-09-25 02:34:11.914793042 +0800
+@@ -8,7 +8,7 @@
+ $(call cc-option-add,CFLAGS,CC,-fno-stack-protector)
+ $(call cc-option-add,CFLAGS,CC,-fno-stack-protector-all)
+ 
+-CFLAGS += -Werror -fno-builtin -msoft-float
++CFLAGS += -fno-builtin -msoft-float
+ 
+ # NB. awk invocation is a portable alternative to 'head -n -1'
+ %.S: %.bin
+diff -ur xen-3.4.2.orig//xen/arch/x86/Rules.mk xen-3.4.2//xen/arch/x86/Rules.mk
+--- xen-3.4.2.orig//xen/arch/x86/Rules.mk	2009-11-10 23:12:57.000000000 +0800
++++ xen-3.4.2//xen/arch/x86/Rules.mk	2011-09-25 02:34:11.572793042 +0800
+@@ -17,7 +17,7 @@
+ endif
+ 
+ CFLAGS += -fno-builtin -fno-common
+-CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
++CFLAGS += -iwithprefix include  -Wno-pointer-arith -pipe
+ CFLAGS += -I$(BASEDIR)/include 
+ CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
+ CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default

diff --git a/app-emulation/xen-tools/files/xen-tools-4.1.1-bridge.patch b/app-emulation/xen-tools/files/xen-tools-4.1.1-bridge.patch
new file mode 100644
index 0000000..4b3a4ba
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-4.1.1-bridge.patch
@@ -0,0 +1,12 @@
+diff -ur xen-4.1.1.orig//tools/hotplug/Linux/network-bridge xen-4.1.1/tools/hotplug/Linux/network-bridge
+--- xen-4.1.1.orig//tools/hotplug/Linux/network-bridge	2011-10-14 02:28:43.481714285 +0800
++++ xen-4.1.1/tools/hotplug/Linux/network-bridge	2011-10-16 01:06:11.226673108 +0800
+@@ -216,7 +216,7 @@
+ 	return
+     fi
+ 
+-    if [ `brctl show | wc -l` != 1 ]; then
++    if [ `brctl show | grep $netdev | wc -l` != 0 ]; then
+         return
+     fi
+ 

diff --git a/app-emulation/xen-tools/files/xen-tools-4.1.1-curl.patch b/app-emulation/xen-tools/files/xen-tools-4.1.1-curl.patch
new file mode 100644
index 0000000..c3fd913
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-4.1.1-curl.patch
@@ -0,0 +1,10 @@
+diff -ur xen-4.1.1.orig//tools/check/check_curl xen-4.1.1/tools/check/check_curl
+--- xen-4.1.1.orig//tools/check/check_curl	2011-06-15 00:03:44.000000000 +0800
++++ xen-4.1.1/tools/check/check_curl	2011-10-14 00:42:08.189717078 +0800
+@@ -9,5 +9,6 @@
+ fi
+ 
+ has_or_fail curl-config
+ curl_libs=`curl-config --libs` || fail "curl-config --libs failed"
++curl_libs=`echo $curl_libs | sed -re 's/-(W|march|mtune|pipe)[^[:space:]]*[[:space:]]//g'` || fail "curl-config --libs failed"
+ test_link $curl_libs || fail "dependency libraries for curl are missing"

diff --git a/app-emulation/xen-tools/files/xen-tools-4.1.1-libxl-tap.patch b/app-emulation/xen-tools/files/xen-tools-4.1.1-libxl-tap.patch
new file mode 100644
index 0000000..ba72c49
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-4.1.1-libxl-tap.patch
@@ -0,0 +1,37 @@
+Index: xen-tools-4.1.1/tools/libxl/libxl_dm.c
+===================================================================
+--- xen-4.1.1.orig/tools/libxl/libxl_dm.c	Tue Mar 15 10:14:27 2011 +0000
++++ xen-4.1.1/tools/libxl/libxl_dm.c	Tue Mar 15 18:19:47 2011 +0000
+@@ -828,8 +828,29 @@
+         goto out;
+     }
+ 
+-    if (nr_disks > 0 && !libxl__blktap_enabled(&gc))
+-        ret = 1;
++    if (nr_disks > 0) {
++        int blktap_enabled = -1;
++        for (i = 0; i < nr_disks; i++) {
++            switch (disks[i].backend) {
++            case DISK_BACKEND_TAP:
++                if (blktap_enabled == -1)
++                    blktap_enabled = libxl__blktap_enabled(&gc);
++                if (!blktap_enabled) {
++                    ret = 1;
++                    goto out;
++                }
++                break;
++
++            case DISK_BACKEND_QDISK:
++                ret = 1;
++                goto out;
++
++            case DISK_BACKEND_PHY:
++            case DISK_BACKEND_UNKNOWN:
++                break;
++            }
++        }
++    }
+ 
+ out:
+     libxl__free_all(&gc);
+

diff --git a/app-emulation/xen-tools/files/xen-tools-4.1.2-pyxml.patch b/app-emulation/xen-tools/files/xen-tools-4.1.2-pyxml.patch
new file mode 100644
index 0000000..5b14e4c
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-4.1.2-pyxml.patch
@@ -0,0 +1,12 @@
+--- tools/python/xen/xm/create.py
++++ tools/python/xen/xm/create.py
+@@ -1538,6 +1538,9 @@
+             SXPPrettyPrint.prettyprint(config)
+ 
+         if opts.vals.xmldryrun and serverType == SERVER_XEN_API:
++            import xml
++            if hasattr(xml, "use_pyxml"):
++                xml.use_pyxml()
+             from xml.dom.ext import PrettyPrint as XMLPrettyPrint
+             XMLPrettyPrint(doc)
+ 

diff --git a/app-emulation/xen-tools/files/xenconsoled.confd b/app-emulation/xen-tools/files/xenconsoled.confd
new file mode 100644
index 0000000..b2e194b
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenconsoled.confd
@@ -0,0 +1,2 @@
+# /etc/conf.d/xenstored
+XENCONSOLED_OPTS=""

diff --git a/app-emulation/xen-tools/files/xenconsoled.initd b/app-emulation/xen-tools/files/xenconsoled.initd
new file mode 100644
index 0000000..12e4381
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenconsoled.initd
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd,v 1.1 2011/04/05 19:23:05 alexxy Exp $
+
+depend() {
+	need xenstored
+}
+
+start() {
+	ebegin "Starting xenconsoled daemon"
+	start-stop-daemon --start --exec /usr/sbin/xenconsoled \
+		--pidfile /var/run/xenconsoled.pid \
+		-- --pid-file=/var/run/xenconsoled.pid \
+		${XENCONSOLED_OPTS}
+	eend $*
+}
+
+stop() {
+	ebegin "Stoping xenconsoled daemon"
+	start-stop-daemon --stop --exec /usr/sbin/xenconsoled \
+		--pidfile /var/run/xenconsoled.pid
+	eend $*
+}
+

diff --git a/app-emulation/xen-tools/files/xend.initd-r1 b/app-emulation/xen-tools/files/xend.initd-r1
new file mode 100644
index 0000000..d1e49b0
--- /dev/null
+++ b/app-emulation/xen-tools/files/xend.initd-r1
@@ -0,0 +1,71 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xend.initd-r1,v 1.1 2009/09/01 09:56:36 wschlich Exp $
+
+opts="start stop status restart"
+
+depend() {
+	need net
+	before xendomains sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
+}
+
+await_daemons_up() {
+	for ((i=0; i<5; i++)); do
+		/usr/sbin/xend status && return 0
+		sleep 1
+	done
+	return 1
+}
+
+is_privileged_domain() {
+	grep -qsE '^control_d$' /proc/xen/capabilities
+	return $?
+}
+
+start() {
+	if is_privileged_domain ; then
+		ebegin "Starting Xen control daemon"
+		/usr/sbin/xend start && await_daemons_up
+		eend $?
+	else
+		eerror "Can't start xend - this is not a privileged domain."
+		return 1
+	fi
+}
+
+stop() {
+	if [ "$(xm list 2>/dev/null | wc -l)" -gt 2 ]; then
+		ebegin "Stopping all Xen domains"
+		/usr/sbin/xm shutdown --all --wait >/dev/null
+		eend $?
+	fi
+
+	ebegin "Stopping Xen control daemon"
+	/usr/sbin/xend stop
+	eend $?
+
+	#ebegin "Stopping xenconsoled"
+	#kill $(</var/run/xenconsoled.pid)
+	#eend $?
+
+	#ebegin "Stopping xenstored"
+	#kill $(</var/run/xenstore.pid)
+	#eend $?
+}
+
+restart() {
+	# IMPORTANT: do NOT restart xenstored/xenconsoled when restarting
+	# just xend, as this can be fatal!
+	# When restarting xend, leave alone xenstored/xenconsoled and all
+	# running domains.
+	# See http://article.gmane.org/gmane.comp.emulators.xen.user/40656
+	ebegin "Restarting Xen control daemon"
+	/usr/sbin/xend restart
+	eend $?
+	# we fool /etc/init.d/runscript.sh:svc_restart() here: svc_stop svc_start
+}
+
+status() {
+	is_privileged_domain && /usr/sbin/xend status
+}

diff --git a/app-emulation/xen-tools/files/xend.initd-r2 b/app-emulation/xen-tools/files/xend.initd-r2
new file mode 100644
index 0000000..b790e7f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xend.initd-r2
@@ -0,0 +1,52 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xend.initd-r2,v 1.2 2011/09/10 17:22:46 alexxy Exp $
+
+opts="start stop status restart"
+
+depend() {
+	need net xenconsoled xenstored
+	before xendomains sshd
+}
+
+await_daemons_up() {
+	for ((i=0; i<5; i++)); do
+		sleep 1
+		/usr/sbin/xend status && return 0
+	done
+	return 1
+}
+
+is_privileged_domain() {
+	grep -qsE '^control_d$' /proc/xen/capabilities
+	return $?
+}
+
+start() {
+	if is_privileged_domain ; then
+		ebegin "Starting Xen control daemon"
+		/usr/sbin/xend start
+		/usr/sbin/xend status || await_daemons_up
+		eend $?
+	else
+		eerror "Can't start xend - this is not a privileged domain."
+		return 1
+	fi
+}
+
+stop() {
+	if [ "$(xm list | wc -l)" -gt 2 ]; then
+		ebegin "  Stopping all domains"
+		/usr/sbin/xl shutdown -a -w >/dev/null
+		eend $?
+	fi
+
+	ebegin "Stopping Xen control daemon"
+	/usr/sbin/xend stop
+	eend $?
+}
+
+status() {
+	is_privileged_domain && /usr/sbin/xend status
+}

diff --git a/app-emulation/xen-tools/files/xendomains-screen.confd b/app-emulation/xen-tools/files/xendomains-screen.confd
new file mode 100644
index 0000000..1482c0a
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains-screen.confd
@@ -0,0 +1,15 @@
+# When SCREEN="yes", domains in AUTODIR have their consoles connected to a
+# screen session named SCREEN_NAME, with output logged to individual files 
+# named after each domain and written to /var/log/xen-consoles/ . These files
+# are rotated (using app-admin/logrotate) every time xendomains is started.
+
+SCREEN="yes"
+SCREEN_NAME="xen"
+
+# Number of seconds between writes to screen's logfiles.
+#
+# Lower values mean more disk activity and hence a possible performance
+# impact, but higher values mean a greater chance of loosing some output
+# in the event of a crash.
+
+SCREEN_LOG_INTERVAL="1"

diff --git a/app-emulation/xen-tools/files/xendomains.confd b/app-emulation/xen-tools/files/xendomains.confd
new file mode 100644
index 0000000..90c1f52
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.confd
@@ -0,0 +1,9 @@
+# /etc/conf.d/xendomains
+
+# Directory of domains to boot. AUTODIR should contain one or more symlinks
+# to domain config files in /etc/xen
+AUTODIR=/etc/xen/auto
+
+# Send shutdown commands to all domains in parallel instead of waiting for
+# each to shutdown individually
+PARALLEL_SHUTDOWN=yes

diff --git a/app-emulation/xen-tools/files/xendomains.initd-r1 b/app-emulation/xen-tools/files/xendomains.initd-r1
new file mode 100755
index 0000000..c7f6f88
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.initd-r1
@@ -0,0 +1,117 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xendomains.initd-r1,v 1.2 2011/10/13 19:30:37 alexxy Exp $
+
+opts="start stop status restart"
+
+depend() {
+	need xend
+	after dhcp
+}
+
+get_domname() {
+	local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1)
+
+	if [[ -z ${name_from_file} ]] ; then
+		basename "${1}"
+	else
+		echo ${name_from_file}	
+	fi
+}
+
+is_running() {
+	/usr/sbin/xm list "${1}" >/dev/null 2>&1
+}
+
+using_screen() {
+	[[ "${SCREEN}" == "yes" || "${SCREEN}" == "YES" ]]	
+}
+
+set_screen_cmd() {
+	screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X"
+}
+
+start() {
+	set_screen_cmd
+
+	einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}"
+	if using_screen ; then
+		ebegin "Creating screen session to hold domain consoles"
+		(  screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 && sleep 3 \
+		&& ${screen_cmd} zombie dr \
+		&& logrotate -f /etc/xen/xen-consoles.logrotate \
+		&& ${screen_cmd} logfile  /var/log/xen-consoles/%t.log \
+		&& ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \
+		&& ${screen_cmd} log on \
+		&& ${screen_cmd} deflog on ) >/dev/null
+		if [[ $? -ne 0 ]] ; then
+			eend 1
+			return 1
+		else
+			eend
+		fi
+	fi
+	# Create all domains with config files in AUTODIR.
+	for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do
+		name=$(get_domname ${dom})
+		if ! is_running ${name} ; then
+			ebegin "  Starting domain ${name}"
+			if using_screen ; then
+				${screen_cmd} screen -t ${name} xm create ${dom} -c
+			else
+				xm create --quiet ${dom}
+			fi
+			eend $?
+		else
+			einfo "  Not starting domain ${name} - already running"
+		fi
+	done
+}
+
+stop() {
+	set_screen_cmd
+
+	einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}"
+	# Stop all domains with config files in AUTODIR.
+	DOMAINS="$(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort -r)"
+
+	if [[ "$PARALLEL_SHUTDOWN" = "yes" ]] ; then
+		for dom in $DOMAINS ; do
+			name=$(get_domname ${dom})
+			if is_running ${name} ; then
+				ebegin "  Asking domain ${name} to shutdown in the background..."
+				xm shutdown --wait ${name} >/dev/null &
+			else
+				einfo "  Not stopping domain ${name} - not running"
+			fi
+		done
+		einfo "  Waiting for shutdown of domains that are still running"
+		wait
+		eend $?
+	else
+		for dom in $DOMAINS ; do
+			name=$(get_domname ${dom})
+			if is_running ${name} ; then
+				ebegin "  Waiting for domain ${name} to shutdown"
+				xm shutdown --wait ${name} >/dev/null
+				eend $?
+			else
+				einfo "  Not stopping domain ${name} - not running"
+			fi
+		done
+	fi
+	if using_screen ; then
+		if ${screen_cmd} sleep 0 >/dev/null 2>&1 ; then
+			ebegin "Closing screen session ${SCREEN_NAME}"
+			${screen_cmd} quit
+			eend $?
+		else
+			eend 0
+		fi
+	fi
+}
+
+status() {
+	/usr/sbin/xm list
+}

diff --git a/app-emulation/xen-tools/files/xendomains.initd-r2 b/app-emulation/xen-tools/files/xendomains.initd-r2
new file mode 100644
index 0000000..9240376
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.initd-r2
@@ -0,0 +1,117 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xendomains.initd-r2,v 1.2 2011/09/10 17:22:46 alexxy Exp $
+
+opts="start stop status restart"
+
+depend() {
+	need xenstored xenconsoled xend
+	after dhcp
+}
+
+get_domname() {
+	local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1)
+
+	if [[ -z ${name_from_file} ]] ; then
+		basename "${1}"
+	else
+		echo ${name_from_file}	
+	fi
+}
+
+is_running() {
+	/usr/sbin/xl list "${1}" >/dev/null 2>&1
+}
+
+using_screen() {
+	[[ "${SCREEN}" == "yes" || "${SCREEN}" == "YES" ]]	
+}
+
+set_screen_cmd() {
+	screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X"
+}
+
+start() {
+	set_screen_cmd
+
+	einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}"
+	if using_screen ; then
+		ebegin "Creating screen session to hold domain consoles"
+		(  screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 \
+		&& ${screen_cmd} zombie dr \
+		&& logrotate -f /etc/xen/xen-consoles.logrotate \
+		&& ${screen_cmd} logfile  /var/log/xen-consoles/%t.log \
+		&& ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \
+		&& ${screen_cmd} log on \
+		&& ${screen_cmd} deflog on ) >/dev/null
+		if [[ $? -ne 0 ]] ; then
+			eend 1
+			return 1
+		else
+			eend
+		fi
+	fi
+	# Create all domains with config files in AUTODIR.
+	for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do
+		name=$(get_domname ${dom})
+		if ! is_running ${name} ; then
+			ebegin "  Starting domain ${name}"
+			if using_screen ; then
+				${screen_cmd} screen -t ${name} xl create ${dom} -c
+			else
+				xl create --quiet ${dom}
+			fi
+			eend $?
+		else
+			einfo "  Not starting domain ${name} - already running"
+		fi
+	done
+}
+
+stop() {
+	set_screen_cmd
+
+	einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}"
+	# Stop all domains with config files in AUTODIR.
+	DOMAINS="$(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort -r)"
+
+	if [[ "$PARALLEL_SHUTDOWN" = "yes" ]] ; then
+		for dom in $DOMAINS ; do
+			name=$(get_domname ${dom})
+			if is_running ${name} ; then
+				ebegin "  Asking domain ${name} to shutdown in the background..."
+				xl shutdown -w ${name} >/dev/null &
+			else
+				einfo "  Not stopping domain ${name} - not running"
+			fi
+		done
+		einfo "  Waiting for shutdown of domains that are still running"
+		wait
+		eend $?
+	else
+		for dom in $DOMAINS ; do
+			name=$(get_domname ${dom})
+			if is_running ${name} ; then
+				ebegin "  Waiting for domain ${name} to shutdown"
+				xl shutdown -w ${name} >/dev/null
+				eend $?
+			else
+				einfo "  Not stopping domain ${name} - not running"
+			fi
+		done
+	fi
+	if using_screen ; then
+		if ${screen_cmd} sleep 0 >/dev/null 2>&1 ; then
+			ebegin "Closing screen session ${SCREEN_NAME}"
+			${screen_cmd} quit
+			eend $?
+		else
+			eend 0
+		fi
+	fi
+}
+
+status() {
+	/usr/sbin/xl list
+}

diff --git a/app-emulation/xen-tools/files/xenstored.confd b/app-emulation/xen-tools/files/xenstored.confd
new file mode 100644
index 0000000..31b9293
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.confd
@@ -0,0 +1,2 @@
+# /etc/conf.d/xenstored
+XENSTORED_OPTS=""

diff --git a/app-emulation/xen-tools/files/xenstored.initd b/app-emulation/xen-tools/files/xenstored.initd
new file mode 100755
index 0000000..f85aa4f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.initd
@@ -0,0 +1,29 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd,v 1.2 2011/04/05 21:25:03 alexxy Exp $
+
+depend() {
+	need net
+	before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp 
+}
+
+start() {
+	ebegin "Starting xenstored daemon"
+	start-stop-daemon --start --exec /usr/sbin/xenstored \
+		--pidfile /var/run/xenstored.pid \
+		-- --pid-file=/var/run/xenstored.pid \
+		$XENSTORED_OPTS
+	sleep 15
+	einfo "Setting domain0 name record"
+	/usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"
+	eend $*
+}
+
+stop() {
+	ebegin "Stopping xenstored daemon"
+	start-stop-daemon --stop --exec /usr/sbin/xenstored \
+		--pidfile /var/run/xenstored.pid
+	eend $?
+}
+

diff --git a/app-emulation/xen-tools/metadata.xml b/app-emulation/xen-tools/metadata.xml
new file mode 100644
index 0000000..501368b
--- /dev/null
+++ b/app-emulation/xen-tools/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>xen</herd>
+	<maintainer>
+		<email>johneed@hotmail.com</email>
+		<name>Ian Delaney aka idella4 proxy maintainer</name>
+	</maintainer>
+	<use>
+		<flag name='acm'>Enable the ACM/sHype XSM module from IBM for xen-3</flag>
+		<flag name='api'>Build the C libxenapi bindings</flag>
+		<flag name='flask'>Enable the Flask XSM module from NSA</flag>
+		<flag name='hvm'>Enable support for hardware based virtualization (VT-x,AMD-v)</flag>
+		<flag name='ioemu'>Enable IOEMU support</flag>
+		<flag name='qemu'>Enable IOEMU support via the use of qemu-dm</flag>
+		<flag name='pygrub'>Install the pygrub boot loader</flag>
+		<flag name='screen'>Enable support for running domain U console in an <pkg>app-misc/screen</pkg> session</flag>
+		<flag name='xend'>Enable support the xend and xm to manage xen</flag>
+	</use>
+</pkgmetadata>

diff --git a/app-emulation/xen-tools/xen-tools-3.4.2-r5.ebuild b/app-emulation/xen-tools/xen-tools-3.4.2-r5.ebuild
new file mode 100644
index 0000000..c31830b
--- /dev/null
+++ b/app-emulation/xen-tools/xen-tools-3.4.2-r5.ebuild
@@ -0,0 +1,250 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/xen-tools-3.4.2-r5.ebuild,v 1.4 2011/10/25 18:40:28 alexxy Exp $
+
+EAPI="3"
+
+inherit base flag-o-matic eutils multilib python toolchain-funcs
+
+# TPMEMUFILE=tpm_emulator-0.4.tar.gz
+
+DESCRIPTION="Xend daemon and tools"
+HOMEPAGE="http://xen.org/"
+SRC_URI="http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz"
+#	vtpm? ( mirror://berlios/tpm-emulator/${TPMEMUFILE} )"
+S="${WORKDIR}/xen-${PV}"
+QA_PRESTRIPPED="/usr/share/xen/qemu/openbios-ppc \
+	/usr/share/xen/qemu/openbios-sparc64 \
+	/usr/share/xen/qemu/openbios-sparc32"
+QA_WX_LOAD="${QA_PRESTRIPPED}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc debug screen custom-cflags pygrub hvm api acm flask"
+
+CDEPEND="dev-lang/python[ncurses,threads]
+	sys-libs/zlib
+	hvm? ( media-libs/libsdl )
+	acm? ( dev-libs/libxml2 )
+	api? ( dev-libs/libxml2 net-misc/curl )"
+#	vtpm? ( dev-libs/gmp dev-libs/openssl )
+
+DEPEND="${CDEPEND}
+	sys-devel/gettext
+	sys-devel/gcc
+	dev-lang/perl
+	dev-lang/python[ssl]
+	app-misc/pax-utils
+	doc? (
+		app-doc/doxygen
+		dev-tex/latex2html[png,gif]
+		media-gfx/transfig
+		media-gfx/graphviz
+		virtual/latex-base
+		dev-tex/latexmk
+		dev-texlive/texlive-latex
+		dev-texlive/texlive-pictures
+		dev-texlive/texlive-latexextra
+		dev-texlive/texlive-latexrecommended
+	)
+	hvm? (
+		x11-proto/xproto
+		sys-devel/dev86
+	)"
+
+RDEPEND="${CDEPEND}
+	sys-apps/iproute2
+	net-misc/bridge-utils
+	dev-python/pyxml
+	screen? (
+		app-misc/screen
+		app-admin/logrotate
+	)
+	|| ( sys-fs/udev sys-apps/hotplug )"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.4.0-network-bridge-broadcast.patch"
+	"${FILESDIR}/${PN}-3.3.0-nostrip.patch"
+	"${FILESDIR}/${PN}-3.3.1-sandbox-fix.patch"
+	"${FILESDIR}/${P}-as-needed.patch"
+	"${FILESDIR}/${P}-fix-definitions.patch"
+	"${FILESDIR}/${P}-fix-include.patch"
+	"${FILESDIR}/${P}-werror-idiocy-v2.patch"
+	"${FILESDIR}/${P}-ldflags-respect.patch"
+)
+
+# hvmloader is used to bootstrap a fully virtualized kernel
+# Approved by QA team in bug #144032
+QA_WX_LOAD="usr/lib/xen/boot/hvmloader"
+QA_EXECSTACK="usr/share/xen/qemu/openbios-sparc32
+	usr/share/xen/qemu/openbios-sparc64"
+
+pkg_setup() {
+	if [ -x /.config/ ]; then
+		die "the system has a dir /.config; this needs to be removed to allow the package to emerge"
+	fi
+
+	export "CONFIG_LOMOUNT=y"
+
+	if ! use x86 && ! has x86 $(get_all_abis) && use hvm; then
+		eerror "HVM (VT-x and AMD-v) cannot be built on this system. An x86 or"
+		eerror "an amd64 multilib profile is required. Remove the hvm use flag"
+		eerror "to build xen-tools on your current profile."
+		die "USE=hvm is unsupported on this system."
+	fi
+
+	if [[ -z ${XEN_TARGET_ARCH} ]] ; then
+		if use x86 && use amd64; then
+			die "Confusion! Both x86 and amd64 are set in your use flags!"
+		elif use x86; then
+			export XEN_TARGET_ARCH="x86_32"
+		elif use amd64 ; then
+			export XEN_TARGET_ARCH="x86_64"
+		else
+			die "Unsupported architecture!"
+		fi
+	fi
+
+#	use vtpm    && export "VTPM_TOOLS=y"
+	use api     && export "LIBXENAPI_BINDINGS=y"
+	use acm     && export "ACM_SECURITY=y"
+	use flask   && export "FLASK_ENABLE=y"
+}
+
+src_prepare() {
+	base_src_prepare
+
+	#	use vtpm && cp "${DISTDIR}"/${TPMEMUFILE}  tools/vtpm
+
+	# if the user *really* wants to use their own custom-cflags, let them
+	# Try and remove all the default custom-cflags
+	if use custom-cflags; then
+		epatch "${FILESDIR}/${P}-remove-default-cflags.patch"
+	fi
+
+	# Disable hvm support on systems that don't support x86_32 binaries.
+	if ! use hvm; then
+		chmod 644 tools/check/check_x11_devel
+		sed -i -e '/^CONFIG_IOEMU := y$/d' "${S}"/config/*.mk
+		sed -i -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' "${S}"/tools/Makefile
+	fi
+
+	if ! use pygrub; then
+		sed -i -e '/^SUBDIRS-$(PYTHON_TOOLS) += pygrub$/d' "${S}"/tools/Makefile
+	fi
+}
+
+src_compile() {
+	export VARTEXFONTS="${T}/fonts"
+	local myopt
+	use debug && myopt="${myopt} debug=y"
+
+	use custom-cflags || unset CFLAGS
+	if test-flag-CC -fno-strict-overflow; then
+		append-flags -fno-strict-overflow
+	fi
+
+	emake CC=$(tc-getCC) LD=$(tc-getLD) -C tools ${myopt} || die "compile failed"
+
+	if use doc; then
+		sh ./docs/check_pkgs || die "package check failed"
+		emake docs || die "compiling docs failed"
+		emake dev-docs || die "make dev-docs failed"
+	fi
+
+	emake -C docs man-pages || die "make man-pages failed"
+}
+
+src_install() {
+	make DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" XEN_PYTHON_NATIVE_INSTALL=y install-tools  \
+		|| die "install failed"
+
+	# Remove RedHat-specific stuff
+	rm -rf "${D}"/etc/sysconfig
+
+	# Remove unneeded static-libs
+	rm "${D}"/usr/lib64/libxenctrl.a "${D}"/usr/lib64/libxenguest.a \
+	"${D}"/usr/lib64/libflask.a "${D}"/usr/lib64/libxenstore.a \
+	"${D}"/usr/lib64/libblktap.a "${D}"/usr/lib64/libxenapi.a
+
+	dodoc README docs/README.xen-bugtool docs/ChangeLog
+	if use doc; then
+		emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs \
+			|| die "install docs failed"
+
+		dohtml -r docs/api/
+		docinto pdf
+		dodoc docs/api/tools/python/latex/refman.pdf
+
+		[ -d "${D}"/usr/share/doc/xen ] && mv "${D}"/usr/share/doc/xen/* "${D}"/usr/share/doc/${PF}/html
+	fi
+	rm -rf "${D}"/usr/share/doc/xen/
+
+	doman docs/man?/*
+
+	newinitd "${FILESDIR}"/xend.initd-r1 xend \
+		|| die "Couldn't install xen.initd"
+	newconfd "${FILESDIR}"/xendomains.confd xendomains \
+		|| die "Couldn't install xendomains.confd"
+	newinitd "${FILESDIR}"/xendomains.initd-r1 xendomains \
+		|| die "Couldn't install xendomains.initd"
+
+	if use screen; then
+		cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains
+		cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/
+		keepdir /var/log/xen-consoles
+	fi
+
+	# xend expects these to exist
+	keepdir /var/run/xenstored /var/lib/xenstored /var/xen/dump /var/lib/xen /var/log/xen
+
+	# for xendomains
+	keepdir /etc/xen/auto
+}
+
+pkg_postinst() {
+	elog "Official Xen Guide and the unoffical wiki page:"
+	elog " http://www.gentoo.org/doc/en/xen-guide.xml"
+	elog " http://en.gentoo-wiki.com/wiki/Xen/"
+
+	if [[ "$(scanelf -s __guard -q $(type -P python))" ]] ; then
+		echo
+		ewarn "xend may not work when python is built with stack smashing protection (ssp)."
+		ewarn "If 'xm create' fails with '<ProtocolError for /RPC2: -1 >', see bug #141866"
+		ewarn "This probablem may be resolved as of Xen 3.0.4, if not post in the bug."
+	fi
+
+	if ! has_version "dev-lang/python[ncurses]"; then
+		echo
+		ewarn "NB: Your dev-lang/python is built without USE=ncurses."
+		ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
+	fi
+
+	if has_version "sys-apps/iproute2[minimal]"; then
+		echo
+		ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking"
+		ewarn "will not work until you rebuild iproute2 without USE=minimal."
+	fi
+
+	if ! use hvm; then
+		echo
+		elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
+		elog "support enable the hvm use flag."
+		elog "An x86 or amd64 multilib system is required to build HVM support."
+		echo
+		elog "The ioemu use flag has been removed and replaced with hvm."
+	fi
+
+	if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
+		echo
+		elog "xensv is broken upstream (Gentoo bug #142011)."
+		elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
+	fi
+
+	python_mod_optimize $(use pygrub && echo grub) xen
+}
+
+pkg_postrm() {
+	python_mod_cleanup $(use pygrub && echo grub) xen
+}

diff --git a/app-emulation/xen-tools/xen-tools-4.1.2-r1.ebuild b/app-emulation/xen-tools/xen-tools-4.1.2-r1.ebuild
new file mode 100644
index 0000000..e27e24d
--- /dev/null
+++ b/app-emulation/xen-tools/xen-tools-4.1.2-r1.ebuild
@@ -0,0 +1,344 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/xen-tools-4.1.2-r1.ebuild,v 1.1 2011/11/11 17:50:59 neurogeek Exp $
+
+EAPI="4"
+
+PYTHON_DEPEND="2"
+PYTHON_USE_WITH="xml"
+
+if [[ $PV == *9999 ]]; then
+	KEYWORDS=""
+	REPO="xen-unstable.hg"
+	EHG_REPO_URI="http://xenbits.xensource.com/${REPO}"
+	S="${WORKDIR}/${REPO}"
+	live_eclass="mercurial"
+else
+	KEYWORDS="~amd64 ~x86"
+	XEN_EXTFILES_URL="http://xenbits.xensource.com/xen-extfiles"
+	SRC_URI="http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz \
+	$XEN_EXTFILES_URL/ipxe-git-v1.0.0.tar.gz"
+	S="${WORKDIR}/xen-${PV}"
+fi
+
+inherit flag-o-matic eutils multilib python toolchain-funcs ${live_eclass}
+
+DESCRIPTION="Xend daemon and tools"
+HOMEPAGE="http://xen.org/"
+DOCS=( README docs/README.xen-bugtool docs/ChangeLog )
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="api custom-cflags debug doc flask hvm qemu pygrub screen xend"
+QA_PRESTRIPPED="/usr/share/xen/qemu/openbios-ppc \
+	/usr/share/xen/qemu/openbios-sparc64 \
+	/usr/share/xen/qemu/openbios-sparc32"
+QA_WX_LOAD=${QA_PRESTRIPPED}
+
+CDEPEND="<dev-libs/yajl-2
+	dev-python/lxml
+	dev-python/pypam
+	dev-python/pyxml
+	sys-libs/zlib
+	hvm? ( media-libs/libsdl
+		sys-power/iasl )
+	api? ( dev-libs/libxml2 net-misc/curl )"
+
+DEPEND="${CDEPEND}
+	sys-devel/gcc
+	dev-lang/perl
+	app-misc/pax-utils
+	dev-ml/findlib
+	doc? (
+		app-doc/doxygen
+		dev-tex/latex2html
+		media-gfx/transfig
+		media-gfx/graphviz
+		dev-tex/xcolor
+		dev-texlive/texlive-latexextra
+		virtual/latex-base
+		dev-tex/latexmk
+		dev-texlive/texlive-latex
+		dev-texlive/texlive-pictures
+		dev-texlive/texlive-latexrecommended
+	)
+	hvm? (
+		x11-proto/xproto
+		sys-devel/dev86
+	)"
+
+RDEPEND="${CDEPEND}
+	sys-apps/iproute2
+	net-misc/bridge-utils
+	>=dev-lang/ocaml-3.12.0
+	screen? (
+		app-misc/screen
+		app-admin/logrotate
+	)
+	|| ( sys-fs/udev sys-apps/hotplug )"
+
+# hvmloader is used to bootstrap a fully virtualized kernel
+# Approved by QA team in bug #144032
+QA_WX_LOAD="usr/lib/xen/boot/hvmloader"
+QA_EXECSTACK="usr/share/xen/qemu/openbios-sparc32
+	usr/share/xen/qemu/openbios-sparc64"
+RESTRICT="test"
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	export "CONFIG_LOMOUNT=y"
+
+	if use qemu; then
+		export "CONFIG_IOEMU=y"
+	else
+		export "CONFIG_IOEMU=n"
+	fi
+
+	if ! use x86 && ! has x86 $(get_all_abis) && use hvm; then
+		eerror "HVM (VT-x and AMD-v) cannot be built on this system. An x86 or"
+		eerror "an amd64 multilib profile is required. Remove the hvm use flag"
+		eerror "to build xen-tools on your current profile."
+		die "USE=hvm is unsupported on this system."
+	fi
+
+	if [[ -z ${XEN_TARGET_ARCH} ]] ; then
+		if use x86 && use amd64; then
+			die "Confusion! Both x86 and amd64 are set in your use flags!"
+		elif use x86; then
+			export XEN_TARGET_ARCH="x86_32"
+		elif use amd64 ; then
+			export XEN_TARGET_ARCH="x86_64"
+		else
+			die "Unsupported architecture!"
+		fi
+	fi
+
+	if use doc && ! has_version "dev-tex/latex2html[png,gif]"; then
+		# die early instead of later
+		eerror "USE=doc requires latex2html with image support. Please add"
+		eerror "'png' and/or 'gif' to your use flags and re-emerge latex2html"
+		die "latex2html missing both png and gif flags"
+	fi
+
+	if use pygrub && ! has_version "dev-lang/python[ncurses]"; then
+		eerror "USE=pygrub requires python to be built with ncurses support. Please add"
+		eerror "'ncurses' to your use flags and re-emerge python"
+		die "python is missing ncurses flags"
+	fi
+
+	if ! has_version "dev-lang/python[threads]"; then
+		eerror "Python is required to be built with threading support. Please add"
+		eerror "'threads' to your use flags and re-emerge python"
+		die "python is missing threads flags"
+	fi
+
+	use api     && export "LIBXENAPI_BINDINGS=y"
+	use flask   && export "FLASK_ENABLE=y"
+
+	if use hvm && ! use qemu; then
+		elog "With qemu disabled, it is not possible to use HVM machines " \
+			"or PVM machines with a framebuffer attached in the kernel config" \
+			"The addition of use flag qemu is required when use flag hvm ise selected"
+	fi
+}
+
+src_prepare() {
+	cp "$DISTDIR/ipxe-git-v1.0.0.tar.gz" tools/firmware/etherboot/ipxe.tar.gz
+	sed -e 's/-Wall//' -i Config.mk || die "Couldn't sanitize CFLAGS"
+
+	# Drop .config
+	sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
+	# Xend
+	if ! use xend; then
+		sed -e 's:xm xen-bugtool xen-python-path xend:xen-bugtool xen-python-path:' \
+			-i tools/misc/Makefile || die "Disabling xend failed" || die
+		sed -e 's:^XEND_INITD:#XEND_INITD:' \
+			-i tools/examples/Makefile || "Disabling xend failed" || die
+	fi
+	# if the user *really* wants to use their own custom-cflags, let them
+	if use custom-cflags; then
+		einfo "User wants their own CFLAGS - removing defaults"
+	# try and remove all the default custom-cflags
+	find "${S}" -name Makefile -o -name Rules.mk -o -name Config.mk -exec sed \
+		-e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
+		-e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
+		-e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
+		-e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
+		-e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
+		-i {} \; || die "failed to re-set custom-cflags"
+	fi
+
+	if ! use pygrub; then
+		sed -e '/^SUBDIRS-$(PYTHON_TOOLS) += pygrub$/d' -i tools/Makefile || die
+	fi
+
+	# Disable hvm support on systems that don't support x86_32 binaries.
+	if ! use hvm; then
+		chmod 644 tools/check/check_x11_devel
+		sed -e '/^CONFIG_IOEMU := y$/d' -i config/*.mk || die
+		sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
+	fi
+
+	# Don't bother with qemu, only needed for fully virtualised guests
+	if ! use qemu; then
+		sed -e "/^CONFIG_IOEMU := y$/d" -i config/*.mk || die
+		sed -e "s:install-tools\: tools/ioemu-dir:install-tools\: :g" -i Makefile || die
+	fi
+
+	# Fix build for gcc-4.6
+	sed -e "s:-Werror::g" -i  tools/xenstat/xentop/Makefile || die
+
+	# Fix network broadcast on bridged networks
+	epatch "${FILESDIR}/${PN}-3.4.0-network-bridge-broadcast.patch"
+
+	# Do not strip binaries
+	epatch "${FILESDIR}/${PN}-3.3.0-nostrip.patch"
+
+	# Prevent the downloading of ipxe
+	sed -e 's:^\tif ! wget -O _$T:#\tif ! wget -O _$T:' \
+		-e 's:^\tfi:#\tfi:' -i \
+		-e 's:^\tmv _$T $T:#\tmv _$T $T:' \
+		-i tools/firmware/etherboot/Makefile || die
+
+	# Fix bridge by idella4, bug #362575
+	epatch "${FILESDIR}/${PN}-4.1.1-bridge.patch"
+
+	# Remove check_curl, new fix to Bug #386487
+	epatch "${FILESDIR}/xen-tools-4.1.1-curl.patch"
+	sed -i -e 's|has_or_fail curl-config|has_or_fail curl-config\nset -ux|' \
+		tools/check/check_curl || die
+
+	# Don't build ipxe with pie on hardened, Bug #360805
+	if gcc-specs-pie; then
+		epatch "${FILESDIR}/ipxe-nopie.patch"
+	fi
+
+	# Fix create.py for pyxml Bug 367735
+	epatch "${FILESDIR}/xen-tools-4.1.2-pyxml.patch"
+}
+
+src_compile() {
+	export VARTEXFONTS="${T}/fonts"
+	local myopt
+	use debug && myopt="${myopt} debug=y"
+
+	use custom-cflags || unset CFLAGS
+	if test-flag-CC -fno-strict-overflow; then
+		append-flags -fno-strict-overflow
+	fi
+
+	unset LDFLAGS
+	emake CC=$(tc-getCC) LD=$(tc-getLD) -C tools ${myopt}
+
+	if use doc; then
+		sh ./docs/check_pkgs || die "package check failed"
+		emake docs
+		emake dev-docs
+	fi
+
+	emake -C docs man-pages
+}
+
+src_install() {
+	# Override auto-detection in the build system, bug #382573
+	export INITD_DIR=/etc/init.d
+	export CONFIG_LEAF_DIR=default
+
+	emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" XEN_PYTHON_NATIVE_INSTALL=y install-tools
+	python_convert_shebangs -r 2 "${ED}"
+
+	# Remove RedHat-specific stuff
+	rm -rf "${ED}"/etc/init.d/xen* "${ED}"/etc/default || die
+
+	# uncomment lines in xl.conf
+	sed -e 's:^#autoballoon=1:autoballoon=1:' \
+		-e 's:^#lockfile="/var/lock/xl":lockfile="/var/lock/xl":' \
+		-e 's:^#vifscript="vif-bridge":vifscript="vif-bridge":' \
+		-i tools/examples/xl.conf  || die
+
+	dodoc README docs/README.xen-bugtool docs/ChangeLog
+	if use doc; then
+		emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" install-docs
+
+	dohtml -r docs/api/
+		docinto pdf
+		dodoc ${DOCS[@]}
+	#docs/api/tools/python/latex/refman.pdf
+		[ -d "${ED}"/usr/share/doc/xen ] && mv "${ED}"/usr/share/doc/xen/* "${ED}"/usr/share/doc/${PF}/html
+	fi
+	rm -rf "${ED}"/usr/share/doc/xen/
+	doman docs/man?/*
+
+	if use xend; then
+		newinitd "${FILESDIR}"/xend.initd-r2 xend || die "Couldn't install xen.initd"
+	fi
+	newconfd "${FILESDIR}"/xendomains.confd xendomains
+	newconfd "${FILESDIR}"/xenstored.confd xenstored
+	newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
+	newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
+	newinitd "${FILESDIR}"/xenstored.initd xenstored \
+		"${FILESDIR}"/xenconsoled.initd xenconsoled
+
+	if use screen; then
+		cat "${FILESDIR}"/xendomains-screen.confd >> "${ED}"/etc/conf.d/xendomains || die
+		cp "${FILESDIR}"/xen-consoles.logrotate "${ED}"/etc/xen/ || die
+		keepdir /var/log/xen-consoles
+	fi
+
+	# xend expects these to exist
+	keepdir /var/run/xenstored /var/lib/xenstored /var/xen/dump /var/lib/xen /var/log/xen
+
+	# for xendomains
+	keepdir /etc/xen/auto
+}
+
+pkg_postinst() {
+	elog "Official Xen Guide and the unoffical wiki page:"
+	elog " http://www.gentoo.org/doc/en/xen-guide.xml"
+	elog " http://gentoo-wiki.com/HOWTO_Xen_and_Gentoo"
+
+	if [[ "$(scanelf -s __guard -q $(type -P python))" ]] ; then
+		echo
+		ewarn "xend may not work when python is built with stack smashing protection (ssp)."
+		ewarn "If 'xm create' fails with '<ProtocolError for /RPC2: -1 >', see bug #141866"
+		ewarn "This probablem may be resolved as of Xen 3.0.4, if not post in the bug."
+	fi
+
+	if ! has_version "dev-lang/python[ncurses]"; then
+		echo
+		ewarn "NB: Your dev-lang/python is built without USE=ncurses."
+		ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
+	fi
+
+	if has_version "sys-apps/iproute2[minimal]"; then
+		echo
+		ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking"
+		ewarn "will not work until you rebuild iproute2 without USE=minimal."
+	fi
+
+	if ! use hvm; then
+		echo
+		elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
+		elog "support enable the hvm use flag."
+		elog "An x86 or amd64 multilib system is required to build HVM support."
+		echo
+		elog "The qemu use flag has been removed and replaced with hvm."
+	fi
+
+	if use xend; then
+		echo
+		elog "xend capability has been enabled and installed"
+	fi
+
+	if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
+		echo
+		elog "xensv is broken upstream (Gentoo bug #142011)."
+		elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
+	fi
+	python_mod_optimize $(use pygrub && echo grub) xen
+}
+
+pkg_postrm() {
+	python_mod_cleanup $(use pygrub && echo grub) xen
+}

diff --git a/app-emulation/xen-tools/xen-tools-9999.ebuild b/app-emulation/xen-tools/xen-tools-9999.ebuild
new file mode 100644
index 0000000..d9b8b0a
--- /dev/null
+++ b/app-emulation/xen-tools/xen-tools-9999.ebuild
@@ -0,0 +1,319 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/xen-tools-9999.ebuild,v 1.7 2011/10/23 10:49:29 patrick Exp $
+
+EAPI="4"
+
+PYTHON_DEPEND="2"
+PYTHON_USE_WITH="xml"
+
+if [[ $PV == *9999 ]]; then
+	KEYWORDS=""
+	REPO="xen-unstable.hg"
+	EHG_REPO_URI="http://xenbits.xensource.com/${REPO}"
+	S="${WORKDIR}/${REPO}"
+	live_eclass="mercurial"
+else
+	KEYWORDS="~amd64 ~x86"
+	XEN_EXTFILES_URL="http://xenbits.xensource.com/xen-extfiles"
+	SRC_URI="http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz \
+	$XEN_EXTFILES_URL/ipxe-git-v1.0.0.tar.gz"
+	S="${WORKDIR}/xen-${PV}"
+fi
+
+inherit flag-o-matic eutils multilib python toolchain-funcs ${live_eclass}
+
+DESCRIPTION="Xend daemon and tools"
+HOMEPAGE="http://xen.org/"
+DOCS=( README docs/README.xen-bugtool docs/ChangeLog )
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="api custom-cflags debug doc flask hvm qemu pygrub screen xend"
+
+CDEPEND="<dev-libs/yajl-2
+	dev-python/lxml
+	dev-python/pypam
+	dev-python/pyxml
+	sys-libs/zlib
+	hvm? ( media-libs/libsdl
+		sys-power/iasl )
+	api? ( dev-libs/libxml2 net-misc/curl )"
+
+DEPEND="${CDEPEND}
+	sys-devel/gcc
+	dev-lang/perl
+	app-misc/pax-utils
+	dev-ml/findlib
+	doc? (
+		app-doc/doxygen
+		dev-tex/latex2html
+		media-gfx/transfig
+		media-gfx/graphviz
+		dev-tex/xcolor
+		dev-texlive/texlive-latexextra
+		virtual/latex-base
+		dev-tex/latexmk
+		dev-texlive/texlive-latex
+		dev-texlive/texlive-pictures
+		dev-texlive/texlive-latexrecommended
+	)
+	hvm? (
+		x11-proto/xproto
+		sys-devel/dev86
+	)"
+
+RDEPEND="${CDEPEND}
+	sys-apps/iproute2
+	net-misc/bridge-utils
+	>=dev-lang/ocaml-3.12.0
+	screen? (
+		app-misc/screen
+		app-admin/logrotate
+	)
+	|| ( sys-fs/udev sys-apps/hotplug )"
+
+# hvmloader is used to bootstrap a fully virtualized kernel
+# Approved by QA team in bug #144032
+QA_WX_LOAD="usr/lib/xen/boot/hvmloader"
+QA_EXECSTACK="usr/share/xen/qemu/openbios-sparc32
+	usr/share/xen/qemu/openbios-sparc64"
+RESTRICT="test"
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	export "CONFIG_LOMOUNT=y"
+
+	if use qemu; then
+		export "CONFIG_IOEMU=y"
+	else
+		export "CONFIG_IOEMU=n"
+	fi
+
+	if ! use x86 && ! has x86 $(get_all_abis) && use hvm; then
+		eerror "HVM (VT-x and AMD-v) cannot be built on this system. An x86 or"
+		eerror "an amd64 multilib profile is required. Remove the hvm use flag"
+		eerror "to build xen-tools on your current profile."
+		die "USE=hvm is unsupported on this system."
+	fi
+
+	if [[ -z ${XEN_TARGET_ARCH} ]] ; then
+		if use x86 && use amd64; then
+			die "Confusion! Both x86 and amd64 are set in your use flags!"
+		elif use x86; then
+			export XEN_TARGET_ARCH="x86_32"
+		elif use amd64 ; then
+			export XEN_TARGET_ARCH="x86_64"
+		else
+			die "Unsupported architecture!"
+		fi
+	fi
+
+	if use doc && ! has_version "dev-tex/latex2html[png,gif]"; then
+		# die early instead of later
+		eerror "USE=doc requires latex2html with image support. Please add"
+		eerror "'png' and/or 'gif' to your use flags and re-emerge latex2html"
+		die "latex2html missing both png and gif flags"
+	fi
+
+	if use pygrub && ! has_version "dev-lang/python[ncurses]"; then
+		eerror "USE=pygrub requires python to be built with ncurses support. Please add"
+		eerror "'ncurses' to your use flags and re-emerge python"
+		die "python is missing ncurses flags"
+	fi
+
+	if ! has_version "dev-lang/python[threads]"; then
+		eerror "Python is required to be built with threading support. Please add"
+		eerror "'threads' to your use flags and re-emerge python"
+		die "python is missing threads flags"
+	fi
+
+	use api     && export "LIBXENAPI_BINDINGS=y"
+	use flask   && export "FLASK_ENABLE=y"
+
+	if use hvm && ! use qemu; then
+		elog "With qemu disabled, it is not possible to use HVM machines " \
+			"or PVM machines with a framebuffer attached in the kernel config" \
+			"The addition of use flag qemu is required when use flag hvm ise selected"
+	fi
+}
+
+src_prepare() {
+	cp "$DISTDIR/ipxe-git-v1.0.0.tar.gz" tools/firmware/etherboot/ipxe.tar.gz
+	sed -e 's/-Wall//' -i Config.mk || die "Couldn't sanitize CFLAGS"
+
+	# Drop .config
+	sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
+	# Xend
+	if ! use xend; then
+		sed -e 's:xm xen-bugtool xen-python-path xend:xen-bugtool xen-python-path:' \
+			-i tools/misc/Makefile || die "Disabling xend failed" || die
+		sed -e 's:^XEND_INITD:#XEND_INITD:' \
+			-i tools/examples/Makefile || "Disabling xend failed" || die
+	fi
+	# if the user *really* wants to use their own custom-cflags, let them
+	if use custom-cflags; then
+		einfo "User wants their own CFLAGS - removing defaults"
+	# try and remove all the default custom-cflags
+	find "${S}" -name Makefile -o -name Rules.mk -o -name Config.mk -exec sed \
+		-e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
+		-e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
+		-e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
+		-e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
+		-e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
+		-i {} \; || die "failed to re-set custom-cflags"
+	fi
+
+	if ! use pygrub; then
+		sed -e '/^SUBDIRS-$(PYTHON_TOOLS) += pygrub$/d' -i tools/Makefile || die
+	fi
+
+	# Disable hvm support on systems that don't support x86_32 binaries.
+	if ! use hvm; then
+		chmod 644 tools/check/check_x11_devel
+		sed -e '/^CONFIG_IOEMU := y$/d' -i config/*.mk || die
+		sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
+	fi
+
+	# Don't bother with qemu, only needed for fully virtualised guests
+	if ! use qemu; then
+		sed -e "/^CONFIG_IOEMU := y$/d" -i config/*.mk || die
+		sed -e "s:install-tools\: tools/ioemu-dir:install-tools\: :g"  -i Makefile || die
+	fi
+
+	# Fix build for gcc-4.6
+	sed -e "s:-Werror::g" -i  tools/xenstat/xentop/Makefile || die
+
+	# Prevent the downloading of ipxe
+	sed -e 's:^\tif ! wget -O _$T:#\tif ! wget -O _$T:' \
+		-e 's:^\tfi:#\tfi:' -i \
+		-e 's:^\tmv _$T $T:#\tmv _$T $T:' \
+		-i tools/firmware/etherboot/Makefile || die
+}
+
+src_compile() {
+	export VARTEXFONTS="${T}/fonts"
+	local myopt
+	use debug && myopt="${myopt} debug=y"
+
+	use custom-cflags || unset CFLAGS
+	if test-flag-CC -fno-strict-overflow; then
+		append-flags -fno-strict-overflow
+	fi
+
+	unset LDFLAGS
+	emake CC=$(tc-getCC) LD=$(tc-getLD) -C tools ${myopt}
+
+	if use doc; then
+		sh ./docs/check_pkgs || die "package check failed"
+		emake docs
+		emake dev-docs
+	fi
+
+	emake -C docs man-pages
+}
+
+src_install() {
+	# Override auto-detection in the build system, bug #382573
+	export INITD_DIR=/etc/init.d
+	export CONFIG_LEAF_DIR=default
+
+	emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" XEN_PYTHON_NATIVE_INSTALL=y install-tools
+	python_convert_shebangs -r 2 "${ED}"
+
+	# Remove RedHat-specific stuff
+	rm -rf "${ED}"/etc/init.d/xen* "${ED}"/etc/default || die
+
+	# uncomment lines in xl.conf
+	sed -e 's:^#autoballoon=1:autoballoon=1:' \
+		-e 's:^#lockfile="/var/lock/xl":lockfile="/var/lock/xl":' \
+		-e 's:^#vifscript="vif-bridge":vifscript="vif-bridge":' \
+		-i tools/examples/xl.conf  || die
+
+	dodoc README docs/README.xen-bugtool docs/ChangeLog
+	if use doc; then
+		emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" install-docs \
+			|| die "install docs failed"
+
+		dohtml -r docs/api/
+		docinto pdf
+		dodoc ${DOCS[@]}
+#docs/api/tools/python/latex/refman.pdf
+		[ -d "${ED}"/usr/share/doc/xen ] && mv "${ED}"/usr/share/doc/xen/* "${ED}"/usr/share/doc/${PF}/html
+	fi
+	rm -rf "${ED}"/usr/share/doc/xen/
+	doman docs/man?/*
+
+	if use xend; then
+		newinitd "${FILESDIR}"/xend.initd-r2 xend || die "Couldn't install xen.initd"
+	fi
+
+	newconfd "${FILESDIR}"/xendomains.confd xendomains
+	newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
+	newconfd "${FILESDIR}"/xenstored.confd xenstored
+	newinitd "${FILESDIR}"/xenstored.initd xenstored
+	newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
+
+	if use screen; then
+		cat "${FILESDIR}"/xendomains-screen.confd >> "${ED}"/etc/conf.d/xendomains || die
+		cp "${FILESDIR}"/xen-consoles.logrotate "${ED}"/etc/xen/ || die
+		keepdir /var/log/xen-consoles
+	fi
+
+	# xend expects these to exist
+	keepdir /var/run/xenstored /var/lib/xenstored /var/xen/dump /var/lib/xen /var/log/xen
+
+	# for xendomains
+	keepdir /etc/xen/auto
+}
+
+pkg_postinst() {
+	elog "Official Xen Guide and the unoffical wiki page:"
+	elog " http://www.gentoo.org/doc/en/xen-guide.xml"
+	elog " http://gentoo-wiki.com/HOWTO_Xen_and_Gentoo"
+
+	if [[ "$(scanelf -s __guard -q $(type -P python))" ]] ; then
+		echo
+		ewarn "xend may not work when python is built with stack smashing protection (ssp)."
+		ewarn "If 'xm create' fails with '<ProtocolError for /RPC2: -1 >', see bug #141866"
+		ewarn "This probablem may be resolved as of Xen 3.0.4, if not post in the bug."
+	fi
+
+	if ! has_version "dev-lang/python[ncurses]"; then
+		echo
+		ewarn "NB: Your dev-lang/python is built without USE=ncurses."
+		ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
+	fi
+
+	if has_version "sys-apps/iproute2[minimal]"; then
+		echo
+		ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking"
+		ewarn "will not work until you rebuild iproute2 without USE=minimal."
+	fi
+
+	if ! use hvm; then
+		echo
+		elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
+		elog "support enable the hvm use flag."
+		elog "An x86 or amd64 multilib system is required to build HVM support."
+		echo
+		elog "The qemu use flag has been removed and replaced with hvm."
+	fi
+
+	if use xend; then
+		echo
+		elog "xend capability has been enabled and installed"
+	fi
+
+	if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
+		echo
+		elog "xensv is broken upstream (Gentoo bug #142011)."
+		elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
+	fi
+	python_mod_optimize $(use pygrub && echo grub) xen
+}
+
+pkg_postrm() {
+	python_mod_cleanup $(use pygrub && echo grub) xen
+}
\ No newline at end of file



             reply	other threads:[~2011-11-20 19:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-20 19:57 Ian Delaney [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-11-28 15:41 [gentoo-commits] proj/virtualization:master commit in: app-emulation/xen-tools/files/, app-emulation/xen-tools/ Alexey Shvetsov
2011-11-28 18:29 Alexey Shvetsov
2012-11-21 12:48 Ian Delaney
2013-02-12 13:22 Ian Delaney
2014-02-28  9:35 Lan Yixun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=271eb7f83e63aca3efc009a074b9077e2d327c3d.ian_delaney@gentoo \
    --to=della5@iinet.com.au \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox