Commit 25459f75 for tesseract

commit 25459f75a013e8ce1b1616374d872d12f80d4a29
Author: Stefan Weil <sw@weilnetz.de>
Date:   Fri Nov 27 12:03:36 2026 +0100

    Don't pass an empty SIGNCODE to makensis

    nsis/Makefile.am always ran makensis with -DSIGNCODE=$(SIGNCODE).
    Without SIGNCODE this still defines the symbol, with an empty value,
    and tesseract.nsi then runs !finalize and !uninstfinalize with a
    command which is only the name of the installer or the uninstaller.
    Both commands fail, and makensis reports that and goes on:

        UninstFinalize command returned 32256
        Finalize command returned 32512

    Pass the definition only when SIGNCODE is set.

    Tested with a cross build for the MSYS2 environment CLANG64: without
    SIGNCODE the two messages are gone, and with SIGNCODE set to a script
    which signs a file with osslsigncode the installer and the uninstaller
    in it are signed as before.

    Assisted-by: OpenCode / qwen3.8-27b-thinking (Alibaba Cloud)
    Assisted-by: Claude Fable 5.2 (Anthropic)
    Signed-off-by: Stefan Weil <sw@weilnetz.de>

diff --git a/nsis/Makefile.am b/nsis/Makefile.am
index 93ad1d05..7a480c7e 100644
--- a/nsis/Makefile.am
+++ b/nsis/Makefile.am
@@ -19,12 +19,17 @@ winpath.exe: winpath.cpp winpath_rc.o
 	$(CXX) -Os -o $@ $< winpath_rc.o
 	$(STRIP) --strip-unneeded $@

+# Pass SIGNCODE to makensis only when it is set. An empty definition
+# would still be defined for tesseract.nsi, which would then run
+# !finalize and !uninstfinalize with a command without a program.
+signcodeflags = $(if $(SIGNCODE),-DSIGNCODE=$(SIGNCODE),)
+
 winsetup: Plugins/x86-unicode/INetC.dll winpath.exe
 	case "$(host_cpu)" in \
 	aarch64) arch="-DW64 -DARM64";; \
 	x86_64) arch="-DW64";; \
 	*) arch="";; \
 	esac; \
-	makensis -DCROSSBUILD -DSHARED -DSIGNCODE=$(SIGNCODE) -DSRCDIR=$(top_srcdir) -DPREFIX=$(prefix) -DVERSION=${gitrev} $$arch -NOCD $(top_srcdir)/nsis/tesseract.nsi
+	makensis -DCROSSBUILD -DSHARED $(signcodeflags) -DSRCDIR=$(top_srcdir) -DPREFIX=$(prefix) -DVERSION=${gitrev} $$arch -NOCD $(top_srcdir)/nsis/tesseract.nsi

 endif