Skip to content

Commit

Permalink
pkgs: Generate Inno Setup based Windows installer
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafostar committed Jan 17, 2025
1 parent 5906d1b commit 21417a1
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ endif

subdir('src')
subdir('doc')
subdir('pkgs')

meson.add_devenv(devenv)

Expand Down
5 changes: 5 additions & 0 deletions pkgs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
is_windows = ['windows'].contains(host_machine.system())

if is_windows
subdir('windows-installer')
endif
31 changes: 31 additions & 0 deletions pkgs/windows-installer/clapper.iss.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[Setup]
AppName=Clapper
AppVersion=@CLAPPER_APP_VERSION@
AppVerName=Clapper @CLAPPER_APP_VERSION@
VersionInfoVersion=@[email protected]
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
WizardStyle=modern
DefaultDirName={autopf}\Clapper
DefaultGroupName=Clapper
DisableProgramGroupPage=yes
ChangesAssociations=yes
Compression=lzma2
SolidCompression=yes
OutputDir=InstallerOutput
OutputBaseFilename=Clapper_@CLAPPER_APP_VERSION@
SetupIconFile=@PROJECT_ROOT@\src\bin\clapper-app\windows\clapper.ico
LicenseFile=@PROJECT_ROOT@\COPYING-GPL

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "@CLAPPER_APP_DEST@\*"; DestDir: "{app}"; Flags: recursesubdirs replacesameversion

[Icons]
Name: "{autoprograms}\Clapper"; Filename: "{app}\bin\clapper.exe"
Name: "{autodesktop}\Clapper"; Filename: "{app}\bin\clapper.exe"; Tasks: desktopicon

[Registry]
@CLAPPER_APP_REG_ENTRIES@
44 changes: 44 additions & 0 deletions pkgs/windows-installer/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Same as "clapper-app-utils.c"
# FIXME: Have these in one place only
win_extensions = [
'avi', 'claps', 'm2ts', 'mkv', 'mov',
'mp4', 'webm', 'wmv'
]
reg_entries = []

foreach ext : win_extensions
ext_id = 'Clapper.' + ext
exe_path = '{app}\\bin\\clapper.exe'

subkey = 'Software\\Classes\\.' + ext + '\\OpenWithProgids'
reg_entries += 'Root: HKA; Subkey: "@0@"; ValueType: string; ValueName: "@1@"; ValueData: ""; Flags: uninsdeletevalue'.format(subkey, ext_id)

subkey = 'Software\\Classes\\' + ext_id
reg_entries += 'Root: HKA; Subkey: "@0@"; ValueType: string; ValueName: ""; ValueData: "@1@"; Flags: uninsdeletekey'.format(subkey, ext)

subkey = 'Software\\Classes\\' + ext_id + '\\DefaultIcon'
reg_entries += 'Root: HKA; Subkey: "@0@"; ValueType: string; ValueName: ""; ValueData: "@1@,0"'.format(subkey, exe_path)

subkey = 'Software\\Classes\\' + ext_id + '\\shell\\open\\command'
reg_entries += 'Root: HKA; Subkey: "@0@"; ValueType: string; ValueName: ""; ValueData: """@1@"" ""%1"""'.format(subkey, exe_path)

reg_entries += '' # Empty line for clarity
endforeach

# NOTE: In meson replacing "@@" vars after "\" sign does not work.
# For this reason we do not pass app name here.
iss_conf = configuration_data()
iss_conf.set('CLAPPER_APP_VERSION', meson.project_version())
iss_conf.set('CLAPPER_APP_REG_ENTRIES', '\n'.join(reg_entries))
iss_conf.set('PROJECT_ROOT', meson.project_source_root())

# NOTE: We also need to package other dependencies, hence using whole prefix.
# Workaround to reduce package size is to set prefix to some custom dir, install,
# then determine the rest with "ldd" and copy remaining files manually there.
iss_conf.set('CLAPPER_APP_DEST', prefix.replace('/', '\\'))

configure_file(
input: 'clapper.iss.in',
output: 'clapper.iss',
configuration: iss_conf,
)

0 comments on commit 21417a1

Please sign in to comment.