Skip to content

Commit 406a824

Browse files
committed
Augment installer repo to specify major/minor/patch
We've decided that registry keys should be indexed by major.minor rather than major.minor.patch. Fix that up with this commit Also, since nsis doesn't do string replacements without the addition of a plugin (which I think we want to avoid using), we should pass in the version elements separately so they can be concatinated easily Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from #6)
1 parent 5d97c13 commit 406a824

File tree

3 files changed

+164
-149
lines changed

3 files changed

+164
-149
lines changed

Diff for: .github/workflows/windows-installer.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ on:
1414
type: string
1515
required: true
1616
description: The tag to build
17-
version:
17+
major:
1818
type: string
1919
required: true
20-
description: The version to assign the installer
20+
description: The major version to assign to the installer
21+
minor:
22+
type: string
23+
required: true
24+
description: The minor version to assign to the installer
25+
patch:
26+
type: string
27+
required: true
28+
description: The patch level to assign to the installer
2129
permissions:
2230
contents: read
2331

@@ -82,7 +90,7 @@ jobs:
8290
run: nmake /S DESTDIR=..\_install32 install
8391
- name: build installer
8492
working-directory: windows-installer
85-
run: nmake INSTVERSION=${{ github.event.inputs.version }} INSTCTX=openssl INSTBUILD32=../openssl/_install32 INSTBUILD64=../openssl/_install64 INSTLICENSE=../openssl/LICENSE.txt openssl-installer
93+
run: nmake INSTMAJOR=${{ github.event.inputs.major }} INSTMINOR=${{ github.event.inputs.minor }} INSTPATCH=${{ github.event.inputs.patch }} INSTCTX=openssl INSTBUILD32=../openssl/_install32 INSTBUILD64=../openssl/_install64 INSTLICENSE=../openssl/LICENSE.txt openssl-installer
8694
- name: Upload installer as artifact
8795
uses: actions/upload-artifact@v4
8896
with:

Diff for: windows-installer/Makefile

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
NISNOPTS=""
1+
NSISOPTS=/DMAJOR=$(INSTMAJOR) /DMINOR=$(INSTMINOR) /DPATCH=$(INSTPATCH)
22

3-
!IFDEF INSTVERSION
4-
NSISOPTS=$(NSISOPTS) /DVERSION=$(INSTVERSION)
5-
!ENDIF
63
!IFDEF INSTBUILD32
74
NSISOPTS=$(NSISOPTS) /DBUILD32=$(INSTBUILD32)
85
!ENDIF
@@ -14,6 +11,7 @@ NSISOPTS=$(NSISOPTS) /DLICENSE_FILE=$(INSTLICENSE)
1411
!ENDIF
1512
!IFDEF INSTCTX
1613
NSISOPTS=$(NSISOPTS) /DCTX=$(INSTCTX)
14+
!ENDIF
1715

1816
openssl-installer: openssl.nsi
1917
echo $(NSISOPTS)

Diff for: windows-installer/openssl.nsi

+151-142
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,151 @@
1-
2-
######################################################
3-
# NSIS windows installer script file
4-
#
5-
# Requirements: NSIS 3.0 must be installed with the MUI plugin
6-
# Usage notes:
7-
# This script expects to be executed from the directory it is
8-
# currently stored in. It expects a 32 bit and 64 bit windows openssl
9-
# build to be present in the ..\${BUILD32} and ..\${BUILD64} directories
10-
# respectively
11-
# ####################################################
12-
13-
!include "MUI.nsh"
14-
!include "winmessages.nsh"
15-
16-
!define PRODUCT_NAME "OpenSSL"
17-
18-
# The name of the output file we create when building this
19-
# NOTE version is passed with the /D option on the command line
20-
OutFile "openssl-${VERSION}-installer.exe"
21-
22-
# The name that will appear in the installer title bar
23-
NAME "${PRODUCT_NAME} ${VERSION}"
24-
25-
ShowInstDetails show
26-
27-
Var DataDir
28-
Var ModDir
29-
30-
Function .onInit
31-
StrCpy $INSTDIR "C:\Program Files\openssl-${VERSION}"
32-
FunctionEnd
33-
34-
# This section is run if installation of 32 bit binaries are selected
35-
36-
!ifdef BUILD64
37-
# This section is run if installation of the 64 bit binaries are selectd
38-
SectionGroup "64 Bit Installation"
39-
Section "64 Bit Binaries"
40-
SetOutPath $INSTDIR\x64\lib
41-
File /r "${BUILD64}\Program Files\OpenSSL\lib\"
42-
SetOutPath $INSTDIR\x64\bin
43-
File /r "${BUILD64}\Program Files\OpenSSL\bin\"
44-
SetOutPath "$INSTDIR\x64\Common Files"
45-
File /r "${BUILD64}\Program Files\Common Files\"
46-
SectionEnd
47-
Section "x64 Development Headers"
48-
SetOutPath $INSTDIR\x64\include
49-
File /r "${BUILD64}\Program Files\OpenSSL\include\"
50-
SectionEnd
51-
SectionGroupEnd
52-
!endif
53-
54-
!ifdef BUILD32
55-
# This section is run if installation of the 64 bit binaries are selectd
56-
SectionGroup "32 Bit Installation"
57-
Section "32 Bit Binaries"
58-
SetOutPath $INSTDIR\x32\lib
59-
File /r "${BUILD32}\Program Files (x86)\OpenSSL\lib\"
60-
SetOutPath $INSTDIR\x32\bin
61-
File /r "${BUILD32}\Program Files(x86)\OpenSSL\bin\"
62-
SetOutPath "$INSTDIR\x64\Common Files"
63-
File /r "${BUILD32}\Program Files (x86)\Common Files\"
64-
SectionEnd
65-
Section "x32 Development Headers"
66-
SetOutPath $INSTDIR\x32\include
67-
File /r "${BUILD32}\Program Files (x86)\OpenSSL\include\"
68-
SectionEnd
69-
SectionGroupEnd
70-
!endif
71-
72-
!ifdef BUILD64
73-
Section "Documentation"
74-
SetOutPath $INSTDIR\html
75-
File /r "${BUILD64}\Program Files\OpenSSL\html\"
76-
SectionEnd
77-
!endif
78-
79-
# Always install the uninstaller and set a registry key
80-
Section
81-
WriteUninstaller $INSTDIR\uninstall.exe
82-
SectionEnd
83-
84-
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
85-
!define openssl_hklm 'HKLM "SOFTWARE\OpenSSL-${VERSION}-${CTX}"'
86-
87-
# This is run on uninstall
88-
Section "Uninstall"
89-
RMDIR /r $INSTDIR
90-
DeleteRegValue ${openssl_hklm} OPENSSLDIR
91-
DeleteRegValue ${openssl_hklm} MODULESLDIR
92-
DeleteRegValue ${openssl_hklm} ENGINESDIR
93-
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
94-
SectionEnd
95-
96-
!insertmacro MUI_PAGE_WELCOME
97-
98-
!insertmacro MUI_PAGE_LICENSE ${LICENSE_FILE}
99-
100-
Function CheckRunUninstaller
101-
!ifdef BUILD64
102-
StrCpy $DataDir "$INSTDIR\x64\Common Files\SSL"
103-
StrCpy $ModDir "$INSTDIR\x64\lib\ossl-modules"
104-
!else
105-
StrCpy $DataDir "$INSTDIR\x32\Common Files\SSL"
106-
StrCpy $ModDir "$INSTDIR\x32\lib\ossl-modules"
107-
!endif
108-
ifFileExists $INSTDIR\uninstall.exe 0 +2
109-
ExecWait "$INSTDIR\uninstall.exe /S _?=$INSTDIR"
110-
111-
WriteRegExpandStr ${openssl_hklm} OPENSSLDIR "$DataDir"
112-
WriteRegExpandStr ${openssl_hklm} ENGINESDIR "$ModDir"
113-
WriteRegExpandStr ${openssl_hklm} MODULESDIR "$ModDir"
114-
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
115-
FunctionEnd
116-
!insertmacro MUI_PAGE_COMPONENTS
117-
118-
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckRunUninstaller
119-
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Installation Directory"
120-
!insertmacro MUI_PAGE_DIRECTORY
121-
122-
!define MUI_DIRECTORYPAGE_VARIABLE $DataDir
123-
!define MUI_DIRECTORYPAGE_TEXT_TOP "Select Configuration/Data Directory"
124-
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Configuration/Data Directory"
125-
!insertmacro MUI_PAGE_DIRECTORY
126-
127-
!insertmacro MUI_PAGE_INSTFILES
128-
129-
!insertmacro MUI_UNPAGE_WELCOME
130-
!insertmacro MUI_UNPAGE_CONFIRM
131-
!insertmacro MUI_UNPAGE_INSTFILES
132-
!insertmacro MUI_UNPAGE_FINISH
133-
134-
!insertmacro MUI_LANGUAGE "English"
135-
136-
!ifdef SIGN
137-
!define OutFileSignSHA1 "SignTool.exe sign /f ${SIGN} /p ${SIGNPASS} /fd sha1 /t http://timestamp.comodoca.com /v"
138-
!define OutFileSignSHA256 "SignTool.exe sign /f ${SIGN} /p ${SIGNPASS} /fd sha256 /tr http://timestamp.comodoca.com?td=sha256 /td sha256 /v"
139-
140-
!finalize "${OutFileSignSHA1} .\openssl-${VERSION}-installer.exe"
141-
!finalize "${OutFileSignSHA256} .\openssl-${VERSION}-installer.exe"
142-
!endif
1+
2+
######################################################
3+
# NSIS windows installer script file
4+
#
5+
# Requirements: NSIS 3.0 must be installed with the MUI plugin
6+
# Usage notes:
7+
# This script expects to be executed from the directory it is
8+
# currently stored in. It expects a 32 bit and 64 bit windows openssl
9+
# build to be present in the ..\${BUILD32} and ..\${BUILD64} directories
10+
# respectively
11+
# ####################################################
12+
13+
!include "MUI.nsh"
14+
!include "winmessages.nsh"
15+
16+
!define PRODUCT_NAME "OpenSSL"
17+
!define VERSION "${MAJOR}.${MINOR}.${PATCH}"
18+
19+
# The name of the output file we create when building this
20+
# NOTE major/minor/patch values are passed with the /D option
21+
# on the command line
22+
OutFile "openssl-${VERSION}-installer.exe"
23+
24+
# The name that will appear in the installer title bar
25+
NAME "${PRODUCT_NAME} ${VERSION}"
26+
27+
ShowInstDetails show
28+
29+
30+
Var DataDir
31+
Var ModDir
32+
33+
Function .onInit
34+
StrCpy $INSTDIR "C:\Program Files\openssl-${MAJOR}.${MINOR}"
35+
FunctionEnd
36+
37+
!ifdef BUILD64
38+
# This section is run if installation of the 64 bit binaries are selectd
39+
SectionGroup "64 Bit Installation"
40+
Section "64 Bit Binaries"
41+
SetOutPath $INSTDIR\x86_64\lib
42+
File /r "${BUILD64}\Program Files\OpenSSL\lib\"
43+
SetOutPath $INSTDIR\x86_64\bin
44+
File /r "${BUILD64}\Program Files\OpenSSL\bin\"
45+
SetOutPath "$INSTDIR\x86_64\Common Files"
46+
File /r "${BUILD64}\Program Files\Common Files\"
47+
SectionEnd
48+
Section "x86_64 Development Headers"
49+
SetOutPath $INSTDIR\x86_64\include
50+
File /r "${BUILD64}\Program Files\OpenSSL\include\"
51+
SectionEnd
52+
SectionGroupEnd
53+
!endif
54+
55+
!ifdef BUILD32
56+
# This section is run if installation of the 32 bit binaries are selectd
57+
SectionGroup "32 Bit Installation"
58+
Section "32 Bit Binaries"
59+
SetOutPath $INSTDIR\x86\lib
60+
File /r "${BUILD32}\Program Files (x86)\OpenSSL\lib\"
61+
SetOutPath $INSTDIR\x86\bin
62+
File /r "${BUILD32}\Program Files (x86)\OpenSSL\bin\"
63+
SetOutPath "$INSTDIR\x86\Common Files"
64+
File /r "${BUILD32}\Program Files (x86)\Common Files\"
65+
SectionEnd
66+
Section "x86 Development Headers"
67+
SetOutPath $INSTDIR\x86\include
68+
File /r "${BUILD32}\Program Files (x86)\OpenSSL\include\"
69+
SectionEnd
70+
SectionGroupEnd
71+
!endif
72+
73+
!ifdef BUILD64
74+
Section "Documentation"
75+
SetOutPath $INSTDIR\html
76+
File /r "${BUILD64}\Program Files\OpenSSL\html\"
77+
SectionEnd
78+
!endif
79+
80+
# Always install the uninstaller and set a registry key
81+
Section
82+
WriteUninstaller $INSTDIR\uninstall.exe
83+
SectionEnd
84+
85+
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
86+
!define openssl_hklm 'HKLM "SOFTWARE\OpenSSL-${MAJOR}.${MINOR}-${CTX}"'
87+
88+
# This is run on uninstall
89+
Section "Uninstall"
90+
RMDIR /r $INSTDIR
91+
DeleteRegValue ${openssl_hklm} OPENSSLDIR
92+
DeleteRegValue ${openssl_hklm} MODULESDIR
93+
DeleteRegValue ${openssl_hklm} ENGINESDIR
94+
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
95+
SectionEnd
96+
97+
!insertmacro MUI_PAGE_WELCOME
98+
99+
!insertmacro MUI_PAGE_LICENSE ${LICENSE_FILE}
100+
101+
Function CheckRunUninstaller
102+
ifFileExists $INSTDIR\uninstall.exe 0 +2
103+
ExecWait "$INSTDIR\uninstall.exe /S _?=$INSTDIR"
104+
FunctionEnd
105+
106+
Function WriteRegistryKeys
107+
!ifdef BUILD64
108+
StrCpy $DataDir "$INSTDIR\x86_64\Common Files\SSL"
109+
StrCpy $ModDir "$INSTDIR\x86_64\lib\ossl-modules"
110+
!else
111+
StrCpy $DataDir "$INSTDIR\x86\Common Files\SSL"
112+
StrCpy $ModDir "$INSTDIR\x86\lib\ossl-modules"
113+
!endif
114+
WriteRegExpandStr ${openssl_hklm} OPENSSLDIR "$DataDir"
115+
WriteRegExpandStr ${openssl_hklm} ENGINESDIR "$ModDir"
116+
WriteRegExpandStr ${openssl_hklm} MODULESDIR "$ModDir"
117+
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
118+
FunctionEnd
119+
120+
Function DoDirectoryWork
121+
Call CheckRunUninstaller
122+
call WriteRegistryKeys
123+
FunctionEnd
124+
125+
!insertmacro MUI_PAGE_COMPONENTS
126+
127+
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DoDirectoryWork
128+
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Installation Directory"
129+
!insertmacro MUI_PAGE_DIRECTORY
130+
131+
!define MUI_DIRECTORYPAGE_VARIABLE $DataDir
132+
!define MUI_DIRECTORYPAGE_TEXT_TOP "Select Configuration/Data Directory"
133+
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Configuration/Data Directory"
134+
!insertmacro MUI_PAGE_DIRECTORY
135+
136+
!insertmacro MUI_PAGE_INSTFILES
137+
138+
!insertmacro MUI_UNPAGE_WELCOME
139+
!insertmacro MUI_UNPAGE_CONFIRM
140+
!insertmacro MUI_UNPAGE_INSTFILES
141+
!insertmacro MUI_UNPAGE_FINISH
142+
143+
!insertmacro MUI_LANGUAGE "English"
144+
145+
!ifdef SIGN
146+
!define OutFileSignSHA1 "SignTool.exe sign /f ${SIGN} /p ${SIGNPASS} /fd sha1 /t http://timestamp.comodoca.com /v"
147+
!define OutFileSignSHA256 "SignTool.exe sign /f ${SIGN} /p ${SIGNPASS} /fd sha256 /tr http://timestamp.comodoca.com?td=sha256 /td sha256 /v"
148+
149+
!finalize "${OutFileSignSHA1} .\openssl-${VERSION}-installer.exe"
150+
!finalize "${OutFileSignSHA256} .\openssl-${VERSION}-installer.exe"
151+
!endif

0 commit comments

Comments
 (0)