]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/e2fsprogs/e2fsprogs.mk
5231a97f9cdd56d884d8ea544e5b177141ae75f8
[coffee/buildroot.git] / package / e2fsprogs / e2fsprogs.mk
1 ################################################################################
2 #
3 # e2fsprogs
4 #
5 ################################################################################
6
7 E2FSPROGS_VERSION = 1.43.4
8 E2FSPROGS_SOURCE = e2fsprogs-$(E2FSPROGS_VERSION).tar.xz
9 E2FSPROGS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/people/tytso/e2fsprogs/v$(E2FSPROGS_VERSION)
10 E2FSPROGS_LICENSE = GPL-2.0, MIT-like with advertising clause (libss and libet)
11 E2FSPROGS_LICENSE_FILES = NOTICE lib/ss/mit-sipb-copyright.h lib/et/internal.h
12 E2FSPROGS_INSTALL_STAGING = YES
13
14 # Use libblkid and libuuid from util-linux for host and target packages.
15 # This prevents overriding them with e2fsprogs' ones, which may cause
16 # problems for other packages.
17 E2FSPROGS_DEPENDENCIES = host-pkgconf util-linux
18 HOST_E2FSPROGS_DEPENDENCIES = host-pkgconf host-util-linux
19
20 # e4defrag doesn't build on older systems like RHEL5.x, and we don't
21 # need it on the host anyway.
22 # Disable fuse2fs as well to avoid carrying over deps, and it's unused
23 HOST_E2FSPROGS_CONF_OPTS = \
24         --disable-defrag \
25         --disable-fuse2fs \
26         --disable-libblkid \
27         --disable-libuuid
28
29 E2FSPROGS_CONF_OPTS = \
30         $(if $(BR2_STATIC_LIBS),,--enable-elf-shlibs) \
31         $(if $(BR2_PACKAGE_E2FSPROGS_DEBUGFS),,--disable-debugfs) \
32         $(if $(BR2_PACKAGE_E2FSPROGS_E2IMAGE),,--disable-imager) \
33         $(if $(BR2_PACKAGE_E2FSPROGS_E4DEFRAG),,--disable-defrag) \
34         $(if $(BR2_PACKAGE_E2FSPROGS_RESIZE2FS),,--disable-resizer) \
35         --disable-uuidd \
36         --disable-libblkid \
37         --disable-libuuid \
38         --enable-fsck \
39         --disable-e2initrd-helper \
40         --disable-testio-debug \
41         --disable-rpath
42
43 ifeq ($(BR2_PACKAGE_E2FSPROGS_FUSE2FS),y)
44 E2FSPROGS_CONF_OPTS += --enable-fuse2fs
45 E2FSPROGS_DEPENDENCIES += libfuse
46 else
47 E2FSPROGS_CONF_OPTS += --disable-fuse2fs
48 endif
49
50 ifeq ($(BR2_nios2),y)
51 E2FSPROGS_CONF_ENV += ac_cv_func_fallocate=no
52 endif
53
54 # Some programs are built for the host, but use definitions guessed by
55 # the configure script (i.e with the cross-compiler). Help them by
56 # saying that <sys/stat.h> is available on the host, which is needed
57 # for util/subst.c to build properly.
58 E2FSPROGS_CONF_ENV += BUILD_CFLAGS="-DHAVE_SYS_STAT_H"
59
60 # Disable use of the host magic.h, as on older hosts (e.g. RHEL 5)
61 # it doesn't provide definitions expected by e2fsprogs support lib.
62 HOST_E2FSPROGS_CONF_ENV += \
63         ac_cv_header_magic_h=no \
64         ac_cv_lib_magic_magic_file=no
65
66 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE),y)
67 # util-linux libuuid pulls in libintl if needed, so ensure we also
68 # link against it, otherwise static linking fails
69 E2FSPROGS_CONF_ENV += LIBS=-lintl
70 endif
71
72 E2FSPROGS_MAKE_OPTS = LDCONFIG=true
73 E2FSPROGS_INSTALL_STAGING_OPTS = \
74         DESTDIR=$(STAGING_DIR) \
75         LDCONFIG=true \
76         install-libs
77 E2FSPROGS_INSTALL_TARGET_OPTS = \
78         DESTDIR=$(TARGET_DIR) \
79         LDCONFIG=true \
80         install
81
82 define HOST_E2FSPROGS_INSTALL_CMDS
83         $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install install-libs
84 endef
85
86 # binaries to keep or remove
87 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_BADBLOCKS) += usr/sbin/badblocks
88 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_CHATTR) += usr/bin/chattr
89 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_DUMPE2FS) += usr/sbin/dumpe2fs
90 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_E2FREEFRAG) += usr/sbin/e2freefrag
91 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_E2FSCK) += usr/sbin/e2fsck
92 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_E2LABEL) += usr/sbin/e2label
93 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_E2UNDO) += usr/sbin/e2undo
94 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_E4DEFRAG) += usr/sbin/e4defrag
95 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_FILEFRAG) += usr/sbin/filefrag
96 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_FSCK) += usr/sbin/fsck
97 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_LOGSAVE) += usr/sbin/logsave
98 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_LSATTR) += usr/bin/lsattr
99 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_MKE2FS) += usr/sbin/mke2fs
100 E2FSPROGS_BINTARGETS_$(BR2_PACKAGE_E2FSPROGS_MKLOSTFOUND) += usr/sbin/mklost+found
101
102 # files to remove
103 E2FSPROGS_TXTTARGETS_ = \
104         usr/sbin/mkfs.ext[234] \
105         usr/sbin/mkfs.ext4dev \
106         usr/sbin/fsck.ext[234] \
107         usr/sbin/fsck.ext4dev \
108         usr/sbin/tune2fs
109
110 define E2FSPROGS_TARGET_REMOVE_UNNEEDED
111         rm -f $(addprefix $(TARGET_DIR)/, $(E2FSPROGS_BINTARGETS_))
112         rm -f $(addprefix $(TARGET_DIR)/, $(E2FSPROGS_TXTTARGETS_))
113 endef
114
115 E2FSPROGS_POST_INSTALL_TARGET_HOOKS += E2FSPROGS_TARGET_REMOVE_UNNEEDED
116
117 define E2FSPROGS_TARGET_MKE2FS_SYMLINKS
118         ln -sf mke2fs $(TARGET_DIR)/usr/sbin/mkfs.ext2
119         ln -sf mke2fs $(TARGET_DIR)/usr/sbin/mkfs.ext3
120         ln -sf mke2fs $(TARGET_DIR)/usr/sbin/mkfs.ext4
121         ln -sf mke2fs $(TARGET_DIR)/usr/sbin/mkfs.ext4dev
122 endef
123
124 ifeq ($(BR2_PACKAGE_E2FSPROGS_MKE2FS),y)
125 E2FSPROGS_POST_INSTALL_TARGET_HOOKS += E2FSPROGS_TARGET_MKE2FS_SYMLINKS
126 endif
127
128 define E2FSPROGS_TARGET_E2FSCK_SYMLINKS
129         ln -sf e2fsck $(TARGET_DIR)/usr/sbin/fsck.ext2
130         ln -sf e2fsck $(TARGET_DIR)/usr/sbin/fsck.ext3
131         ln -sf e2fsck $(TARGET_DIR)/usr/sbin/fsck.ext4
132         ln -sf e2fsck $(TARGET_DIR)/usr/sbin/fsck.ext4dev
133 endef
134
135 ifeq ($(BR2_PACKAGE_E2FSPROGS_E2FSCK),y)
136 E2FSPROGS_POST_INSTALL_TARGET_HOOKS += E2FSPROGS_TARGET_E2FSCK_SYMLINKS
137 endif
138
139 # If BusyBox is included, its configuration may supply its own variant
140 # of ext2-related tools. Since Buildroot desires having full blown
141 # variants take precedence (in this case, e2fsprogs), we want to remove
142 # BusyBox's variant of e2fsprogs provided binaries. e2fsprogs targets
143 # /usr/{bin,sbin} where BusyBox targets /{bin,sbin}. We will attempt to
144 # remove BusyBox-generated ext2-related tools from /{bin,sbin}. We need
145 # to do this in the pre-install stage to ensure we do not accidentally
146 # remove e2fsprogs's binaries in usr-merged environments (ie. if they
147 # are removed, they would be re-installed in this package's install
148 # stage).
149 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
150 E2FSPROGS_DEPENDENCIES += busybox
151
152 define E2FSPROGS_REMOVE_BUSYBOX_APPLETS
153         $(RM) -f $(TARGET_DIR)/bin/chattr
154         $(RM) -f $(TARGET_DIR)/bin/lsattr
155         $(RM) -f $(TARGET_DIR)/sbin/fsck
156         $(RM) -f $(TARGET_DIR)/sbin/tune2fs
157         $(RM) -f $(TARGET_DIR)/sbin/e2label
158 endef
159 E2FSPROGS_PRE_INSTALL_TARGET_HOOKS += E2FSPROGS_REMOVE_BUSYBOX_APPLETS
160 endif
161
162 define E2FSPROGS_TARGET_TUNE2FS_SYMLINK
163         ln -sf e2label $(TARGET_DIR)/usr/sbin/tune2fs
164 endef
165
166 ifeq ($(BR2_PACKAGE_E2FSPROGS_TUNE2FS),y)
167 E2FSPROGS_POST_INSTALL_TARGET_HOOKS += E2FSPROGS_TARGET_TUNE2FS_SYMLINK
168 endif
169
170 $(eval $(autotools-package))
171 $(eval $(host-autotools-package))