Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Makefile.in
/config.h
/config.cache
/configure
/conf_nut_report_feature
/config.nut_report_feature.log
/conf??????/
/dir.??????/
/dir?.???????/
Expand Down
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ endif !HAVE_CPPCHECK
# Automatically generate the ChangeLog from Git logs:
MAINTAINERCLEANFILES += ChangeLog

# CI builds can leave a log of selected features:
MAINTAINERCLEANFILES += config.nut_report_feature.log

# Older boundary of the ChangeLog commits range
# It can be a tag ('v2.2.0'), a commit hash, a date, ...
# See gitrevisions for more information on specifying ranges
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ artifacts:
- path: config.log
name: config.log of recent build of NUT for Windows

- path: config.nut_report_feature.log
name: config.nut_report_feature.log of recent build of NUT for Windows

# Example optional cache (depends on file change):
# - C:\msys64 -> appveyor.yml
cache:
Expand Down
3 changes: 3 additions & 0 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp
CONFIG_OPTS+=("PKG_CONFIG_PATH=${DEFAULT_PKG_CONFIG_PATH}")
fi

CONFIG_OPTS+=("--enable-keep_nut_report_feature")
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
CONFIG_OPTS+=("--sysconfdir=${BUILD_PREFIX}/etc/nut")
CONFIG_OPTS+=("--with-udev-dir=${BUILD_PREFIX}/etc/udev")
Expand Down Expand Up @@ -1793,6 +1794,7 @@ bindings)
# enable whatever is auto-detectable (except docs), and highlight
# any warnings if we can.
${CONFIGURE_SCRIPT} --enable-Wcolor \
--enable-keep_nut_report_feature \
--with-all=auto --with-cgi=auto --with-serial=auto \
--with-dev=auto --with-doc=skip \
--with-nut_monitor=auto --with-pynut=auto \
Expand Down Expand Up @@ -1853,6 +1855,7 @@ cross-windows-mingw*)

SOURCEMODE="out-of-tree" \
MAKEFLAGS="$PARMAKE_FLAGS" \
KEEP_NUT_REPORT_FEATURE="true" \
./build-mingw-nut.sh $cmd
;;

Expand Down
18 changes: 13 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ AC_C_BIGENDIAN
AC_C_INLINE
AC_C_FLEXIBLE_ARRAY_MEMBER
AC_C_VARARRAYS

NUT_ARG_ENABLE([keep_nut_report_feature],
[Request that we keep config.nut_report_feature.log (normally deleted by configure script after displaying)],
[no])
dnl Note: the compiler/pragma/attr methods below are custom for NUT codebase:
NUT_COMPILER_FAMILY
dnl Help find warning/error details in a wall of text (must be processed before NUT_COMPILER_FAMILY_FLAGS):
Expand Down Expand Up @@ -2475,16 +2479,17 @@ case "${systemdsystemunitdir}" in
yes|auto|"")
AS_IF([test x"$have_PKG_CONFIG" = xyes],
[systemdsystemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null`" && test -n "$systemdsystemunitdir" || systemdsystemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir libsystemd 2>/dev/null`"],
[AS_IF([test "${withval}" = yes],
[AC_MSG_ERROR([--with-systemdsystemunitdir=${withval} was requested, but PKG_CONFIG could not be queried for the system settings])])
[AS_IF([test "${systemdsystemunitdir}" = yes],
[AC_MSG_ERROR([--with-systemdsystemunitdir=${systemdsystemunitdir} was requested, but PKG_CONFIG could not be queried for the system settings])])
systemdsystemunitdir=""
])
;;
no)
systemdsystemunitdir=""
;;
*)
systemdsystemunitdir="${withval}"
AS_IF([test -d "${systemdsystemunitdir}"], [],
[AC_MSG_WARN([--with-systemdsystemunitdir='${systemdsystemunitdir}' was requested, but that location does not currently exist in build environment - just so you know...])])
;;
esac
if test "${systemdsystemunitdir}" = "auto" ; then systemdsystemunitdir=""; fi
Expand Down Expand Up @@ -2518,7 +2523,8 @@ if test -n "${systemdsystemunitdir}"; then
systemdshutdowndir=""
;;
*)
systemdshutdowndir="${withval}"
AS_IF([test -d "${systemdshutdowndir}"], [],
[AC_MSG_WARN([--with-systemdshutdowndir='${systemdshutdowndir}' was requested, but that location does not currently exist in build environment - just so you know...])])
;;
esac
fi
Expand Down Expand Up @@ -2549,7 +2555,8 @@ case "${systemdtmpfilesdir}" in
systemdtmpfilesdir=""
;;
*)
systemdtmpfilesdir="${withval}"
AS_IF([test -d "${systemdtmpfilesdir}"], [],
[AC_MSG_WARN([--with-systemdtmpfilesdir='${systemdtmpfilesdir}' was requested, but that location does not currently exist in build environment - just so you know...])])
;;
esac
if test "${systemdtmpfilesdir}" = "auto" ; then systemdtmpfilesdir=""; fi
Expand Down Expand Up @@ -3575,4 +3582,5 @@ m4_foreach_w([SCRIPTFILE], [

AC_OUTPUT

NUT_REPORT_COMPILERS
NUT_PRINT_FEATURE_REPORT
42 changes: 27 additions & 15 deletions m4/nut_report_feature.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ dnl AM_CONDITIONAL)
AC_DEFUN([NUT_REPORT],
[ if test -z "${nut_report_feature_flag}"; then
nut_report_feature_flag="1"
ac_clean_files="${ac_clean_files} conf_nut_report_feature"
echo > conf_nut_report_feature
echo "Configuration summary:" >> conf_nut_report_feature
echo "======================" >> conf_nut_report_feature
dnl By (legacy) default we remove this report file
dnl For CI we want to publish its artifact
dnl Manageable by "--enable-keep_nut_report_feature"
AS_IF([test x"${nut_enable_keep_nut_report_feature-}" = xyes],
[AC_MSG_NOTICE([Will keep config.nut_report_feature.log])],
[ac_clean_files="${ac_clean_files} config.nut_report_feature.log"])
echo "NUT Configuration summary:" > config.nut_report_feature.log
echo "==========================" >> config.nut_report_feature.log
echo "" >> config.nut_report_feature.log
fi
echo "$1: $2" >> conf_nut_report_feature
echo "* $1: $2" >> config.nut_report_feature.log
])

AC_DEFUN([NUT_REPORT_FEATURE],
Expand All @@ -27,16 +32,23 @@ AC_DEFUN([NUT_REPORT_FEATURE],
fi
])

AC_DEFUN([NUT_PRINT_FEATURE_REPORT],
AC_DEFUN([NUT_REPORT_COMPILERS],
[
cat conf_nut_report_feature
(echo ""
echo "NUT Compiler settings:"
echo "----------------------"
echo ""
printf '* CC \t: %s\n' "$CC"
printf '* CFLAGS \t: %s\n' "$CFLAGS"
printf '* CXX \t: %s\n' "$CXX"
printf '* CXXFLAGS\t: %s\n' "$CXXFLAGS"
printf '* CPP \t: %s\n' "$CPP"
printf '* CPPFLAGS\t: %s\n' "$CPPFLAGS"
) >> config.nut_report_feature.log
])

echo "------------------"
echo "Compiler settings:"
printf 'CC \t:%s\n' "$CC"
printf 'CFLAGS \t:%s\n' "$CFLAGS"
printf 'CXX \t:%s\n' "$CXX"
printf 'CXXFLAGS\t:%s\n' "$CXXFLAGS"
printf 'CPP \t:%s\n' "$CPP"
printf 'CPPFLAGS\t:%s\n' "$CPPFLAGS"
AC_DEFUN([NUT_PRINT_FEATURE_REPORT],
[
echo ""
cat config.nut_report_feature.log
])
25 changes: 18 additions & 7 deletions scripts/Windows/build-mingw-nut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,29 @@ if [ "$cmd" == "all64" ] || [ "$cmd" == "b64" ] || [ "$cmd" == "all32" ] || [ "$
BUILD_FLAG="--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE`"
export CC="$ARCH-gcc"
export CXX="$ARCH-g++"
export PATH="/usr/$ARCH/bin:$PATH"

# TODO: Detect/parameterize?
# This prefix is currently valid for mingw packaging in Debian/Ubuntu.
ARCH_PREFIX="/usr/$ARCH"
export PATH="${ARCH_PREFIX}/bin:$PATH"

# Note: _WIN32_WINNT>=0x0600 is needed for inet_ntop in mingw headers
# and the value 0xffff is anyway forced into some components at least
# by netsnmp cflags.
export CFLAGS+=" -D_POSIX=1 -D_POSIX_C_SOURCE=200112L -I/usr/$ARCH/include/ -D_WIN32_WINNT=0xffff"
export CXXFLAGS+=" -D_POSIX=1 -D_POSIX_C_SOURCE=200112L -I/usr/$ARCH/include/ -D_WIN32_WINNT=0xffff"
export LDFLAGS+=" -L/usr/$ARCH/lib/"
export CFLAGS+=" -D_POSIX=1 -D_POSIX_C_SOURCE=200112L -I${ARCH_PREFIX}/include/ -D_WIN32_WINNT=0xffff"
export CXXFLAGS+=" -D_POSIX=1 -D_POSIX_C_SOURCE=200112L -I${ARCH_PREFIX}/include/ -D_WIN32_WINNT=0xffff"
export LDFLAGS+=" -L${ARCH_PREFIX}/lib/"

KEEP_NUT_REPORT_FEATURE_FLAG=""
if [ x"${KEEP_NUT_REPORT_FEATURE-}" = xtrue ]; then
KEEP_NUT_REPORT_FEATURE_FLAG="--enable-keep_nut_report_feature"
fi

# Note: installation prefix here is "/" and desired INSTALL_DIR
# location is passed to `make install` as DESTDIR below.
$CONFIGURE_SCRIPT $HOST_FLAG $BUILD_FLAG --prefix=/ \
PKG_CONFIG_PATH=/usr/$ARCH/lib/pkgconfig \
$KEEP_NUT_REPORT_FEATURE_FLAG \
PKG_CONFIG_PATH=${ARCH_PREFIX}/lib/pkgconfig \
--without-pkg-config --with-all=auto \
--without-systemdsystemunitdir \
--with-pynut=app \
Expand Down Expand Up @@ -139,8 +150,8 @@ if [ "$cmd" == "all64" ] || [ "$cmd" == "b64" ] || [ "$cmd" == "all32" ] || [ "$
# Cover dependencies for nut-scanner (not pre-linked)
# Note: lib*snmp*.dll not listed below, it is
# statically linked into binaries that use it
(cd $INSTALL_DIR/bin && cp -pf /usr/$ARCH/bin/{libgnurx,libusb,libltdl}*.dll .) || true
(cd $INSTALL_DIR/bin && cp -pf /usr/$ARCH/lib/libwinpthread*.dll .) || true
(cd $INSTALL_DIR/bin && cp -pf ${ARCH_PREFIX}/bin/{libgnurx,libusb,libltdl}*.dll .) || true
(cd $INSTALL_DIR/bin && cp -pf ${ARCH_PREFIX}/lib/libwinpthread*.dll .) || true

# Steam-roll over all executables/libs we have here and copy
# over resolved dependencies from the cross-build environment:
Expand Down