This commit is contained in:
TriForceX
2021-03-13 22:13:38 -03:00
parent c77595adbd
commit b3ecc6e32d
7043 changed files with 119377 additions and 73694 deletions

View File

@@ -0,0 +1,34 @@
From 473b4288d8f4e891d0d21f7b60ef8053c5cd7af9 Mon Sep 17 00:00:00 2001
From: Adam Duskett <aduskett@gmail.com>
Date: Mon, 3 Feb 2020 10:07:15 -0800
Subject: [PATCH] disable tests
If introspection data on the host is not built, meson throws the error:
"Unknown variable "typelibs". Because tests are not required, removing
the subdir tests alltogether fixes this issue.
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
meson.build | 6 ------
1 file changed, 6 deletions(-)
diff --git a/meson.build b/meson.build
index eed4d6b..5058664 100644
--- a/meson.build
+++ b/meson.build
@@ -214,12 +214,6 @@ if get_option('build_introspection_data') == true
endif
subdir('docs')
-# The tests will also run, which is not possible if they
-# were built for a different architecture.
-if not meson.is_cross_build()
- subdir('tests')
-endif
-
install_data('Makefile.introspection', install_dir: join_paths(get_option('datadir'), 'gobject-introspection-1.0'))
install_data('m4/introspection.m4', install_dir: join_paths(get_option('datadir'), 'aclocal'))
--
2.24.1

View File

@@ -0,0 +1,29 @@
From 72a427bc50daee8f1ded0e9221e53dbbf2a80f08 Mon Sep 17 00:00:00 2001
From: Adam Duskett <aduskett@gmail.com>
Date: Wed, 14 Mar 2018 12:07:10 -0400
Subject: [PATCH] Add rpath links to ccompiler
This patch allows gobject-introspection to process extra paths passed to the
compiler via the GIR_EXTRA_LIBS_PATH variable.
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
giscanner/ccompiler.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index a8bd5b1..51bb9bc 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -229,6 +229,8 @@ class CCompiler(object):
for envvar in runtime_path_envvar:
if envvar in os.environ:
+ for envvar_path in os.environ[envvar].split(':'):
+ args.append("-Wl,-rpath-link," + envvar_path)
os.environ[envvar] = \
os.pathsep.join(runtime_paths + [os.environ[envvar]])
else:
--
2.14.3

View File

@@ -0,0 +1,28 @@
From f742da8b3913f4818d3f419117076afe62f4dbf4 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>
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
giscanner/shlibs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index d67df95..80352a6 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -103,7 +103,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,49 @@
config BR2_PACKAGE_GOBJECT_INTROSPECTION_ARCH_SUPPORTS
bool
default y
depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
depends on !BR2_RISCV_32 # qemu-riscv32 segfaults in qemu-5.0.0
config BR2_PACKAGE_GOBJECT_INTROSPECTION
bool "gobject-introspection"
depends on BR2_USE_MMU # python3, libglib2
depends on BR2_PACKAGE_GOBJECT_INTROSPECTION_ARCH_SUPPORTS
# While gcc 4.8 might be compatible with gobject-introspection,
# The autobuilders use some toolchains from codesourcery which
# have gcc 4.8 and a very old version of glibc, which will cause
# compile errors with locale.c. As such, require 4.9 until this
# can be verified.
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
depends on BR2_TOOLCHAIN_USES_GLIBC
# gobject-introspection does not require python3 to run on the
# target; however, because the tools run in a qemu wrapper, a
# cross-compiled python3 must be installed to staging. As there
# is no current mechanism to tell Buildroot only to install
# python to staging, then python must also be installed
# unconditionally to the target when building
# gobject-introspection.
depends on BR2_PACKAGE_PYTHON3
select BR2_PACKAGE_HOST_QEMU
select BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
select BR2_PACKAGE_LIBFFI
select BR2_PACKAGE_LIBGLIB2
select BR2_PACKAGE_ZLIB
help
GObject introspection is a middleware layer between C
libraries (using GObject) and language bindings. The C library
can be scanned at compile time and generate a metadata file,
in addition to the actual native C library. Then at runtime,
language bindings can read this metadata and automatically
provide bindings to call into the C library.
https://wiki.gnome.org/action/show/Projects/GObjectIntrospection
comment "gobject-introspection needs python3"
depends on !BR2_PACKAGE_PYTHON3
depends on BR2_PACKAGE_GOBJECT_INTROSPECTION_ARCH_SUPPORTS
comment "gobject-introspection needs a glibc toolchain, gcc >= 4.9"
depends on BR2_USE_MMU
depends on BR2_PACKAGE_GOBJECT_INTROSPECTION_ARCH_SUPPORTS
depends on !BR2_TOOLCHAIN_USES_GLIBC || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
$(dirname $0)/g-ir-scanner-qemuwrapper $(dirname $0)/g-ir-compiler.real "$@"

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
${HOST_DIR}/sbin/prelink-rtld --root=$(dirname $0)/../../ "$@"

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Pass -r to qemu-user as to trick glibc into not errorings out if the host kernel
# is older than the target kernel.
# Use a modules directory which does not exist so we don't load random things
# which may then get deleted (or their dependencies) and potentially segfault
GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \
@QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \
-L $(dirname $0)/../../ \
-E LD_LIBRARY_PATH=${GIR_EXTRA_LIBS_PATH}:.libs:$(dirname $0)/../lib:$(dirname $0)/../../lib \
"$@"
if [[ $? -ne 0 ]]; then
echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help."
echo 'Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"'
exit 1
fi

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# These environment variables are empty by default, and as such ccompiler.py
# defaults to either using the system tools (CC, CXX, and CPP) or leaving
# the variables blank (LDFLAGS, CFLAGS, and CPPFLAGS.)
# Export these variables to ensure all build systems can generate .gir and
# .typelib files properly.
export CPP="${CPP:-${HOST_DIR}/bin/@BASENAME_TARGET_CPP@}"
export CC="${CC:-${HOST_DIR}/bin/@BASENAME_TARGET_CC@}"
export CXX="${CXX:-${HOST_DIR}/bin/@BASENAME_TARGET_CXX@}"
export CPPFLAGS="${CPPFLAGS:-@TARGET_CPPFLAGS@}"
export CFLAGS="${CFLAGS:-@TARGET_CFLAGS@}"
export CXXFLAGS="${CXXFLAGS:-@TARGET_CXXFLAGS@}"
export LDFLAGS="${LDFLAGS:-@TARGET_LDFLAGS@}"
export GI_SCANNER_DISABLE_CACHE=1
${HOST_DIR}/bin/g-ir-scanner \
--lib-dirs-envvar=GIR_EXTRA_LIBS_PATH \
--use-binary-wrapper=$(dirname $0)/g-ir-scanner-qemuwrapper \
--use-ldd-wrapper=$(dirname $0)/g-ir-scanner-lddwrapper \
--add-include-path=$(dirname $0)/../share/gir-1.0 "$@"

View File

@@ -0,0 +1,4 @@
#From http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.64/gobject-introspection-1.64.1.sha256sum
sha256 80beae6728c134521926affff9b2e97125749b38d38744dc901f4010ee3e7fa7 gobject-introspection-1.64.1.tar.xz
sha256 d245807f90032872d1438d741ed21e2490e1175dc8aa3afa5ddb6c8e529b58e5 COPYING.LGPL
sha256 32b1062f7da84967e7019d01ab805935caa7ab7321a7ced0e30ebe75e5df1670 COPYING.GPL

View File

@@ -0,0 +1,146 @@
################################################################################
#
# gobject-introspection
#
################################################################################
GOBJECT_INTROSPECTION_VERSION_MAJOR = 1.64
GOBJECT_INTROSPECTION_VERSION = $(GOBJECT_INTROSPECTION_VERSION_MAJOR).1
GOBJECT_INTROSPECTION_SITE = http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/$(GOBJECT_INTROSPECTION_VERSION_MAJOR)
GOBJECT_INTROSPECTION_SOURCE = gobject-introspection-$(GOBJECT_INTROSPECTION_VERSION).tar.xz
GOBJECT_INTROSPECTION_INSTALL_STAGING = YES
GOBJECT_INTROSPECTION_AUTORECONF = YES
GOBJECT_INTROSPECTION_LICENSE = LGPL-2.0+, GPL-2.0+, BSD-2-Clause
GOBJECT_INTROSPECTION_LICENSE_FILES = COPYING.LGPL COPYING.GPL giscanner/scannerlexer.l
GOBJECT_INTROSPECTION_DEPENDENCIES = \
host-autoconf-archive \
host-gobject-introspection \
host-prelink-cross \
host-qemu \
libffi \
libglib2 \
python3 \
zlib
HOST_GOBJECT_INTROSPECTION_DEPENDENCIES = \
host-bison \
host-flex \
host-libglib2 \
host-python3
# g-ir-scanner will default to /usr/bin/ld for linking if this is not set.
GOBJECT_INTROSPECTION_NINJA_ENV += \
CC="$(TARGET_CC)"
# When building, gobject-introspection uses tools/g-ir-scanner to build several
# .gir and .typelib files. g-ir-scanner does not use LDFLAGS, and by default,
# links to the system-installed libglib2 path. To remedy this issue, defining
# LD_LIBRARY_PATH forces g-ir-scanner to use our host installed libglib2 files.
HOST_GOBJECT_INTROSPECTION_NINJA_ENV += \
LD_LIBRARY_PATH="$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(HOST_DIR)/lib"
# Use the host gi-scanner to prevent the scanner from generating incorrect
# elf classes.
GOBJECT_INTROSPECTION_CONF_OPTS = \
-Dgi_cross_use_host_gi=true \
-Dgi_cross_binary_wrapper="$(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper" \
-Dgi_cross_ldd_wrapper="$(STAGING_DIR)/usr/bin/g-ir-scanner-lddwrapper" \
-Dbuild_introspection_data=true \
-Ddoctool=disabled
ifeq ($(BR2_PACKAGE_CAIRO),y)
GOBJECT_INTROSPECTION_DEPENDENCIES += cairo
GOBJECT_INTROSPECTION_CONF_OPTS += -Dcairo=enabled
else
GOBJECT_INTROSPECTION_CONF_OPTS += -Dcairo=disabled
endif
# GI_SCANNER_DISABLE_CACHE=1 prevents g-ir-scanner from writing cache data to ${HOME}
GOBJECT_INTROSPECTION_CONF_ENV = \
GI_SCANNER_DISABLE_CACHE=1
HOST_GOBJECT_INTROSPECTION_CONF_ENV = \
GI_SCANNER_DISABLE_CACHE=1
# Make sure g-ir-tool-template uses the host python.
define GOBJECT_INTROSPECTION_FIX_TOOLTEMPLATE_PYTHON_PATH
$(SED) '1s%#!.*%#!$(HOST_DIR)/bin/python%' $(@D)/tools/g-ir-tool-template.in
endef
HOST_GOBJECT_INTROSPECTION_PRE_CONFIGURE_HOOKS += GOBJECT_INTROSPECTION_FIX_TOOLTEMPLATE_PYTHON_PATH
# Perform the following:
# - Just as above, Ensure that g-ir-tool-template.in uses the host python.
# - Install all of the wrappers needed to build gobject-introspection.
# - Create a safe modules directory which does not exist so we don't load random things
# which may then get deleted (or their dependencies) and potentially segfault
define GOBJECT_INTROSPECTION_INSTALL_PRE_WRAPPERS
$(SED) '1s%#!.*%#!$(HOST_DIR)/bin/python%' $(@D)/tools/g-ir-tool-template.in
$(INSTALL) -D -m 755 $(GOBJECT_INTROSPECTION_PKGDIR)/g-ir-scanner-lddwrapper.in \
$(STAGING_DIR)/usr/bin/g-ir-scanner-lddwrapper
$(INSTALL) -D -m 755 $(GOBJECT_INTROSPECTION_PKGDIR)/g-ir-scanner-qemuwrapper.in \
$(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
$(SED) "s%@QEMU_USER@%$(QEMU_USER)%g" \
$(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
$(SED) "s%@TOOLCHAIN_HEADERS_VERSION@%$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)%g" \
$(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
# Use a modules directory which does not exist so we don't load random things
# which may then get deleted (or their dependencies) and potentially segfault
mkdir -p $(STAGING_DIR)/usr/lib/gio/modules-dummy
endef
GOBJECT_INTROSPECTION_PRE_CONFIGURE_HOOKS += GOBJECT_INTROSPECTION_INSTALL_PRE_WRAPPERS
# Move the real compiler and scanner to .real, and replace them with the wrappers.
# Using .real has the following advantages:
# - There is no need to change the logic for other packages.
# - The wrappers call the .real files using qemu.
define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
# Move the real binaries to their names.real, then replace them with
# the wrappers.
$(foreach w,g-ir-compiler g-ir-scanner,
mv $(STAGING_DIR)/usr/bin/$(w) $(STAGING_DIR)/usr/bin/$(w).real
$(INSTALL) -D -m 755 \
$(GOBJECT_INTROSPECTION_PKGDIR)/$(w).in $(STAGING_DIR)/usr/bin/$(w)
)
$(SED) "s%@BASENAME_TARGET_CPP@%$(notdir $(TARGET_CPP))%g" \
-e "s%@BASENAME_TARGET_CC@%$(notdir $(TARGET_CC))%g" \
-e "s%@BASENAME_TARGET_CXX@%$(notdir $(TARGET_CXX))%g" \
-e "s%@TARGET_CPPFLAGS@%$(TARGET_CPPFLAGS)%g" \
-e "s%@TARGET_CFLAGS@%$(TARGET_CFLAGS)%g" \
-e "s%@TARGET_CXXFLAGS@%$(TARGET_CXXFLAGS)%g" \
-e "s%@TARGET_LDFLAGS@%$(TARGET_LDFLAGS)%g" \
$(STAGING_DIR)/usr/bin/g-ir-scanner
# Gobject-introspection installs Makefile.introspection in
# $(STAGING_DIR)/usr/share which is needed for autotools-based programs to
# build .gir and .typelib files. Unfortuantly, gobject-introspection-1.0.pc
# uses $(prefix)/share as the directory, which
# causes the host /usr/share being used instead of $(STAGING_DIR)/usr/share.
# Change datarootdir to $(libdir)/../share which will prefix $(STAGING_DIR)
# to the correct location.
$(SED) "s%datarootdir=.*%datarootdir=\$${libdir}/../share%g" \
$(STAGING_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
# By default, girdir and typelibdir use datadir and libdir as their prefix,
# of which pkg-config appends the sysroot directory. This results in files
# being installed in $(STAGING_DIR)/$(STAGING_DIR)/path/to/files.
# Changing the prefix to exec_prefix prevents this error.
$(SED) "s%girdir=.*%girdir=\$${exec_prefix}/share/gir-1.0%g" \
$(STAGING_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
$(SED) "s%typelibdir=.*%typelibdir=\$${exec_prefix}/lib/girepository-1.0%g" \
$(STAGING_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
endef
GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
# Only .typelib files are needed to run.
define GOBJECT_INTROSPECTION_REMOVE_DEVELOPMENT_FILES
find $(TARGET_DIR)/usr/share \( -iname "*.gir" -o -iname \*.rnc \) -delete
endef
GOBJECT_INTROSPECTION_TARGET_FINALIZE_HOOKS += GOBJECT_INTROSPECTION_REMOVE_DEVELOPMENT_FILES
$(eval $(meson-package))
$(eval $(host-meson-package))