0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-02-22 16:57:09 +00:00
Termux Github Actions 79d6455505 bump(main/glib): 2.82.4
This commit has been automatically submitted by Github Actions.
2024-12-12 19:32:26 +00:00

153 lines
5.2 KiB
Bash

TERMUX_PKG_HOMEPAGE=https://developer.gnome.org/glib/
TERMUX_PKG_DESCRIPTION="Library providing core building blocks for libraries and applications written in C"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="2.82.4"
TERMUX_PKG_SRCURL=https://download.gnome.org/sources/glib/${TERMUX_PKG_VERSION%.*}/glib-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=37dd0877fe964cd15e9a2710b044a1830fb1bd93652a6d0cb6b8b2dff187c709
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="libandroid-support, libffi, libiconv, pcre2, resolv-conf, zlib"
TERMUX_PKG_BREAKS="glib-dev"
TERMUX_PKG_REPLACES="glib-dev"
TERMUX_PKG_VERSIONED_GIR=false
TERMUX_PKG_DISABLE_GIR=false
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-Dintrospection=enabled
-Druntime_dir=$TERMUX_PREFIX/var/run
-Dlibmount=disabled
-Dman-pages=enabled
-Dtests=false
"
TERMUX_PKG_RM_AFTER_INSTALL="
bin/glib-gettextize
bin/gtester-report
lib/locale
share/gdb/auto-load
share/glib-2.0/gdb
share/glib-2.0/gettext
share/gtk-doc
"
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS="
-Ddefault_library=static
-Dintrospection=disabled
-Dlibmount=disabled
-Dtests=false
--prefix ${TERMUX_PREFIX}/opt/${TERMUX_PKG_NAME}/cross
"
TERMUX_PKG_NO_SHEBANG_FIX_FILES="
opt/glib/cross/bin/gdbus-codegen
opt/glib/cross/bin/glib-genmarshal
opt/glib/cross/bin/glib-gettextize
opt/glib/cross/bin/glib-mkenums
opt/glib/cross/bin/gtester-report
"
termux_step_host_build() {
if [[ "${TERMUX_ON_DEVICE_BUILD}" == "true" ]]; then return; fi
# XXX: termux_setup_meson is not expected to be called in host build
AR=;CC=;CFLAGS=;CPPFLAGS=;CXX=;CXXFLAGS=;LD=;LDFLAGS=;PKG_CONFIG=;STRIP=
termux_setup_meson
unset AR CC CFLAGS CPPFLAGS CXX CXXFLAGS LD LDFLAGS PKG_CONFIG STRIP
${TERMUX_MESON} setup ${TERMUX_PKG_SRCDIR} . \
${TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS}
ninja -j "${TERMUX_PKG_MAKE_PROCESSES}" install
# termux_step_massage strip does not cover opt dir
find "${TERMUX_PREFIX}/opt" \
-path "*/glib/cross/bin/*" \
-type f -print0 | \
xargs -0 -r file | grep -E "ELF .+ (executable|shared object)" | \
cut -d":" -f1 | xargs -r strip --strip-unneeded --preserve-dates
}
termux_step_pre_configure() {
# glib checks for __BIONIC__ instead of __ANDROID__:
CFLAGS+=" -D__BIONIC__=1"
_PREFIX="$TERMUX_PKG_TMPDIR/prefix"
local _WRAPPER_BIN="${TERMUX_PKG_BUILDDIR}/_wrapper/bin"
rm -rf "$_PREFIX" "$_WRAPPER_BIN"
mkdir -p "$_PREFIX" "$_WRAPPER_BIN"
sed '/^export PKG_CONFIG_LIBDIR=/s|$|:'${_PREFIX}'/lib/pkgconfig|' \
"${TERMUX_STANDALONE_TOOLCHAIN}/bin/pkg-config" \
> "${_WRAPPER_BIN}/pkg-config"
chmod +x "${_WRAPPER_BIN}/pkg-config"
export PKG_CONFIG="${_WRAPPER_BIN}/pkg-config"
export PATH="${_WRAPPER_BIN}:${PATH}"
# Magic happens here.
# I borrowed nested building method from https://github.com/termux/termux-packages/blob/1244c75380beefc7f7da9744d55aa88df1640acb/x11-packages/qbittorrent/build.sh#L21-L28
# and modified termux_step_configure_meson in runtime to make it use another prefix
# Also I used advice from here https://github.com/termux/termux-packages/issues/20447#issuecomment-2156066062
# Running a subshell to not mess with variables
(
# Building `glib` with `-Dintrospection=disabled` and installing it to temporary directory
TERMUX_PKG_BUILDDIR="$TERMUX_PKG_TMPDIR/glib-build"
mkdir -p "$TERMUX_PKG_BUILDDIR"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/"-Dintrospection=enabled"/"-Dintrospection=disabled"}"
termux_setup_gir
cd "$TERMUX_PKG_BUILDDIR"
TERMUX_PREFIX="$_PREFIX" termux_step_configure
cd "$TERMUX_PKG_BUILDDIR"
termux_step_make
cd "$TERMUX_PKG_BUILDDIR"
termux_step_make_install
)
# Running a subshell to not mess with variables
(
# Building `gobject-introspection` and installing it to temporary directory
TERMUX_PKG_BUILDER_DIR="$TERMUX_SCRIPTDIR/packages/gobject-introspection"
TERMUX_PKG_BUILDDIR="$TERMUX_PKG_TMPDIR/gobject-introspection-build"
TERMUX_PKG_SRCDIR="$TERMUX_PKG_TMPDIR/gobject-introspection-src"
mkdir -p "$TERMUX_PKG_BUILDDIR" "$TERMUX_PKG_SRCDIR"
# Sourcing another build script for nested build
. "$TERMUX_PKG_BUILDER_DIR/build.sh"
cd "$TERMUX_PKG_CACHEDIR"
termux_step_get_source
termux_step_get_dependencies_python
termux_step_patch_package
termux_step_pre_configure
cd "$TERMUX_PKG_BUILDDIR"
TERMUX_PREFIX="$_PREFIX" termux_step_configure
cd "$TERMUX_PKG_BUILDDIR"
termux_step_make
cd "$TERMUX_PKG_BUILDDIR"
termux_step_make_install
)
# Place the GIR files inside the root of the GIR directory (gir/.) of the package
termux_setup_gir
# The package will be built with using gobject-introspection we built before...
}
termux_step_post_make_install() {
local pc_files=$(ls "${TERMUX_PREFIX}/opt/glib/cross/lib/x86_64-linux-gnu/pkgconfig")
for pc in ${pc_files}; do
echo "INFO: Patching cross pkgconfig ${pc}"
sed "s|\${bindir}|${TERMUX_PREFIX}/opt/glib/cross/bin|g" \
"${TERMUX_PREFIX}/lib/pkgconfig/${pc}" \
> "${TERMUX_PREFIX}/opt/glib/cross/lib/x86_64-linux-gnu/pkgconfig/${pc}"
done
}
termux_step_create_debscripts() {
for i in postinst postrm triggers; do
sed \
"s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
"${TERMUX_PKG_BUILDER_DIR}/hooks/${i}.in" > ./${i}
chmod 755 ./${i}
done
unset i
chmod 644 ./triggers
}