1 # Created by: Maxim Sobolev <sobomax@FreeBSD.org>
8 MASTER_SITES= KERNEL_ORG/linux/kernel/people/tytso/${PORTNAME}/v${PORTVERSION}
10 MAINTAINER?= mandree@FreeBSD.org
11 COMMENT?= Utilities & library to manipulate ext2/3/4 filesystems
15 PORTSCOUT= ignore # cannot handle the version in the directory
17 BROKEN_aarch64= Fails to link: missing sbrk
19 USES= cpe gmake pkgconfig tar:xz
20 CPE_VENDOR= e2fsprogs_project
24 CONFIGURE_ARGS+=--disable-fsck --disable-e2initrd-helper \
25 --with-root-prefix='${PREFIX}'
26 CPPFLAGS+= -I${WRKSRC}/lib -I${LOCALBASE}/include # -D_EXT2_USE_C_VERSIONS
27 MAKE_ARGS+= LDFLAGS='${LDFLAGS} -L${LOCALBASE}/lib' pkgconfigdir='${PREFIX}/libdata/pkgconfig'
28 MAKE_ENV+= CHECK_CMD=@true
30 .if !defined(MASTERDIR)
31 OPTIONS_DEFINE= DOCS NLS
32 OPTIONS_EXCLUDE+= EXAMPLES
34 BUILD_DEPENDS+= gdd:sysutils/coreutils
36 PORTDOCS= NOTICE README RELEASE-NOTES SUBMITTING-PATCHES
38 OPTIONS_DEFINE= PARALLELTESTS
39 OPTIONS_SINGLE= SELFTEST
40 OPTIONS_SINGLE_SELFTEST= NOTESTS SMALLTESTS ALLTESTS
41 OPTIONS_DEFAULT= SMALLTESTS
42 SELFTEST_DESC= Choose which set of self-tests to run
43 NOTESTS_DESC= Do not run any self-tests (only Tier-1 & DISCOURAGED)
44 SMALLTESTS_DESC=Run tests that fit into 500 MB disk space (DEFAULT)
45 ALLTESTS_DESC= Run most self-tests (requires more RAM & disk space)
46 PARALLELTESTS_DESC= Run self-tests in parallel (requires more disk space)
49 PKGDEINSTALL= ${PKGINSTALL}
53 .include <bsd.port.options.mk>
55 .if ${PORT_OPTIONS:MNLS}
56 USES+= gettext iconv:build
59 .if empty(PORT_OPTIONS:MNOTESTS) && ${MASTERDIR} == ${.CURDIR}
64 .include <bsd.port.pre.mk>
66 .if ${PORT_OPTIONS:MNLS}
69 libintl= "${LOCALBASE}/lib/libintl.a"
71 libintl= "${LOCALBASE}/lib/libintl.a ${LOCALBASE}/lib/libiconv.a"
74 CONFIGURE_ARGS+=--disable-nls
75 PLIST_SUB= NLS="@comment "
79 # d_fallocate_blkmap appears to fail on some systems for unknown reasons.
81 # don't build/install libext2fs.info
82 @${REINPLACE_CMD} -e 's/ install-doc-libs$$//' ${WRKSRC}/Makefile.in
83 @${REINPLACE_CMD} -E -e 's/md5sum ([^ ]*)/printf "%s %s\\n" $$(md5 -q \1) \1/' \
84 -e "s/ == 0/ = 0/" -e "s/tar x$$/tar xf -/" -e "s/\<dd\>/gdd/" \
85 ${WRKSRC}/tests/[a-z]_*/script
86 @${REINPLACE_CMD} -e 's/<malloc\.h>/<stdlib.h>/' ${WRKSRC}/*/*.c
87 .if empty(PORT_OPTIONS:MALLTESTS)
94 f_inode_ea_collision \
96 f_no_cache_corrupt_inode \
98 j_corrupt_descr_csum \
104 r_32to64bit_expand_full \
106 r_32to64bit_move_itable \
111 t_change_uuid_mounted \
113 t_disable_changed_csum_seed_mounted \
115 t_disable_mcsum_noinitbg \
116 t_disable_mcsum_yesinitbg \
118 t_enable_mcsum_initbg \
124 @${MV} ${WRKSRC}/tests/${i} ${WRKSRC}/tests/disabled_test-${i}
126 # m_rootdir behaves erratically on 9.x and fails randomly,
127 # but may succeed when run again. Disable for now.
128 .if ${OSVERSION} < 1000000
130 @${MV} ${WRKSRC}/tests/${i} ${WRKSRC}/tests/disabled_test-${i}
135 # Master port stuff that is not to be seen by the slave ports.
136 .if ${MASTERDIR} == ${.CURDIR}
137 # NOTE: The previous .if block goes all the way to the end of the file.
139 .if !empty(PORT_OPTIONS:MNOTESTS) && (${OPSYS} == FreeBSD) && (${OSVERSION} >= 1100000 || ((${ARCH} != i386) && (${ARCH} != x86_64)))
140 BROKEN= it was not tested on your system by the maintainer; you must run self-tests
144 # fix up Makefile ordering for parallel builds
145 cd ${WRKSRC}/lib/et && ${DO_MAKE_BUILD} compile_et
146 cd ${WRKSRC}/lib/support && ${DO_MAKE_BUILD} prof_err.h
148 .if ${PORT_OPTIONS:MPARALLELTESTS}
149 _CHECK_JOBS=${_MAKE_JOBS}
155 _checkaddargs=TMPDIR=${WRKDIR}/tmp
159 # Relink e2fsck statically - We need to make sure that tools for the root file
160 # system are statically linked against anything that is outside the root fs,
161 # else we're in trouble if e2fsck is needed for boot:
162 # (we don't use e2fsck.static, since we can link libc.so dynamically)
163 cd ${WRKSRC}/e2fsck && ${RM} e2fsck \
164 && ${MAKE_CMD} e2fsck \
165 STATIC_LIBS="../lib/libext2fs.a ../lib/libcom_err.a \
166 ../lib/libblkid.a ../lib/libuuid.a" \
167 LIBINTL=${libintl} LIBMAGIC=/usr/lib/libmagic.a\ -lz
168 # Regression check: avoid a port (not upstream!) regression from 1.40.5,
169 # check that e2fsck isn't dynalinked against anything but libc.so:
170 @${ECHO_CMD} -n "===> checking that e2fsck depends on no shared objects outside /lib: "
171 @a="$$(ldd ${WRKSRC}/e2fsck/e2fsck 2>/dev/null \
172 | ${GREP} -v 'not a dynamic executable' \
174 | ${AWK} '{print $$3;}' \
175 | ${EGREP} -v '^/lib/lib.*\.so\.' || :)"; \
176 if test "x$$a" = "x" ; then echo 'PASS' ; else \
177 echo 'FAIL' ; echo '===> e2fsck depends on:' ; echo "$$a" ; exit 1 ; fi
178 # Update translation binary files
179 .if ${PORT_OPTIONS:MNLS}
180 cd ${WRKSRC}/po && ${MAKE_CMD} update-gmo
182 # Build fsck(8) wrapper
183 ${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -s ${LIBS} \
184 -o ${WRKSRC}/fsck_ext2fs ${FILESDIR}/fsck_ext2fs.c
185 # While the ${MAKE} check can take a minute on an end user's system, the
186 # correctness of tools such as e2fsck is critical to the health of the
187 # file systems. The upstream is not using any *BSD as his development
188 # system, and therefore let's exercise due diligence in running the self-
189 # test on each and every system and not just package building hosts.
190 # There have been subtle failures induced by Linux-isms in the past.
191 # -- Matthias Andree, package maintainer, 2007-09-18
192 .if empty(PORT_OPTIONS:MNOTESTS)
193 @${ECHO_CMD} '===> Running e2fsprogs self-test suite'
194 # do not add -j options unconditionally to ${MAKE_CMD} below, this might break
195 # due to excessive disk space use.
196 cd ${WRKSRC}/tests && ulimit -t 60 && ${MKDIR} ${WRKDIR}/tmp && ${SETENV} e2fsprogs_inhibit_SIGINFO=1 ${MAKE_CMD} check ${_CHECK_JOBS} ${_checkaddargs} \
197 || { head -n30000 ${WRKSRC}/tests/*.failed 2>/dev/null ; exit 1 ; }
199 @${ECHO_CMD} '===> SKIPPING e2fsprogs self-test suite (DISCOURAGED!)'
203 ${RM} ${STAGEDIR}${PREFIX}/sbin/uuidd
204 ${INSTALL_PROGRAM} ${WRKSRC}/fsck_ext2fs ${STAGEDIR}${PREFIX}/sbin/
205 ${INSTALL_MAN} ${FILESDIR}/fsck_ext2fs.8 ${STAGEDIR}${PREFIX}/man/man8/
206 .if ${PORT_OPTIONS:MDOCS}
207 ${MKDIR} ${STAGEDIR}${DOCSDIR}
208 .for i in ${PORTDOCS}
209 ${INSTALL_DATA} ${WRKSRC}/${i} ${STAGEDIR}${DOCSDIR}
213 # the next line closes .if ${MASTERDIR} == ${.CURDIR}
216 .include <bsd.port.post.mk>