Sync from SUSE:SLFO:Main gobject-introspection revision 2e9565d6d4d51cce36b91766636ae5f8

This commit is contained in:
Adrian Schröter 2024-05-03 13:08:25 +02:00
commit 895a2648f1
9 changed files with 2565 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
baselibs.conf Normal file
View File

@ -0,0 +1 @@
libgirepository-1_0-1

276
gi-find-deps.sh Normal file
View File

@ -0,0 +1,276 @@
#!/bin/bash
# Automatically find Provides and Requires for typelib() gobject-introspection bindings.
# can be started with -R (Requires) and -P (Provides)
# Copyright 2011 by Dominique Leuenberger, Amsterdam, Netherlands (dimstar [at] opensuse.org)
# This file is released under the GPLv2 or later.
function split_name_version {
base=$1
tsymbol=${base%-*}
# Sometimes we get a Requires on Gdk.Settings.foo, because you can directly use imports.gi.Gdk.Settings.Foo in Javascript.
# We know that the symbol in this case is called Gdk, so we cut everything after the . away.
symbol=$(echo $tsymbol | awk -F. '{print $1}')
version=${base#*-}
# In case there is no '-' in the filename, then the split above 'fails' and version == symbol (thus: no version specified)
if [ "$tsymbol" = "$version" ]; then
unset version
fi
}
function split_name_version2 {
symbol=$(echo $1 | awk -F: '{print $1}' | sed "s:[' ]::g")
version=$(echo $1 | awk -F: '{print $2}' | sed "s:[' ]::g")
}
# some javascript code imports gi like this (seen since GNOME 43, e.g. GNOME Maps)
# import 'gi://GeocodeGlib?version=2.0'
function split_name_versionjs_gi_name_version {
symbol=$(echo $1 | awk -F? '{print $1}')
version=$(echo $1 | awk -F? '/version=/ {print $2}' | sed 's/version=//')
}
function print_req_prov {
echo -n "typelib($symbol)"
if [ ! -z "$version" ]; then
echo " = ${version}"
else
echo ""
fi
}
function find_provides {
while read file; do
case $file in
*.typelib)
split_name_version $(basename $file | sed 's,.typelib$,,')
print_req_prov
;;
esac
done
}
function gresources_requires {
# GNOME is embedding .js files into ELF binaries for faster startup.
# As a result, we need to extract them and re-run the scanner over the
# embedded files.
# We extract all the gresources embedded in ELF binaries and start
# gi-find-deps.sh recusively over the extracted file list.
tmpdir=$(mktemp -d)
for resource in $($gresourcecmd list "$1" 2>/dev/null); do
mkdir -p $tmpdir/$(dirname $resource)
$gresourcecmd extract "$1" $resource > $tmpdir/$resource
done
find $tmpdir -type f | sort | sh $0 -R
rm -rf "$tmpdir"
}
function python_requires {
for module in $(grep -h -P "^\s*from gi\.repository import (\w+)" $1 | sed -e 's:#.*::' -e 's:raise ImportError.*::' -e 's:.*"from gi.repository import .*".*::' | sed -e 's,from gi.repository import,,' -r -e 's:\s+$::g' -e 's:\s+as\s+\w+::g' -e 's:,: :g'); do
split_name_version $module
print_req_prov
# Temporarly disabled... this is not true if the python code is written for python3... And there seems no real 'way' to identify this.
# echo "python-gobject >= 2.21.4"
done
for module in $(grep -h -P -o ".*(gi\.require_version\(['\"][^'\"]+['\"],\s*['\"][^'\"]+['\"]\))" $1 | sed -e 's:#.*::' -e 's:.*gi.require_version::' -e "s:[()\"' ]::g" -e 's:,:-:'); do
split_name_version $module
print_req_prov
done
# python glue layers (/gi/overrides) import their typelibs slightly different
for module in $(grep -h -P -o "=\s+(get_introspection_module\(['\"][^'\"]+['\"]\))" $1 | sed -e 's:#.*::' -e 's:=.*get_introspection_module::' -e "s:[()\"' ]::g"); do
split_name_version $module
print_req_prov
done
}
function javascript_requires {
# parse the new import style in 3.32
for module in $(grep -r -h -A2 'const {' $1 | paste -s -d ' ' | grep '} = imports.gi;' | sed 's/imports.gi;.*/imports.gi;/' | awk -F '[{}]' '{print $(NF>1?NF-1:"")}' | tr ',' '\n' | tr -d ' ' | awk -F ':' '{print $1}'); do
split_name_version $module
print_req_prov
done
# parse the old import style before 3.32
for module in $(grep -h -P -o "imports\.gi\.([^\s'\";]+)" $1 | grep -v "imports\.gi\.version" | sed -r -e 's,\s+$,,g' -e 's,imports.gi.,,'); do
split_name_version $module
print_req_prov
done
for module in $(grep -h -P -o "imports\.gi\.versions.([^\s'\";]+)\s*=\s*['\"].+['\"]" $1 | \
sed -e 's:imports.gi.versions.::' -e "s:['\"]::g" -e 's:=:-:' -e 's: ::g'); do
split_name_version $module
print_req_prov
done
# some javascript code imports gi like this (seen since GNOME 43, e.g. GNOME Maps)
# import 'gi://GeocodeGlib?version=2.0'
for module in $(grep -h -P -o "[']gi://([^']+)" $1 | sed "s|'gi://||"); do
split_name_versionjs_gi_name_version $module
print_req_prov
done
# This is, at the moment, specifically for Polari where a "const { Foo, Bar } = imports.gi;" is used.
for module in $(grep -h -E -o "\{ \w+(: \w+|, \w+)+ \} = imports.gi;" $1 | \
sed -r -e '0,/\w+:\s\w+/ s/:\s\w+//g' -e 's: = imports.gi;:: ; s:\{ :: ; s: \}:: ; s/,//g'); do
split_name_version $module
print_req_prov
done
# Remember files which contain a pkg.require() call
if pcre2grep -M "pkg.require\\(([^;])*" $1 > /dev/null; then
# the file contains a pkg.require(..) list... let's remember th is file for the in-depth scanner
if [ -n "$jspkg" ]; then
jspkg=$1:${jspkg}
else
jspkg=$1
fi
fi
# remember files which contain exlucde filters used against pkg.require()
if pcre2grep -M "const RECOGNIZED_MODULE_NAMES =([^;])*" $1 > /dev/null; then
# the file contains RECOGNIZED_MODULE_NAMES list. We remember the file name for the follow up filtering
if [ -n "$jspkgfilt" ]; then
jspkgfilt=$1:${jspkgfilt}
else
jspkgfilt=$1
fi
fi
}
function javascript_pkg_filter {
# For now this is a dummy function based on gnome-weather information
#for file in $jspkgfilt; do
# FILTER=($(pcre2grep -M "const RECOGNIZED_MODULE_NAMES =([^;])*" $file | grep -o "'.*'" | sed "s:'::g"))
#done
FILTER=('Lang' 'Mainloop' 'Signals' 'System' 'Params')
}
function javascript_pkg_requires {
# javascript files were found which specify pkg.require('..': '..'[,'..': '']); list
# This is used in some apps in order to have a 'centralized' point to specify all package dependencies.
# once we reach this function, we already know which file(s) contain the pkg.require(..) list.
oldIFS=$IFS
IFS=:
for file in "$jspkg"; do
IFS=$'\n'
PKGS=$(pcre2grep -M "pkg.require\\(([^;])*" $file | grep -o "'.*': '.*'")
for pkg in $PKGS; do
split_name_version2 $pkg
found=0
for (( i=0 ; i<${#FILTER[@]} ; i++ )); do
if [ "$symbol" = "${FILTER[$i]}" ]; then
found=1
fi
done
if [ $found -eq 0 ]; then
print_req_prov
fi
done
IFS=:
done
IFS=$oldIFS
}
function typelib_requires {
split_name_version $(basename $1 | sed 's,.typelib$,,')
oldIFS=$IFS
IFS=$'\n'
for req in $(g-ir-inspect --print-shlibs --print-typelibs $symbol --version $version); do
case $req in
typelib:*)
module=${req#typelib: }
split_name_version $module
print_req_prov
;;
shlib:*)
echo "${req#shlib: }${shlib_64}"
;;
esac
done
IFS=$oldIFS
}
function find_requires {
# Currently, we detect:
# - in python:
# . from gi.repository import foo [Unversioned requirement of 'foo']
# . from gi.repository import foo-1.0 [versioned requirement]
# . gi.require_version('Gtk', '3.0') (To specify a version.. there is still an import needed)
# . And we do not stumble over:
# from gi.repository import foo as _bar
# from gi.repository import foo, bar
# - in JS:
# . imports.gi.foo; [unversioned requirement of 'foo']
# . imports.gi.foo-1.0; [versioned requirement of 'foo']
# . imports.gi.versions.Gtk = '3.0';
# . const { foo, bar } = imports.gi;
# . The imports can be listed on one line, and we catch them.
while read file; do
case $file in
*.js)
javascript_requires "$file"
;;
*.py)
python_requires "$file"
;;
*.typelib)
typelib_requires "$file"
;;
*.gresource)
gresources_requires "$file"
;;
*)
case $(file -b $file) in
*[Pp]ython*script*)
python_requires "$file"
;;
*ELF*)
gresources_requires "$file"
;;
esac
;;
esac
done
# The pkg filter is a place holder. This should read the filter from the javascript files.
#if [ -n "$jspkgfilt" ]; then
javascript_pkg_filter
#fi
# in case the javascript parser above detected files which specify pkg.require, we enter the more in-depth scanning scheme for those files.
if [ -n "$jspkg" ]; then
javascript_pkg_requires
fi
}
function inList() {
for word in $1; do
[[ "$word" = "$2" ]] && return 0
done
return 1
}
# Confer with /usr/lib/rpm/platforms
x64bitarch="aarch64 mips64 mips64el mips64r6 mips64r6el ppc64 ppc64le riscv64 s390x sparc64 x86_64"
for path in \
$(for tlpath in \
$(find ${RPM_BUILD_ROOT}/usr/lib64 ${RPM_BUILD_ROOT}/usr/lib /usr/lib64 /usr/lib -name '*.typelib' 2>/dev/null); do
dirname $tlpath; done | sort --unique ); do
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:$path
done
if which gresource >/dev/null 2>&1; then
gresourcecmd=$(which gresource 2>/dev/null)
else
grsourcecmd="false"
fi
if inList "$x64bitarch" "${HOSTTYPE}"; then
shlib_64="()(64bit)"
fi
case $1 in
-P)
find_provides
;;
-R)
find_requires
;;
esac

BIN
gobject-introspection-1.76.1.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
addFilter(".*devel-file-in-non-devel-package.*/usr/share/gir-.*/*\.gir")
addFilter(".*devel-file-in-non-devel-package.*/usr/share/gobject-introspection-.*/*\.[ch]")

View File

@ -0,0 +1,18 @@
typelib(DBus) = 1.0
typelib(DBusGLib) = 1.0
typelib(GIRepository) = 2.0
typelib(GL) = 1.0
typelib(GLib) = 2.0
typelib(GModule) = 2.0
typelib(GObject) = 2.0
typelib(Gio) = 2.0
typelib(Vulkan) = 1.0
typelib(cairo) = 1.0
typelib(fontconfig) = 2.0
typelib(freetype2) = 2.0
typelib(libxml2) = 2.0
typelib(win32) = 1.0
typelib(xfixes) = 4.0
typelib(xft) = 2.0
typelib(xlib) = 2.0
typelib(xrandr) = 1.3

File diff suppressed because it is too large Load Diff

181
gobject-introspection.spec Normal file
View File

@ -0,0 +1,181 @@
#
# spec file for package gobject-introspection
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: gobject-introspection
Version: 1.76.1
Release: 0
# FIXME: Find a way to identify if we need python3-gobject or python-gobject from gi-find-deps.sh.
Summary: GObject Introspection Tools
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: Development/Libraries/GNOME
URL: https://wiki.gnome.org/Projects/GObjectIntrospection
Source0: https://download.gnome.org/sources/gobject-introspection/1.76/%{name}-%{version}.tar.xz
# gi-find-deps.sh is a rpm helper for Provides and Requires. Script creates typelib()-style Provides/Requires.
Source1: gi-find-deps.sh
Source2: gobjectintrospection.attr
Source3: gobject-introspection-typelib.template
Source98: baselibs.conf
Source99: %{name}-rpmlintrc
BuildRequires: bison
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: gtk-doc
BuildRequires: meson >= 0.55.3
BuildRequires: pkgconfig
BuildRequires: python3-Mako
BuildRequires: python3-Markdown
BuildRequires: python3-devel
BuildRequires: python3-xml
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(cairo-gobject)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(glib-2.0) >= 2.75.0
BuildRequires: pkgconfig(gmodule-2.0)
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(libffi) >= 3.0.0
# gi-find-deps makes use of 'file' to identify the types.
Requires: file
Requires: libgirepository-1_0-1 = %{version}
# gi-find-deps uses the enhanced grep variant in order to do multi-line matching (for pkg.requires(..))
Requires: pcre2-tools
Requires: python3-xml
Requires: python(abi) = %{python3_version}
%description
The goal of the project is to describe the APIs and collect them in
a uniform, machine readable format.
%package -n libgirepository-1_0-1
Summary: GObject Introspection Library
License: LGPL-2.1-or-later
Group: System/Libraries
Requires: girepository-1_0 >= %{version}
%description -n libgirepository-1_0-1
The goal of the project is to describe the APIs and collect them in
a uniform, machine readable format.
%package -n girepository-1_0
Summary: Base GObject Introspection Bindings
License: LGPL-2.1-or-later
Group: System/Libraries
Requires: libgirepository-1_0-1 >= %{version}
# Provide typelib() symbols based on gobject-introspection-typelib.template
# The template is checked during install if it matches the installed *.typelib files.
%(cat %{SOURCE3} | awk '{ print "Provides: " $0}')
%description -n girepository-1_0
The goal of the project is to describe the APIs and collect them in
a uniform, machine readable format.
%package devel
Summary: GObject Introspection Development Files
# Note: the devel package requires the binaries, not just the library
License: LGPL-2.1-or-later
Group: Development/Libraries/GNOME
Requires: %{name} = %{version}
Requires: libffi-devel
Requires: libgirepository-1_0-1 = %{version}
%description devel
The goal of the project is to describe the APIs and collect them in
a uniform, machine readable format.
%prep
%autosetup -p1
%build
%meson \
-Dcairo=enabled \
-Ddoctool=enabled \
-Dgtk_doc=true \
-Dpython='%{_bindir}/python3' \
%{nil}
%meson_build
%check
# Needed due to https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/458
%ifarch %ix86 x86_64
%meson_test
%endif
%install
%meson_install
install -D %{SOURCE1} %{buildroot}%{_rpmconfigdir}/gi-find-deps.sh
install -D %{SOURCE2} -m 0644 %{buildroot}%{_rpmconfigdir}/fileattrs/gobjectintrospection.attr
# comparing, if we provide all the symbols expected.
ls %{buildroot}%{_libdir}/girepository-1.0/*.typelib | bash %{SOURCE1} -P > gobject-introspection-typelib.installed
diff -s %{SOURCE3} gobject-introspection-typelib.installed
%fdupes %{buildroot}
# fixup shebangs in files installed to /usr/bin
sed -i "s|%{_bindir}/env python|%{_bindir}/python|" %{buildroot}%{_bindir}/*
%ldconfig_scriptlets -n libgirepository-1_0-1
%files
%license COPYING COPYING.GPL
%doc NEWS README.rst TODO
%{_bindir}/g-ir-annotation-tool
%{_bindir}/g-ir-compiler
%{_bindir}/g-ir-doc-tool
%{_bindir}/g-ir-generate
%{_bindir}/g-ir-inspect
%{_bindir}/g-ir-scanner
%{_mandir}/man1/g-ir-compiler.1%{?ext_man}
%{_mandir}/man1/g-ir-generate.1%{?ext_man}
%{_mandir}/man1/g-ir-scanner.1%{?ext_man}
%{_mandir}/man1/g-ir-doc-tool.1%{?ext_man}
%{_datadir}/aclocal/introspection.m4
%{_datadir}/gir-1.0/*.gir
%{_datadir}/gir-1.0/gir-1.2.rnc
# We don't include directly %%{_libdir}/gobject-introspection since there might
# be files there in the future that belong to the library package
%dir %{_libdir}/gobject-introspection
%{_libdir}/gobject-introspection/giscanner/
# We explicitly list the content of the directory that is of interest to us,
# since there might be files there in the future that belong to the library
# package
%dir %{_datadir}/gobject-introspection-1.0
%{_datadir}/gobject-introspection-1.0/Makefile.introspection
%{_datadir}/gobject-introspection-1.0/tests/
%{_datadir}/gobject-introspection-1.0/gdump.c
%{_rpmconfigdir}/gi-find-deps.sh
%{_rpmconfigdir}/fileattrs/gobjectintrospection.attr
%files -n libgirepository-1_0-1
%license COPYING.LGPL
# We own this directory here instead of devel to make sure other packages do
# not have to own it
%dir %{_datadir}/gir-1.0
%{_libdir}/libgirepository-1.0.so.*
%dir %{_libdir}/girepository-1.0
%files -n girepository-1_0
%{_libdir}/girepository-1.0/*.typelib
%files devel
%doc %{_datadir}/gtk-doc/html/gi/
%{_includedir}/gobject-introspection-1.0/
%{_libdir}/libgirepository-1.0.so
%{_libdir}/pkgconfig/gobject-introspection-1.0.pc
%{_libdir}/pkgconfig/gobject-introspection-no-export-1.0.pc
%changelog

View File

@ -0,0 +1,4 @@
%__gobjectintrospection_provides %{_rpmconfigdir}/gi-find-deps.sh -P
%__gobjectintrospection_requires %{_rpmconfigdir}/gi-find-deps.sh -R
%__gobjectintrospection_path ^%{_libdir}/.*\\.typelib$|^%{_bindir}/|\\.(gresource|py|js|so|so\\.[^/]*)$
%__gobjectintrospection_exclude_path ^/usr/share/doc/packages/