mirror of
https://github.com/pkgconf/pkgconf.git
synced 2026-01-26 08:07:53 +00:00
meson: add MSI build target
It would be nice to provide a release MSI for Windows users. Requires wixl. Tested on Fedora, with mingw64 cross-build. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
e49cbdfcb3
commit
86d38119c0
40
meson.build
40
meson.build
@ -1,8 +1,8 @@
|
||||
project('pkgconf', 'c',
|
||||
version : '2.4.3',
|
||||
license : 'ISC',
|
||||
meson_version : '>=0.49',
|
||||
default_options : ['c_std=c99'],
|
||||
meson_version: '>=0.52',
|
||||
)
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
@ -149,3 +149,41 @@ install_man('man/pkgconf-personality.5')
|
||||
install_data('pkg.m4', install_dir: 'share/aclocal')
|
||||
install_data('AUTHORS', install_dir: 'share/doc/pkgconf')
|
||||
install_data('README.md', install_dir: 'share/doc/pkgconf')
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
conf_data = configuration_data()
|
||||
conf_data.set('VERSION', meson.project_version())
|
||||
conf_data.set('EXE', pkgconf_exe.full_path())
|
||||
conf_data.set('DLL', libpkgconf.full_path())
|
||||
if host_machine.cpu() != 'x86_64'
|
||||
wixl_arch = 'x86'
|
||||
else
|
||||
wixl_arch = 'x64'
|
||||
endif
|
||||
conf_data.set('WIXL_ARCH', wixl_arch)
|
||||
|
||||
python = find_program('python3')
|
||||
wixl = find_program('wixl', required: false, version: '>= 0.105')
|
||||
unoconv = find_program('unoconv', required: false)
|
||||
msi_filename = 'pkgconf-@0@-@1@.msi'.format(wixl_arch, meson.project_version())
|
||||
|
||||
wxsfile = configure_file(input: 'pkgconf.wxs.in', output: 'pkgconf.wxs', configuration: conf_data)
|
||||
|
||||
if wixl.found() and unoconv.found()
|
||||
licensefile = custom_target(
|
||||
'License.rtf',
|
||||
input: 'COPYING',
|
||||
output: 'License.rtf',
|
||||
command: [python, files('txt2rtf.py'), '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
|
||||
msi = custom_target(
|
||||
msi_filename,
|
||||
input: [wxsfile, licensefile],
|
||||
output: msi_filename,
|
||||
command: [wixl, '--arch', wixl_arch, '--ext', 'ui', '-o', msi_filename, wxsfile],
|
||||
)
|
||||
|
||||
alias_target('msi', msi)
|
||||
endif
|
||||
endif
|
||||
|
||||
64
pkgconf.wxs.in
Normal file
64
pkgconf.wxs.in
Normal file
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
|
||||
<?define Arch = "@WIXL_ARCH@"?>
|
||||
<?if $(var.Arch) = "x64"?>
|
||||
<?define GLIB_ARCH = "win64"?>
|
||||
<?define ArchString = "64-bit"?>
|
||||
<?define ArchProgramFilesFolder = "ProgramFiles64Folder"?>
|
||||
<?define Win64 = "yes"?>
|
||||
<?else?>
|
||||
<?define GLIB_ARCH = "win32"?>
|
||||
<?define ArchString = "32-bit"?>
|
||||
<?define ArchProgramFilesFolder = "ProgramFilesFolder"?>
|
||||
<?define Win64 = "no"?>
|
||||
<?endif?>
|
||||
|
||||
|
||||
<Product Id="*"
|
||||
Name="pkgconf @VERSION@ ($(var.ArchString))"
|
||||
Language="1033"
|
||||
Version="@VERSION@"
|
||||
Manufacturer="pkgconf"
|
||||
UpgradeCode="4faedad2-3f9d-45cc-89a7-3732ad2db0f7">
|
||||
|
||||
<Package InstallerVersion="200"
|
||||
Compressed="yes"
|
||||
InstallScope="perMachine" />
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
||||
<Feature Id="ProductFeature" Title="pkgconf" Level="1">
|
||||
<ComponentGroupRef Id="ProductComponents" />
|
||||
</Feature>
|
||||
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="$(var.ArchProgramFilesFolder)">
|
||||
<Directory Id="INSTALLFOLDER" Name="pkgconf @VERSION@" />
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
|
||||
<Component Id="PkgconfExe" Guid="*" Win64="$(var.Win64)">
|
||||
<File Id="PkgconfExeFile"
|
||||
Source="@EXE@"
|
||||
KeyPath="yes" />
|
||||
<File Id="PkgconfigExeFile"
|
||||
Name="pkg-config.exe"
|
||||
Source="@EXE@"/>
|
||||
<File Id="PkgconfDllFile"
|
||||
Source="@DLL@"/>
|
||||
<Environment Id="PATH"
|
||||
Name="PATH"
|
||||
Value="[INSTALLFOLDER]"
|
||||
Permanent="no"
|
||||
Part="last"
|
||||
Action="set"
|
||||
System="yes" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
|
||||
<UIRef Id="WixUI_Minimal" />
|
||||
</Product>
|
||||
</Wix>
|
||||
35
txt2rtf.py
Normal file
35
txt2rtf.py
Normal file
@ -0,0 +1,35 @@
|
||||
def text_to_rtf(input_file: str, output_file: str) -> None:
|
||||
with open(input_file, "r", encoding="utf-8") as file:
|
||||
text_content = file.read()
|
||||
|
||||
text_content = text_content.replace("\\", "\\\\")
|
||||
text_content = text_content.replace("{", "\\{")
|
||||
text_content = text_content.replace("}", "\\}")
|
||||
|
||||
text_content = text_content.replace("\n", "\\par\n")
|
||||
|
||||
rtf_content = "{\\rtf1\\ansi\\ansicpg1252\\cocoartf2580\\cocoasubrtf220\n"
|
||||
rtf_content += "{\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;}\n"
|
||||
rtf_content += "\\vieww12000\\viewh15840\\viewkind0\n"
|
||||
rtf_content += "\\pard\\tx720\\tx1440\\tx2160\\tx2880\\tx3600\\tx4320\\pardirnatural\\partightenfactor0\n"
|
||||
rtf_content += "\\f0\\fs24 "
|
||||
rtf_content += text_content
|
||||
rtf_content += "\n}"
|
||||
|
||||
with open(output_file, "w", encoding="utf-8") as file:
|
||||
file.write(rtf_content)
|
||||
|
||||
print(f"Conversion complete! RTF file saved as: {output_file}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print(f"Usage: python {sys.argv[0]} input.txt output.rtf")
|
||||
sys.exit(1)
|
||||
|
||||
input_file = sys.argv[1]
|
||||
output_file = sys.argv[2]
|
||||
|
||||
text_to_rtf(input_file, output_file)
|
||||
Loading…
x
Reference in New Issue
Block a user