Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Windows installer #518

Merged
merged 5 commits into from
Jan 18, 2025
Merged
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
13 changes: 12 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,20 @@ jobs:
find $BUILD_PREFIX/lib/clapper-0.0/ -name '*\.dll' -type f -exec ldd "{}" \; | grep '\/mingw.*\.dll' -o | xargs -I{} cp -n "{}" $BUILD_PREFIX/bin
find $BUILD_PREFIX/lib/gstreamer-1.0/ -name '*\.dll' -type f -exec ldd "{}" \; | grep '\/mingw.*\.dll' -o | xargs -I{} cp -n "{}" $BUILD_PREFIX/bin
find $BUILD_PREFIX/lib/gio/ -name '*\.dll' -type f -exec ldd "{}" \; | grep '\/mingw.*\.dll' -o | xargs -I{} cp -n "{}" $BUILD_PREFIX/bin
- name: Cleanup
run: |
BUILD_PREFIX="$GITHUB_WORKSPACE/clapper-win-${{ matrix.arch }}"

rm -rf $BUILD_PREFIX/include
rm -rf $BUILD_PREFIX/lib/pkgconfig
- name: Installer
uses: Minionguyjpro/[email protected]
with:
path: builddir/pkgs/windows-installer/clapper.iss
options: /O+
- name: Upload
uses: actions/upload-artifact@v4
with:
name: clapper-win-${{ matrix.arch }}
path: clapper-win-${{ matrix.arch }}
path: builddir/pkgs/windows-installer/InstallerOutput/Clapper*.exe
if-no-files-found: error
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,
)
3 changes: 2 additions & 1 deletion src/bin/clapper-app/clapper-app-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ clapper_app_utils_win_enforce_hi_res_clock (void)
{
#ifdef HAVE_WIN_PROCESS_THREADS_API
PROCESS_POWER_THROTTLING_STATE PowerThrottling;
RtlZeroMemory (&PowerThrottling, sizeof (PowerThrottling));
gboolean success;

RtlZeroMemory (&PowerThrottling, sizeof (PowerThrottling));

PowerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
PowerThrottling.ControlMask = PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION;
PowerThrottling.StateMask = 0; // Always honor timer resolution requests
Expand Down
1 change: 1 addition & 0 deletions src/bin/clapper-app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ if is_windows
clapperapp_deps += winmm_dep
clapperapp_c_args += ['-DHAVE_WIN_TIME_API']
endif
subdir('windows')
endif

executable(
Expand Down
30 changes: 30 additions & 0 deletions src/bin/clapper-app/windows/clapper.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 10 and Windows 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
Binary file added src/bin/clapper-app/windows/clapper.ico
Binary file not shown.
56 changes: 56 additions & 0 deletions src/bin/clapper-app/windows/clapper.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* Clapper Application
* Copyright (C) 2024 Rafał Dzięgiel <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include <windows.h>

#define VER_CLAPPERVERSION @VER_CLAPPERVERSION@
#define VER_NONE 0x0L

MAIN_ICON ICON "clapper.ico"

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_CLAPPERVERSION
PRODUCTVERSION VER_CLAPPERVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS VER_NONE
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VER_NONE
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Rafostar"
VALUE "FileDescription", @CLAPPER_APP_NAME@
VALUE "FileVersion", @PACKAGE_VERSION@
VALUE "InternalName", @PACKAGE@
VALUE "LegalCopyright", "Copyright (C) Rafal Dziegiel"
VALUE "OriginalFilename", @CLAPPER_EXE@
VALUE "ProductName", @CLAPPER_APP_NAME@
VALUE "ProductVersion", @PACKAGE_VERSION@
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END

#ifdef __MINGW32__
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "clapper.exe.manifest"
#endif
20 changes: 20 additions & 0 deletions src/bin/clapper-app/windows/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
rc_conf = configuration_data()
rc_conf.set('VER_CLAPPERVERSION', clapper_version.replace('.', ',') + ',0')
rc_conf.set_quoted('PACKAGE', meson.project_name())
rc_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
rc_conf.set_quoted('PACKAGE_ORIGIN', 'https://github.com/Rafostar/clapper')
rc_conf.set_quoted('CLAPPER_APP_NAME', 'Clapper')
rc_conf.set_quoted('CLAPPER_EXE', meson.project_name() + '.exe')

clapperapp_rc = configure_file(
input: 'clapper.rc.in',
output: 'clapper.rc',
configuration: rc_conf,
)

windres = find_program('windres', required: true)
clapperapp_sources += custom_target('clapper.o',
input: clapperapp_rc,
output: 'clapper.o',
command: [windres, '-I', '@CURRENT_SOURCE_DIR@', '-o', '@OUTPUT@', '@INPUT@']
)
Loading