summaryrefslogtreecommitdiff
path: root/package/fakeroot/fakeroot.mk
blob: 5b22ee94cd5eec523d5c4a5fcfb1d8ef1a85735b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#############################################################
#
# fakeroot
#
#############################################################
FAKEROOT_VERSION:=1.5.8
FAKEROOT_SOURCE:=fakeroot_$(FAKEROOT_VERSION).tar.gz
FAKEROOT_SITE:=http://ftp.debian.org/debian/pool/main/f/fakeroot
FAKEROOT_CAT:=$(ZCAT)
FAKEROOT_DIR1:=$(TOOL_BUILD_DIR)/fakeroot-$(FAKEROOT_VERSION)
FAKEROOT_DIR2:=$(BUILD_DIR)/fakeroot-$(FAKEROOT_VERSION)


$(DL_DIR)/$(FAKEROOT_SOURCE):
	 $(WGET) -P $(DL_DIR) $(FAKEROOT_SITE)/$(FAKEROOT_SOURCE)

fakeroot-source: $(DL_DIR)/$(FAKEROOT_SOURCE)


#############################################################
#
# build fakeroot for use on the host system
#
#############################################################
$(FAKEROOT_DIR1)/.unpacked: $(DL_DIR)/$(FAKEROOT_SOURCE)
	$(FAKEROOT_CAT) $(DL_DIR)/$(FAKEROOT_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
	$(SED) "s,getopt --version,getopt --version 2>/dev/null," \
		$(FAKEROOT_DIR1)/scripts/fakeroot.in
	toolchain/patch-kernel.sh $(FAKEROOT_DIR1) package/fakeroot/ \*.patch
	touch $(FAKEROOT_DIR1)/.unpacked

$(FAKEROOT_DIR1)/.configured: $(FAKEROOT_DIR1)/.unpacked
	(cd $(FAKEROOT_DIR1); rm -rf config.cache; \
		CC="$(HOSTCC)" \
		./configure \
		--prefix=/usr \
		$(DISABLE_NLS) \
	);
	touch $(FAKEROOT_DIR1)/.configured

$(FAKEROOT_DIR1)/faked: $(FAKEROOT_DIR1)/.configured
	$(MAKE) -C $(FAKEROOT_DIR1)

$(STAGING_DIR)/usr/bin/fakeroot: $(FAKEROOT_DIR1)/faked
	$(MAKE) DESTDIR=$(STAGING_DIR) -C $(FAKEROOT_DIR1) install
	$(SED) 's,^PREFIX=.*,PREFIX=$(STAGING_DIR)/usr,g' $(STAGING_DIR)/usr/bin/fakeroot
	$(SED) 's,^BINDIR=.*,BINDIR=$(STAGING_DIR)/usr/bin,g' $(STAGING_DIR)/usr/bin/fakeroot
	$(SED) 's,^PATHS=.*,PATHS=$(FAKEROOT_DIR1)/.libs:/lib:/usr/lib,g' $(STAGING_DIR)/usr/bin/fakeroot

host-fakeroot: uclibc $(STAGING_DIR)/usr/bin/fakeroot

host-fakeroot-clean:
	$(MAKE) -C $(FAKEROOT_DIR1) clean

host-fakeroot-dirclean:
	rm -rf $(FAKEROOT_DIR1)


#############################################################
#
# build fakeroot for use on the target system
#
#############################################################
$(FAKEROOT_DIR2)/.unpacked: $(DL_DIR)/$(FAKEROOT_SOURCE)
	$(FAKEROOT_CAT) $(DL_DIR)/$(FAKEROOT_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	# If using busybox getopt, make it be quiet.
	$(SED) "s,getopt --version,getopt --version 2>/dev/null," \
		$(FAKEROOT_DIR2)/scripts/fakeroot.in
	touch $(FAKEROOT_DIR2)/.unpacked

$(FAKEROOT_DIR2)/.configured: $(FAKEROOT_DIR2)/.unpacked
	(cd $(FAKEROOT_DIR2); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libdir=/usr/lib/libfakeroot \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		$(DISABLE_NLS) \
	);
	touch $(FAKEROOT_DIR2)/.configured

$(FAKEROOT_DIR2)/faked: $(FAKEROOT_DIR2)/.configured
	$(MAKE) CC=$(TARGET_CC) -C $(FAKEROOT_DIR2)

$(TARGET_DIR)/usr/bin/fakeroot: $(FAKEROOT_DIR2)/faked
	$(MAKE) DESTDIR=$(TARGET_DIR) -C $(FAKEROOT_DIR2) install
	-mv $(TARGET_DIR)/usr/bin/$(ARCH)-linux-faked $(TARGET_DIR)/usr/bin/faked
	-mv $(TARGET_DIR)/usr/bin/$(ARCH)-linux-fakeroot $(TARGET_DIR)/usr/bin/fakeroot
	rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
		$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc

fakeroot: uclibc $(TARGET_DIR)/usr/bin/fakeroot

fakeroot-clean:
	$(MAKE) -C $(FAKEROOT_DIR2) clean

fakeroot-dirclean:
	rm -rf $(FAKEROOT_DIR2)


#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_FAKEROOT)),y)
TARGETS+=fakeroot
endif