blob: 26206109039c53e801d18603b852872fdb8ccaf3 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001require e2fsprogs.inc
2
3SRC_URI += "file://remove.ldconfig.call.patch \
4 file://run-ptest \
5 file://ptest.patch \
6 file://mkdir_p.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +00007 "
8SRC_URI:append:class-native = " \
9 file://e2fsprogs-fix-missing-check-for-permission-denied.patch \
10 file://quiet-debugfs.patch \
11 "
12
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060013SRCREV = "f4c9cc4bedacde8408edda3520a32d3842290112"
Andrew Geissler595f6302022-01-24 19:11:47 +000014UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+\.\d+(\.\d+)*)$"
15
16EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} \
17 --enable-elf-shlibs --disable-libuuid --disable-uuidd \
18 --disable-libblkid --enable-verbose-makecmds \
Andrew Geissler517393d2023-01-13 08:55:19 -060019 --enable-largefile --with-crond-dir=no"
Andrew Geissler595f6302022-01-24 19:11:47 +000020
21EXTRA_OECONF:darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
22
23PACKAGECONFIG ??= ""
24PACKAGECONFIG[fuse] = '--enable-fuse2fs,--disable-fuse2fs,fuse'
25
26# make locale rules sometimes fire, sometimes don't as git doesn't preserve
27# file mktime. Touch the files introducing non-determinism to the build
28do_compile:prepend (){
29 find ${S}/po -type f -name "*.po" -exec touch {} +
30}
31
32do_install () {
33 oe_runmake 'DESTDIR=${D}' install
34 oe_runmake 'DESTDIR=${D}' install-libs
35 # We use blkid from util-linux now so remove from here
36 rm -f ${D}${base_libdir}/libblkid*
37 rm -rf ${D}${includedir}/blkid
38 rm -f ${D}${base_libdir}/pkgconfig/blkid.pc
39 rm -f ${D}${base_sbindir}/blkid
40 rm -f ${D}${base_sbindir}/fsck
41 rm -f ${D}${base_sbindir}/findfs
42
43 # e2initrd_helper and the pkgconfig files belong in libdir
44 if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
45 install -d ${D}${libdir}
46 mv ${D}${base_libdir}/e2initrd_helper ${D}${libdir}
47 mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
48 fi
49
50 oe_multilib_header ext2fs/ext2_types.h
51 install -d ${D}${base_bindir}
52 mv ${D}${bindir}/chattr ${D}${base_bindir}/chattr.e2fsprogs
Andrew Geissler78b72792022-06-14 06:47:25 -050053 mv ${D}${bindir}/lsattr ${D}${base_bindir}/lsattr.e2fsprogs
Andrew Geissler595f6302022-01-24 19:11:47 +000054
55 install -v -m 755 ${S}/contrib/populate-extfs.sh ${D}${base_sbindir}/
56
57 # Clean host path (build directory) in compile_et, mk_cmds
58 sed -i -e "s,\(ET_DIR=.*\)${S}/lib/et\(.*\),\1${datadir}/et\2,g" ${D}${bindir}/compile_et
59 sed -i -e "s,\(SS_DIR=.*\)${S}/lib/ss\(.*\),\1${datadir}/ss\2,g" ${D}${bindir}/mk_cmds
60}
61
62# Need to find the right mke2fs.conf file
63e2fsprogs_conf_fixup () {
64 for i in mke2fs mkfs.ext2 mkfs.ext3 mkfs.ext4; do
65 create_wrapper ${D}${base_sbindir}/$i MKE2FS_CONFIG=${sysconfdir}/mke2fs.conf
66 done
67}
68
69do_install:append:class-native() {
70 e2fsprogs_conf_fixup
71}
72
73do_install:append:class-nativesdk() {
74 e2fsprogs_conf_fixup
75}
76
77do_install:append:class-target() {
78 mv ${D}${base_sbindir}/mke2fs ${D}${base_sbindir}/mke2fs.e2fsprogs
79 mv ${D}${base_sbindir}/mkfs.ext2 ${D}${base_sbindir}/mkfs.ext2.e2fsprogs
80 mv ${D}${base_sbindir}/tune2fs ${D}${base_sbindir}/tune2fs.e2fsprogs
81}
82
83RDEPENDS:e2fsprogs = "e2fsprogs-badblocks e2fsprogs-dumpe2fs"
84RRECOMMENDS:e2fsprogs = "e2fsprogs-mke2fs e2fsprogs-e2fsck"
85
86PACKAGES =+ "e2fsprogs-badblocks e2fsprogs-dumpe2fs e2fsprogs-e2fsck e2fsprogs-e2scrub e2fsprogs-mke2fs e2fsprogs-resize2fs e2fsprogs-tune2fs"
87PACKAGES =+ "libcomerr libss libe2p libext2fs"
88
89FILES:e2fsprogs-dumpe2fs = "${base_sbindir}/dumpe2fs"
90FILES:e2fsprogs-resize2fs = "${base_sbindir}/resize2fs*"
91FILES:e2fsprogs-e2fsck = "${base_sbindir}/e2fsck ${base_sbindir}/fsck.ext*"
92FILES:e2fsprogs-e2scrub = "${base_sbindir}/e2scrub*"
93FILES:e2fsprogs-mke2fs = "${base_sbindir}/mke2fs.e2fsprogs ${base_sbindir}/mkfs.ext* ${sysconfdir}/mke2fs.conf"
94FILES:e2fsprogs-tune2fs = "${base_sbindir}/tune2fs.e2fsprogs ${base_sbindir}/e2label"
95FILES:e2fsprogs-badblocks = "${base_sbindir}/badblocks"
96FILES:libcomerr = "${base_libdir}/libcom_err.so.*"
97FILES:libss = "${base_libdir}/libss.so.*"
98FILES:libe2p = "${base_libdir}/libe2p.so.*"
99FILES:libext2fs = "${libdir}/e2initrd_helper ${base_libdir}/libext2fs.so.*"
100FILES:${PN}-dev += "${datadir}/*/*.awk ${datadir}/*/*.sed ${base_libdir}/*.so ${bindir}/compile_et ${bindir}/mk_cmds"
101
Andrew Geissler78b72792022-06-14 06:47:25 -0500102ALTERNATIVE:${PN} = "chattr lsattr"
Andrew Geissler595f6302022-01-24 19:11:47 +0000103ALTERNATIVE_PRIORITY = "100"
104ALTERNATIVE_LINK_NAME[chattr] = "${base_bindir}/chattr"
105ALTERNATIVE_TARGET[chattr] = "${base_bindir}/chattr.e2fsprogs"
Andrew Geissler78b72792022-06-14 06:47:25 -0500106ALTERNATIVE_LINK_NAME[lsattr] = "${base_bindir}/lsattr"
107ALTERNATIVE_TARGET[lsattr] = "${base_bindir}/lsattr.e2fsprogs"
Andrew Geissler595f6302022-01-24 19:11:47 +0000108
109ALTERNATIVE:${PN}-doc = "fsck.8"
110ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
111
112ALTERNATIVE:${PN}-mke2fs = "mke2fs mkfs.ext2"
113ALTERNATIVE_LINK_NAME[mke2fs] = "${base_sbindir}/mke2fs"
114ALTERNATIVE_LINK_NAME[mkfs.ext2] = "${base_sbindir}/mkfs.ext2"
115
116ALTERNATIVE:${PN}-tune2fs = "tune2fs"
117ALTERNATIVE_LINK_NAME[tune2fs] = "${base_sbindir}/tune2fs"
118
119RDEPENDS:e2fsprogs-e2scrub = "bash"
120RDEPENDS:${PN}-ptest += "coreutils procps bash bzip2 diffutils perl sed"
121RDEPENDS:${PN}-ptest += "e2fsprogs-badblocks e2fsprogs-dumpe2fs e2fsprogs-e2fsck e2fsprogs-mke2fs e2fsprogs-resize2fs e2fsprogs-tune2fs"
122
123do_compile_ptest() {
124 oe_runmake -C ${B}/tests
125}
126
127do_install_ptest() {
128 # This file's permissions depends on the host umask so be deterministic
129 chmod 0644 ${B}/tests/test_data.tmp
130 cp -R --no-dereference --preserve=mode,links -v ${B}/tests ${D}${PTEST_PATH}/test
131 cp -R --no-dereference --preserve=mode,links -v ${S}/tests/* ${D}${PTEST_PATH}/test
132 sed -e 's!../e2fsck/e2fsck!e2fsck!g' \
133 -e 's!../misc/tune2fs!tune2fs!g' -i ${D}${PTEST_PATH}/test/*/expect*
134 sed -e 's!../e2fsck/e2fsck!${base_sbindir}/e2fsck!g' -i ${D}${PTEST_PATH}/test/*/script
135
136 # Remove various files
137 find "${D}${PTEST_PATH}" -type f \
138 \( -name 'Makefile' -o -name 'Makefile.in' -o -name '*.o' -o -name '*.c' -o -name '*.h' \)\
139 -exec rm -f {} +
140
141 install -d ${D}${PTEST_PATH}/lib
142 install -m 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/
143}