bump version
[buildroot.git] / package / file / file.mk
blobe7b3b99ed33d7fb8d79bffa798a97a02ceec4669
1 #############################################################
3 # file
5 #############################################################
6 FILE_VERSION:=4.24
7 FILE_SOURCE:=file_$(FILE_VERSION).orig.tar.gz
8 FILE_PATCH:=file_$(FILE_VERSION)-1.diff.gz
9 FILE_SITE:=$(BR2_DEBIAN_MIRROR)/debian/pool/main/f/file
10 FILE_SOURCE_DIR:=$(BUILD_DIR)/file-$(FILE_VERSION)
11 FILE_DIR1:=$(TOOL_BUILD_DIR)/file-$(FILE_VERSION)-host
12 FILE_DIR2:=$(BUILD_DIR)/file-$(FILE_VERSION)-target
13 FILE_CAT:=$(ZCAT)
14 FILE_BINARY:=src/file
15 FILE_TARGET_BINARY:=usr/bin/file
17 ifneq ($(FILE_PATCH),)
18 FILE_PATCH_FILE:=$(DL_DIR)/$(FILE_PATCH)
19 $(FILE_PATCH_FILE):
20 $(WGET) -P $(DL_DIR) $(FILE_SITE)/$(FILE_PATCH)
21 endif
22 $(DL_DIR)/$(FILE_SOURCE): $(FILE_PATCH_FILE)
23 $(WGET) -P $(DL_DIR) $(FILE_SITE)/$(FILE_SOURCE)
25 #############################################################
27 # build file for use on the host system
29 #############################################################
30 $(FILE_DIR1)/.configured: $(FILE_SOURCE_DIR)/.unpacked
31 mkdir -p $(FILE_DIR1)
32 (cd $(FILE_DIR1); rm -rf config.cache; \
33 CC="$(HOSTCC) $(HOST_CFLAGS)" \
34 $(FILE_SOURCE_DIR)/configure \
35 --prefix=$(FILE_DIR1)/install \
37 touch $@
39 $(TOOL_BUILD_DIR)/bin/file: $(FILE_DIR1)/.configured
40 $(MAKE) -C $(FILE_DIR1) install
41 ln -sf $(FILE_DIR1)/install/bin/file $(TOOL_BUILD_DIR)/bin/file
43 host-file: $(TOOL_BUILD_DIR)/bin/file
45 host-file-clean:
46 -$(MAKE) -C $(FILE_DIR1) clean
48 host-file-dirclean:
49 rm -rf $(FILE_DIR1) $(FILE_SOURCE_DIR)
51 #############################################################
53 # build file for use on the target system
55 #############################################################
56 file-unpacked: $(FILE_SOURCE_DIR)/.unpacked
57 $(FILE_SOURCE_DIR)/.unpacked: $(DL_DIR)/$(FILE_SOURCE)
58 $(FILE_CAT) $(DL_DIR)/$(FILE_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
59 ifneq ($(FILE_PATCH),)
60 (cd $(FILE_SOURCE_DIR) && $(FILE_CAT) $(FILE_PATCH_FILE) | patch -p1)
61 if [ -d $(FILE_SOURCE_DIR)/debian/patches ]; then \
62 toolchain/patch-kernel.sh $(FILE_SOURCE_DIR) $(FILE_SOURCE_DIR) debian/patches/\?\?\?-\*.dpatch; \
64 endif
65 toolchain/patch-kernel.sh $(FILE_SOURCE_DIR) package/file/ file\*.patch
66 $(CONFIG_UPDATE) $(@D)
67 $(SED) 's/-O2//g' $(@D)/configure
68 touch $@
70 $(FILE_DIR2)/.configured: THIS_SRCDIR = $(FILE_SOURCE_DIR)
71 $(FILE_DIR2)/.configured: $(FILE_SOURCE_DIR)/.unpacked
72 mkdir -p $(FILE_DIR2)
73 (cd $(FILE_DIR2); rm -rf config.cache; \
74 $(AUTO_CONFIGURE_TARGET) \
75 --prefix=/usr \
76 --exec-prefix=/usr \
77 --sysconfdir=/etc \
78 --datadir=/usr/share/misc \
79 --localstatedir=/var \
80 --mandir=/usr/share/man \
81 --infodir=/usr/share/info \
82 $(DISABLE_NLS) \
83 $(DISABLE_LARGEFILE) \
84 --enable-static \
85 --disable-fsect-man5 \
87 touch $@
89 $(FILE_DIR2)/$(FILE_BINARY): $(FILE_DIR2)/.configured $(TOOL_BUILD_DIR)/bin/file
90 # Make sure that we find the correct binary to create our magic..
91 ln -sf $(TOOL_BUILD_DIR)/bin/file $(FILE_DIR2)/magic/file
92 $(MAKE) -C $(FILE_DIR2)
94 $(TARGET_DIR)/$(FILE_TARGET_BINARY): $(FILE_DIR2)/$(FILE_BINARY)
95 $(MAKE) -C $(FILE_DIR2) \
96 DESTDIR=$(TARGET_DIR) FILE_COMPILE=$(TOOL_BUILD_DIR)/bin/file \
97 install
98 -$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libmagic.so.*.*
99 ifneq ($(BR2_HAVE_INFOPAGES),y)
100 rm -rf $(TARGET_DIR)/usr/share/info
101 endif
102 ifneq ($(BR2_HAVE_MANPAGES),y)
103 rm -rf $(TARGET_DIR)/usr/share/man
104 endif
105 rm -rf $(TARGET_DIR)/usr/share/locale
106 rm -rf $(TARGET_DIR)/usr/share/doc
107 mv $(TARGET_DIR)/usr/lib/libmagic.a $(STAGING_DIR)/usr/lib
108 rm -f $(TARGET_DIR)/lib/libmagic.la
109 mv $(TARGET_DIR)/usr/include/magic.h $(STAGING_DIR)/usr/include
111 file: zlib uclibc $(TARGET_DIR)/$(FILE_TARGET_BINARY)
113 file-source: $(DL_DIR)/$(FILE_SOURCE)
115 file-clean:
116 -$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(FILE_DIR2) uninstall
117 -$(MAKE) -C $(FILE_DIR2) clean
119 file-dirclean:
120 rm -rf $(FILE_DIR2)
122 #############################################################
124 # Toplevel Makefile options
126 #############################################################
127 ifeq ($(BR2_PACKAGE_FILE),y)
128 TARGETS+=file
129 endif