blob: 4f7cafeac979be8e58304fc0d578fe9aa6320942 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001require e2fsprogs.inc
2
3SRC_URI += "file://remove.ldconfig.call.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -05004 file://run-ptest \
5 file://ptest.patch \
6 file://mkdir_p.patch \
7 file://0001-misc-create_inode.c-set-dir-s-mode-correctly.patch \
8 file://0001-configure.ac-correct-AM_GNU_GETTEXT.patch \
9 file://0001-intl-do-not-try-to-use-gettext-defines-that-no-longe.patch \
10 file://CVE-2019-5188.patch \
11 file://0001-e2fsck-don-t-try-to-rehash-a-deleted-directory.patch \
12 file://e2fsck-fix-use-after-free-in-calculate_tree.patch \
13 "
Brad Bishop19323692019-04-05 15:28:33 -040014
15SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch \
16 file://quiet-debugfs.patch \
17"
18
Brad Bishop64c979e2019-11-04 13:55:29 -050019SRCREV = "984ff8d6a0a1d5dc300505f67b38ed5047d51dac"
Brad Bishop19323692019-04-05 15:28:33 -040020UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+\.\d+(\.\d+)*)$"
21
22EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} \
23 --enable-elf-shlibs --disable-libuuid --disable-uuidd \
Brad Bishop08902b02019-08-20 09:16:51 -040024 --disable-libblkid --enable-verbose-makecmds \
25 --with-crond-dir=no"
Brad Bishop19323692019-04-05 15:28:33 -040026
27EXTRA_OECONF_darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
28
29PACKAGECONFIG ??= ""
30PACKAGECONFIG[fuse] = '--enable-fuse2fs,--disable-fuse2fs,fuse'
31
32# make locale rules sometimes fire, sometimes don't as git doesn't preserve
33# file mktime. Touch the files introducing non-determinism to the build
34do_compile_prepend (){
35 find ${S}/po -type f -name "*.po" -exec touch {} +
36}
37
38do_install () {
39 oe_runmake 'DESTDIR=${D}' install
40 oe_runmake 'DESTDIR=${D}' install-libs
41 # We use blkid from util-linux now so remove from here
42 rm -f ${D}${base_libdir}/libblkid*
43 rm -rf ${D}${includedir}/blkid
44 rm -f ${D}${base_libdir}/pkgconfig/blkid.pc
45 rm -f ${D}${base_sbindir}/blkid
46 rm -f ${D}${base_sbindir}/fsck
47 rm -f ${D}${base_sbindir}/findfs
48
49 # e2initrd_helper and the pkgconfig files belong in libdir
50 if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
51 install -d ${D}${libdir}
52 mv ${D}${base_libdir}/e2initrd_helper ${D}${libdir}
53 mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
54 fi
55
56 oe_multilib_header ext2fs/ext2_types.h
57 install -d ${D}${base_bindir}
58 mv ${D}${bindir}/chattr ${D}${base_bindir}/chattr.e2fsprogs
59
60 install -v -m 755 ${S}/contrib/populate-extfs.sh ${D}${base_sbindir}/
61
62 # Clean host path (build directory) in compile_et, mk_cmds
63 sed -i -e "s,\(ET_DIR=.*\)${S}/lib/et\(.*\),\1${datadir}/et\2,g" ${D}${bindir}/compile_et
64 sed -i -e "s,\(SS_DIR=.*\)${S}/lib/ss\(.*\),\1${datadir}/ss\2,g" ${D}${bindir}/mk_cmds
65}
66
67# Need to find the right mke2fs.conf file
68e2fsprogs_conf_fixup () {
69 for i in mke2fs mkfs.ext2 mkfs.ext3 mkfs.ext4; do
70 create_wrapper ${D}${base_sbindir}/$i MKE2FS_CONFIG=${sysconfdir}/mke2fs.conf
71 done
72}
73
74do_install_append_class-native() {
75 e2fsprogs_conf_fixup
76}
77
78do_install_append_class-nativesdk() {
79 e2fsprogs_conf_fixup
80}
81
82do_install_append_class-target() {
83 mv ${D}${base_sbindir}/mke2fs ${D}${base_sbindir}/mke2fs.e2fsprogs
84 mv ${D}${base_sbindir}/mkfs.ext2 ${D}${base_sbindir}/mkfs.ext2.e2fsprogs
85 mv ${D}${base_sbindir}/tune2fs ${D}${base_sbindir}/tune2fs.e2fsprogs
86}
87
Andrew Geissler82c905d2020-04-13 13:39:40 -050088RDEPENDS_e2fsprogs = "e2fsprogs-badblocks e2fsprogs-dumpe2fs"
Brad Bishop19323692019-04-05 15:28:33 -040089RRECOMMENDS_e2fsprogs = "e2fsprogs-mke2fs e2fsprogs-e2fsck"
90
Andrew Geissler82c905d2020-04-13 13:39:40 -050091PACKAGES =+ "e2fsprogs-badblocks e2fsprogs-dumpe2fs e2fsprogs-e2fsck e2fsprogs-e2scrub e2fsprogs-mke2fs e2fsprogs-resize2fs e2fsprogs-tune2fs"
Brad Bishop19323692019-04-05 15:28:33 -040092PACKAGES =+ "libcomerr libss libe2p libext2fs"
93
Andrew Geissler82c905d2020-04-13 13:39:40 -050094FILES_e2fsprogs-dumpe2fs = "${base_sbindir}/dumpe2fs"
Brad Bishop19323692019-04-05 15:28:33 -040095FILES_e2fsprogs-resize2fs = "${base_sbindir}/resize2fs*"
96FILES_e2fsprogs-e2fsck = "${base_sbindir}/e2fsck ${base_sbindir}/fsck.ext*"
Brad Bishop08902b02019-08-20 09:16:51 -040097FILES_e2fsprogs-e2scrub = "${base_sbindir}/e2scrub*"
Brad Bishop19323692019-04-05 15:28:33 -040098FILES_e2fsprogs-mke2fs = "${base_sbindir}/mke2fs.e2fsprogs ${base_sbindir}/mkfs.ext* ${sysconfdir}/mke2fs.conf"
99FILES_e2fsprogs-tune2fs = "${base_sbindir}/tune2fs.e2fsprogs ${base_sbindir}/e2label"
100FILES_e2fsprogs-badblocks = "${base_sbindir}/badblocks"
101FILES_libcomerr = "${base_libdir}/libcom_err.so.*"
102FILES_libss = "${base_libdir}/libss.so.*"
103FILES_libe2p = "${base_libdir}/libe2p.so.*"
104FILES_libext2fs = "${libdir}/e2initrd_helper ${base_libdir}/libext2fs.so.*"
105FILES_${PN}-dev += "${datadir}/*/*.awk ${datadir}/*/*.sed ${base_libdir}/*.so ${bindir}/compile_et ${bindir}/mk_cmds"
106
107ALTERNATIVE_${PN} = "chattr"
108ALTERNATIVE_PRIORITY = "100"
109ALTERNATIVE_LINK_NAME[chattr] = "${base_bindir}/chattr"
110ALTERNATIVE_TARGET[chattr] = "${base_bindir}/chattr.e2fsprogs"
111
112ALTERNATIVE_${PN}-doc = "fsck.8"
113ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
114
115ALTERNATIVE_${PN}-mke2fs = "mke2fs mkfs.ext2"
116ALTERNATIVE_LINK_NAME[mke2fs] = "${base_sbindir}/mke2fs"
117ALTERNATIVE_LINK_NAME[mkfs.ext2] = "${base_sbindir}/mkfs.ext2"
118
119ALTERNATIVE_${PN}-tune2fs = "tune2fs"
120ALTERNATIVE_LINK_NAME[tune2fs] = "${base_sbindir}/tune2fs"
121
Brad Bishop08902b02019-08-20 09:16:51 -0400122RDEPENDS_e2fsprogs-e2scrub = "bash"
Brad Bishop15ae2502019-06-18 21:44:24 -0400123RDEPENDS_${PN}-ptest += "coreutils procps bash bzip2 diffutils perl sed"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500124RDEPENDS_${PN}-ptest += "e2fsprogs-badblocks e2fsprogs-dumpe2fs e2fsprogs-e2fsck e2fsprogs-mke2fs e2fsprogs-resize2fs e2fsprogs-tune2fs"
Brad Bishop19323692019-04-05 15:28:33 -0400125
126do_compile_ptest() {
127 oe_runmake -C ${B}/tests
128}
129
130do_install_ptest() {
131 cp -R --no-dereference --preserve=mode,links -v ${B}/tests ${D}${PTEST_PATH}/test
132 cp -R --no-dereference --preserve=mode,links -v ${S}/tests/* ${D}${PTEST_PATH}/test
133 sed -e 's!../e2fsck/e2fsck!e2fsck!g' \
134 -e 's!../misc/tune2fs!tune2fs!g' -i ${D}${PTEST_PATH}/test/*/expect*
135 sed -e 's!../e2fsck/e2fsck!${base_sbindir}/e2fsck!g' -i ${D}${PTEST_PATH}/test/*/script
136
137 # Remove various files
138 find "${D}${PTEST_PATH}" -type f \
139 \( -name 'Makefile' -o -name 'Makefile.in' -o -name '*.o' -o -name '*.c' -o -name '*.h' \)\
140 -exec rm -f {} +
141
142 install -d ${D}${PTEST_PATH}/lib
143 install -m 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/
144}