Skip to content

Commit a84dc24

Browse files
committed
Build both classical per-machine only installers and installers with per-user installation support.
1 parent de5c64b commit a84dc24

File tree

4 files changed

+73
-12
lines changed

4 files changed

+73
-12
lines changed

installer/Config.wxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ See the 'LICENSE.txt' file for the additional details.
7373
<!--
7474
Set the following variable to to "yes" to support per user installations
7575
-->
76-
<?define PerUserSupport="no" ?>
76+
<!-- <?define PerUserSupport="no" ?> -->
7777
<!--
7878
The name of your application *.exe files. These will be used to kill the process when updating
7979
and creating the desktop shortcut

makemsi.bat

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ set WixExtensions=-ext WixUIExtension -ext WixUtilExtension
1717

1818
rem set old current directory
1919
set OldDir=%cd%
20+
21+
22+
rem Build the installers
23+
24+
rem per-machine
25+
CALL :gen_version_per_machine
26+
CALL :build_the_installer
27+
CALL :rename_per_machine_installer
28+
29+
rem per-user
30+
CALL :gen_version_per_user
31+
CALL :build_the_installer
32+
CALL :rename_per_user_installer
33+
34+
EXIT /B 0
35+
36+
rem procedure to build the installer
37+
:build_the_installer
2038
cd "%~dp0\"
2139

2240
rem Cleanup
@@ -27,9 +45,6 @@ del %InstallerObjectFiles%
2745
rem convert TXT license to RTF
2846
.\emacs\bin\emacs.exe -Q --batch -l .\scripts\license-to-rtf.el
2947

30-
rem Generate file with build version information
31-
.\emacs\bin\emacs.exe -Q --batch -l .\scripts\generate-version-wxi.el
32-
3348
rem Generate fragments.
3449
rem These should be synchronised with values in 'Config.wxi'
3550

@@ -44,8 +59,39 @@ rem build the installer
4459
"%WIX%\bin\candle" %WiXExtensions% -out .\installer\ %InstallerFiles%
4560
"%WIX%\bin\light" %WiXExtensions% -sw1076 -dcl:high -cultures:en-US %InstallerObjectFiles% -out %InstallerName%
4661

62+
rem change current directory
63+
cd "%OldDir%"
64+
65+
rem end of procedure
66+
EXIT /B 0
67+
68+
:rename_per_machine_installer
69+
cd "%~dp0\"
70+
rem rename Emacs installer binary
71+
.\emacs\bin\emacs.exe -Q --batch -l .\scripts\rename-installer.el --eval "(rename-installer)"
72+
cd "%OldDir%"
73+
EXIT /B 0
74+
75+
:rename_per_user_installer
76+
cd "%~dp0\"
4777
rem rename Emacs installer binary
48-
.\emacs\bin\emacs.exe -Q --batch -l .\scripts\rename-installer.el
78+
.\emacs\bin\emacs.exe -Q --batch -l .\scripts\rename-installer.el --eval "(rename-installer t)"
79+
cd "%OldDir%"
80+
EXIT /B 0
4981

50-
rem change current directory
82+
:gen_version_per_machine
83+
cd "%~dp0\"
84+
rem Generate file with build version information
85+
.\emacs\bin\emacs.exe -Q --batch -l .\scripts\generate-version-wxi.el --eval "(generate-version-per-machine)"
5186
cd "%OldDir%"
87+
EXIT /B 0
88+
89+
:gen_version_per_user
90+
cd "%~dp0\"
91+
rem Generate file with build version information
92+
.\emacs\bin\emacs.exe -Q --batch -l .\scripts\generate-version-wxi.el --eval "(generate-version-per-user)"
93+
cd "%OldDir%"
94+
EXIT /B 0
95+
96+
97+

scripts/generate-version-wxi.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
(defun emacs-x86_64-build-p ()
99
(not (null (string-match "^[xX]?86_64.+" system-configuration))))
1010

11-
(defun generate-version-wxi (filename)
11+
(defun generate-version-wxi (filename per-user-support)
1212
(when (file-exists-p filename)
1313
(delete-file filename))
1414
(with-temp-buffer
@@ -23,8 +23,15 @@
2323
(insert (format " <?define Win64=\"%s\" ?>\n" (if (emacs-x86_64-build-p)
2424
"yes"
2525
"no")))
26+
(insert (format " <?define PerUserSupport=\"%s\" ?>\n" (if per-user-support
27+
"yes"
28+
"no")))
2629
(insert "</Include>\n")
2730
(write-file filename)))
2831

29-
(generate-version-wxi ".\\installer\\Version.wxi")
32+
(defun generate-version-per-machine ()
33+
(generate-version-wxi ".\\installer\\Version.wxi" nil))
3034

35+
36+
(defun generate-version-per-user ()
37+
(generate-version-wxi ".\\installer\\Version.wxi" t))

scripts/rename-installer.el

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,23 @@
1111
(defun get-installer-name ()
1212
(format "emacs-%d.%d-%s" emacs-major-version emacs-minor-version (get-emacs-patform)))
1313

14-
(defun rename-installer ()
15-
(let ((new-msi-name (concat (get-installer-name) ".msi"))
16-
(new-wixpdb-name (concat (get-installer-name) ".wixpdb"))
14+
(defun rename-installer (&optional per-user)
15+
(let ((new-msi-name (concat (get-installer-name)
16+
(if per-user
17+
"-per-user"
18+
"")
19+
".msi"))
20+
(new-wixpdb-name (concat (get-installer-name)
21+
(if per-user
22+
"-per-user"
23+
"")
24+
".wixpdb"))
1725
(msi-name "emacs-installer.msi")
1826
(wixpdb-name "emacs-installer.wixpdb"))
1927
(when (file-exists-p msi-name)
2028
(rename-file msi-name new-msi-name t))
2129
(when (file-exists-p wixpdb-name)
2230
(rename-file wixpdb-name new-wixpdb-name t))))
2331

24-
(rename-installer)
32+
;;(rename-installer)
2533

0 commit comments

Comments
 (0)