diff --git a/meson.build b/meson.build index 1d5298f3..c5e7a9dc 100644 --- a/meson.build +++ b/meson.build @@ -130,6 +130,7 @@ endif subdir('src') subdir('doc') +subdir('pkgs') meson.add_devenv(devenv) diff --git a/pkgs/meson.build b/pkgs/meson.build new file mode 100644 index 00000000..a44c9a8f --- /dev/null +++ b/pkgs/meson.build @@ -0,0 +1,5 @@ +is_windows = ['windows'].contains(host_machine.system()) + +if is_windows + subdir('windows-installer') +endif diff --git a/pkgs/windows-installer/clapper.iss.in b/pkgs/windows-installer/clapper.iss.in new file mode 100644 index 00000000..79e6d768 --- /dev/null +++ b/pkgs/windows-installer/clapper.iss.in @@ -0,0 +1,31 @@ +[Setup] +AppName=Clapper +AppVersion=@CLAPPER_APP_VERSION@ +AppVerName=Clapper @CLAPPER_APP_VERSION@ +VersionInfoVersion=@CLAPPER_APP_VERSION@.0 +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@ diff --git a/pkgs/windows-installer/meson.build b/pkgs/windows-installer/meson.build new file mode 100644 index 00000000..cd2a59c8 --- /dev/null +++ b/pkgs/windows-installer/meson.build @@ -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, +)