# Created by: Maxim Sobolev # $FreeBSD$ PORTNAME= e2fsprogs PORTVERSION= 1.42.8 PORTREVISION?= 0 CATEGORIES?= sysutils MASTER_SITES= KERNEL_ORG/linux/kernel/people/tytso/${PORTNAME}/v${PORTVERSION} MAINTAINER?= mandree@FreeBSD.org COMMENT?= Utilities & library to manipulate ext2/3/4 filesystems LICENSE= GPLv2 PATCH_STRIP= -p1 USES= gmake pkgconfig USE_GMAKE= yes USE_CSTD= gnu99 USE_LDCONFIG= yes USE_XZ= yes GNU_CONFIGURE= yes CONFIGURE_ARGS+=--disable-fsck --disable-e2initrd-helper \ --with-root-prefix='${PREFIX}' CPPFLAGS+= -I${WRKSRC}/lib -I${LOCALBASE}/include # -D_EXT2_USE_C_VERSIONS MAKE_ARGS+= LDFLAGS='${LDFLAGS} -L${LOCALBASE}/lib' .if !defined(MASTERDIR) OPTIONS_DEFINE= DOCS NLS OPTIONS_DEFAULT= NLS OPTIONS_EXCLUDE+= EXAMPLES MAN1= chattr.1 lsattr.1 MAN5= e2fsck.conf.5 mke2fs.conf.5 MAN8= badblocks.8 debugfs.8 dumpe2fs.8 e2fsck.8 e2image.8 e2label.8 \ e2undo.8 mke2fs.8 mklost+found.8 resize2fs.8 tune2fs.8 \ fsck.ext2.8 fsck.ext3.8 fsck.ext4.8 fsck.ext4dev.8 \ mkfs.ext2.8 mkfs.ext3.8 mkfs.ext4.8 mkfs.ext4dev.8 \ findfs.8 blkid.8 logsave.8 fsck_ext2fs.8 e2freefrag.8 PORTDOCS= COPYING RELEASE-NOTES post-extract: @${CHMOD} u+w ${WRKSRC}/po/*.po ${WRKSRC}/po/*.pot \ ${WRKSRC}/${CONFIGURE_SCRIPT} .endif PKGDEINSTALL= ${PKGINSTALL} # get more details into tinderbox logs .if defined(PACKAGE_BUILDING) MAKE_ARGS+= V=1 .endif .include .if ${PORT_OPTIONS:MNLS} USES+= gettext iconv:build PLIST_SUB= NLS="" . if empty(ICONV_LIB) libintl= "${LOCALBASE}/lib/libintl.a" . else libintl= "${LOCALBASE}/lib/libintl.a ${LOCALBASE}/lib/libiconv.a" . endif .else CONFIGURE_ARGS+=--disable-nls PLIST_SUB= NLS="@comment " libintl= .endif .include post-patch:: @${REINPLACE_CMD} -E -e \ 's:\$$\(libdir\)/pkgconfig:${PREFIX}/libdata/pkgconfig:' \ ${WRKSRC}/lib/*/Makefile.in # don't build/install libext2fs.info @${REINPLACE_CMD} -e 's/ install-doc-libs$$//' ${WRKSRC}/Makefile.in @${REINPLACE_CMD} -E -e 's/md5sum ([^ ]*)/printf "%s %s\\n" $$(md5 -q \1) \1/' \ -e "s/ == 0/ = 0/" ${WRKSRC}/tests/[a-t]_*/script @${REINPLACE_CMD} -e 's///' ${WRKSRC}/*/*.c # disable f_mmp_garbage, fails on FreeBSD, and the resize*big_expand tests, # which are too unwieldy to run automatically (need too much free space). # f_extent_oobounds fails in Tinderbox and is fine outside, reason unclear. .for i in f_mmp_garbage f_extent_oobounds r_64bit_big_expand r_bigalloc_big_expand r_ext4_big_expand @${MV} ${WRKSRC}/tests/${i} ${WRKSRC}/tests/disabled_test-${i} .endfor .if ${MASTERDIR} == ${.CURDIR} post-build: # Relink e2fsck statically - We need to make sure that tools for the root file # system are statically linked against anything that is outside the root fs, # else we're in trouble if e2fsck is needed for boot: # (we don't use e2fsck.static, since we can link libc.so dynamically) cd ${WRKSRC}/e2fsck && ${RM} -f e2fsck \ && ${GMAKE} e2fsck \ STATIC_LIBS="../lib/libext2fs.a ../lib/libcom_err.a \ ../lib/libblkid.a ../lib/libuuid.a" \ LIBINTL=${libintl} # Regression check: avoid a port (not upstream!) regression from 1.40.5, # check that e2fsck isn't dynalinked against anything but libc.so: @${ECHO_CMD} -n "===> checking that e2fsck depends on no shared objects beyond libc and libgcc: " @a="$$(ldd ${WRKSRC}/e2fsck/e2fsck 2>/dev/null \ | ${GREP} -v 'not a dynamic executable' \ | ${GREP} '=>' \ | ${AWK} '{print $$3;}' \ | ${EGREP} -v '^/lib/libgcc(_s)?\.so\.' \ | ${GREP} -v '^/lib/libc\.so\.' || :)"; \ if test "x$$a" = "x" ; then echo 'PASS' ; else \ echo 'FAIL' ; echo '===> e2fsck depends on:' ; echo "$$a" ; exit 1 ; fi # Update translation binary files .if ${PORT_OPTIONS:MNLS} cd ${WRKSRC}/po && ${GMAKE} update-gmo .endif # Build fsck(8) wrapper ${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -s ${LIBS} \ -o ${WRKSRC}/fsck_ext2fs ${FILESDIR}/fsck_ext2fs.c # While the ${MAKE} check can take a minute on an end user's system, the # correctness of tools such as e2fsck is critical to the health of the # file systems. The upstream is not using any *BSD as his development # system, and therefore let's exercise due diligence in running the self- # test on each and every system and not just package building hosts. # There have been subtle failures induced by Linux-isms in the past. # -- Matthias Andree, package maintainer, 2007-09-18 @${ECHO_CMD} '===> Running e2fsprogs self-test suite' cd ${WRKSRC}/tests && ${MKDIR} ${WRKDIR}/tmp && ${GMAKE} -j${MAKE_JOBS_NUMBER} check TMPDIR=${WRKDIR}/tmp \ || { head -n30000 ${WRKSRC}/tests/*.failed 2>/dev/null ; exit 1 ; } post-install: ${INSTALL_PROGRAM} ${WRKSRC}/fsck_ext2fs ${PREFIX}/sbin/ ${INSTALL_MAN} ${FILESDIR}/fsck_ext2fs.8 ${PREFIX}/man/man8/ .if ${PORT_OPTIONS:MDOCS} ${MKDIR} ${DOCSDIR} .for i in ${PORTDOCS} ${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR} .endfor .endif PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${ECHO_MSG} ; ${CAT} ${PKGMESSAGE} ; ${ECHO_MSG} # the next line closes .if ${MASTERDIR} == ${.CURDIR} .endif .include