This is an automated email from the ASF dual-hosted git repository. rjung pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new 9dc5126fe3 Add back wine support for building the Windows installer. 9dc5126fe3 is described below commit 9dc5126fe3d836a77082acc00b423be884bc0034 Author: Rainer Jung <rainer.j...@kippdata.de> AuthorDate: Mon Mar 10 12:04:50 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 more ";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 2d2e697e57..8263314fa4 100644 --- a/build.xml +++ b/build.xml @@ -305,11 +305,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"/> @@ -2686,9 +2681,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"/> @@ -2699,6 +2713,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}"> @@ -2731,30 +2780,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}" @@ -2764,32 +2803,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 613330d8dc..fa70af02c0 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 @@ -114,9 +118,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 @@ -157,8 +163,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 @@ -198,9 +205,6 @@ Section "Core" SecTomcatCore SetOutPath $INSTDIR\webapps\ROOT File /r webapps\ROOT\*.* - ;Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" - Call configure DetailPrint "Using Jvm: $JavaHome" @@ -349,6 +353,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" \ @@ -430,6 +440,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 @@ -1234,6 +1252,8 @@ FunctionEnd ;-------------------------------- ;Uninstaller Section +!ifdef UNINSTALLONLY + Section Uninstall ${If} $TomcatServiceName == "" @@ -1368,4 +1388,5 @@ FunctionEnd FindClose $1 FunctionEnd +!endif ;eof --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org