This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new bfdfba1f30 Add makensis as an option for building the Windows installer
bfdfba1f30 is described below
commit bfdfba1f30185bc4d41c6c3374d65dc03656b79e
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Feb 12 10:14:58 2025 +0000
Add makensis as an option for building the Windows installer
---
build.properties.default | 3 +
build.xml | 157 +++++++++++++++++++++++----------------------
res/install-win/tomcat.nsi | 37 +++--------
webapps/docs/changelog.xml | 4 ++
4 files changed, 99 insertions(+), 102 deletions(-)
diff --git a/build.properties.default b/build.properties.default
index 2eac1d0c76..0bea62d954 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -36,6 +36,9 @@ version.dev=-dev
# ----- Build tools -----
ant.version.required=1.10.2
+# Which tool to use for building Windows installer
+# on unix platform: wine or makensis.
+nsis.tool=wine
# ----- Build control flags -----
compile.debug=true
diff --git a/build.xml b/build.xml
index ec5822656a..8a22ce2d8a 100644
--- a/build.xml
+++ b/build.xml
@@ -301,6 +301,11 @@
<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"/>
@@ -2570,19 +2575,35 @@
<target name="-installer-pre-init">
<property environment="env" />
<condition property="wine.ok">
+ <or>
+ <and>
+ <equals arg1="${nsis.tool}" arg2="wine" forcestring="true"/>
+ <available file="wine" filepath="${env.PATH}" />
+ </and>
+ </or>
+ </condition>
+ <condition property="makensis.ok">
+ <or>
+ <and>
+ <equals arg1="${nsis.tool}" arg2="makensis" forcestring="true"/>
+ <available file="makensis" filepath="${env.PATH}" />
+ </and>
+ </or>
+ </condition>
+ <condition property="installer.ok">
<or>
<os family="windows" />
- <available file="wine" filepath="${env.PATH}" />
- <isset property="skip.installer"/>
+ <isset property="wine.ok"/>
+ <isset property="makensis.ok"/>
</or>
</condition>
</target>
- <target name="-installer-init" depends="-installer-pre-init"
unless="${wine.ok}">
- <fail message="The executable wine was not found on the current path.
-Wine is required to build the Windows installer when running a release build on
-a non-Windows platform. To skip building the Windows installer, set the
-skip.installer property in build.properties" />
+ <target name="-installer-init" depends="-installer-pre-init"
unless="${installer.ok}">
+ <fail message="The executable ${nsis.tool} was not found on the current
path.
+Either wine or makensis are required to build the Windows installer on a
non-Windows platform.
+Choose the tool by setting property nsis.tool in build.properties.
+To skip building the Windows installer, set the skip.installer property in
build.properties" />
</target>
<target name="-installer-prep"
@@ -2593,13 +2614,8 @@ skip.installer property in build.properties" />
<include name="*.bmp" />
<include name="*.ico" />
<include name="*.xml" />
- <include name="Uninstall.exe.sig" />
</fileset>
</copy>
- <copy file="res/install-win/tomcat-installer.exe.sig"
- tofile="${tomcat.release}/v${version}/bin/${final.name}.exe.sig"
- failonerror="false"
- quiet="true" />
<copy file="${nsis.installoptions.dll}" todir="${tomcat.dist}" />
<copy file="${nsis.nsexec.dll}" todir="${tomcat.dist}" />
<copy file="${nsis.nsisdl.dll}" todir="${tomcat.dist}" />
@@ -2607,6 +2623,7 @@ skip.installer property in build.properties" />
<copy file="${nsis.nsdialogs.dll}" todir="${tomcat.dist}" />
<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"/>
</copy>
<fixcrlf srcdir="${tomcat.dist}" eol="crlf"
encoding="ISO-8859-1" fixlast="false" >
@@ -2618,81 +2635,77 @@ skip.installer property in build.properties" />
</touch>
</target>
- <target name="-installer-create-tempinstaller"
- unless="skip.installer" depends="-installer-prep">
- <exec dir="${tomcat.dist}" executable="${nsis.exe}" osfamily="windows">
- <arg value="/DUNINSTALLONLY" />
- <arg value="/DNSISDIR=${nsis.home}" />
- <arg value="/V2" />
- <arg value="tomcat.nsi" />
- </exec>
- <exec dir="${tomcat.dist}" executable="wine" osfamily="unix">
+ <target name="-installer-wine" if="${wine.ok}">
+ <exec dir="${tomcat.dist}" executable="wine" osfamily="unix">
<arg value="${nsis.exe}" />
- <arg value="/DUNINSTALLONLY" />
<arg value="/DNSISDIR=${nsis.home}" />
<arg value="/V2" />
<arg value="tomcat.nsi" />
</exec>
</target>
- <target name="-installer-create-uninstaller"
- unless="skip.installer" depends="-installer-create-tempinstaller">
- <!-- Execute the temporary installer to create the uninstaller -->
- <exec dir="${tomcat.dist}" executable="${tomcat.dist}/tempinstaller.exe"
- osfamily="windows" />
- <exec dir="${tomcat.dist}" executable="wine" osfamily="unix">
- <arg value="${tomcat.dist}/tempinstaller.exe" />
+ <target name="-installer-makensis" if="${makensis.ok}">
+ <exec dir="${tomcat.dist}" executable="makensis" osfamily="unix">
+ <arg value="-DNSISDIR=${nsis.home}" />
+ <arg value="-V2" />
+ <arg value="tomcat.nsi" />
</exec>
- <!-- Reproducible builds: consistent timestamps for installer files -->
- <touch datetime="${tstamp.file}" pattern="yyyy-MM-dd HH:mm:ss">
- <fileset dir="${tomcat.dist}"/>
- </touch>
- </target>
-
- <target name="-installer-sign-uninstaller"
- unless="skip.installer"
depends="-installer-create-uninstaller,setup-jsign"
- if="${do.codesigning}">
- <!-- 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}/Uninstall.exe"
- storepass="${codesigning.storepass}"
- storetype="${codesigning.storetype}"
- keypass="${codesigning.keypass}"
- alias="${codesigning.alias}"
- alg="${codesigning.digest}"
- tsaurl="http://ts.ssl.com"
- tsmode="RFC3161"
- detached="true"/>
- <!-- Copy detached signature to source tree -->
- <copy file="${tomcat.dist}/Uninstall.exe.sig" todir="res/install-win"/>
- <!-- Reproducible builds: consistent timestamps for installer files -->
- <touch datetime="${tstamp.file}" pattern="yyyy-MM-dd HH:mm:ss">
- <fileset dir="${tomcat.dist}"/>
- </touch>
</target>
<target name="-installer" unless="skip.installer"
- depends="-installer-sign-uninstaller">
+ depends="-installer-prep,-installer-wine,-installer-makensis">
<exec dir="${tomcat.dist}" executable="${nsis.exe}" osfamily="windows">
<arg value="/DNSISDIR=${nsis.home}" />
<arg value="/V2" />
<arg value="tomcat.nsi" />
</exec>
- <exec dir="${tomcat.dist}" executable="wine" osfamily="unix">
- <arg value="${nsis.exe}" />
- <arg value="/DNSISDIR=${nsis.home}" />
- <arg value="/V2" />
- <arg value="tomcat.nsi" />
- </exec>
- <move file="${tomcat.dist}/tomcat-installer.exe"
tofile="${tomcat.release}/v${version}/bin/${final.name}.exe" />
- <hashAndSign file="${tomcat.release}/v${version}/bin/${final.name}.exe" />
</target>
<target name="installer-sign"
description="Builds and optionally signs the Windows installer"
- depends="-installer,setup-jsign" if="${do.codesigning}" >
- <jsign file="${tomcat.release}/v${version}/bin/${final.name}.exe"
+ depends="-installer" 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"
+ 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"
+ storepass="${codesigning.storepass}"
+ storetype="${codesigning.storetype}"
+ alias="${codesigning.alias}"
+ alg="${codesigning.digest}"
+ tsaurl="http://timestamp.digicert.com"
+ 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"/>
+ </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}"
@@ -2701,14 +2714,8 @@ skip.installer property in build.properties" />
tsaurl="http://ts.ssl.com"
tsmode="RFC3161"
detached="true" />
- <!-- Copy detached signature to source tree -->
- <copy file="${tomcat.release}/v${version}/bin/${final.name}.exe.sig"
- tofile="res/install-win/tomcat-installer.exe.sig"/>
- <delete file="${tomcat.release}/v${version}/bin/${final.name}.exe.sig" />
- <!-- .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" />
+ <!-- Move detached signature to source tree -->
+ <move file="${codesigning.file_to_sign}.sig"
tofile="res/install-win/Uninstall.exe.sig"/>
</target>
<target name="release-version-check">
diff --git a/res/install-win/tomcat.nsi b/res/install-win/tomcat.nsi
index 424eb949a1..0d37e87ffb 100644
--- a/res/install-win/tomcat.nsi
+++ b/res/install-win/tomcat.nsi
@@ -17,11 +17,7 @@
Unicode true
-!ifdef UNINSTALLONLY
- OutFile "tempinstaller.exe"
-!else
- OutFile tomcat-installer.exe
-!endif
+OutFile tomcat-installer.exe
;Compression options
CRCCheck on
@@ -117,11 +113,9 @@ Var ServiceInstallLog
Page custom CheckUserType
!insertmacro MUI_PAGE_FINISH
- !ifdef UNINSTALLONLY
- ;Uninstall Page order
- !insertmacro MUI_UNPAGE_CONFIRM
- !insertmacro MUI_UNPAGE_INSTFILES
- !endif
+ ;Uninstall Page order
+ !insertmacro MUI_UNPAGE_CONFIRM
+ !insertmacro MUI_UNPAGE_INSTFILES
;Language
!insertmacro MUI_LANGUAGE English
@@ -162,6 +156,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'
+
ReserveFile System.dll
ReserveFile nsDialogs.dll
ReserveFile tomcat-users_1.xml
@@ -200,6 +197,9 @@ Section "Core" SecTomcatCore
SetOutPath $INSTDIR\webapps\ROOT
File /r webapps\ROOT\*.*
+ ;Create uninstaller
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+
Call configure
DetailPrint "Using Jvm: $JavaHome"
@@ -338,12 +338,6 @@ 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" \
@@ -425,14 +419,6 @@ 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
@@ -1140,7 +1126,6 @@ FunctionEnd
;--------------------------------
;Uninstaller Section
-!ifdef UNINSTALLONLY
Section Uninstall
${If} $TomcatServiceName == ""
@@ -1270,6 +1255,4 @@ FunctionEnd
FindClose $1
FunctionEnd
-!endif
-
;eof
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4cf51eaa67..da6bcab6aa 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -195,6 +195,10 @@
Add <code>org.apache.juli.JsonFormatter</code> to format log as one
line JSON documents. (remm)
</add>
+ <add>
+ Add <code>makensis</code> as an option for building the Installer for
+ Windows on non-Windows platforms. (rjung)
+ </add>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]