Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Windows packaging for [Helium](https://github.com/imputnet/helium).

## Updates

Windows builds include built-in update checks while Helium is running.
Update fetching is controlled by the existing Helium services toggle in
`Settings > Privacy and security > Helium services`, and uses the configured
Helium services origin for the update appcast.

## Credits

This repo is based on
Expand Down Expand Up @@ -166,4 +173,3 @@ ln -s /usr/bin/vim /usr/bin/vi
1. Download nightly rust build from: `https://static.rust-lang.org/dist/<build-date>/rust-nightly-aarch64-pc-windows-msvc.tar.gz`
1. Replace `build-date` with the obtained value
1. Get the SHA-512 checksum using `sha512sum` in **`MSYS2 MSYS`**.

9 changes: 9 additions & 0 deletions downloads.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ extractor = 7z
output_path = third_party/nsis
strip_leading_dirs = nsis-%(version)s

[winsparkle]
version = 0.9.2
url = https://github.com/vslavik/winsparkle/releases/download/v%(version)s/WinSparkle-%(version)s.zip
download_filename = WinSparkle-%(version)s.zip
sha512 = 73ea15e81a6bffd5268674f633f0aa55660764c8b8f35b7fac073e5f82c85b4e888172b3dfd9c3e71341bd23e5314539dd0f47360f89473f94b39f2352910012
extractor = 7z
output_path = third_party/winsparkle
strip_leading_dirs = WinSparkle-%(version)s

# Pre-built GNU bison from GnuWin32
[bison-bin]
version = 2.4.1
Expand Down
35 changes: 27 additions & 8 deletions installer/helium.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Var InstallFailed
Var RadioUser
Var RadioSystem
Var SystemInstallExists
Var UpdateMode

; --- MUI2 Configuration ---
!define MUI_ICON "${ICON_FILE}"
Expand All @@ -53,10 +54,14 @@ Var SystemInstallExists
; Welcome page
!define MUI_WELCOMEPAGE_TITLE "Welcome to ${PRODUCT_NAME} Setup"
!define MUI_WELCOMEPAGE_TEXT "Setup will install ${PRODUCT_NAME} ${VERSION} on your computer.$\r$\n$\r$\nClick Next to continue."
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipPageInUpdateMode
!insertmacro MUI_PAGE_WELCOME
!undef MUI_PAGE_CUSTOMFUNCTION_PRE

; License page
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipPageInUpdateMode
!insertmacro MUI_PAGE_LICENSE "${LICENSE_FILE}"
!undef MUI_PAGE_CUSTOMFUNCTION_PRE

; Install type selection (custom page)
Page custom InstallTypePage InstallTypePageLeave
Expand All @@ -70,7 +75,9 @@ Page custom InstallTypePage InstallTypePageLeave
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Launch ${PRODUCT_NAME}"
!define MUI_FINISHPAGE_RUN_FUNCTION LaunchHelium
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipPageInUpdateMode
!insertmacro MUI_PAGE_FINISH
!undef MUI_PAGE_CUSTOMFUNCTION_PRE

; --- Language ---
!insertmacro MUI_LANGUAGE "English"
Expand All @@ -83,11 +90,21 @@ VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer"
VIAddVersionKey "FileVersion" "${VERSION}"
VIAddVersionKey "LegalCopyright" "Copyright The Helium Authors"

Function SkipPageInUpdateMode
${If} $UpdateMode == "1"
Abort
${EndIf}
FunctionEnd

; =============================================================================
; Custom Install Type Page
; =============================================================================

Function InstallTypePage
${If} $UpdateMode == "1"
Abort
${EndIf}

!insertmacro MUI_HEADER_TEXT "Installation Type" "Choose how you want to install ${PRODUCT_NAME}."

nsDialogs::Create 1018
Expand Down Expand Up @@ -145,8 +162,15 @@ Function .onInit
; Default to user install; parse command-line flags
StrCpy $InstallType "user"
StrCpy $SetupFlags ""
StrCpy $UpdateMode "0"
${GetParameters} $0

${GetOptions} $0 "/UPDATE" $1
${IfNot} ${Errors}
StrCpy $UpdateMode "1"
${EndIf}
ClearErrors

${GetOptions} $0 "/SYSTEM" $1
${IfNot} ${Errors}
StrCpy $InstallType "system"
Expand Down Expand Up @@ -200,13 +224,14 @@ Section "Install" SecInstall
StrCpy $InstallFailed ""

; Extract setup files to temp directory
SetOutPath "$TEMP\helium_install"
InitPluginsDir
SetOutPath "$PLUGINSDIR"
DetailPrint "Extracting installation files..."
File "${SETUP_EXE}"
File /oname=helium.7z "${HELIUM_7Z}"

; Build setup.exe command line
StrCpy $0 '"$TEMP\helium_install\setup.exe" --install-archive="$TEMP\helium_install\helium.7z" --do-not-launch-chrome'
StrCpy $0 '"$PLUGINSDIR\setup.exe" --install-archive="$PLUGINSDIR\helium.7z" --do-not-launch-chrome'

${If} $InstallType == "system"
StrCpy $0 '$0 --system-level'
Expand Down Expand Up @@ -309,12 +334,6 @@ Section "Install" SecInstall

${EndSwitch}

; Clean up extracted files
DetailPrint "Cleaning up..."
Delete "$TEMP\helium_install\setup.exe"
Delete "$TEMP\helium_install\helium.7z"
RMDir "$TEMP\helium_install"

; Abort if installation failed (prevents finish page from showing success)
${If} $InstallFailed == "1"
Abort
Expand Down
62 changes: 62 additions & 0 deletions patches/helium/windows/enable-browser-updates.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--- a/components/helium_services/helium_services_helpers.cc
+++ b/components/helium_services/helium_services_helpers.cc
@@ -6,6 +6,7 @@

#include <optional>

+#include "build/build_config.h"
#include "base/functional/bind.h"
#include "base/strings/stringprintf.h"
#include "components/helium_services/pref_names.h"
@@ -19,9 +20,15 @@

#if BUILDFLAG(IS_MAC)
#if defined(ARCH_CPU_ARM_FAMILY)
-constexpr std::string cpu_arch = "arm64";
+constexpr char kBrowserUpdateArch[] = "arm64";
#else
-constexpr std::string cpu_arch = "x86_64";
+constexpr char kBrowserUpdateArch[] = "x86_64";
+#endif
+#elif BUILDFLAG(IS_WIN)
+#if defined(ARCH_CPU_ARM64)
+constexpr char kBrowserUpdateArch[] = "arm64";
+#else
+constexpr char kBrowserUpdateArch[] = "x64";
#endif
#endif

@@ -130,11 +137,14 @@

#if BUILDFLAG(IS_MAC)
std::string path = base::StringPrintf(
- "/updates/mac/appcast-%s.xml", cpu_arch);
- return GetServicesBaseURL(prefs).Resolve(path);
+ "/updates/mac/appcast-%s.xml", kBrowserUpdateArch);
+#elif BUILDFLAG(IS_WIN)
+ std::string path = base::StringPrintf(
+ "/updates/win/appcast-%s.xml", kBrowserUpdateArch);
#else
return GetDummyURL();
#endif
+ return GetServicesBaseURL(prefs).Resolve(path);
}

GURL GetComponentUpdateURL(const PrefService* prefs) {
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -2075,12 +2075,12 @@
<message name="IDS_SETTINGS_HELIUM_SERVICES_UPDATE" desc="Toggle for automatic update downloads">
Allow automatic browser and component updates
</message>
- <if expr="is_macosx">
+ <if expr="is_macosx or is_win">
<message name="IDS_SETTINGS_HELIUM_SERVICES_UPDATE_DESCRIPTION" desc="Description of the toggle for automatic update downloads">
Helium will automatically download and install browser and component updates as they become available. We recommend keeping this setting enabled to ensure you get the latest features and security updates.
</message>
</if>
- <if expr="not is_macosx">
+ <if expr="not is_macosx and not is_win">
<message name="IDS_SETTINGS_HELIUM_SERVICES_UPDATE_DESCRIPTION" desc="Description of the toggle for automatic update downloads">
Helium will automatically download and install browser and component updates as they become available. We recommend keeping this setting enabled to ensure you get the latest features and security updates. Automatic core browser updates are not available on this platform yet, but component updates are. Please use external software to keep Helium up to date.
</message>
Loading