From b4d36d32e467499a298a37356c0a91863425197f Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 4 Nov 2021 15:54:10 +0900 Subject: [PATCH] Bump to gobject-introspection 1.70.0 Change-Id: I8d5c8e1f7b831fa634af76c820959cf4a99a049d Signed-off-by: DongHun Kwak --- packaging/add_pie_compile_option.patch | 27 +++ packaging/doctool_disable.patch | 13 ++ packaging/gi-find-deps.sh | 263 +++++++++++++++++++++++ packaging/gobject-introspection-rpmlintrc | 2 + packaging/gobject-introspection-typelib.template | 17 ++ packaging/gobject-introspection.changes | 18 ++ packaging/gobject-introspection.manifest | 5 + packaging/gobject-introspection.spec | 145 +++++++++++++ packaging/gobjectintrospection.attr | 4 + 9 files changed, 494 insertions(+) create mode 100644 packaging/add_pie_compile_option.patch create mode 100644 packaging/doctool_disable.patch create mode 100644 packaging/gi-find-deps.sh create mode 100644 packaging/gobject-introspection-rpmlintrc create mode 100644 packaging/gobject-introspection-typelib.template create mode 100644 packaging/gobject-introspection.changes create mode 100644 packaging/gobject-introspection.manifest create mode 100644 packaging/gobject-introspection.spec create mode 100644 packaging/gobjectintrospection.attr diff --git a/packaging/add_pie_compile_option.patch b/packaging/add_pie_compile_option.patch new file mode 100644 index 0000000..1986ffd --- /dev/null +++ b/packaging/add_pie_compile_option.patch @@ -0,0 +1,27 @@ +diff --git a/tools/meson.build b/tools/meson.build +index 46b487e0..4e105847 100644 +--- a/tools/meson.build ++++ b/tools/meson.build +@@ -63,6 +63,7 @@ gircompiler = executable('g-ir-compiler', 'compiler.c', + ], + install: true, + c_args: custom_c_args, ++ link_args : '-pie', + ) + meson.override_find_program('g-ir-compiler', gircompiler) + +@@ -73,6 +74,7 @@ girgenerate = executable('g-ir-generate', 'generate.c', + ], + install: true, + c_args: custom_c_args, ++ link_args : '-pie', + ) + meson.override_find_program('g-ir-generate', girgenerate) + +@@ -80,5 +82,6 @@ girinspect = executable('g-ir-inspect', 'g-ir-inspect.c', + dependencies: girepo_dep, + install: true, + c_args: custom_c_args, ++ link_args : '-pie', + ) + meson.override_find_program('g-ir-inspect', girinspect) diff --git a/packaging/doctool_disable.patch b/packaging/doctool_disable.patch new file mode 100644 index 0000000..938ef6b --- /dev/null +++ b/packaging/doctool_disable.patch @@ -0,0 +1,13 @@ +diff --git a/meson_options.txt b/meson_options.txt +index dff9be8e..1dd70b9b 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -2,7 +2,7 @@ option('cairo', type: 'feature', value : 'auto', + description: 'Use cairo for tests' + ) + +-option('doctool', type: 'feature', value : 'auto', ++option('doctool', type: 'feature', value : 'disabled', + description: 'Install g-ir-doc-tool and run related tests' + ) + diff --git a/packaging/gi-find-deps.sh b/packaging/gi-find-deps.sh new file mode 100644 index 0000000..4a04a2f --- /dev/null +++ b/packaging/gi-find-deps.sh @@ -0,0 +1,263 @@ +#!/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") +} + +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 + # 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 pcregrep -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 pcregrep -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=($(pcregrep -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=$(pcregrep -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 +} + +x64bitarch="x86_64 ppc64 ppc64le s390x ia64 aarch64 riscv64" + +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 + + diff --git a/packaging/gobject-introspection-rpmlintrc b/packaging/gobject-introspection-rpmlintrc new file mode 100644 index 0000000..ba04669 --- /dev/null +++ b/packaging/gobject-introspection-rpmlintrc @@ -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]") diff --git a/packaging/gobject-introspection-typelib.template b/packaging/gobject-introspection-typelib.template new file mode 100644 index 0000000..7ca7aec --- /dev/null +++ b/packaging/gobject-introspection-typelib.template @@ -0,0 +1,17 @@ +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(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 diff --git a/packaging/gobject-introspection.changes b/packaging/gobject-introspection.changes new file mode 100644 index 0000000..43502fd --- /dev/null +++ b/packaging/gobject-introspection.changes @@ -0,0 +1,18 @@ +* Wed Mar 27 2013 Anas Nashif GOBJECT_INTROSPECTION_1_36_0@e964a45 +- Update to 1.36.0 + +* Tue Feb 26 2013 Anas Nashif GOBJECT_INTROSPECTION_1_35_8@eeaad65 +- Update to 1.35.8 + +* Sat Feb 02 2013 Anas Nashif submit/trunk/20130202.182003@200237a +- remove gtk-doc dependency + +* Sat Feb 02 2013 Anas Nashif GOBJECT_INTROSPECTION_1_35_4@7b86a1b +- Update to 1.35.4 + +* Wed Dec 12 2012 Philippe Coval GOBJECT_INTROSPECTION_1_35_2@02eee0d +- update to upstream/1.35.2 + +* Wed Dec 12 2012 Philippe Coval GOBJECT_INTROSPECTION_1_34_0@44a16b0 +- update from upstream/1.34.0 git://git.gnome.org/gobject-introspection + diff --git a/packaging/gobject-introspection.manifest b/packaging/gobject-introspection.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/gobject-introspection.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/gobject-introspection.spec b/packaging/gobject-introspection.spec new file mode 100644 index 0000000..47beba1 --- /dev/null +++ b/packaging/gobject-introspection.spec @@ -0,0 +1,145 @@ +Name: gobject-introspection +Version: 1.70.0 +Release: 0 +Summary: GObject Introspection Tools +License: GPL-2.0+ +Group: Development/Libraries +Url: http://live.gnome.org/GObjectIntrospection +Source0: http://download.gnome.org/sources/gobject-introspection/1.66/%{name}-%{version}.tar.xz +Source1: gi-find-deps.sh +Source2: gobjectintrospection.attr +Source3: gobject-introspection-typelib.template +Source4: doctool_disable.patch +Source5: add_pie_compile_option.patch +Source99: %{name}-rpmlintrc +Source1001: gobject-introspection.manifest + +BuildRequires: bison +BuildRequires: fdupes +BuildRequires: flex +BuildRequires: libffi-devel +BuildRequires: libtool + +BuildRequires: meson +BuildRequires: ninja +BuildRequires: pkgconfig(python3) +BuildRequires: python3-mako +BuildRequires: python3-markdown +BuildRequires: python3-xml + +BuildRequires: pkgconfig(cairo) +BuildRequires: pkgconfig(cairo-gobject) +BuildRequires: pkgconfig(gobject-2.0) +#BuildRequires: pkgconfig(gtk-doc) + +Requires: libgirepository = %{version} +Requires: python3-xml + +%description +The goal of the project is to describe the APIs and collect them in +a uniform, machine readable format. + +%package -n libgirepository +Summary: GObject Introspection Library +License: LGPL-2.1+ +Group: System/Libraries +Requires: girepository >= %{version} + +%description -n libgirepository +The goal of the project is to describe the APIs and collect them in +a uniform, machine readable format. + +%package -n girepository +Summary: Base GObject Introspection Bindings +License: LGPL-2.1+ +Group: System/Libraries +Requires: libgirepository >= %{version} +%(cat %{S:3} | awk '{ print "Provides: " $0}') + +%description -n girepository +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 +License: LGPL-2.1+ +Group: Development/Libraries +# Note: the devel package requires the binaries, not just the library +Requires: %{name} = %{version} +Requires: libffi-devel + +%description devel +The goal of the project is to describe the APIs and collect them in +a uniform, machine readable format. + +%prep +%setup -q +cp %{SOURCE1001} . +%{__patch} -p1 < %{SOURCE4} +%{__patch} -p1 < %{SOURCE5} + +%build +CFLAGS+=" -fPIC" +chmod +x tools/g-ir-tool-template.in + +%meson +%meson_build + +# %check +# meson test -C armv7l-tizen-linux + +%install +%meson_install + +install -D %{S:1} %{buildroot}%{_rpmconfigdir}/gi-find-deps.sh +install -D %{S:2} -m 0644 %{buildroot}%{_rpmconfigdir}/fileattrs/gobjectintrospection.attr + +# ls %{buildroot}%{_libdir}/girepository-1.0/*.typelib | sh %{S:1} -P > gobject-introspection-typelib.installed +# diff -s %{S:3} gobject-introspection-typelib.installed + +%fdupes %{buildroot} + +%post -n libgirepository -p /sbin/ldconfig + +%postun -n libgirepository -p /sbin/ldconfig + +%docs_package + +%files +%manifest %{name}.manifest +%license COPYING COPYING.GPL +%{_bindir}/g-ir-annotation-tool +%{_bindir}/g-ir-compiler +%{_bindir}/g-ir-generate +%{_bindir}/g-ir-scanner +%{_bindir}/g-ir-inspect +%{_datadir}/aclocal/introspection.m4 +%{_datadir}/gir-1.0/*.gir +%{_datadir}/gir-1.0/gir-1.2.rnc +%dir %{_libdir}/gobject-introspection +%{_libdir}/gobject-introspection/giscanner/ +%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 +%manifest %{name}.manifest +%license COPYING.LGPL +%dir %{_datadir}/gir-1.0 +%{_libdir}/libgirepository-1.0.so.* +%dir %{_libdir}/girepository-1.0 + +%files -n girepository +%manifest %{name}.manifest +%license COPYING.LGPL +%{_libdir}/girepository-1.0/*.typelib + +%files devel +%manifest %{name}.manifest +%{_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 diff --git a/packaging/gobjectintrospection.attr b/packaging/gobjectintrospection.attr new file mode 100644 index 0000000..78a5869 --- /dev/null +++ b/packaging/gobjectintrospection.attr @@ -0,0 +1,4 @@ +%__gobjectintrospection_provides %{_rpmconfigdir}/gi-find-deps.sh -P +%__gobjectintrospection_requires %{_rpmconfigdir}/gi-find-deps.sh -R +%__gobjectintrospection_path ^(%{_libdir}/.*\.typelib)|(.*\.gresource)|(.*\.py)|(.*\.js)|(.*\.so)|(%{_bindir}/.*)$ +%__gobjectintrospection_exclude_path ^/usr/share/doc/packages/ -- 2.7.4