aboutsummaryrefslogtreecommitdiffstats
path: root/package/tar/tar.mk
blob: ff7ee3a224764ef8fca34adfefd874335ab19056 (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
#############################################################
#
# tar
#
#############################################################
GNUTAR_VERSION:=1.18
GNUTAR_SOURCE:=tar-$(GNUTAR_VERSION).tar.bz2
GNUTAR_SITE:=$(BR2_GNU_MIRROR)/tar/
GNUTAR_DIR:=$(BUILD_DIR)/tar-$(GNUTAR_VERSION)
GNUTAR_CAT:=$(BZCAT)
GNUTAR_BINARY:=src/tar
GNUTAR_TARGET_BINARY:=bin/tar

$(DL_DIR)/$(GNUTAR_SOURCE):
	 $(WGET) -P $(DL_DIR) $(GNUTAR_SITE)/$(GNUTAR_SOURCE)

tar-source: $(DL_DIR)/$(GNUTAR_SOURCE)

$(GNUTAR_DIR)/.unpacked: $(DL_DIR)/$(GNUTAR_SOURCE)
	$(GNUTAR_CAT) $(DL_DIR)/$(GNUTAR_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(GNUTAR_DIR) package/tar/ tar\*.patch
	$(CONFIG_UPDATE) $(GNUTAR_DIR)
	$(CONFIG_UPDATE) $(GNUTAR_DIR)/build-aux
	touch $@

$(GNUTAR_DIR)/.configured: $(GNUTAR_DIR)/.unpacked
	(cd $(GNUTAR_DIR); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		ac_cv_func_chown_works=yes \
		gl_cv_func_chown_follows_symlink=yes \
		./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=/lib \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		$(DISABLE_NLS) \
		$(DISABLE_LARGEFILE) \
	)
	touch $@

$(GNUTAR_DIR)/$(GNUTAR_BINARY): $(GNUTAR_DIR)/.configured
	$(MAKE) -C $(GNUTAR_DIR)

# This stuff is needed to work around GNU make deficiencies
tar-target_binary: $(GNUTAR_DIR)/$(GNUTAR_BINARY)
	@if [ -L $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY) ]; then \
		rm -f $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY); \
	fi
	@if [ ! -f $(GNUTAR_DIR)/$(GNUTAR_BINARY) -o $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY) \
	-ot $(GNUTAR_DIR)/$(GNUTAR_BINARY) ]; then \
		set -x; \
		rm -f $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY); \
		cp -a $(GNUTAR_DIR)/$(GNUTAR_BINARY) \
			$(TARGET_DIR)/$(GNUTAR_TARGET_BINARY); \
	fi

tar: uclibc tar-target_binary

tar-clean:
	$(MAKE) DESTDIR=$(TARGET_DIR) -C $(GNUTAR_DIR) uninstall
	-$(MAKE) -C $(GNUTAR_DIR) clean

tar-dirclean:
	rm -rf $(GNUTAR_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_TAR)),y)
TARGETS+=tar
endif