shared-mime-info/shared-mime-info.spec

108 lines
3.5 KiB
RPMSpec
Raw Permalink Normal View History

Summary: Shared MIME information database
Name: shared-mime-info
2023-10-07 18:45:12 +00:00
Version: 2.3
Release: %autorelease
2023-10-07 18:23:17 +00:00
License: GPL-2.0-or-later
URL: http://freedesktop.org/Software/shared-mime-info
2022-04-23 18:45:44 +00:00
Source0: https://gitlab.freedesktop.org/xdg/shared-mime-info/-/archive/%{version}/shared-mime-info-%{version}.tar.bz2
Source1: mimeapps.list
2006-06-29 20:59:38 +00:00
2023-10-07 18:45:12 +00:00
%global xdgmime_commit 179296748e92bd91bf531656632a1056307fb7b7
2021-01-04 11:07:51 +00:00
# Tarball for https://gitlab.freedesktop.org/xdg/xdgmime/-/tree/%%{xdgmime_commit}
Source6: https://gitlab.freedesktop.org/xdg/xdgmime/-/archive/%{xdgmime_commit}/xdgmime-%{xdgmime_commit}.tar.bz2
# HACK in use of RPM_OPT_FLAGS into xdgmime build
Source7: shared-mime-info-2.1-CFLAGS.patch
2020-05-06 14:57:03 +00:00
# Work-around for https://bugs.freedesktop.org/show_bug.cgi?id=40354
Patch0: 0001-Remove-sub-classing-from-OO.o-mime-types.patch
2023-12-08 01:13:21 +00:00
# Fix build with libxml2 2.12.0
# https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/219
Patch1: 0002-Fix-build-with-libxml2-2.12.0.patch
2018-03-07 18:40:48 +00:00
BuildRequires: gcc
2023-10-07 18:45:12 +00:00
BuildRequires: gcc-c++
BuildRequires: libxml2-devel
2020-05-06 14:57:03 +00:00
BuildRequires: xmlto
BuildRequires: glib2-devel
2006-08-25 17:35:17 +00:00
BuildRequires: gettext
2019-09-11 12:08:27 +00:00
BuildRequires: itstool
2020-11-08 23:07:35 +00:00
BuildRequires: make
2020-05-06 14:57:03 +00:00
BuildRequires: meson
BuildRequires: git-core
# Disable pkgconfig autodep
%global __requires_exclude ^/usr/bin/pkg-config$
%description
This is the freedesktop.org shared MIME info database.
Many programs and desktops use the MIME system to represent the types of
files. Frequently, it is necessary to work out the correct MIME type for
a file. This is generally done by examining the file's name or contents,
and looking up the correct MIME type in a database.
%prep
%autosetup -S git_am
2022-04-23 18:45:44 +00:00
rmdir xdgmime
2020-05-06 14:57:03 +00:00
tar xjf %SOURCE6
2021-01-04 11:07:51 +00:00
mv xdgmime-%{xdgmime_commit}/ xdgmime/
patch -p1 < %SOURCE7
%build
2020-11-08 23:07:35 +00:00
%make_build -C xdgmime
# the updated mimedb is later owned as %%ghost to ensure proper file-ownership
# it also asserts it is possible to build it
%meson -Dupdate-mimedb=true
2020-05-06 14:57:03 +00:00
%meson_build
%install
2020-05-06 14:57:03 +00:00
%meson_install
2012-03-08 01:32:49 +00:00
find $RPM_BUILD_ROOT%{_datadir}/mime -type d \
| sed -e "s|^$RPM_BUILD_ROOT|%%dir |" > %{name}.files
find $RPM_BUILD_ROOT%{_datadir}/mime -type f -not -path "*/packages/*" \
| sed -e "s|^$RPM_BUILD_ROOT|%%ghost |" >> %{name}.files
# Support fallback/generic mimeapps.list (currently based on an old version of
# gnome-mimeapps.list), see:
# https://lists.fedoraproject.org/pipermail/devel/2015-July/212403.html
# https://bugzilla.redhat.com/show_bug.cgi?id=1243049
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/applications
install -m 644 %SOURCE1 $RPM_BUILD_ROOT/%{_datadir}/applications/mimeapps.list
## remove bogus translation files
## translations are already in the xml file installed
rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/*
2020-05-06 14:57:03 +00:00
%check
%meson_test
%post
2014-07-08 14:19:18 +00:00
/bin/touch --no-create %{_datadir}/mime/packages &>/dev/null ||:
%transfiletriggerin -- %{_datadir}/mime
update-mime-database -n %{_datadir}/mime &> /dev/null ||:
%transfiletriggerpostun -- %{_datadir}/mime
update-mime-database -n %{_datadir}/mime &> /dev/null ||:
2012-03-08 01:32:49 +00:00
%files -f %{name}.files
2014-08-05 13:05:42 +00:00
%license COPYING
2020-05-06 14:57:03 +00:00
%doc README.md NEWS HACKING.md data/shared-mime-info-spec.xml
%{_bindir}/update-mime-database
2012-03-08 01:32:49 +00:00
%{_datadir}/mime/packages/*
%{_datadir}/applications/mimeapps.list
# better to co-own this dir than to pull in pkgconfig
2013-06-09 00:36:59 +00:00
%dir %{_datadir}/pkgconfig
%{_datadir}/pkgconfig/shared-mime-info.pc
%{_mandir}/man*/update-mime-database.*
# also co-own the gettext dirs, we don't require it
%dir %{_datadir}/gettext
%dir %{_datadir}/gettext/its
2020-05-06 14:57:03 +00:00
%{_datadir}/gettext/its/shared-mime-info.its
%{_datadir}/gettext/its/shared-mime-info.loc
%changelog
%autochangelog