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

Makefile.am: install-win-bundle-thirdparty DLL check: cover libexecdir #2624

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
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
25 changes: 19 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ if HAVE_WINDOWS
# Then hardlink libraries for sbin... (alternative: all bins in one dir)
# TOTHINK: Are there more dirs to consider? So far we cover bindir, sbindir and
# driverexecdir (e.g. some Linux distros place drivers to /lib/nut while tools
# and daemons are in /usr/bin and /usr/sbin), and cgiexecdir; anything else?..
# and daemons are in /usr/bin and /usr/sbin), and cgiexecdir, and occasional
# helpers like "sockdebug.exe" in libexecdir; anything else?..
# Note we hold existance of cgiexecdir as optional, but the name is expected to
# be defined. Other dirs are "just assumed" to exist (that we are not packaging
# some NUT build without drivers/tools/daemons). Subject to change if needed.
Expand All @@ -575,15 +576,15 @@ install-win-bundle-thirdparty:
( cd '$(DESTDIR)' || exit ; \
DESTDIR="" '$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->bin $$D" 2>&1 ; \
echo " DLL->bin $$D" 2>&1 ; \
cp -pf "$$D" './$(bindir)/' ; \
done ; \
) || exit ; \
( if test x"$(bindir)" = x"$(sbindir)" ; then exit 0 ; fi ; \
cd '$(DESTDIR)/$(sbindir)' || exit ; \
'$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->sbin $$D" 2>&1 ; \
echo " DLL->sbin $$D" 2>&1 ; \
ln -f '$(DESTDIR)/$(bindir)'/"`basename "$$D"`" ./ ; \
done ; \
) || exit ; \
Expand All @@ -592,7 +593,7 @@ install-win-bundle-thirdparty:
cd '$(DESTDIR)/$(driverexecdir)' || exit ; \
'$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->drv $$D" 2>&1 ; \
echo " DLL->drv $$D" 2>&1 ; \
ln -f '$(DESTDIR)/$(bindir)'/"`basename "$$D"`" ./ ; \
done ; \
) || exit ; \
Expand All @@ -603,18 +604,30 @@ install-win-bundle-thirdparty:
cd '$(DESTDIR)/$(cgiexecdir)' || exit ; \
'$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->cgi $$D" 2>&1 ; \
echo " DLL->cgi $$D" 2>&1 ; \
ln -f '$(DESTDIR)/$(bindir)'/"`basename "$$D"`" ./ ; \
done ; \
) || exit
( if test x"$(libexecdir)" = x"$(bindir)" ; then exit 0 ; fi ; \
if test x"$(libexecdir)" = x"$(sbindir)" ; then exit 0 ; fi ; \
if test x"$(libexecdir)" = x"$(driverexecdir)" ; then exit 0 ; fi ; \
if test x"$(libexecdir)" = x"$(cgiexecdir)" ; then exit 0 ; fi ; \
cd '$(DESTDIR)/$(libexecdir)' || exit ; \
'$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->libexec $$D" 2>&1 ; \
ln -f '$(DESTDIR)/$(bindir)'/"`basename "$$D"`" ./ ; \
done ; \
) || exit ; \
@echo "CHECKING if any executable files were installed to locations other than those covered by this recipe, so might not have needed DLLs bundled near them" >&2 ; \
relbindir="`echo './$(bindir)/' | sed 's,//*,/,g'`" ; \
relsbindir="`echo './$(sbindir)/' | sed 's,//*,/,g'`" ; \
reldriverexecdir="`echo './$(driverexecdir)/' | sed 's,//*,/,g'`" ; \
relcgiexecdir="`echo './$(cgiexecdir)/' | sed 's,//*,/,g'`" ; \
rellibexecdir="`echo './$(libexecdir)/' | sed 's,//*,/,g'`" ; \
cd '$(DESTDIR)' || exit ; \
find . -type f | grep -Ei '\.(exe|dll)$$' \
| grep -vE "^($${relbindir}|$${relsbindir}|$${reldriverexecdir}|$${relcgiexecdir})" \
| grep -vE "^($${relbindir}|$${relsbindir}|$${reldriverexecdir}|$${relcgiexecdir}|$${rellibexecdir})" \
| ( RES=0 ; while IFS= read LINE ; do echo "$$LINE" ; RES=1; done; exit $$RES )

else
Expand Down
Loading