[Bug 213446] Configurable verbose build output

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Jan 15 02:43:53 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213446

--- Comment #25 from lightside <lightside at gmx.com> ---
Created attachment 178899
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=178899&action=edit
The custom.bsd.port.mk file to use for BSDPORTMK variable

People, who interested to solve this issue on user level, may create wrappers
for build utilities. For example:
cmake:
-8<--
#!/bin/sh

if [ -z "$ALLOW_VERBOSE" ] || [ -n "$LESS_VERBOSE" ]; then
        args=$(echo -n "$@" | sed
's/-\<DCMAKE_VERBOSE_MAKEFILE[:[:alnum:]]*=[[:alnum:]]*\>//gI')
elif [ -n "$FLAG_VERBOSE" ]; then
        args="$@ $FLAG_VERBOSE"
else
        args="$@"
fi

/path/to/cmake $args
-->8-
gmake (but some issue(s) possible with VPATH):
-8<--
#!/bin/sh

if [ -z "$ALLOW_VERBOSE" ] || [ -n "$LESS_VERBOSE" ]; then
        args=$(echo -n "$@" | sed 's/\<V=[[:alnum:]]*\>//gI ;
s/\<VERBOSE=[[:alnum:]]*\>//gI')
        unset BUILD_VERBOSE V VERBOSE
elif [ -n "$FLAG_VERBOSE" ]; then
        args="$@ $FLAG_VERBOSE"
else
        args="$@"
fi

/path/to/gmake $args
-->8-
ninja:
-8<--
#!/bin/sh

if [ -z "$ALLOW_VERBOSE" ] || [ -n "$LESS_VERBOSE" ]; then
        args=$(echo -n "$@" | sed 's/-\<v\>//g')
elif [ -n "$FLAG_VERBOSE" ]; then
        args="$@ $FLAG_VERBOSE"
else
        args="$@"
fi

/path/to/ninja $args
-->8-

Also, there is a possibility to define BSDPORTMK variable (e.g.
BSDPORTMK=/path/to/custom.bsd.port.mk in /etc/make.conf file) with path to
custom bsd.port.mk file, which filters needed variables (or for some other
purposes):
custom.bsd.port.mk:
-8<--
.include "${PORTSDIR}/Mk/bsd.port.mk"

.ifndef ALLOW_VERBOSE

.if !defined(_SET_LATE_CONFIGURE_ARGS_CHANGED) && defined(GNU_CONFIGURE) &&
defined(SET_LATE_CONFIGURE_ARGS)
_SET_LATE_CONFIGURE_ARGS_CHANGED=       yes
SET_LATE_CONFIGURE_ARGS+=       \
        if [ ! -z "`${CONFIGURE_CMD} --help 2>&1 | ${GREP} --
'--enable-silent-rules'`" ]; then \
        _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --enable-silent-rules" ;
fi ;
.endif

.if !defined(_CMAKE_ARGS_CHANGED) && defined(_INCLUDE_USES_CMAKE_MK) &&
defined(CMAKE_ARGS)
_CMAKE_ARGS_CHANGED=    yes
CMAKE_ARGS+=    -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
.endif

.if !defined(_NINJA_MAKE_ARGS_CHANGED) && defined(_INCLUDE_USES_NINJA_MK) &&
defined(MAKE_ARGS)
_NINJA_MAKE_ARGS_CHANGED=       yes
MAKE_ARGS:=     ${MAKE_ARGS:N-v}
.endif

.if !defined(_WAF_MAKE_ARGS_CHANGED) && defined(_INCLUDE_USES_WAF_MK) &&
defined(MAKE_ARGS)
_WAF_MAKE_ARGS_CHANGED= yes
MAKE_ARGS:=     ${MAKE_ARGS:N--verbose}
.endif

.if !defined(_QMAKE_ARGS_CHANGED) && defined(_INCLUDE_USES_QMAKE_MK) &&
defined(QMAKE_VERBOSE) && defined(QMAKE_ARGS)
_QMAKE_ARGS_CHANGED=    yes
QMAKE_ARGS:=    ${QMAKE_ARGS:N-d}
.endif

.endif
-->8-
This was possible because of
https://svnweb.freebsd.org/base/head/share/mk/bsd.port.mk?revision=287436&view=markup#l20
-8<--
BSDPORTMK?= ${PORTSDIR}/Mk/bsd.port.mk
-->8-

For example, I found this useful for waf build system, where mutlimedia/mpv
port builds 8 times faster (on my configuration) with less verbose build
output, compared to full verbose build output:
-8<--
# time make -C /usr/ports/multimedia/mpv build
<...>
88.732u 16.573s 0:36.56 288.0%  19218+338k 1+62io 0pf+0w
# make -C /usr/ports/multimedia/mpv clean
<...>
# time make -C /usr/ports/multimedia/mpv ALLOW_VERBOSE=1 build
331.393u 43.463s 4:53.40 127.7% 5144+212k 0+62io 0pf+0w
-->8-

Build times for other systems may vary (or almost the same).

I attached custom.bsd.port.mk file, just in case, but its contents may be
outdated by changes in ports framework. Therefore, you may use it on your own
risk.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-ports-bugs mailing list