From 73be7f9ef4b22e6250b77dda2d1a72245f6ce36d Mon Sep 17 00:00:00 2001
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Date: Fri, 6 Apr 2007 16:36:48 +0000
Subject: [PATCH] - make sure to download fakeroot if needed

---
 Makefile                     | 2 +-
 package/fakeroot/Config.in   | 5 +++++
 package/fakeroot/fakeroot.mk | 4 ++++
 target/cpio/Config.in        | 9 +++++----
 target/cramfs/Config.in      | 1 +
 target/ext2/Config.in        | 1 +
 target/iso9660/Config.in     | 1 +
 target/jffs2/Config.in       | 1 +
 target/squashfs/Config.in    | 1 +
 target/tar/Config.in         | 1 +
 10 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 6cb05d30c8..5a30f26cdf 100644
--- a/Makefile
+++ b/Makefile
@@ -119,7 +119,7 @@ $(TARGET_DIR):
 	-find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
 	-find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
 
-source: $(TARGETS_SOURCE)
+source: $(TARGETS_SOURCE) $(HOST_SOURCE)
 
 #############################################################
 #
diff --git a/package/fakeroot/Config.in b/package/fakeroot/Config.in
index f9aa1ebf85..caab206df0 100644
--- a/package/fakeroot/Config.in
+++ b/package/fakeroot/Config.in
@@ -5,3 +5,8 @@ config BR2_PACKAGE_FAKEROOT
 	  Run commands in an environment faking root privileges.
 
 	  http://joostje.op.het.net/fakeroot/
+
+# dummy for fakeroot-source
+config BR2_HOST_FAKEROUTE
+	bool
+	default n
diff --git a/package/fakeroot/fakeroot.mk b/package/fakeroot/fakeroot.mk
index 9a55fd1fc3..18f577e4a7 100644
--- a/package/fakeroot/fakeroot.mk
+++ b/package/fakeroot/fakeroot.mk
@@ -122,3 +122,7 @@ fakeroot-dirclean:
 ifeq ($(strip $(BR2_PACKAGE_FAKEROOT)),y)
 TARGETS+=fakeroot
 endif
+
+ifeq ($(strip $(BR2_HOST_FAKEROUTE)),y)
+HOST_SOURCE+=fakeroot-source
+endif
diff --git a/target/cpio/Config.in b/target/cpio/Config.in
index 0de70f964a..7f1af40776 100644
--- a/target/cpio/Config.in
+++ b/target/cpio/Config.in
@@ -1,6 +1,7 @@
 config BR2_TARGET_ROOTFS_CPIO
-       bool "cpio the root filesystem"
-       default n
-       help
-         Build a cpio archive of the root filesystem
+	bool "cpio the root filesystem"
+	default n
+	select BR2_HOST_FAKEROUTE
+	help
+	  Build a cpio archive of the root filesystem
 
diff --git a/target/cramfs/Config.in b/target/cramfs/Config.in
index 917e99d118..d7c1dea683 100644
--- a/target/cramfs/Config.in
+++ b/target/cramfs/Config.in
@@ -1,6 +1,7 @@
 config BR2_TARGET_ROOTFS_CRAMFS
 	bool "cramfs root filesystem"
 	default n
+	select BR2_HOST_FAKEROUTE
 	help
 	  Build a cramfs root filesystem
 
diff --git a/target/ext2/Config.in b/target/ext2/Config.in
index b84ead3cd2..70589974a8 100644
--- a/target/ext2/Config.in
+++ b/target/ext2/Config.in
@@ -1,6 +1,7 @@
 config BR2_TARGET_ROOTFS_EXT2
 	bool "ext2 root filesystem"
 	default y
+	select BR2_HOST_FAKEROUTE
 	help
 	  Build an ext2 root filesystem
 
diff --git a/target/iso9660/Config.in b/target/iso9660/Config.in
index ecfcd39627..7b3575111b 100644
--- a/target/iso9660/Config.in
+++ b/target/iso9660/Config.in
@@ -4,6 +4,7 @@ config BR2_TARGET_ROOTFS_ISO9660
 	depends on BR2_i386
 	select BR2_TARGET_ROOTFS_EXT2
 	select BR2_TARGET_GRUB
+	select BR2_HOST_FAKEROUTE
 	help
 	  Build a bootable iso9660 image
 
diff --git a/target/jffs2/Config.in b/target/jffs2/Config.in
index c7c8e9f0cf..2d4e7a4552 100644
--- a/target/jffs2/Config.in
+++ b/target/jffs2/Config.in
@@ -1,6 +1,7 @@
 config BR2_TARGET_ROOTFS_JFFS2
 	bool "jffs2 root filesystem"
 	default n
+	select BR2_HOST_FAKEROUTE
 	select BR2_PACKAGE_MTD
 	help
 	  Build a jffs2 root filesystem
diff --git a/target/squashfs/Config.in b/target/squashfs/Config.in
index 733eea825e..34b16ad63f 100644
--- a/target/squashfs/Config.in
+++ b/target/squashfs/Config.in
@@ -1,6 +1,7 @@
 config BR2_TARGET_ROOTFS_SQUASHFS
 	bool "squashfs root filesystem"
 	default n
+	select BR2_HOST_FAKEROUTE
 	help
 	  Build a squashfs root filesystem
 
diff --git a/target/tar/Config.in b/target/tar/Config.in
index 9a0b80560c..142ac878dd 100644
--- a/target/tar/Config.in
+++ b/target/tar/Config.in
@@ -1,6 +1,7 @@
 config BR2_TARGET_ROOTFS_TAR
 	bool "tar the root filesystem"
 	default n
+	select BR2_HOST_FAKEROUTE
 	help
 	  Build a tar archive of the root filesystem