gobject-introspection: enable cross.

This commit is contained in:
maxice8 2019-01-29 11:18:25 -02:00 committed by maxice8
parent fae786dec1
commit 64111e0e15
12 changed files with 569 additions and 3 deletions

View File

@ -0,0 +1,20 @@
#!/bin/sh
#
# Check if we are running in an xbps-src environment and run the wrapper if that
# is the case.
if [ -n "$XBPS_CROSS_BASE" -a -n "$XBPS_TARGET_MACHINE" -a -n "$XBPS_VERSION" ]; then
# wrapper for g-ir-compiler, which runs the target version of it through qemu.
# g-ir-compiler writes out the raw content of a C struct to disk, and therefore
# is architecture dependent.
if [ -x build/tools/g-ir-compiler ]; then
# We are compiling gobject-introspection.
# lets used the one we just compiled.
gir_bin=build/tools/g-ir-compiler
elif [ -x ${XBPS_CROSS_BASE}/usr/bin/g-ir-compiler.wrapped ]; then
# Lets use the g-ir-compiler from the target
gir_bin=${XBPS_CROSS_BASE}/usr/bin/g-ir-compiler.wrapped
fi
exec /usr/bin/g-ir-scanner-qemuwrapper ${gir_bin} "$@"
fi
exec /usr/bin/g-ir-compiler.wrapped "$@"

View File

@ -0,0 +1,2 @@
#!/bin/sh
/usr/bin/prelink-rtld --root=${XBPS_CROSS_BASE} "$@"

View File

@ -0,0 +1,16 @@
#!/bin/sh
# Use a modules directory which doesn't exist so we don't load random things
# which may then get deleted (or their dependencies) and potentially segfault
export GIO_MODULE_DIR=${XBPS_CROSS_BASE}/gio/modules-dummy
case "$XBPS_TARGET_MACHINE" in
x86_64*) _MACHINE=x86_64 ;;
i686) _MACHINE=i386 ;;
aarch64*) _MACHINE=aarch64 ;;
armv*) _MACHINE=arm ;;
esac
/usr/bin/qemu-${_MACHINE}-static \
-L ${XBPS_CROSS_BASE} \
-E LD_LIBRARY_PATH="${XBPS_CROSS_BASE}/usr/lib:.libs:${GIR_EXTRA_LIBS_PATH}" \
"$@"

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Check if we are running in an xbps-src environment and run the wrapper if that
# is the case.
if [ -n "$XBPS_CROSS_BASE" -a -n "$XBPS_TARGET_MACHINE" -a -n "$XBPS_VERSION" ]; then
# This prevents g-ir-scanner from writing cache data to $HOME
export GI_SCANNER_DISABLE_CACHE=1
exec /usr/bin/g-ir-scanner.wrapped \
--use-binary-wrapper=/usr/bin/g-ir-scanner-qemuwrapper \
--use-ldd-wrapper=/usr/bin/g-ir-scanner-lddwrapper \
--add-include-path=${XBPS_CROSS_BASE}/usr/share/gir-1.0 \
--add-include-path=${XBPS_CROSS_BASE}/usr/lib/gir-1.0 \
"${@//-I\/usr\/include/-I${XBPS_CROSS_BASE}\/usr\/include}"
fi
exec /usr/bin/g-ir-scanner.wrapped "$@"

View File

@ -0,0 +1,160 @@
From ea25a5a755bc839d5b504aac207f860ae68109bc Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 15 Nov 2018 15:10:05 +0100
Subject: [PATCH] Port cross-compilation support to meson
Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
gir/meson.build | 59 ++++++++++++++++++++++++++++++++++-------------
meson.build | 4 +++-
meson_options.txt | 20 ++++++++++++++++
3 files changed, 66 insertions(+), 17 deletions(-)
diff --git a/gir/meson.build b/gir/meson.build
index 1cb514a..f873068 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -36,15 +36,27 @@ gir_files = [
typelibdir = join_paths(get_option('libdir'), 'girepository-1.0')
install_data(gir_files, install_dir: girdir)
-scanner_command = [
- python,
- girscanner,
- '--output=@OUTPUT@',
- '--no-libtool',
- '--reparse-validate',
- '--add-include-path', join_paths(meson.current_build_dir()),
- '--add-include-path', join_paths(meson.current_source_dir()),
-]
+if get_option('enable-host-gi')
+ scanner_command = [
+ 'g-ir-scanner',
+ '--output=@OUTPUT@',
+ '--no-libtool',
+ '--reparse-validate',
+ '--add-include-path', join_paths(meson.current_build_dir()),
+ '--add-include-path', join_paths(meson.current_source_dir()),
+ ]
+else
+ scanner_command = [
+ python,
+ girscanner,
+ '--output=@OUTPUT@',
+ '--no-libtool',
+ '--reparse-validate',
+ '--add-include-path', join_paths(meson.current_build_dir()),
+ '--add-include-path', join_paths(meson.current_source_dir()),
+ ]
+endif
+
dep_type = glib_dep.type_name()
if dep_type == 'internal'
@@ -57,6 +69,12 @@ if dep_type == 'internal'
'--extra-library=glib-2.0', '--extra-library=gobject-2.0']
endif
+if get_option('enable-gi-cross-wrapper') != ''
+ scanner_command += ['--use-binary-wrapper=' + get_option('enable-gi-cross-wrapper')]
+endif
+if get_option('enable-gi-ldd-wrapper') != ''
+ scanner_command += ['--use-ldd-wrapper=' + get_option('enable-gi-ldd-wrapper')]
+endif
# Take a glob and print to newlines
globber = '''
from glob import glob
@@ -83,8 +101,8 @@ glib_command = scanner_command + [
if dep_type == 'pkgconfig'
glib_command += ['--external-library', '--pkg=glib-2.0']
- glib_libdir = glib_dep.get_pkgconfig_variable('libdir')
- glib_incdir = join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
+ glib_libdir = get_option('pkgconfig-sysroot-path') + glib_dep.get_pkgconfig_variable('libdir')
+ glib_incdir = get_option('pkgconfig-sysroot-path') + join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
glib_libincdir = join_paths(glib_libdir, 'glib-2.0', 'include')
glib_files += join_paths(glib_incdir, 'gobject', 'glib-types.h')
glib_files += join_paths(glib_libincdir, 'glibconfig.h')
@@ -338,7 +356,7 @@ endforeach
if giounix_dep.found()
if dep_type == 'pkgconfig'
gio_command += ['--pkg=gio-unix-2.0']
- giounix_includedir = join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0')
+ giounix_includedir = get_option('pkgconfig-sysroot-path') + join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0')
# Get the installed gio-unix header list
ret = run_command(python, '-c', globber.format(join_paths(giounix_includedir, 'gio', '*.h')))
if ret.returncode() != 0
@@ -416,15 +434,24 @@ gir_files += custom_target('gir-girepository',
]
)
+if get_option('enable-gi-cross-wrapper') != ''
+ gircompiler_command = [get_option('enable-gi-cross-wrapper'), gircompiler.full_path(), '-o', '@OUTPUT@', '@INPUT@',
+ '--includedir', meson.current_build_dir(),
+ '--includedir', meson.current_source_dir(),
+ ]
+else
+ gircompiler_command = [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
+ '--includedir', meson.current_build_dir(),
+ '--includedir', meson.current_source_dir(),
+ ]
+endif
+
foreach gir : gir_files
custom_target('generate-typelib-@0@'.format(gir).underscorify(),
input: gir,
output: '@BASENAME@.typelib',
depends: [gobject_gir, ],
- command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
- '--includedir', meson.current_build_dir(),
- '--includedir', meson.current_source_dir(),
- ],
+ command: gircompiler_command,
install: true,
install_dir: typelibdir,
)
diff --git a/meson.build b/meson.build
index 17acd82..e0bb495 100644
--- a/meson.build
+++ b/meson.build
@@ -81,7 +81,9 @@ libffi_dep = dependency('libffi',
subdir('girepository')
subdir('tools')
subdir('giscanner')
-subdir('gir')
+if get_option('enable-introspection-data') == true
+ subdir('gir')
+endif
subdir('examples')
subdir('docs')
subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
index ee6958d..b168142 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -25,3 +25,23 @@ option('python', type: 'string', value: 'python3',
option('gir-dir-prefix', type: 'string',
description: 'Intermediate prefix for gir installation under ${prefix}'
)
+
+option('enable-host-gi', type: 'boolean', value : false,
+ description: 'Use gobject introspection tools installed in the host system (useful when cross-compiling)'
+)
+
+option('enable-gi-cross-wrapper', type: 'string',
+ description: 'Use a wrapper to run gicompiler and binaries produced by giscanner (useful when cross-compiling)'
+)
+
+option('enable-gi-ldd-wrapper', type: 'string',
+ description: 'Use a ldd wrapper instead of system ldd command in giscanner (useful when cross-compiling)'
+)
+
+option('enable-introspection-data', type: 'boolean', value : true,
+ description: 'Build introspection data (.gir and .typelib files) in addition to library and tools'
+)
+
+option('pkgconfig-sysroot-path', type: 'string',
+ description: 'Specify a sysroot path to prepend to pkgconfig output (useful when cross-compiling)'
+)

View File

@ -0,0 +1,76 @@
From 7ea8c83d84a05f686128e652a5447fb5f6fb68be Mon Sep 17 00:00:00 2001
From: Sascha Silbe <x-yo17@se-silbe.de>
Date: Fri, 8 Jun 2018 13:55:10 +0200
Subject: [PATCH] Relocate the repository directory for native builds
Instead of hard-coding GOBJECT_INTROSPECTION_LIBDIR when
gobject-introspection is built, use dladdr() to determine where
GOBJECT_INTROSPECTION_LIBDIR is and use that path to calculate the
repository directory.
This fixes gobject-introspection-native accessing paths across build
directories (e.g. if the build directories use the same shared state
cache or sstate mirror).
Upstream-Status: Inappropriate
Signed-off-by: Sascha Silbe <x-yo17@se-silbe.de>
---
girepository/girepository.c | 15 +++++++++++++--
girepository/meson.build | 2 +-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/girepository/girepository.c b/girepository/girepository.c
index c1fa3d3..efa557e 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -21,6 +21,8 @@
* Boston, MA 02111-1307, USA.
*/
+#define _GNU_SOURCE
+
#include "config.h"
#include <stdio.h>
@@ -34,6 +36,8 @@
#include "gitypelib-internal.h"
#include "girepository-private.h"
+#include <dlfcn.h>
+
/**
* SECTION:girepository
* @short_description: GObject Introspection repository manager
@@ -188,9 +192,16 @@ init_globals (void)
g_free (custom_dirs);
}
- libdir = GOBJECT_INTROSPECTION_LIBDIR;
+ Dl_info gi_lib_info;
- typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
+ if (dladdr (g_irepository_get_default, &gi_lib_info)) {
+ char *libdir = g_path_get_dirname (gi_lib_info.dli_fname);
+ typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
+ g_free (libdir);
+ } else {
+ libdir = GOBJECT_INTROSPECTION_LIBDIR;
+ typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
+ }
typelib_search_path = g_slist_prepend (typelib_search_path, typelib_dir);
diff --git a/girepository/meson.build b/girepository/meson.build
index 6a8c5b5..8892f2a 100644
--- a/girepository/meson.build
+++ b/girepository/meson.build
@@ -27,7 +27,7 @@ girepo_internals_lib = static_library('girepository-internals',
],
c_args: gi_hidden_visibility_cflags,
include_directories : configinc,
- dependencies: [girepo_gthash_dep, libffi_dep],
+ dependencies: [girepo_gthash_dep, libffi_dep, cc.find_library('dl')],
)
girepo_internals_dep = declare_dependency(

View File

@ -0,0 +1,48 @@
From ca0fb17e268c176ac89df081b1efa4a42989f014 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 23 Mar 2016 17:07:28 +0200
Subject: [PATCH] Revert an incomplete upstream attempt at cross-compile
support
Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
common.mk | 4 ----
giscanner/gdumpparser.py | 6 ------
2 files changed, 10 deletions(-)
diff --git a/common.mk b/common.mk
index b778f7a..e26c637 100644
--- a/common.mk
+++ b/common.mk
@@ -24,12 +24,8 @@ INTROSPECTION_SCANNER_ARGS = \
--add-include-path=$(top_builddir) \
--add-include-path=$(top_builddir)/gir
-# GI_CROSS_LAUNCHER is the command to use for executing g-ir-compiler.
-# Normally will be undefined but can be set (e.g. to wine or qemu)
-# when cross-compiling
INTROSPECTION_COMPILER = \
env PATH=".libs:$(PATH)" \
- $(GI_CROSS_LAUNCHER) \
$(top_builddir)/g-ir-compiler$(EXEEXT)
INTROSPECTION_COMPILER_ARGS = \
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index cd9d94d..b41772c 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -161,12 +161,6 @@ blob containing data gleaned from GObject's primitive introspection."""
out_path = os.path.join(self._binary.tmpdir, 'dump.xml')
args = []
-
- # Prepend the launcher command and arguments, if defined
- launcher = os.environ.get('GI_CROSS_LAUNCHER')
- if launcher:
- args.extend(launcher.split())
-
args.extend(self._binary.args)
args.append('--introspect-dump=%s,%s' % (in_path, out_path))

View File

@ -0,0 +1,27 @@
From f128cbeead687bfc6532cc1f2cc3e2dc5a2b5b30 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 5 Sep 2018 16:46:52 +0200
Subject: [PATCH] giscanner: ignore error return codes from ldd-wrapper
prelink-rtld, which we use instead of ldd returns 127 when it can't find a library.
It is not an error per se, but it breaks subprocess.check_output().
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
giscanner/shlibs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index 01d21a3..3bd3250 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -108,7 +108,7 @@ def _resolve_non_libtool(options, binary, libraries):
args.extend(['otool', '-L', binary.args[0]])
else:
args.extend(['ldd', binary.args[0]])
- output = subprocess.check_output(args)
+ output = subprocess.run(args, check=False, stdout=subprocess.PIPE).stdout
if isinstance(output, bytes):
output = output.decode("utf-8", "replace")

View File

@ -0,0 +1,64 @@
g-ir-tools: respect gir_dir_prefix
Configure option gir_dir_prefix is used to configure install dir for
.gir files, so add its value to include file search paths.
Upstream-Status: Accepted [https://gitlab.gnome.org/GNOME/gobject-introspection/commit/3fe995a]
Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
giscanner/transformer.py | 1 +
tests/warn/warningtester.py | 1 +
tools/g-ir-tool-template.in | 10 ++++++++++
6 files changed, 15 insertions(+), 2 deletions(-)
g-ir-scanner: tools/g-ir-tool-template.in _giscanner.la Makefile
$(AM_V_GEN) sed $(TOOL_SUBSTITUTIONS) -e s,@TOOL_MODULE\@,scannermain, -e s,@TOOL_FUNCTION\@,scanner_main, $< > $@.tmp && mv $@.tmp $@
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 335e229f..2c412339 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -184,6 +184,7 @@ None."""
def _get_gi_data_dirs(self):
data_dirs = utils.get_system_data_dirs()
data_dirs.append(DATADIR)
+ data_dirs.append(GIRDIR)
if os.name != 'nt':
# For backwards compatibility, was always unconditionally added to the list.
data_dirs.append('/usr/share')
diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py
index f17c8889..be5aec13 100644
--- a/tests/warn/warningtester.py
+++ b/tests/warn/warningtester.py
@@ -18,6 +18,7 @@ sys.path.insert(0, path)
# Not correct, but enough to get the tests going uninstalled
builtins.__dict__['DATADIR'] = path
+builtins.__dict__['GIRDIR'] = ''
from giscanner.annotationparser import GtkDocCommentBlockParser
from giscanner.ast import Include, Namespace
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index ed33d16b..b9cf0911 100755
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -60,6 +60,16 @@ if not os.path.isdir(os.path.join(datadir, 'gir-1.0')):
builtins.__dict__['DATADIR'] = datadir
+# Respect gir_dir_prefix for meson and autotools
+girdir = ''
+# for meson
+if '@gir_dir_prefix@' and not '@gir_dir_prefix@'.startswith('@'):
+ girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@'))
+# for autotools
+elif '@GIR_DIR@' and not '@GIR_DIR@'.startswith('@'):
+ girdir = os.path.dirname(os.path.abspath('@GIR_DIR@'))
+builtins.__dict__['GIRDIR'] = girdir
+
# Again, relative paths first so that the installation prefix is relocatable
pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection'))
--
2.17.0

View File

@ -0,0 +1,49 @@
From 46dbe963aa6435591c87e788cdb54bc0daeac42e Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Mon, 19 Oct 2015 18:26:40 +0300
Subject: [PATCH] giscanner: add --use-binary-wrapper option
With this option, giscanner will use a wrapper executable to run
binaries it's producing, instead of running them directly. This
is useful when binaries are cross-compiled and cannot be run directly,
but they can be run using for example QEMU emulation.
Upstream-Status: Pending [review on oe-core list]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
giscanner/scannermain.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index ccb14e9..061def0 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -126,6 +126,9 @@ def _get_option_parser():
parser.add_option("", "--program",
action="store", dest="program", default=None,
help="program to execute")
+ parser.add_option("", "--use-binary-wrapper",
+ action="store", dest="wrapper", default=None,
+ help="wrapper to use for running programs (useful when cross-compiling)")
parser.add_option("", "--program-arg",
action="append", dest="program_args", default=[],
help="extra arguments to program")
@@ -418,6 +421,17 @@ def create_binary(transformer, options, args):
gdump_parser.get_error_quark_functions())
shlibs = resolve_shlibs(options, binary, options.libraries)
+ if options.wrapper:
+ # The wrapper needs the binary itself, not the libtool wrapper script,
+ # so we check if libtool has sneaked the binary into .libs subdirectory
+ # and adjust the path accordingly
+ import os.path
+ dir_name, binary_name = os.path.split(binary.args[0])
+ libtool_binary = os.path.join(dir_name, '.libs', binary_name)
+ if os.path.exists(libtool_binary):
+ binary.args[0] = libtool_binary
+ # Then prepend the wrapper to the command line to execute
+ binary.args = [options.wrapper] + binary.args
gdump_parser.set_introspection_binary(binary)
gdump_parser.parse()
return shlibs

View File

@ -0,0 +1,45 @@
From eba2b999e81d81b5f43bb1f0ab33881786bebdec Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Fri, 30 Oct 2015 16:28:46 +0200
Subject: [PATCH] giscanner: add a --use-ldd-wrapper option
This is useful in cross-compile environments where system's ldd
command does not work on binaries built for a different architecture
Upstream-Status: Pending [review in oe-core]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
giscanner/scannermain.py | 3 +++
giscanner/shlibs.py | 4 +++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 061def0..5cb793e 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -129,6 +129,9 @@ def _get_option_parser():
parser.add_option("", "--use-binary-wrapper",
action="store", dest="wrapper", default=None,
help="wrapper to use for running programs (useful when cross-compiling)")
+ parser.add_option("", "--use-ldd-wrapper",
+ action="store", dest="ldd_wrapper", default=None,
+ help="wrapper to use instead of ldd (useful when cross-compiling)")
parser.add_option("", "--program-arg",
action="append", dest="program_args", default=[],
help="extra arguments to program")
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index 7b7b2d0..01d21a3 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -102,7 +102,9 @@ def _resolve_non_libtool(options, binary, libraries):
args.extend(libtool)
args.append('--mode=execute')
platform_system = platform.system()
- if platform_system == 'Darwin':
+ if options.ldd_wrapper:
+ args.extend([options.ldd_wrapper, binary.args[0]])
+ elif platform_system == 'Darwin':
args.extend(['otool', '-L', binary.args[0]])
else:
args.extend(['ldd', binary.args[0]])

View File

@ -1,21 +1,63 @@
# Template file for 'gobject-introspection' # Template file for 'gobject-introspection'
pkgname=gobject-introspection pkgname=gobject-introspection
version=1.58.3 version=1.58.3
revision=1 revision=2
build_style=meson build_style=meson
pycompile_dirs="usr/lib/${pkgname}/giscanner" pycompile_dirs="usr/lib/${pkgname}/giscanner"
hostmakedepends="flex pkg-config" hostmakedepends="flex pkg-config"
makedepends="cairo-devel libffi-devel libglib-devel libxml2-devel python3-devel" makedepends="cairo-devel libffi-devel libglib-devel libxml2-devel python3-devel"
depends="libgirepository-devel" depends="libgirepository-devel python3-Mako python3-Markdown"
short_desc="Introspection system for GObject-based libraries" short_desc="Introspection system for GObject-based libraries"
maintainer="Enno Boland <gottox@voidlinux.org>" maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-2.0-or-later, LGPL-2.1-or-later" license="GPL-2.0-or-later, LGPL-2.1-or-later"
homepage="https://wiki.gnome.org/Projects/GObjectIntrospection" homepage="https://wiki.gnome.org/Projects/GObjectIntrospection"
distfiles="${GNOME_SITE}/${pkgname}/${version%.*}/${pkgname}-${version}.tar.xz" distfiles="${GNOME_SITE}/${pkgname}/${version%.*}/${pkgname}-${version}.tar.xz"
checksum=025b632bbd944dcf11fc50d19a0ca086b83baf92b3e34936d008180d28cdc3c8 checksum=025b632bbd944dcf11fc50d19a0ca086b83baf92b3e34936d008180d28cdc3c8
nocross=yes
pycompile_version="$py3_ver" pycompile_version="$py3_ver"
patch_args="-Np1"
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" gobject-introspection qemu-user-static prelink-cross"
configure_args+=" -Denable-host-gi=true
-Denable-gi-cross-wrapper=/usr/bin/g-ir-scanner-qemuwrapper
-Denable-gi-ldd-wrapper=/usr/bin/g-ir-scanner-lddwrapper
-Dpkgconfig-sysroot-path=${XBPS_CROSS_BASE}"
fi
post_install() {
# Install our wrappers system-wide, they are required for building all other
# gobject-based packages.
vbin ${FILESDIR}/g-ir-scanner-qemuwrapper
vbin ${FILESDIR}/g-ir-scanner-lddwrapper
# Install g-ir-scanner-wrapper as g-ir-scanner, we need it with that name since
# we can't expect people to just not hardcode /usr/bin/g-ir-scanner, some packages
# like gtk+3 just like **really** much to use /usr/bin/g-ir-scanner and meson with
# find_program is also to blame.
mv ${DESTDIR}/usr/bin/g-ir-scanner{,.wrapped}
vbin ${FILESDIR}/g-ir-scanner-wrapper g-ir-scanner
# Same logic of g-ir-scanner applies here
mv ${DESTDIR}/usr/bin/g-ir-compiler{,.wrapped}
vbin ${FILESDIR}/g-ir-compiler-wrapper g-ir-compiler
# modify the pkg-config files to respect ${pc_sysrootdir} for variables that are
# meant to be called with 'pkg-config --variable'
vsed -e 's|^g_ir_scanner=.*|g_ir_scanner=${pc_sysrootdir}/${bindir}/g-ir-scanner|g' \
-e 's|^g_ir_compiler=.*|g_ir_compiler=${pc_sysrootdir}/${bindir}/g-ir-compiler|g' \
-e 's|^g_ir_generate=.*|g_ir_generate=${pc_sysrootdir}/${bindir}/g-ir-generate|g' \
-e 's|^gidatadir.*|gidatadir=${pc_sysrootdir}/${datadir}/gobject-introspection-1.0|g' \
-e 's|^girdir.*|girdir=${pc_sysrootdir}/${datadir}/gir-1.0|g' \
-e 's|^typelibdir.*|typelibdir=${pc_sysrootdir}/${libdir}/girepository-1.0|g' \
-i ${DESTDIR}/usr/lib/pkgconfig/gobject-introspection-1.0.pc \
-i ${DESTDIR}/usr/lib/pkgconfig/gobject-introspection-no-export-1.0.pc
# Fix the name of the python3 c bindings
mv ${DESTDIR}/usr/lib/gobject-introspection/giscanner/_giscanner*.so \
${DESTDIR}/usr/lib/gobject-introspection/giscanner/_giscanner.so
}
gir-freedesktop_package() { gir-freedesktop_package() {
short_desc="Introspection data for some FreeDesktop components" short_desc="Introspection data for some FreeDesktop components"
pkg_install() { pkg_install() {
@ -39,5 +81,6 @@ libgirepository-devel_package() {
vmove usr/lib/pkgconfig vmove usr/lib/pkgconfig
vmove "usr/lib/*.so" vmove "usr/lib/*.so"
vmove usr/share/gir-1.0 vmove usr/share/gir-1.0
vmove usr/share/aclocal
} }
} }