Tweak devel/p5-Cdk version 5.20120324_1
[dports.git] / sysutils / e2fsprogs / Makefile
1 # Created by: Maxim Sobolev <sobomax@FreeBSD.org>
2 # $FreeBSD$
3
4 PORTNAME=       e2fsprogs
5 PORTVERSION=    1.43.3
6 PORTREVISION?=  3
7 CATEGORIES?=    sysutils
8 MASTER_SITES=   KERNEL_ORG/linux/kernel/people/tytso/${PORTNAME}/v${PORTVERSION}
9
10 MAINTAINER?=    mandree@FreeBSD.org
11 COMMENT?=       Utilities & library to manipulate ext2/3/4 filesystems
12
13 LICENSE=        GPLv2
14
15 PORTSCOUT=      ignore  # cannot handle the version in the directory
16
17 BROKEN_aarch64= Fails to link: missing sbrk
18
19 USES=           cpe gmake pkgconfig tar:xz
20 CPE_VENDOR=     e2fsprogs_project
21 USE_CSTD=       gnu99
22 USE_LDCONFIG=   yes
23 GNU_CONFIGURE=  yes
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
29
30 .if !defined(MASTERDIR)
31 OPTIONS_DEFINE=         DOCS NLS
32 OPTIONS_EXCLUDE+=       EXAMPLES
33
34 BUILD_DEPENDS+= gdd:sysutils/coreutils
35
36 PORTDOCS=       NOTICE README RELEASE-NOTES SUBMITTING-PATCHES
37
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)
47 .endif
48
49 PKGDEINSTALL=   ${PKGINSTALL}
50
51 MAKE_ARGS+=     V=1
52
53 .include <bsd.port.options.mk>
54
55 .if ${PORT_OPTIONS:MNLS}
56 USES+=          gettext iconv:build
57 .endif
58
59 .if empty(PORT_OPTIONS:MNOTESTS) && ${MASTERDIR} == ${.CURDIR}
60 USES+=          perl5
61 USE_PERL5=      build
62 .endif
63
64 .include <bsd.port.pre.mk>
65
66 .if ${PORT_OPTIONS:MNLS}
67 PLIST_SUB=      NLS=""
68 . if empty(ICONV_LIB)
69 libintl=        "${LOCALBASE}/lib/libintl.a"
70 . else
71 libintl=        "${LOCALBASE}/lib/libintl.a ${LOCALBASE}/lib/libiconv.a"
72 . endif
73 .else
74 CONFIGURE_ARGS+=--disable-nls
75 PLIST_SUB=      NLS="@comment "
76 libintl=
77 .endif
78
79 # d_fallocate_blkmap appears to fail on some systems for unknown reasons.
80 post-patch::
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)
88 .for i in \
89                 d_fallocate_blkmap \
90                 f_baddir \
91                 f_bbfile \
92                 f_convert_bmap \
93                 f_detect_junk \
94                 f_inode_ea_collision \
95                 f_lpffile \
96                 f_no_cache_corrupt_inode \
97                 f_opt_extent \
98                 j_corrupt_descr_csum \
99                 m_bigjournal \
100                 m_hugefile_slack \
101                 m_offset \
102                 m_raid_opt \
103                 r_32to64bit \
104                 r_32to64bit_expand_full \
105                 r_32to64bit_meta \
106                 r_32to64bit_move_itable \
107                 r_64to32bit \
108                 r_64to32bit_meta \
109                 r_expand_full \
110                 r_min_itable \
111                 t_change_uuid_mounted \
112                 t_dangerous \
113                 t_disable_changed_csum_seed_mounted \
114                 t_disable_mcsum \
115                 t_disable_mcsum_noinitbg \
116                 t_disable_mcsum_yesinitbg \
117                 t_enable_mcsum \
118                 t_enable_mcsum_initbg \
119                 t_iexpand_full \
120                 t_iexpand_mcsum \
121                 t_uninit_bg_rm \
122                 u_dryrun \
123                 u_mke2fs_opt_offset
124         @${MV} ${WRKSRC}/tests/${i} ${WRKSRC}/tests/disabled_test-${i}
125 .endfor
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
129 .for i in m_rootdir
130         @${MV} ${WRKSRC}/tests/${i} ${WRKSRC}/tests/disabled_test-${i}
131 .endfor
132 .endif
133 .endif
134
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.
138
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
141 .endif
142
143 pre-build:
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
147
148 .if ${PORT_OPTIONS:MPARALLELTESTS}
149 _CHECK_JOBS=${_MAKE_JOBS}
150 .else
151 _CHECK_JOBS=
152 .endif
153
154 .if !defined(TMPDIR)
155 _checkaddargs=TMPDIR=${WRKDIR}/tmp
156 .endif
157
158 post-build:
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' \
173             | ${GREP} '=>' \
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
181 .endif
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 ; }
198 .else
199         @${ECHO_CMD} '===>  SKIPPING e2fsprogs self-test suite (DISCOURAGED!)'
200 .endif
201
202 post-install:
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}
210 .endfor
211 .endif
212 #
213 # the next line closes .if ${MASTERDIR} == ${.CURDIR}
214 .endif
215
216 .include <bsd.port.post.mk>