Add macros.typelib to facilitate automatic gir typelib sub-packaging

This commit is contained in:
Yanko Kaneti 2018-02-08 18:55:18 +02:00
parent 51f1c66748
commit 2a70173f5f
2 changed files with 41 additions and 0 deletions

39
macros.typelib Normal file
View File

@ -0,0 +1,39 @@
# -- Automatic gir typelib subpackage generation
# eg typelib-Notify_0.7
# - Usage
# typelib <namespace> <version>
#
# - Optional paramters used for bootstrap when gobject-introspection
# is not in the buildroot and Provides/Requires cannot be autogenerated
# eg. building gobject-instrospection itself
#
# -b generate basic provides in the form of
# typelib(<namespace>) = <version>
#
# -r <requires> insert hardcoded requires
# eg. typelib -r gobject-introspection%{_isa} Glib 2.0
# for typelib-Glib_2.0 which is in gobject-introspection itself
#
# - Global typelib_macro_used is used as flag to automatically skip the
# typelib fileattrs automation in gobject-introspection for spec files
# that don't want to adopt the typelib macro yet. i.e if your package has
# gir typelibs but doesn't want to use the typelib subpackaging nothing changes
#
%typelib(r:b) %{expand:
%global typelib_macro_used 1
%define typelib_manual_requires %{?-r*:Requires: %{-r*}}
%define tpname typelib-%{1}_%{2}
%define typelib_bootstrap %{?-b:Provides: typelib(%1) = %2}
echo<<EOF
%%package -n %tpname
Summary: Typelin %tpname
%typelib_bootstrap
%typelib_manual_requires
\
%%description -n %tpname
Autogenerated subpackage containing typelib %tpname
\
%%files -n %tpname
%%{_libdir}/girepository-1.0/%1-%2.typelib
}

View File

@ -34,6 +34,7 @@ Source102: macros.mono-srpm
Source103: macros.nodejs-srpm
Source104: macros.ldc-srpm
Source105: macros.valgrind-srpm
Source106: macros.typelib
# Other misc macros
Source150: macros.dwz
@ -168,6 +169,7 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
%{_rpmconfigdir}/macros.d/macros.dwz
%{_rpmconfigdir}/macros.d/macros.forge
%{_rpmconfigdir}/macros.d/macros.ldconfig
%{_rpmconfigdir}/macros.d/macros.typelib
%{_rpmconfigdir}/macros.d/macros.vpath
%doc buildflags.md