Add MinGW packages

This commit is contained in:
Marc-André Lureau 2023-07-26 16:09:13 +04:00
parent 003fa6ecd3
commit 1ecd39e97a
2 changed files with 107 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From da11d2e2deca9f21973bfd118c33df8b7e97b082 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Wed, 26 Jul 2023 15:45:54 +0400
Subject: [PATCH] meson: fix prefix for windows build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
See also:
https://github.com/hughsie/libxmlb/pull/136
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 7c27a4b..a4d89c2 100644
--- a/meson.build
+++ b/meson.build
@@ -102,12 +102,12 @@ add_project_link_arguments(
language: 'c'
)
+prefix = get_option('prefix')
if host_machine.system() == 'windows'
bindir = get_option('bindir')
installed_test_bindir = get_option('libexecdir')
installed_test_datadir = get_option('datadir')
else
- prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
bindir = join_paths(prefix, get_option('bindir'))
libexecdir = join_paths(prefix, get_option('libexecdir'))
--
2.41.0

View File

@ -1,3 +1,9 @@
%global with_mingw 0
%if 0%{?fedora}
%global with_mingw 1
%endif
%global glib2_version 2.45.8
Summary: Library for querying compressed XML metadata
@ -7,6 +13,7 @@ Release: %autorelease
License: LGPL-2.1-or-later
URL: https://github.com/hughsie/%{name}
Source0: https://github.com/hughsie/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
Patch0001: 0001-meson-fix-prefix-for-windows-build.patch
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gtk-doc
@ -17,6 +24,20 @@ BuildRequires: xz-devel
BuildRequires: libzstd-devel
BuildRequires: python3-setuptools
%if %{with_mingw}
BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw32-gcc-c++
BuildRequires: mingw32-glib2
BuildRequires: mingw32-xz
BuildRequires: mingw32-zstd
BuildRequires: mingw64-filesystem >= 95
BuildRequires: mingw64-gcc-c++
BuildRequires: mingw64-glib2
BuildRequires: mingw64-xz
BuildRequires: mingw64-zstd
%endif
# needed for the self tests
BuildRequires: shared-mime-info
@ -46,8 +67,26 @@ Summary: Files for installed tests
%description tests
Executable and data files for installed tests.
%if %{with_mingw}
%package -n mingw32-libxmlb
Summary: MinGW library for querying compressed XML metadata
BuildArch: noarch
%description -n mingw32-libxmlb
MinGW32 libxmlb library.
%package -n mingw64-libxmlb
Summary: MinGW library for querying compressed XML metadata
BuildArch: noarch
%description -n mingw64-libxmlb
MinGW64 libxmlb library.
%{?mingw_debug_package}
%endif
%prep
%setup -q
%autosetup -p1
%build
@ -57,12 +96,24 @@ Executable and data files for installed tests.
%meson_build
%if %{with_mingw}
%mingw_meson -Dintrospection=false -Dtests=false -Dgtkdoc=false
%mingw_ninja
%endif
%check
%meson_test
%install
%meson_install
%if %{with_mingw}
%mingw_ninja_install
%mingw_debug_install_post
rm -f $RPM_BUILD_ROOT/%{mingw32_mandir}/man1/xb-tool.1*
rm -f $RPM_BUILD_ROOT/%{mingw64_mandir}/man1/xb-tool.1*
%endif
%files
%doc README.md
%license LICENSE
@ -89,5 +140,23 @@ Executable and data files for installed tests.
%dir %{_datadir}/installed-tests/libxmlb
%{_datadir}/installed-tests/libxmlb/libxmlb.test
%if %{with_mingw}
%files -n mingw32-libxmlb
%license LICENSE
%{mingw32_bindir}/xb-tool.exe
%{mingw32_bindir}/libxmlb-2.dll
%{mingw32_libdir}/libxmlb.dll.a
%{mingw32_includedir}/libxmlb-2
%{mingw32_libdir}/pkgconfig/xmlb.pc
%files -n mingw64-libxmlb
%license LICENSE
%{mingw64_bindir}/xb-tool.exe
%{mingw64_bindir}/libxmlb-2.dll
%{mingw64_libdir}/libxmlb.dll.a
%{mingw64_includedir}/libxmlb-2
%{mingw64_libdir}/pkgconfig/xmlb.pc
%endif
%changelog
%autochangelog