Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Appveyor CI to use NUT libmodbus fork #2778

Merged
merged 38 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
40fd96f
scripts/Windows/build-mingw-prereqs.sh: add a way to provide_libmodbu…
jimklimov Jan 20, 2025
388e86e
scripts/Windows/build-mingw-prereqs.sh: use libmodbus branch fix-ming…
jimklimov Jan 20, 2025
c727c05
scripts/Windows/build-mingw-prereqs.sh: minimize local filesystem cha…
jimklimov Jan 20, 2025
b2b858c
scripts/Windows/build-mingw-prereqs.sh: only chmod/remove builddir if…
jimklimov Jan 20, 2025
7883a6c
appveyor.yml: skip installing packaged mingw-w64-x86_64-libmodbus-git…
jimklimov Jan 20, 2025
735033f
scripts/Windows/build-mingw-prereqs.sh: comment progression through t…
jimklimov Jan 20, 2025
cb7be08
scripts/Windows/build-mingw-prereqs.sh: revise determination of ARCH …
jimklimov Jan 20, 2025
99b20bd
scripts/Windows/build-mingw-prereqs.sh: revise determination of PREFI…
jimklimov Jan 20, 2025
48d4eb9
scripts/Windows/build-mingw-prereqs.sh: avoid use of "true" program […
jimklimov Jan 20, 2025
cbb1769
scripts/Windows/build-mingw-prereqs.sh: document example usage for no…
jimklimov Jan 20, 2025
a61bf2b
scripts/Windows/build-mingw-prereqs.sh: document that libmodbus is al…
jimklimov Jan 20, 2025
24829c5
appveyor.yml: force rebuild/reinstall of custom prereqs (TBD: disable…
jimklimov Jan 20, 2025
be93552
scripts/Windows/build-mingw-prereqs.sh: if component "configure" scri…
jimklimov Jan 20, 2025
b378401
scripts/Windows/build-mingw-prereqs.sh: report the prepared environme…
jimklimov Jan 21, 2025
22ce6ef
scripts/Windows/build-mingw-prereqs.sh: fetch with curl non-verbosely
jimklimov Jan 22, 2025
eae72ec
scripts/Windows/build-mingw-prereqs.sh: normalize away extra slashes …
jimklimov Jan 22, 2025
0280953
appveyor.yml: use faster compression in APPVEYOR_CACHE_ENTRY_ZIP_ARGS
jimklimov Jan 22, 2025
92273e9
appveyor.yml: parallelize spellcheck a bit more
jimklimov Jan 22, 2025
34afb9d
appveyor.yml: pepper CCACHE location into PATH for explicit MAKE call…
jimklimov Jan 22, 2025
0901f35
appveyor.yml: TEMPORARY: Constrain to only re-build NUT prerequisites…
jimklimov Jan 22, 2025
8e2a2fa
scripts/Windows/build-mingw-prereqs.sh: only fix up PATH if PREFIX/bi…
jimklimov Jan 22, 2025
9d7ebf2
scripts/Windows/build-mingw-prereqs.sh: fix shell expansion style for…
jimklimov Jan 22, 2025
ccec6de
scripts/Windows/build-mingw-prereqs.sh: fix shell expansion style for…
jimklimov Jan 22, 2025
46b0947
scripts/Windows/build-mingw-prereqs.sh: report resulting PATH
jimklimov Jan 22, 2025
647bed9
scripts/Windows/build-mingw-prereqs.sh: inject MSYS2 ccache symlink l…
jimklimov Jan 22, 2025
8482953
Revert "appveyor.yml: TEMPORARY: Constrain to only re-build NUT prere…
jimklimov Jan 22, 2025
1c66a8c
Revert "appveyor.yml: force rebuild/reinstall of custom prereqs (TBD:…
jimklimov Jan 22, 2025
12370fb
scripts/Windows/build-mingw-prereqs.sh: report *.pc files in the "pro…
jimklimov Jan 22, 2025
d0e3b7a
m4/nut_check_libmodbus.m4: tests on Windows may require -lws2_32 and/…
jimklimov Jan 22, 2025
b3a3520
m4/nut_check_libmodbus.m4: remember tuned depLIBS and depCFLAGS if re…
jimklimov Jan 22, 2025
25d8dcb
configure.ac, drivers/Makefile.am: fix condition for linking apc_modb…
jimklimov Jan 22, 2025
a0028fe
m4/nut_check_libmodbus.m4, m4/nut_check_libusb.m4: comment to remind …
jimklimov Jan 22, 2025
b6f2f82
m4/nut_check_libusb.m4: enable libusb-1.0 on mingw/MSYS2 if we also w…
jimklimov Jan 22, 2025
fe6637a
appveyor.yml: when installing, "set -e" to fail if any script actions…
jimklimov Jan 22, 2025
d128665
ci_build.sh: introduce CANBUILD_WITH_LIBMODBUS_USB tweak
jimklimov Jan 23, 2025
2c02d11
appveyor.yml: pass CANBUILD_WITH_LIBMODBUS_USB tweak to ci_build.sh
jimklimov Jan 23, 2025
adfffd4
ci_build.sh: fix "[" tests to use "=" not "==" for comparisons
jimklimov Jan 23, 2025
8c851c8
ci_build.sh: also handle CANBUILD_WITH_LIBMODBUS_USB in parameter-les…
jimklimov Jan 23, 2025
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
17 changes: 9 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ platform: x64
# https://www.appveyor.com/docs/build-cache/
environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: -t7z -m0=lzma -mx=9
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: -t7z -m0=lzma -mx=6
CCACHE_DIR: /home/appveyor/.ccache

# https://github.com/networkupstools/nut/blob/Windows-v2.8.0-1/docs/config-prereqs.txt#L951
Expand All @@ -47,7 +47,8 @@ install:
C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -Syuu"
- cmd: |
REM Prerequisites for NUT per https://github.com/networkupstools/nut/blob/master/docs/config-prereqs.txt :
C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -S --needed base-devel mingw-w64-x86_64-toolchain autoconf-wrapper automake-wrapper libtool mingw-w64-x86_64-libltdl gcc ccache mingw-w64-x86_64-ccache git aspell aspell-en python mingw-w64-x86_64-python-pygments mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-neon libneon-devel mingw-w64-x86_64-libmodbus-git mingw-w64-x86_64-libgd mingw-w64-x86_64-cppunit"
C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -S --needed base-devel mingw-w64-x86_64-toolchain autoconf-wrapper automake-wrapper libtool mingw-w64-x86_64-libltdl gcc ccache mingw-w64-x86_64-ccache git aspell aspell-en python mingw-w64-x86_64-python-pygments mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-neon libneon-devel mingw-w64-x86_64-libgd mingw-w64-x86_64-cppunit"
REM SKIP mingw-w64-x86_64-libmodbus-git : we custom-build one with USB support
- cmd: |
REM Assorted stats after package processing:
C:\msys64\usr\bin\bash -lc "date -u; ls -la / ; du -ksx / ; date -u; du -ks /var/cache/pacman/pkg; date -u"
Expand All @@ -68,7 +69,7 @@ before_build:
set CHERE_INVOKING=yes
REM Start a 64 bit Mingw environment:
set MSYSTEM=MINGW64
C:\msys64\usr\bin\bash -lc "date -u; export MSYS2_PATH ; bash ./scripts/Windows/build-mingw-prereqs.sh"
C:\msys64\usr\bin\bash -lc 'date -u; export MSYS2_PATH ; PATH="/mingw64/lib/ccache/bin:/mingw64/bin:$PATH" bash ./scripts/Windows/build-mingw-prereqs.sh'


build_script:
Expand All @@ -77,7 +78,7 @@ build_script:
set CHERE_INVOKING=yes
REM Start a 64 bit Mingw environment:
set MSYSTEM=MINGW64
C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" CI_SKIP_CHECK=true ./ci_build.sh'
C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" CI_SKIP_CHECK=true CANBUILD_WITH_LIBMODBUS_USB=yes ./ci_build.sh'


after_build:
Expand All @@ -96,9 +97,9 @@ test_script:
REM Start a 64 bit Mingw environment:
set MSYSTEM=MINGW64
REM Start Mingw-based integration and unit checks:
C:\msys64\usr\bin\bash -lc 'date -u; NUT_STATEPATH="C:\\Users\\appveyor\\AppData\\Local\\Temp\\nut-test"; mkdir -p "${NUT_STATEPATH}"; export NUT_STATEPATH; PATH="/mingw64/bin:$PATH" make -s check || bash -lc "for F in tests/*.log tests/*.trs ; do echo \"===---=== $F :\"; cat \"$F\"; done; exit 1;" '
REM Start a Mingw-based documentation spellcheck:
C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" make -s -j 4 spellcheck'
C:\msys64\usr\bin\bash -lc 'date -u; NUT_STATEPATH="C:\\Users\\appveyor\\AppData\\Local\\Temp\\nut-test"; mkdir -p "${NUT_STATEPATH}"; export NUT_STATEPATH; PATH="/mingw64/lib/ccache/bin:/mingw64/bin:$PATH" make -s check || bash -lc "for F in tests/*.log tests/*.trs ; do echo \"===---=== $F :\"; cat \"$F\"; done; exit 1;" '
REM Start a Mingw-based documentation spellcheck (note that "make check" above could cover some documents in path of artifact delivery, but maybe not all that we have):
C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/lib/ccache/bin:/mingw64/bin:$PATH" make -s -j 8 spellcheck'


after_test:
Expand All @@ -109,7 +110,7 @@ after_test:
set MSYSTEM=MINGW64
REM Oh the joys of shell scripting with strings passed through CMD:
REM Note: currently Python installation path with MSYS is buggy [#1584]
C:\msys64\usr\bin\bash -lc 'date -u; if ! rm -rf ".inst" ; then echo "WARNING: Failed to clean away .inst" ; fi ; PATH="/mingw64/bin:$PATH" make -s install-win-bundle DESTDIR="`pwd`/.inst/NUT-for-Windows-x86_64-SNAPSHOT-%APPVEYOR_BUILD_VERSION%" ; ln -fs "NUT-for-Windows-x86_64-SNAPSHOT-%APPVEYOR_BUILD_VERSION%" ./.inst/NUT-for-Windows-x86_64-SNAPSHOT ; ( cd .inst/NUT-for-Windows-x86_64-SNAPSHOT ; find . -ls ; )'
C:\msys64\usr\bin\bash -lc 'date -u; set -e ; if ! rm -rf ".inst" ; then echo "WARNING: Failed to clean away .inst" ; fi ; PATH="/mingw64/lib/ccache/bin:/mingw64/bin:$PATH" make -s install-win-bundle DESTDIR="`pwd`/.inst/NUT-for-Windows-x86_64-SNAPSHOT-%APPVEYOR_BUILD_VERSION%" ; ln -fs "NUT-for-Windows-x86_64-SNAPSHOT-%APPVEYOR_BUILD_VERSION%" ./.inst/NUT-for-Windows-x86_64-SNAPSHOT ; ( cd .inst/NUT-for-Windows-x86_64-SNAPSHOT ; find . -ls ; ) ; date -u'
cd .inst
7z a ../NUT-for-Windows-x86_64-SNAPSHOT-%APPVEYOR_BUILD_VERSION%.7z NUT*
- cmd: |
Expand Down
16 changes: 14 additions & 2 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,12 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp
CONFIG_OPTS+=("--with-nut_monitor=force")
CONFIG_OPTS+=("--with-pynut=auto")

# Primarily here to ensure libusb-1.0 use on MSYS2/mingw
# when 0.1 is available too
if [ "${CANBUILD_WITH_LIBMODBUS_USB-}" = yes ] ; then
CONFIG_OPTS+=("--with-modbus+usb=yes")
fi

# Similarly for nut-scanner which requires libltdl which
# is not ubiquitous on CI workers. So unless agent labels
# declare it should be capable, err on the safe side:
Expand Down Expand Up @@ -1532,7 +1538,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp
# below depending on scenario
autogen_get_CONFIGURE_SCRIPT

if [ "$NO_PKG_CONFIG" == "true" ] && [ "$CI_OS_NAME" = "linux" ] && (command -v dpkg) ; then
if [ "$NO_PKG_CONFIG" = "true" ] && [ "$CI_OS_NAME" = "linux" ] && (command -v dpkg) ; then
# This should be done in scratch containers...
echo "NO_PKG_CONFIG==true : BUTCHER pkg-config package for this test case" >&2
sudo dpkg -r --force all pkg-config
Expand Down Expand Up @@ -2059,7 +2065,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp
[ -n "$CI_TIME" ] && echo "`date`: listing files installed into the custom DESTDIR..." && \
find "$INST_PREFIX" -ls || true

if [ "$DO_DISTCHECK" == "no" ] ; then
if [ "$DO_DISTCHECK" = "no" ] ; then
echo "Skipping distcheck (doc generation is disabled, it would fail)"
else
[ -z "$CI_TIME" ] || echo "`date`: Starting distcheck of currently tested project..."
Expand Down Expand Up @@ -2132,6 +2138,12 @@ bindings)
--disable-force-nut-version-header \
--enable-check-NIT --enable-maintainer-mode)

# Primarily here to ensure libusb-1.0 use on MSYS2/mingw
# when 0.1 is available too
if [ "${CANBUILD_WITH_LIBMODBUS_USB-}" = yes ] ; then
CONFIG_OPTS+=("--with-modbus+usb=yes")
fi

# Not default for parameter-less build, to prevent "make check-NIT"
# from somehow interfering with the running daemons.
if [ x"${INPLACE_RUNTIME-}" = xtrue ] || [ x"${BUILD_TYPE-}" = xinplace ] ; then
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,7 @@ AS_IF([test "${nut_with_modbus}" != "no"], [
dnl detection method (if nut_have_libmodbus_usb=="yes")
NUT_REPORT_DRV([build Modbus drivers with RTU USB support], [${nut_have_libmodbus_usb}])
])
AM_CONDITIONAL(WITH_MODBUS_USB, [test "${nut_with_modbus}" = "yes" && test "${nut_have_libmodbus_usb}" = yes && test "${nut_with_usb}" = yes && test "${nut_with_modbus_and_usb}" != "no"])

dnl ----------------------------------------------------------------------
dnl Check for with-ipmi, and --with-freeipmi (or --with-openipmi)
Expand Down
2 changes: 1 addition & 1 deletion drivers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ adelsystem_cbi_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS)
# for USB connections. Legacy versions work for Serial and TCP links.
apc_modbus_SOURCES = apc_modbus.c
apc_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS)
if WITH_USB
if WITH_MODBUS_USB
apc_modbus_SOURCES += $(LIBUSB_IMPL) hidparser.c usb-common.c
apc_modbus_LDADD += $(LIBUSB_LIBS)
endif
Expand Down
39 changes: 36 additions & 3 deletions m4/nut_check_libmodbus.m4
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,33 @@ if test -z "${nut_have_libmodbus_seen}"; then
CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}"
LIBS="${LIBS_ORIG} ${depLIBS}"
AC_CHECK_HEADERS(modbus.h, [nut_have_libmodbus=yes], [nut_have_libmodbus=no], [AC_INCLUDES_DEFAULT])
AS_IF([test x"${nut_have_libmodbus}" = xyes ], [
AC_CHECK_FUNCS(modbus_new_tcp, [], [
nut_have_libmodbus=no
AC_REQUIRE([NUT_CHECK_SOCKETLIB])
AS_IF([test x"${NETLIBS-}" != x], [
AC_MSG_NOTICE([Retry detection of libmodbus TCP support with NETLIBS])
unset ac_cv_func_modbus_new_tcp
LIBS="${LIBS} ${NETLIBS}"
AC_CHECK_FUNCS(modbus_new_tcp, [
nut_have_libmodbus=yes
depLIBS="${depLIBS} ${NETLIBS}"
], [
AS_IF([test x"${NETLIBS_GETADDRS-}" != x], [
AC_MSG_NOTICE([Retry detection of libmodbus TCP support with NETLIBS and NETLIBS_GETADDRS])
unset ac_cv_func_modbus_new_tcp
LIBS="${LIBS} ${NETLIBS_GETADDRS}"
AC_CHECK_FUNCS(modbus_new_tcp, [
nut_have_libmodbus=yes
depLIBS="${depLIBS} ${NETLIBS} ${NETLIBS_GETADDRS}"
], [nut_have_libmodbus=no])
])
])
])
])
])
AS_IF([test x"${nut_have_libmodbus}" = xyes ], [
AC_CHECK_FUNCS(modbus_new_rtu, [], [nut_have_libmodbus=no])
AC_CHECK_FUNCS(modbus_new_tcp, [], [nut_have_libmodbus=no])
AC_CHECK_FUNCS(modbus_set_byte_timeout, [], [nut_have_libmodbus=no])
AC_CHECK_FUNCS(modbus_set_response_timeout, [], [nut_have_libmodbus=no])
])
Expand All @@ -88,12 +112,21 @@ if test -z "${nut_have_libmodbus_seen}"; then
dnl know we are not opposed to pulling it in.
dnl Static libmodbus builds do not refer to
dnl (shared) libusb for example.
dnl NOTE: Currently libusb-1.0 is required by
dnl libmodbus with rtu_usb additions. By our
dnl default, mingw/MSYS2 native builds prefer
dnl libusb-0.1(-compat) over libusb-1.0 if
dnl both are available - see nut_check_libusb.m4
AC_REQUIRE([NUT_CHECK_LIBUSB])
AC_MSG_NOTICE([Retry detection of libmodbus USB support])
AC_MSG_NOTICE([Retry detection of libmodbus USB support (may require libusb-1.0 specifically)])
CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
LIBS="$LIBS $LIBUSB_LIBS"
unset ac_cv_func_modbus_new_rtu_usb
AC_CHECK_FUNCS(modbus_new_rtu_usb, [nut_have_libmodbus_usb=yes], [
AC_CHECK_FUNCS(modbus_new_rtu_usb, [
nut_have_libmodbus_usb=yes
depCFLAGS="${depCFLAGS} ${LIBUSB_CFLAGS}"
depLIBS="${depLIBS} ${LIBUSB_LIBS}"
], [
AS_IF([test x"${nut_with_usb}" = xyes && test x"${nut_with_modbus}" = xyes && test x"${nut_have_libmodbus}" = xyes ], [
AC_MSG_WARN([Both --with-modbus and --with-usb were requested, and a libmodbus was found, but it seems to not support USB. You may require a custom build per https://github.com/networkupstools/nut/wiki/APC-UPS-with-Modbus-protocol])
])
Expand Down
14 changes: 10 additions & 4 deletions m4/nut_check_libusb.m4
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,20 @@ if test -z "${nut_have_libusb_seen}"; then
nut_usb_lib="(libusb-1.0)"
dnl ...except on Windows, where we support libusb-0.1(-compat)
dnl better so far (allow manual specification though, to let
dnl someone finally develop the on-par support):
dnl someone finally develop the on-par support), see also
dnl https://github.com/networkupstools/nut/issues/1507
dnl Note this may upset detection of libmodbus RTU USB support.
AS_IF([test x"${LIBUSB_0_1_VERSION}" != xnone], [
AS_CASE(["${target_os}"],
[*mingw*], [
AS_IF([test x"$build" = x"$host"], [
AC_MSG_NOTICE([mingw/MSYS2 native builds prefer libusb-0.1(-compat) over libusb-1.0 if both are available])
LIBUSB_VERSION="${LIBUSB_0_1_VERSION}"
nut_usb_lib="(libusb-0.1)"
AS_IF([test "${nut_with_modbus_and_usb}" = "yes"], [
AC_MSG_NOTICE(["Normally" mingw/MSYS2 native builds prefer libusb-0.1(-compat) over libusb-1.0 if both are available, but you requested --with-modbus+usb so preferring libusb-1.0 in this build])
], [
AC_MSG_NOTICE([mingw/MSYS2 native builds prefer libusb-0.1(-compat) over libusb-1.0 if both are available until https://github.com/networkupstools/nut/issues/1507 is solved])
LIBUSB_VERSION="${LIBUSB_0_1_VERSION}"
nut_usb_lib="(libusb-0.1)"
])
],[
AC_MSG_NOTICE([mingw cross-builds prefer libusb-1.0 over libusb-0.1(-compat) if both are available])
])
Expand Down
Loading
Loading