Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
From 952e2e2bb6a22ec8824223b03b65cb28361c6e34 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 cb97e76f..d29b28c8 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -266,6 +266,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.25.1

View File

@@ -0,0 +1,56 @@
config BR2_PACKAGE_GOBJECT_INTROSPECTION_ARCH_SUPPORTS
bool
default y
depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
# gobject-introspection programs cause a hang of Qemu on
# Microblaze, and supporting GOI on Microblaze is not very
# relevant.
depends on !BR2_microblazeel
depends on !BR2_microblazebe
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_HOST_GCC_AT_LEAST_8 # host-qemu
depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL
# 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_GOBJECT_INTROSPECTION
select BR2_PACKAGE_HOST_QEMU
select BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
select BR2_PACKAGE_LIBFFI
select BR2_PACKAGE_LIBGLIB2_BOOTSTRAP
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://gi.readthedocs.io/
comment "gobject-introspection needs python3"
depends on !BR2_PACKAGE_PYTHON3
depends on BR2_PACKAGE_GOBJECT_INTROSPECTION_ARCH_SUPPORTS
comment "gobject-introspection needs a glibc or musl toolchain, gcc >= 4.9, host gcc >= 8"
depends on BR2_USE_MMU
depends on BR2_PACKAGE_GOBJECT_INTROSPECTION_ARCH_SUPPORTS
depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL) || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
!BR2_HOST_GCC_AT_LEAST_8

View File

@@ -0,0 +1,2 @@
config BR2_PACKAGE_HOST_GOBJECT_INTROSPECTION
bool

View File

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

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env sh
@TARGET_OBJDUMP@ -p "$@"

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env sh
GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib"
# Pass -r to qemu-user as to trick glibc into not erroring 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@ \
@QEMU_USERMODE_ARGS@ \
-L "$(dirname "$0")/../../" \
-E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \
"$@"
# shellcheck disable=SC2181
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."
# shellcheck disable=SC2016
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 sh
# 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,5 @@
# From https://download.gnome.org/sources/gobject-introspection/1.86/gobject-introspection-1.86.0.sha256sum
sha256 920d1a3fcedeadc32acff95c2e203b319039dd4b4a08dd1a2dfd283d19c0b9ae gobject-introspection-1.86.0.tar.xz
sha256 faa2e414bd5f91d2d2c39e85c7cc3f2ccde05c3306f96b404f8ed8cf0266c279 COPYING.LGPL
sha256 4c1cedcbb4a12ea964f1160dbbf36099e5a59b96129a99a1a1a61f2cb09271fb COPYING.GPL
sha256 2596a580b8be710642b734a4ef459b9593db5f148b204a9ce65415e2db4fc87f giscanner/scannerlexer.l

View File

@@ -0,0 +1,160 @@
################################################################################
#
# gobject-introspection
#
################################################################################
GOBJECT_INTROSPECTION_VERSION_MAJOR = 1.86
GOBJECT_INTROSPECTION_VERSION = $(GOBJECT_INTROSPECTION_VERSION_MAJOR).0
GOBJECT_INTROSPECTION_SITE = https://download.gnome.org/sources/gobject-introspection/$(GOBJECT_INTROSPECTION_VERSION_MAJOR)
GOBJECT_INTROSPECTION_SOURCE = gobject-introspection-$(GOBJECT_INTROSPECTION_VERSION).tar.xz
GOBJECT_INTROSPECTION_INSTALL_STAGING = 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 depends on the bootstrap version of libglib2
# during the build because the full version depends on
# gobject-introspection (applies to target and host packages
# alike). "select BR2_PACKAGE_LIBGLIB2" in Config.in ensures the full
# libglib2 gets installed together with gobject-introspection.
GOBJECT_INTROSPECTION_DEPENDENCIES = \
host-autoconf-archive \
host-gobject-introspection \
host-qemu \
libffi \
libglib2-bootstrap \
python3 \
zlib
HOST_GOBJECT_INTROSPECTION_DEPENDENCIES = \
host-bison \
host-flex \
host-libglib2-bootstrap \
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.
# As of gobject-introspection version 1.84.0, Meson records the
# LD_LIBRARY_PATH set during config and passes it to g-ir-scanner.
HOST_GOBJECT_INTROSPECTION_CONF_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_prebuilt_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 \
-Dcairo=disabled \
-Dtests=false
HOST_GOBJECT_INTROSPECTION_CONF_OPTS = -Dtests=false
# 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_TOOLS_PYTHON_PATH
$(SED) '1s%#!.*%#!$(HOST_DIR)/bin/python3%' $(@D)/tools/g-ir-tool-template.in
endef
HOST_GOBJECT_INTROSPECTION_PRE_CONFIGURE_HOOKS += GOBJECT_INTROSPECTION_FIX_TOOLS_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/python3%' $(@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
$(SED) "s%@TARGET_OBJDUMP@%$(TARGET_OBJDUMP)%" \
$(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%@QEMU_USERMODE_ARGS@%$(call qstrip,$(BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS))%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. Unfortunately, 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 datadir to $(libdir)/../share which will prefix $(STAGING_DIR)
# to the correct location.
# Since we use libdir to define datadir, we must define datadir after
# libdir is defined.
$(SED) "\%^datadir=%d; s%^\(libdir=.*\)$$%\1\ndatadir=\$${libdir}/../share%" \
$(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 prefix prevents this error.
$(SED) "s%girdir=.*%girdir=\$${prefix}/share/gir-1.0%g" \
$(STAGING_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
$(SED) "s%typelibdir=.*%typelibdir=\$${prefix}/lib/girepository-1.0%g" \
$(STAGING_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
# Set includedir to $(STAGING_DIR)/usr/share/gir-1.0 instead of . or
# g-ir-compiler won't find .gir files resulting in a build failure for
# autotools-based based programs
$(SED) "s%includedir=.%includedir=$(STAGING_DIR)/usr/share/gir-1.0%g" \
$(STAGING_DIR)/usr/share/gobject-introspection-1.0/Makefile.introspection
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))