Skip to content

Commit

Permalink
experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxython committed Jan 4, 2024
1 parent 980ef1e commit 0a1f360
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 4 deletions.
38 changes: 34 additions & 4 deletions gpkg/gobject-introspection/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,42 @@ TERMUX_PKG_VERSION="1.78.1"
TERMUX_PKG_SRCURL=https://download.gnome.org/sources/gobject-introspection/${TERMUX_PKG_VERSION%.*}/gobject-introspection-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=bd7babd99af7258e76819e45ba4a6bc399608fe762d83fde3cac033c50841bb4
TERMUX_PKG_DEPENDS="libgirepository-glibc, python-glibc"
TERMUX_PKG_BUILD_DEPENDS="coreutils-glibc"
TERMUX_PKG_MESON_NATIVE=true
#TERMUX_PKG_BUILD_DEPENDS="coreutils-glibc"
#TERMUX_PKG_MESON_NATIVE=true
#TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
#-Dpython=$TERMUX_PREFIX/bin/python3
#"
TERMUX_PKG_DISABLE_GIR=false
TERMUX_PKG_PYTHON_COMMON_DEPS="wheel"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-Dpython=$TERMUX_PREFIX/bin/python3
-Dcairo_libname=libcairo-gobject.so
-Dpython=python
-Dbuild_introspection_data=true
"

#termux_step_pre_configure() {
# CPPFLAGS+="-I$TERMUX_PREFIX/include/python${TERMUX_PYTHON_VERSION} -I$TERMUX_PREFIX/include/python${TERMUX_PYTHON_VERSION}/cpython"
#}

termux_step_pre_configure() {
CPPFLAGS+="-I$TERMUX_PREFIX/include/python${TERMUX_PYTHON_VERSION} -I$TERMUX_PREFIX/include/python${TERMUX_PYTHON_VERSION}/cpython"
TERMUX_PKG_VERSION=. termux_setup_gir
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+="
-Dgi_cross_binary_wrapper=$GI_CROSS_LAUNCHER
"
unset GI_CROSS_LAUNCHER
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+="
-Dgi_cross_use_prebuilt_gi=true
-Dgi_cross_ldd_wrapper=$(command -v ldd)
"
fi

echo "Applying meson-python.diff"
sed "s%@PYTHON_VERSION@%$TERMUX_PYTHON_VERSION%g" \
$TERMUX_PKG_BUILDER_DIR/meson-python.diff | patch --silent -p1

CPPFLAGS+="
-I$TERMUX_PREFIX/include/python${TERMUX_PYTHON_VERSION}
-I$TERMUX_PREFIX/include/python${TERMUX_PYTHON_VERSION}/cpython
"
}
29 changes: 29 additions & 0 deletions gpkg/gobject-introspection/gi-cross-launcher-on-device.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!@TERMUX_PREFIX@/bin/sh

DUMP_DIR="$TERMUX_PKG_GIR_PRE_GENERATED_DUMP_DIR"
mkdir -p "$DUMP_DIR" || exit 1

ERROR_HEADER="gi-cross-launcher: ERROR:"

#logfile="$(readlink -f "$(dirname "$0")")/../gi-cross-launcher.log"
#echo "$@" >> "$logfile"

cmd="$1"
case "$cmd" in
*/g-ir-compiler | g-ir-compiler ) exec "$@" ;;
esac

arg="$2"
case "$arg" in
--introspect-dump=*,* ) ;;
* ) echo "$ERROR_HEADER Unsupported command: $@" >&2; exit 1 ;;
esac

cmd_base="$(basename "$cmd")"
dest_xml="${arg##*,}"
"$@"
ret="$?"
if [ "$ret" -ne 0 ]; then
exit "$ret"
fi
cp "$dest_xml" "$DUMP_DIR/${cmd_base}.xml" || exit 1
42 changes: 42 additions & 0 deletions gpkg/gobject-introspection/gi-cross-launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

PRE_GENERATED_DUMP_DIR="$TERMUX_PKG_GIR_PRE_GENERATED_DUMP_DIR"
G_IR_COMPILER="${TERMUX_G_IR_COMPILER:-g-ir-compiler}"

ERROR_HEADER="gi-cross-launcher: ERROR:"

#logfile="$(readlink -f "$(dirname "$0")")/../gi-cross-launcher.log"
#echo "$@" >> "$logfile"

cmd="$1"
case "$cmd" in
*/g-ir-compiler | g-ir-compiler )
shift
for a in "$@"; do
case "$a" in
--shared-library=* | --shared-library )
echo "$ERROR_HEADER This script does not support --shared-library option for g-ir-compiler." >&2
echo "$ERROR_HEADER Command: $cmd $@" >&2
exit 1
;;
esac
done
exec "$G_IR_COMPILER" "$@"
;;
esac

arg="$2"
case "$arg" in
--introspect-dump=*,* ) ;;
* ) echo "$ERROR_HEADER Unsupported command: $@" >&2; exit 1 ;;
esac

cmd_base="$(basename "$cmd")"
pre_gen="$PRE_GENERATED_DUMP_DIR/${cmd_base}.xml"
if [ ! -e "$pre_gen" ]; then
echo "$ERROR_HEADER Pre-generated dump for $cmd_base not found." >&2
echo "$ERROR_HEADER Expected file: $pre_gen" >&2
exit 1
fi
dest_xml="${arg##*,}"
cp "$pre_gen" "$dest_xml" || exit 1
51 changes: 51 additions & 0 deletions gpkg/gobject-introspection/meson-python.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff -uNr gobject-introspection/giscanner/meson.build gobject-introspection.mod/giscanner/meson.build
--- gobject-introspection/giscanner/meson.build 2021-06-03 13:43:38.060569823 +0000
+++ gobject-introspection.mod/giscanner/meson.build 2021-06-03 13:55:08.705053742 +0000
@@ -98,24 +98,12 @@
dependencies: [glib_dep, gobject_dep, gio_dep, gmodule_dep],
)

-# https://github.com/mesonbuild/meson/issues/4117
-if host_machine.system() == 'windows'
- python_ext_dep = python.dependency()
-else
- python_ext_dep = python.dependency().partial_dependency(compile_args: true)
-endif
-
-if not python_ext_dep.found()
- # For example if Python is 32bit but we require a 64bit variant
- error('Python installation not useable')
-endif
-
giscanner_pymod = python.extension_module('_giscanner', ['giscannermodule.c'],
link_with: giscanner_lib,
c_args: gi_hidden_visibility_cflags + custom_c_args,
include_directories : configinc,
- dependencies: [glib_dep, gobject_dep, gio_dep, gmodule_dep,
- python_ext_dep],
+ dependencies: [glib_dep, gobject_dep, gio_dep, gmodule_dep],
+ link_args: '-lpython@PYTHON_VERSION@',
install: true,
install_dir: giscannerdir,
)
diff -uNr gobject-introspection/meson.build gobject-introspection.mod/meson.build
--- gobject-introspection/meson.build 2021-06-03 13:43:38.062569940 +0000
+++ gobject-introspection.mod/meson.build 2021-06-03 13:57:59.063038610 +0000
@@ -3,6 +3,7 @@
meson_version: '>= 0.58.2',
default_options: [
'warning_level=2',
+ 'c_link_args=-lpython@PYTHON_VERSION@',
'buildtype=debugoptimized',
],
)
@@ -157,9 +158,6 @@
libffi_dep = dependency('libffi',
fallback : ['libffi', 'ffi_dep'])

-# python headers
-cc.check_header('Python.h', dependencies: [python.dependency()], required: true)
-
# cairo
cairo_option = get_option('cairo')
if cc.get_id() == 'msvc'
15 changes: 15 additions & 0 deletions gpkg/gobject-introspection/meson.build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- a/meson.build
+++ b/meson.build
@@ -251,9 +249,9 @@
pkgconfig_variables = [
'datadir=' + '${prefix}' / get_option('datadir'),
'bindir=' + '${prefix}' / get_option('bindir'),
- 'g_ir_scanner=${bindir}/g-ir-scanner',
- 'g_ir_compiler=${bindir}/g-ir-compiler@0@'.format(exe_ext),
- 'g_ir_generate=${bindir}/g-ir-generate@0@'.format(exe_ext),
+ 'g_ir_scanner=g-ir-scanner',
+ 'g_ir_compiler=g-ir-compiler@0@'.format(exe_ext),
+ 'g_ir_generate=g-ir-generate@0@'.format(exe_ext),
'gidatadir=${datadir}/gobject-introspection-1.0',
'girdir=' + gir_dir_pc_prefix / 'gir-1.0',
'typelibdir=${libdir}/girepository-1.0',
File renamed without changes.

0 comments on commit 0a1f360

Please sign in to comment.