[tbb-commits] [Git][tpo/applications/tor-browser-build][main] Bug 40757: Use single .nsi template for all browsers

boklm (@boklm) git at gitlab.torproject.org
Fri Feb 10 08:45:30 UTC 2023



boklm pushed to branch main at The Tor Project / Applications / tor-browser-build


Commits:
3299ed3d by Nicolas Vigier at 2023-02-10T09:44:21+01:00
Bug 40757: Use single .nsi template for all browsers

- - - - -


4 changed files:

- projects/browser/build
- projects/browser/windows-installer/basebrowser.nsi → projects/browser/windows-installer.nsi
- − projects/browser/windows-installer/privacybrowser.nsi
- − projects/browser/windows-installer/torbrowser.nsi


Changes:

=====================================
projects/browser/build
=====================================
@@ -285,6 +285,9 @@ done
   export PATH="/var/tmp/dist/nsis/bin:$PATH"
 
   mv $rootdir/windows-installer $distdir/windows-installer
+  cat > $distdir/windows-installer/browser.nsi << 'BROWSER_NSI'
+[% INCLUDE 'windows-installer.nsi' %]
+BROWSER_NSI
   mv ${TB_STAGE_DIR} $distdir/windows-installer/"[% c('var/Project_Name') %]"
   mv $distdir/windows-installer ${TB_STAGE_DIR}
 [% END %]
@@ -354,7 +357,7 @@ cd $distdir
 [% ELSIF c("var/windows") %]
   find "$PKG_DIR" -exec [% c("touch") %] {} \;
   pushd "$PKG_DIR"
-  makensis [% c("var/projectname") %].nsi
+  makensis browser.nsi
   # Working around NSIS braindamage
   mv [% c("var/projectname") %]-install.exe browser-install-tmp.exe
   python3 $rootdir/pe_checksum_fix.py


=====================================
projects/browser/windows-installer/basebrowser.nsi → projects/browser/windows-installer.nsi
=====================================
@@ -1,4 +1,4 @@
-;NSIS Installer for Base Browser Bundle
+;NSIS Installer for Tor/Base/Privacy Browser
 ;Written by Moritz Bartl
 ;released under Public Domain
 
@@ -12,14 +12,14 @@
 ;--------------------------------
 ;General
 
-  ; location of Base Browser bundle to put into installer
-  !define TBBSOURCE ".\Base Browser\"
+  ; location of Tor/Base/Privacy Browser to put into installer
+  !define PROGRAM_SOURCE ".\[% c('var/Project_Name') %]\"
 
-  Name "Base Browser"
-  OutFile "basebrowser-install.exe"
+  Name "[% c('var/Project_Name') %]"
+  OutFile "[% c('var/projectname') %]-install.exe"
 
   ;Default installation folder
-  InstallDir "$DESKTOP\Base Browser"
+  InstallDir "$DESKTOP\[% c('var/Project_Name') %]"
 
   ;Best (but slowest) compression
   SetCompressor /SOLID lzma
@@ -31,14 +31,14 @@
 ;--------------------------------
 ;Interface Configuration
 
-  !define MUI_ICON   "basebrowser.ico"
+  !define MUI_ICON   "[% c('var/projectname') %].ico"
   !define MUI_ABORTWARNING
 
 ;--------------------------------
 ;Modern UI settings
   !define MUI_FINISHPAGE_NOREBOOTSUPPORT     ; we don't require a reboot
   !define MUI_FINISHPAGE_RUN
-  !define MUI_FINISHPAGE_RUN_FUNCTION "StartBaseBrowser"
+  !define MUI_FINISHPAGE_RUN_FUNCTION "StartBrowser"
   !define MUI_FINISHPAGE_SHOWREADME ; misuse for option to create shortcut; less ugly than MUI_PAGE_COMPONENTS
   !define MUI_FINISHPAGE_SHOWREADME_TEXT "&Add Start Menu && Desktop shortcuts"
   !define MUI_FINISHPAGE_SHOWREADME_FUNCTION "CreateShortCuts"
@@ -113,7 +113,7 @@
 ;--------------------------------
 ;Multi Language support: Read strings from separate file
 
-; !include torbrowser-langstrings.nsi
+; !include [% c('var/projectname') %]-langstrings.nsi
 
 ;--------------------------------
 ;Reserve Files
@@ -127,19 +127,19 @@
 ;--------------------------------
 ;Installer Sections
 
-Section "Base Browser Bundle" SecTBB
+Section "[% c('var/Project_Name') %]" SecBrowser
 
   SetOutPath "$INSTDIR"
-  File /r "${TBBSOURCE}\*.*"
+  File /r "${PROGRAM_SOURCE}\*.*"
   SetOutPath "$INSTDIR\Browser"
-  CreateShortCut "$INSTDIR\Start Base Browser.lnk" "$INSTDIR\Browser\firefox.exe"
+  CreateShortCut "$INSTDIR\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe"
 
 SectionEnd
 
 Function CreateShortcuts
 
-  CreateShortCut "$SMPROGRAMS\Start Base Browser.lnk" "$INSTDIR\Browser\firefox.exe"
-  CreateShortCut "$DESKTOP\Start Base Browser.lnk" "$INSTDIR\Browser\firefox.exe"
+  CreateShortCut "$SMPROGRAMS\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe"
+  CreateShortCut "$DESKTOP\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe"
 
 FunctionEnd
 ;--------------------------------
@@ -148,7 +148,7 @@ FunctionEnd
 Function .onInit
 
   ${IfNot} ${AtLeastWin7}
-    MessageBox MB_USERICON|MB_OK "Base Browser requires at least Windows 7"
+    MessageBox MB_USERICON|MB_OK "[% c('var/Project_Name') %] requires at least Windows 7"
     SetErrorLevel 1
     Quit
   ${EndIf}
@@ -159,7 +159,7 @@ Function .onInit
   System::Call "kernel32::IsProcessorFeaturePresent(i 10)i .R7"
 
   ${If} "$R7" == "0"
-    MessageBox MB_OK|MB_ICONSTOP "Sorry, Base Browser can't be installed. This version of Base Browser requires a processor with SSE2 support."
+    MessageBox MB_OK|MB_ICONSTOP "Sorry, [% c('var/Project_Name') %] can't be installed. This version of [% c('var/Project_Name') %] requires a processor with SSE2 support."
     Abort
   ${EndIf}
 
@@ -172,14 +172,14 @@ FunctionEnd
 
 Function CheckIfTargetDirectoryExists
 ${If} ${FileExists} "$INSTDIR\*.*"
- MessageBox MB_YESNO "The destination directory already exists. You can try to upgrade the Base Browser Bundle, but if you run into any problems, use a new directory instead. Continue?" IDYES NoAbort
+ MessageBox MB_YESNO "The destination directory already exists. You can try to upgrade the [% c('var/Project_Name') %], but if you run into any problems, use a new directory instead. Continue?" IDYES NoAbort
    Abort
  NoAbort:
 ${EndIf}
 FunctionEnd
 
 
-Function StartBaseBrowser
-ExecShell "open" "$INSTDIR/Start Base Browser.lnk"
+Function StartBrowser
+ExecShell "open" "$INSTDIR/Start [% c('var/Project_Name') %].lnk"
 FunctionEnd
 


=====================================
projects/browser/windows-installer/privacybrowser.nsi deleted
=====================================
@@ -1,180 +0,0 @@
-;NSIS Installer for Privacy Browser
-;Written by Moritz Bartl
-;released under Public Domain
-
-;--------------------------------
-;Modern UI
-
-  !include "MUI2.nsh"
-  !include "LogicLib.nsh"
-  !include "WinVer.nsh"
-
-;--------------------------------
-;General
-
-  ; location of Privacy Browser bundle to put into installer
-  !define TBBSOURCE ".\Privacy Browser\"
-
-  Name "Privacy Browser"
-  OutFile "privacybrowser-install.exe"
-
-  ;Default installation folder
-  InstallDir "$DESKTOP\Privacy Browser"
-
-  ;Best (but slowest) compression
-  SetCompressor /SOLID lzma
-  SetCompressorDictSize 32
-
-  ;Request application privileges for Windows Vista
-  RequestExecutionLevel user
-
-;--------------------------------
-;Interface Configuration
-
-  !define MUI_ICON   "privacybrowser.ico"
-  !define MUI_ABORTWARNING
-
-;--------------------------------
-;Modern UI settings
-  !define MUI_FINISHPAGE_NOREBOOTSUPPORT     ; we don't require a reboot
-  !define MUI_FINISHPAGE_RUN
-  !define MUI_FINISHPAGE_RUN_FUNCTION "StartPrivacyBrowser"
-  !define MUI_FINISHPAGE_SHOWREADME ; misuse for option to create shortcut; less ugly than MUI_PAGE_COMPONENTS
-  !define MUI_FINISHPAGE_SHOWREADME_TEXT "&Add Start Menu && Desktop shortcuts"
-  !define MUI_FINISHPAGE_SHOWREADME_FUNCTION "CreateShortCuts"
-;--------------------------------
-;Pages
-
-  !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckIfTargetDirectoryExists
-  !insertmacro MUI_PAGE_DIRECTORY
-  !insertmacro MUI_PAGE_INSTFILES
-  !insertmacro MUI_PAGE_FINISH
-
-;--------------------------------
-;Languages
-
-  !insertmacro MUI_LANGUAGE "English" ;first language is the default language
-  !insertmacro MUI_LANGUAGE "French"
-  !insertmacro MUI_LANGUAGE "German"
-  !insertmacro MUI_LANGUAGE "Spanish"
-  !insertmacro MUI_LANGUAGE "SpanishInternational"
-  !insertmacro MUI_LANGUAGE "SimpChinese"
-  !insertmacro MUI_LANGUAGE "TradChinese"
-  !insertmacro MUI_LANGUAGE "Japanese"
-  !insertmacro MUI_LANGUAGE "Korean"
-  !insertmacro MUI_LANGUAGE "Italian"
-  !insertmacro MUI_LANGUAGE "Dutch"
-  !insertmacro MUI_LANGUAGE "Danish"
-  !insertmacro MUI_LANGUAGE "Swedish"
-  !insertmacro MUI_LANGUAGE "Norwegian"
-  !insertmacro MUI_LANGUAGE "NorwegianNynorsk"
-  !insertmacro MUI_LANGUAGE "Finnish"
-  !insertmacro MUI_LANGUAGE "Greek"
-  !insertmacro MUI_LANGUAGE "Russian"
-  !insertmacro MUI_LANGUAGE "Portuguese"
-  !insertmacro MUI_LANGUAGE "PortugueseBR"
-  !insertmacro MUI_LANGUAGE "Polish"
-  !insertmacro MUI_LANGUAGE "Ukrainian"
-  !insertmacro MUI_LANGUAGE "Czech"
-  !insertmacro MUI_LANGUAGE "Slovak"
-  !insertmacro MUI_LANGUAGE "Croatian"
-  !insertmacro MUI_LANGUAGE "Bulgarian"
-  !insertmacro MUI_LANGUAGE "Hungarian"
-  !insertmacro MUI_LANGUAGE "Thai"
-  !insertmacro MUI_LANGUAGE "Romanian"
-  !insertmacro MUI_LANGUAGE "Latvian"
-  !insertmacro MUI_LANGUAGE "Macedonian"
-  !insertmacro MUI_LANGUAGE "Estonian"
-  !insertmacro MUI_LANGUAGE "Turkish"
-  !insertmacro MUI_LANGUAGE "Lithuanian"
-  !insertmacro MUI_LANGUAGE "Slovenian"
-  !insertmacro MUI_LANGUAGE "Serbian"
-  !insertmacro MUI_LANGUAGE "SerbianLatin"
-  !insertmacro MUI_LANGUAGE "Arabic"
-  !insertmacro MUI_LANGUAGE "Farsi"
-  !insertmacro MUI_LANGUAGE "Hebrew"
-  !insertmacro MUI_LANGUAGE "Indonesian"
-  !insertmacro MUI_LANGUAGE "Mongolian"
-  !insertmacro MUI_LANGUAGE "Luxembourgish"
-  !insertmacro MUI_LANGUAGE "Albanian"
-  !insertmacro MUI_LANGUAGE "Breton"
-  !insertmacro MUI_LANGUAGE "Belarusian"
-  !insertmacro MUI_LANGUAGE "Icelandic"
-  !insertmacro MUI_LANGUAGE "Malay"
-  !insertmacro MUI_LANGUAGE "Bosnian"
-  !insertmacro MUI_LANGUAGE "Kurdish"
-  !insertmacro MUI_LANGUAGE "Irish"
-  !insertmacro MUI_LANGUAGE "Uzbek"
-  !insertmacro MUI_LANGUAGE "Galician"
-  !insertmacro MUI_LANGUAGE "Afrikaans"
-  !insertmacro MUI_LANGUAGE "Catalan"
-  !insertmacro MUI_LANGUAGE "Esperanto"
-
-;--------------------------------
-;Reserve Files
-
-  ;If you are using solid compression, files that are required before
-  ;the actual installation should be stored first in the data block,
-  ;because this will make your installer start faster.
-
-  !insertmacro MUI_RESERVEFILE_LANGDLL
-
-;--------------------------------
-;Installer Sections
-
-Section "Privacy Browser" SecPB
-
-  SetOutPath "$INSTDIR"
-  File /r "${TBBSOURCE}\*.*"
-  SetOutPath "$INSTDIR\Browser"
-  CreateShortCut "$INSTDIR\Start Privacy Browser.lnk" "$INSTDIR\Browser\privacybrowser.exe"
-
-SectionEnd
-
-Function CreateShortcuts
-
-  CreateShortCut "$SMPROGRAMS\Start Privacy Browser.lnk" "$INSTDIR\Browser\privacybrowser.exe"
-  CreateShortCut "$DESKTOP\Start Privacy Browser.lnk" "$INSTDIR\Browser\privacybrowser.exe"
-
-FunctionEnd
-;--------------------------------
-;Installer Functions
-
-Function .onInit
-
-  ${IfNot} ${AtLeastWin7}
-    MessageBox MB_USERICON|MB_OK "Privacy Browser requires at least Windows 7"
-    SetErrorLevel 1
-    Quit
-  ${EndIf}
-
-  ; Don't install on systems that don't support SSE2. The parameter value of
-  ; 10 is for PF_XMMI64_INSTRUCTIONS_AVAILABLE which will check whether the
-  ; SSE2 instruction set is available.
-  System::Call "kernel32::IsProcessorFeaturePresent(i 10)i .R7"
-
-  ${If} "$R7" == "0"
-    MessageBox MB_OK|MB_ICONSTOP "Sorry, Privacy Browser can't be installed. This version of Privacy Browser requires a processor with SSE2 support."
-    Abort
-  ${EndIf}
-
-  !insertmacro MUI_LANGDLL_DISPLAY
-
-FunctionEnd
-
-;--------------------------------
-;Helper Functions
-
-Function CheckIfTargetDirectoryExists
-${If} ${FileExists} "$INSTDIR\*.*"
-  MessageBox MB_YESNO "The destination directory already exists. You can try to upgrade Privacy Browser, but if you run into any problems, use a new directory instead. Continue?" IDYES NoAbort
-    Abort
-  NoAbort:
-${EndIf}
-FunctionEnd
-
-
-Function StartPrivacyBrowser
-ExecShell "open" "$INSTDIR/Start Privacy Browser.lnk"
-FunctionEnd
-


=====================================
projects/browser/windows-installer/torbrowser.nsi deleted
=====================================
@@ -1,185 +0,0 @@
-;NSIS Installer for Tor Browser Bundle
-;Written by Moritz Bartl
-;released under Public Domain
-
-;--------------------------------
-;Modern UI
-
-  !include "MUI2.nsh"
-  !include "LogicLib.nsh"
-  !include "WinVer.nsh"
-
-;--------------------------------
-;General
-
-  ; location of Tor Browser bundle to put into installer
-  !define TBBSOURCE ".\Tor Browser\"
-
-  Name "Tor Browser"
-  OutFile "torbrowser-install.exe"
-
-  ;Default installation folder
-  InstallDir "$DESKTOP\Tor Browser"
-
-  ;Best (but slowest) compression
-  SetCompressor /SOLID lzma
-  SetCompressorDictSize 32
-
-  ;Request application privileges for Windows Vista
-  RequestExecutionLevel user
-
-;--------------------------------
-;Interface Configuration
-
-  !define MUI_ICON   "torbrowser.ico"
-  !define MUI_ABORTWARNING
-
-;--------------------------------
-;Modern UI settings
-  !define MUI_FINISHPAGE_NOREBOOTSUPPORT     ; we don't require a reboot
-  !define MUI_FINISHPAGE_RUN
-  !define MUI_FINISHPAGE_RUN_FUNCTION "StartTorBrowser"
-  !define MUI_FINISHPAGE_SHOWREADME ; misuse for option to create shortcut; less ugly than MUI_PAGE_COMPONENTS
-  !define MUI_FINISHPAGE_SHOWREADME_TEXT "&Add Start Menu && Desktop shortcuts"
-  !define MUI_FINISHPAGE_SHOWREADME_FUNCTION "CreateShortCuts"
-;--------------------------------
-;Pages
-
-  !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckIfTargetDirectoryExists
-  !insertmacro MUI_PAGE_DIRECTORY
-  !insertmacro MUI_PAGE_INSTFILES
-  !insertmacro MUI_PAGE_FINISH
-
-;--------------------------------
-;Languages
-
-  !insertmacro MUI_LANGUAGE "English" ;first language is the default language
-  !insertmacro MUI_LANGUAGE "French"
-  !insertmacro MUI_LANGUAGE "German"
-  !insertmacro MUI_LANGUAGE "Spanish"
-  !insertmacro MUI_LANGUAGE "SpanishInternational"
-  !insertmacro MUI_LANGUAGE "SimpChinese"
-  !insertmacro MUI_LANGUAGE "TradChinese"
-  !insertmacro MUI_LANGUAGE "Japanese"
-  !insertmacro MUI_LANGUAGE "Korean"
-  !insertmacro MUI_LANGUAGE "Italian"
-  !insertmacro MUI_LANGUAGE "Dutch"
-  !insertmacro MUI_LANGUAGE "Danish"
-  !insertmacro MUI_LANGUAGE "Swedish"
-  !insertmacro MUI_LANGUAGE "Norwegian"
-  !insertmacro MUI_LANGUAGE "NorwegianNynorsk"
-  !insertmacro MUI_LANGUAGE "Finnish"
-  !insertmacro MUI_LANGUAGE "Greek"
-  !insertmacro MUI_LANGUAGE "Russian"
-  !insertmacro MUI_LANGUAGE "Portuguese"
-  !insertmacro MUI_LANGUAGE "PortugueseBR"
-  !insertmacro MUI_LANGUAGE "Polish"
-  !insertmacro MUI_LANGUAGE "Ukrainian"
-  !insertmacro MUI_LANGUAGE "Czech"
-  !insertmacro MUI_LANGUAGE "Slovak"
-  !insertmacro MUI_LANGUAGE "Croatian"
-  !insertmacro MUI_LANGUAGE "Bulgarian"
-  !insertmacro MUI_LANGUAGE "Hungarian"
-  !insertmacro MUI_LANGUAGE "Thai"
-  !insertmacro MUI_LANGUAGE "Romanian"
-  !insertmacro MUI_LANGUAGE "Latvian"
-  !insertmacro MUI_LANGUAGE "Macedonian"
-  !insertmacro MUI_LANGUAGE "Estonian"
-  !insertmacro MUI_LANGUAGE "Turkish"
-  !insertmacro MUI_LANGUAGE "Lithuanian"
-  !insertmacro MUI_LANGUAGE "Slovenian"
-  !insertmacro MUI_LANGUAGE "Serbian"
-  !insertmacro MUI_LANGUAGE "SerbianLatin"
-  !insertmacro MUI_LANGUAGE "Arabic"
-  !insertmacro MUI_LANGUAGE "Farsi"
-  !insertmacro MUI_LANGUAGE "Hebrew"
-  !insertmacro MUI_LANGUAGE "Indonesian"
-  !insertmacro MUI_LANGUAGE "Mongolian"
-  !insertmacro MUI_LANGUAGE "Luxembourgish"
-  !insertmacro MUI_LANGUAGE "Albanian"
-  !insertmacro MUI_LANGUAGE "Breton"
-  !insertmacro MUI_LANGUAGE "Belarusian"
-  !insertmacro MUI_LANGUAGE "Icelandic"
-  !insertmacro MUI_LANGUAGE "Malay"
-  !insertmacro MUI_LANGUAGE "Bosnian"
-  !insertmacro MUI_LANGUAGE "Kurdish"
-  !insertmacro MUI_LANGUAGE "Irish"
-  !insertmacro MUI_LANGUAGE "Uzbek"
-  !insertmacro MUI_LANGUAGE "Galician"
-  !insertmacro MUI_LANGUAGE "Afrikaans"
-  !insertmacro MUI_LANGUAGE "Catalan"
-  !insertmacro MUI_LANGUAGE "Esperanto"
-
-;--------------------------------
-;Multi Language support: Read strings from separate file
-
-; !include torbrowser-langstrings.nsi
-
-;--------------------------------
-;Reserve Files
-
-  ;If you are using solid compression, files that are required before
-  ;the actual installation should be stored first in the data block,
-  ;because this will make your installer start faster.
-
-  !insertmacro MUI_RESERVEFILE_LANGDLL
-
-;--------------------------------
-;Installer Sections
-
-Section "Tor Browser Bundle" SecTBB
-
-  SetOutPath "$INSTDIR"
-  File /r "${TBBSOURCE}\*.*"
-  SetOutPath "$INSTDIR\Browser"
-  CreateShortCut "$INSTDIR\Start Tor Browser.lnk" "$INSTDIR\Browser\firefox.exe"
-
-SectionEnd
-
-Function CreateShortcuts
-
-  CreateShortCut "$SMPROGRAMS\Start Tor Browser.lnk" "$INSTDIR\Browser\firefox.exe"
-  CreateShortCut "$DESKTOP\Start Tor Browser.lnk" "$INSTDIR\Browser\firefox.exe"
-
-FunctionEnd
-;--------------------------------
-;Installer Functions
-
-Function .onInit
-
-  ${IfNot} ${AtLeastWin7}
-    MessageBox MB_USERICON|MB_OK "Tor Browser requires at least Windows 7"
-    SetErrorLevel 1
-    Quit
-  ${EndIf}
-
-  ; Don't install on systems that don't support SSE2. The parameter value of
-  ; 10 is for PF_XMMI64_INSTRUCTIONS_AVAILABLE which will check whether the
-  ; SSE2 instruction set is available.
-  System::Call "kernel32::IsProcessorFeaturePresent(i 10)i .R7"
-
-  ${If} "$R7" == "0"
-    MessageBox MB_OK|MB_ICONSTOP "Sorry, Tor Browser can't be installed. This version of Tor Browser requires a processor with SSE2 support."
-    Abort
-  ${EndIf}
-
-  !insertmacro MUI_LANGDLL_DISPLAY
-
-FunctionEnd
-
-;--------------------------------
-;Helper Functions
-
-Function CheckIfTargetDirectoryExists
-${If} ${FileExists} "$INSTDIR\*.*"
- MessageBox MB_YESNO "The destination directory already exists. You can try to upgrade the Tor Browser Bundle, but if you run into any problems, use a new directory instead. Continue?" IDYES NoAbort
-   Abort
- NoAbort:
-${EndIf}
-FunctionEnd
-
-
-Function StartTorBrowser
-ExecShell "open" "$INSTDIR/Start Tor Browser.lnk"
-FunctionEnd
-



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/3299ed3d6ceab30644e2cd84978804519bbc9b0c

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/3299ed3d6ceab30644e2cd84978804519bbc9b0c
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20230210/1fef77e0/attachment-0001.htm>


More information about the tbb-commits mailing list