Skip to content

Commit

Permalink
scripts/Windows/build-mingw-nut.sh et al: extend to use "nut_build_${…
Browse files Browse the repository at this point in the history
…ARCH}" and "nut_install_${ARCH}" dirs by default

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jan 9, 2025
1 parent 216f290 commit a3d9b40
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 38 deletions.
6 changes: 6 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,12 @@ relocated into new `shutdown.default` INSTCMD definitions. [#2670]
as a service, have a help message, pass debug verbosity to launched NUT
programs...) and add a man page for it. [issue #2432, PR #2446]
- the `scripts/Windows/build-mingw-nut.sh` helper script was extended to
use `nut_build_${ARCH}` and `nut_install_${ARCH}` directories by default,
with the older `nut_build` and `nut_install` short names becoming just a
symbolic link to the latest executed build: this should help compare the
differences of 32/64-bit builds, without them stepping on each other's toes.
- the `PyNUTClient` module should no longer rely on presence of a `telnetlib`
module in the build or execution environment (deprecated in Python 3.11,
removed since Python 3.13). [#2183]
Expand Down
3 changes: 2 additions & 1 deletion docs/nut.dict
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
personal_ws-1.1 en 3277 utf-8
personal_ws-1.1 en 3278 utf-8
AAC
AAS
ABI
Expand Down Expand Up @@ -2550,6 +2550,7 @@ optiups
oq
os
ostream
other's
otheruser
outliers
ovmf
Expand Down
6 changes: 4 additions & 2 deletions scripts/Windows/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
winevent.h
winevent.rc
MSG00409.bin
/nut_build/
/nut_install/
/nut_build_*/
/nut_install_*/
/nut_build
/nut_install
16 changes: 8 additions & 8 deletions scripts/Windows/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -808,13 +808,13 @@ release would fare, starting from a git checkout, use this:
(cd scripts/Windows/ && SOURCEMODE=dist ./build-mingw-nut.sh all64)
If everything goes fine, you will find a NUT installation tree in 'nut_install'
sub-directory. Note the script accepts some parameters e.g. for 32/64 bit build
targets.
sub-directory (technically, a symbolic link to `nut_install_${ARCH}` directory).
Note the script accepts some parameters e.g. for 32/64 bit build targets.
NOTE: For other ways of building and packaging, it might make sense for
a packaged delivery to also `make install DESTDIR=.../nut_install` from
the sources of dependency projects built above, or at least to copy the
built `*.dll` files from `${PREFIX}/bin` to `nut_install/bin`. For those
dependencies that are listed above, the script does this best-effort
activity (does not fail if some are missing, but running the programs
can fail later).
a packaged delivery to also `make install DESTDIR=.../nut_install_${ARCH}`
from the sources of dependency projects built above, or at least to copy
the built `*.dll` files from `${PREFIX}/bin` to `nut_install_${ARCH}/bin`.
For those dependencies that are listed above, the script does this best-effort
activity (does not fail if some are missing, but running the programs can fail
later).
72 changes: 45 additions & 27 deletions scripts/Windows/build-mingw-nut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ SCRIPTDIR="`cd "$SCRIPTDIR" && pwd`"

DLLLDD_SOURCED=true . "${SCRIPTDIR}/dllldd.sh"

# default to update source then build

# These paths are somewhat related:
[ -n "${WINDIR-}" ] || WINDIR="$(pwd)"
[ -n "${TOP_DIR-}" ] || TOP_DIR="$WINDIR/../.."

# These may be located elsewhere:
[ -n "${BUILD_DIR-}" ] || BUILD_DIR="$WINDIR/nut_build"
[ -n "${INSTALL_DIR-}" ] || INSTALL_DIR="$WINDIR/nut_install"

# This should match the tarball and directory name,
# if a stable version is used:
[ -n "$VER_OPT" ] || VER_OPT=2.8.2
Expand All @@ -32,13 +22,49 @@ DEBUG=true
# those DLLs should correspond to same architecture selection
cmd=all32
if [ -n "$1" ] ; then
cmd=$1
cmd="$1"
fi

[ -n "$SOURCEMODE" ] || SOURCEMODE="out-of-tree"
if [ "$cmd" == "all64" ] || [ "$cmd" == "b64" ] || [ "$cmd" == "all32" ] || [ "$cmd" == "b32" ] ; then
ARCH="x86_64-w64-mingw32"
if [ "$cmd" == "all32" ] || [ "$cmd" == "b32" ] ; then
ARCH="i686-w64-mingw32"
fi
else
echo "Usage:"
echo " $0 [all64 | b64 | all32 | b32]"
echo " Default: 'all32'"
echo "Optionally export SOURCEMODE=[stable|dist|out-of-tree]"
case "${cmd}" in
-h|--help|help) exit 0 ;;
*) exit 1 ;;
esac
fi

# These paths are somewhat related:
[ -n "${WINDIR-}" ] || WINDIR="$(pwd)"
[ -n "${TOP_DIR-}" ] || TOP_DIR="$WINDIR/../.."

# These may be located elsewhere:
[ -n "${BUILD_DIR-}" ] || BUILD_DIR="$WINDIR/nut_build_${ARCH}"
[ -n "${INSTALL_DIR-}" ] || INSTALL_DIR="$WINDIR/nut_install_${ARCH}"

# Convenience symlink to find the latest completed build workspace and
# installed results; not used by the script other than updating the symlink:
[ -n "${BUILD_DIR_SYMLINK-}" ] || BUILD_DIR_SYMLINK="$WINDIR/nut_build"
[ -n "${INSTALL_DIR_SYMLINK-}" ] || INSTALL_DIR_SYMLINK="$WINDIR/nut_install"

rm -rf "$BUILD_DIR" "$INSTALL_DIR" "$BUILD_DIR_SYMLINK" "$INSTALL_DIR_SYMLINK"
if [ x"$BUILD_DIR" != x"$BUILD_DIR_SYMLINK" ] ; then
ln -fsr "$BUILD_DIR" "$BUILD_DIR_SYMLINK"
fi
if [ x"$INSTALL_DIR" != x"$INSTALL_DIR_SYMLINK" ] ; then
ln -fsr "$INSTALL_DIR" "$INSTALL_DIR_SYMLINK"
fi

rm -rf "$BUILD_DIR" "$INSTALL_DIR"
CONFIGURE_SCRIPT="./configure"
[ -n "$SOURCEMODE" ] || SOURCEMODE="out-of-tree"

case "$SOURCEMODE" in
stable)
# FIXME
Expand All @@ -57,7 +83,7 @@ dist)
rm -f nut-?.?.?*.tar.gz
[ -s Makefile ] || { ./autogen.sh && ./configure; }
make dist
SRC_ARCHIVE=$(ls -1 nut-?.?.?*.tar.gz | sort -n | tail -1)
SRC_ARCHIVE="$(ls -1 nut-?.?.?*.tar.gz | sort -n | tail -1)"
cd scripts/Windows
tar -xzf "../../$SRC_ARCHIVE"
mv nut-?.?.?* "$BUILD_DIR"
Expand All @@ -76,18 +102,13 @@ out-of-tree)
;;
esac

cd "$BUILD_DIR" || exit

if [ -z "$INSTALL_WIN_BUNDLE" ]; then
echo "NOTE: You might want to export INSTALL_WIN_BUNDLE=true to use main NUT Makefile"
echo "recipe for DLL co-bundling (default: false to use logic maintained in $0"
fi >&2

if [ "$cmd" == "all64" ] || [ "$cmd" == "b64" ] || [ "$cmd" == "all32" ] || [ "$cmd" == "b32" ] ; then
ARCH="x86_64-w64-mingw32"
if [ "$cmd" == "all32" ] || [ "$cmd" == "b32" ] ; then
ARCH="i686-w64-mingw32"
fi
do_build_mingw_nut() {
cd "$BUILD_DIR" || exit

HOST_FLAG="--host=$ARCH"
# --build needs to be specified, beside of --host, to avoid Warning
Expand Down Expand Up @@ -197,9 +218,6 @@ if [ "$cmd" == "all64" ] || [ "$cmd" == "b64" ] || [ "$cmd" == "all32" ] || [ "$

echo "$0: install phase complete ($?)" >&2
cd ..
else
echo "Usage:"
echo " $0 [all64 | b64 | all32 | b32]"
echo " Default: 'all32'"
echo "Optionally export SOURCEMODE=[stable|dist|out-of-tree]"
fi
}

do_build_mingw_nut

0 comments on commit a3d9b40

Please sign in to comment.