This is an automated email from the ASF dual-hosted git repository.
rjung pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 56bbec8d0d Add back wine support for building the Windows installer.
56bbec8d0d is described below
commit 56bbec8d0d0ce392fc1a4c6c470f9dee7521dc13
Author: Rainer Jung <[email protected]>
AuthorDate: Mon Mar 10 12:01:54 2025 +0100
Add back wine support for building the Windows installer.
The NSIS callback in tomcat.nsi no longer calls ant, but instead
only copies the Uninstall.exe. The signing is done in a separate
ant step wiithout callback use.
The temporary installer created in the first step is no longer
actually used, the step is only needed to trigger the Uninstaller
creation.
Possible further improvement: speed up temporary installer creation
by using mote ";ifndef UNINSTALLONLY" in installer parts.
---
build.xml | 145 +++++++++++++++++++++++++++++----------------
res/install-win/tomcat.nsi | 33 +++++++++--
2 files changed, 122 insertions(+), 56 deletions(-)
diff --git a/build.xml b/build.xml
index c1420c922b..510201be3e 100644
--- a/build.xml
+++ b/build.xml
@@ -301,11 +301,6 @@
<filter token="JASPIC_SPEC_VERSION" value="${jaspic.spec.version}"/>
</filterset>
- <!-- Path filter set -->
- <filterset id="path.filters">
- <filter token="BASEDIR" value="${basedir}"/>
- </filterset>
-
<!-- Files to change line endings for depending on target platform -->
<patternset id="text.files" >
<include name="**/INSTALLLICENSE"/>
@@ -2658,9 +2653,28 @@ You may need a custom build of makensis. Instructions
for this may be found in B
<include name="*.xml"/>
</fileset>
</copy>
+ <property name="uninstall.exe" value="${tomcat.dist}/Uninstall.exe"/>
+ <pathconvert property="win.uninstall.exe">
+ <path location="${uninstall.exe}"/>
+ </pathconvert>
+ <condition property="os.uninstall.exe" value="${win.uninstall.exe}"
else="${uninstall.exe}">
+ <or>
+ <os family="windows"/>
+ <isset property="wine.ok"/>
+ </or>
+ </condition>
+ <condition property="os.cmd.copy" value="copy" else="cp">
+ <or>
+ <os family="windows"/>
+ <isset property="wine.ok"/>
+ </or>
+ </condition>
<copy file="res/install-win/tomcat.nsi" tofile="${tomcat.dist}/tomcat.nsi"
overwrite="true" encoding="ISO-8859-1">
<filterset refid="version.filters"/>
- <filterset refid="path.filters"/>
+ <filterset>
+ <filter token="OS.CMD.COPY" value="${os.cmd.copy}"/>
+ <filter token="OS.UNINSTALL.EXE" value="${os.uninstall.exe}"/>
+ </filterset>
</copy>
<fixcrlf srcdir="${tomcat.dist}" eol="crlf" encoding="ISO-8859-1"
fixlast="false">
<patternset refid="text.files"/>
@@ -2671,6 +2685,41 @@ You may need a custom build of makensis. Instructions
for this may be found in B
</touch>
</target>
+ <target name="-uninstaller-wine"
+ if="${wine.ok}"
+ unless="${skip.installer}">
+ <exec dir="${tomcat.dist}" executable="wine" osfamily="unix">
+ <arg value="${nsis.executable.windows}"/>
+ <arg value="/DNSISDIR=${nsis.bin.home}"/>
+ <arg value="/DUNINSTALLONLY"/>
+ <arg value="/V2"/>
+ <arg value="tomcat.nsi"/>
+ </exec>
+ </target>
+
+ <target name="-uninstaller-makensis"
+ if="nsis.executable.unix"
+ unless="${skip.installer}">
+ <echo message="Using makensis: ${nsis.executable.unix} version
[${nsis.executable.unix.version}]"/>
+ <exec dir="${tomcat.dist}" executable="${nsis.executable.unix}"
osfamily="unix">
+ <arg value="-DNSISDIR=${nsis.bin.home}"/>
+ <arg value="-DUNINSTALLONLY"/>
+ <arg value="-V2"/>
+ <arg value="tomcat.nsi"/>
+ </exec>
+ </target>
+
+ <target name="-uninstaller-build"
+ depends="-installer-prep,-uninstaller-wine,-uninstaller-makensis"
+ unless="${skip.installer}">
+ <exec dir="${tomcat.dist}" executable="${nsis.executable.windows}"
osfamily="windows">
+ <arg value="/DNSISDIR=${nsis.bin.home}"/>
+ <arg value="/DUNINSTALLONLY"/>
+ <arg value="/V2"/>
+ <arg value="tomcat.nsi"/>
+ </exec>
+ </target>
+
<target name="-installer-wine"
if="${wine.ok}"
unless="${skip.installer}">
@@ -2703,30 +2752,20 @@ You may need a custom build of makensis. Instructions
for this may be found in B
</exec>
</target>
- <target name="installer"
- description="Builds and optionally signs the Windows installer"
- depends="-installer-build"
- unless="${skip.installer}">
- <move file="${tomcat.dist}/tomcat-installer.exe"
tofile="${tomcat.release}/v${version}/bin/${final.name}.exe"/>
- <!-- .exe has changed so need to redo checksums and OpenPGP signature -->
- <delete file="${tomcat.release}/v${version}/bin/${final.name}.exe.asc"/>
- <delete file="${tomcat.release}/v${version}/bin/${final.name}.exe.sha512"/>
- <hashAndSign file="${tomcat.release}/v${version}/bin/${final.name}.exe"/>
- </target>
-
- <!-- Called via a callback in the NSIS installer script -->
- <target name="jsign-installer"
- depends="setup-jsign"
- if="${do.codesigning}">
- <echo>Signing ${tomcat.dist}/tomcat-installer.exe</echo>
- <!-- Copy pre-existing detachced signature to signing directory -->
- <copy file="res/install-win/tomcat-installer.exe.sig"
- tofile="${tomcat.dist}/tomcat-installer.exe.sig"
+ <target name="-file-jsign"
+ depends="setup-jsign">
+ <fail unless="file" />
+ <fail unless="dir" />
+ <fail unless="savedir" />
+ <echo>Signing ${file} in ${dir}, using/saving signature in
${savedir}</echo>
+ <!-- Copy pre-existing detached signature to signing directory -->
+ <copy file="${savedir}/${file}.sig"
+ todir="${dir}"
failonerror="false"/>
<!-- If the detached signature doesn't exist, this will sign the file -->
<!-- and create the detached signature. If the detached signature does -->
<!-- exist it will be attached to the file. -->
- <jsign file="${tomcat.dist}/tomcat-installer.exe"
+ <jsign file="${dir}/${file}"
storepass="${codesigning.storepass}"
storetype="${codesigning.storetype}"
keypass="${codesigning.keypass}"
@@ -2736,32 +2775,38 @@ You may need a custom build of makensis. Instructions
for this may be found in B
tsmode="RFC3161"
detached="true"/>
<!-- Move detached signature to source tree -->
- <move file="${tomcat.dist}/tomcat-installer.exe.sig"
tofile="res/install-win/tomcat-installer.exe.sig"/>
+ <move file="${dir}/${file}.sig" todir="${savedir}"/>
</target>
- <!-- Called via a callback in the NSIS installer script -->
- <target name="jsign-uninstaller"
- depends="setup-jsign"
- if="${do.codesigning}">
- <echo>Signing ${codesigning.file_to_sign}</echo>
- <!-- Copy pre-existing detachced signature to signing directory -->
- <copy file="res/install-win/Uninstall.exe.sig"
- tofile="${codesigning.file_to_sign}.sig"
- failonerror="false"/>
- <!-- If the detached signature doesn't exist, this will sign the file -->
- <!-- and create the detached signature. If the detached signature does -->
- <!-- exist it will be attached to the file. -->
- <jsign file="${codesigning.file_to_sign}"
- storepass="${codesigning.storepass}"
- storetype="${codesigning.storetype}"
- keypass="${codesigning.keypass}"
- alias="${codesigning.alias}"
- alg="${codesigning.digest}"
- tsaurl="http://ts.ssl.com"
- tsmode="RFC3161"
- detached="true"/>
- <!-- Move detached signature to source tree -->
- <move file="${codesigning.file_to_sign}.sig"
tofile="res/install-win/Uninstall.exe.sig"/>
+ <target name="-uninstaller-jsign"
+ if="${do.codesigning}"
+ unless="${skip.installer}">
+ <antcall target="-file-jsign" >
+ <param name="dir" value="${tomcat.dist}" />
+ <param name="file" value="Uninstall.exe" />
+ <param name="savedir" value="res/install-win" />
+ </antcall>
+ </target>
+
+ <target name="-installer-jsign"
+ if="${do.codesigning}"
+ unless="${skip.installer}">
+ <antcall target="-file-jsign" >
+ <param name="dir" value="${tomcat.dist}" />
+ <param name="file" value="tomcat-installer.exe" />
+ <param name="savedir" value="res/install-win" />
+ </antcall>
+ </target>
+
+ <target name="installer"
+ description="Builds and optionally signs the Windows installer"
+
depends="-uninstaller-build,-uninstaller-jsign,-installer-build,-installer-jsign"
+ unless="${skip.installer}">
+ <move file="${tomcat.dist}/tomcat-installer.exe"
tofile="${tomcat.release}/v${version}/bin/${final.name}.exe"/>
+ <!-- .exe has changed so need to redo checksums and OpenPGP signature -->
+ <delete file="${tomcat.release}/v${version}/bin/${final.name}.exe.asc"/>
+ <delete file="${tomcat.release}/v${version}/bin/${final.name}.exe.sha512"/>
+ <hashAndSign file="${tomcat.release}/v${version}/bin/${final.name}.exe"/>
</target>
<target name="-local-makensis-set-properties">
diff --git a/res/install-win/tomcat.nsi b/res/install-win/tomcat.nsi
index 5419addb67..6b0a50c3a2 100644
--- a/res/install-win/tomcat.nsi
+++ b/res/install-win/tomcat.nsi
@@ -17,7 +17,11 @@
Unicode true
-OutFile tomcat-installer.exe
+!ifdef UNINSTALLONLY
+ OutFile "tempinstaller.exe"
+!else
+ OutFile tomcat-installer.exe
+!endif
;Compression options
CRCCheck on
@@ -113,9 +117,11 @@ Var ServiceInstallLog
Page custom CheckUserType
!insertmacro MUI_PAGE_FINISH
+!ifdef UNINSTALLONLY
;Uninstall Page order
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
+!endif
;Language
!insertmacro MUI_LANGUAGE English
@@ -156,8 +162,9 @@ Var ServiceInstallLog
InstType Minimum
InstType Full
- !finalize 'ant -f @BASEDIR@/build.xml jsign-installer'
- !uninstfinalize 'ant -f @BASEDIR@/build.xml -Dcodesigning.file_to_sign=%1
jsign-uninstaller'
+!ifdef UNINSTALLONLY
+ !uninstfinalize '@OS.CMD.COPY@ %1 Uninstall.exe'
+!endif
ReserveFile /plugin System.dll
ReserveFile /plugin nsDialogs.dll
@@ -197,9 +204,6 @@ Section "Core" SecTomcatCore
SetOutPath $INSTDIR\webapps\ROOT
File /r webapps\ROOT\*.*
- ;Create uninstaller
- WriteUninstaller "$INSTDIR\Uninstall.exe"
-
Call configure
DetailPrint "Using Jvm: $JavaHome"
@@ -338,6 +342,12 @@ Section -post
Call createShortcuts
${EndIf}
+ !ifndef UNINSTALLONLY
+ SetOutPath $INSTDIR
+ ; this packages the signed uninstaller
+ File Uninstall.exe
+ !endif
+
WriteRegStr HKLM "SOFTWARE\Apache Software
Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" "InstallPath"
$INSTDIR
WriteRegStr HKLM "SOFTWARE\Apache Software
Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" "Version" @VERSION@
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache
Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" \
@@ -419,6 +429,14 @@ Function ReadFromConfigIni
FunctionEnd
Function .onInit
+ !ifdef UNINSTALLONLY
+ ; If UNINSTALLONLY is defined, then we aren't supposed to do anything
except write out
+ ; the installer. This is better than processing a command line option as
it means
+ ; this entire code path is not present in the final (real) installer.
+ WriteUninstaller "$EXEDIR\Uninstall.exe"
+ Quit
+ !endif
+
${GetParameters} $R0
ClearErrors
@@ -1126,6 +1144,8 @@ FunctionEnd
;--------------------------------
;Uninstaller Section
+!ifdef UNINSTALLONLY
+
Section Uninstall
${If} $TomcatServiceName == ""
@@ -1255,4 +1275,5 @@ FunctionEnd
FindClose $1
FunctionEnd
+!endif
;eof
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]