kumquat-buildroot/package/libglib2/libglib2.mk
James Knight 3f9622fe3d package/libglib2: bump version to 2.76.1
- glib2 has moved from PCRE to PCRE2 [1].
- Drop `fam` option since it no longer available [2].
- Drop "0001-fix-compile-time-atomic-detection.patch" since upstream
   patch was dropped and new atomic detection implementation has been
   applied in this version.
- Drop "0002-remove-cpp-requirement.patch" since upstream has modified
   its Meson scripts to have any C++ usage as optional.
- Drop "0003-Add-Wno-format-nonliteral-to-compiler-arguments.patch"
   since change is available in this version.
- Add new patch to address new Werror compilation errors [3].
- Renamed "0004-*.patch" -> "0001-*.patch" since it should still be
   applicable for its mentioned build case.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1938974
[2]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2570
[3]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3390

Signed-off-by: James Knight <james.d.knight@live.com>
[yann.morin.1998@free.fr:
  - update upstream status on new patch
  - regenerate .checkpackageignore
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2023-04-23 13:01:34 +02:00

151 lines
4.6 KiB
Makefile

################################################################################
#
# libglib2
#
################################################################################
LIBGLIB2_VERSION_MAJOR = 2.76
LIBGLIB2_VERSION = $(LIBGLIB2_VERSION_MAJOR).1
LIBGLIB2_SOURCE = glib-$(LIBGLIB2_VERSION).tar.xz
LIBGLIB2_SITE = https://download.gnome.org/sources/glib/$(LIBGLIB2_VERSION_MAJOR)
LIBGLIB2_LICENSE = LGPL-2.1+
LIBGLIB2_LICENSE_FILES = COPYING
LIBGLIB2_CPE_ID_VENDOR = gnome
LIBGLIB2_CPE_ID_PRODUCT = glib
LIBGLIB2_INSTALL_STAGING = YES
LIBGLIB2_CFLAGS = $(TARGET_CFLAGS)
LIBGLIB2_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
# glib/valgrind.h contains inline asm not compatible with thumb1
ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
LIBGLIB2_CFLAGS += -marm
endif
HOST_LIBGLIB2_CONF_OPTS = \
-Ddtrace=false \
-Dglib_debug=disabled \
-Dlibelf=disabled \
-Dselinux=disabled \
-Dsystemtap=false \
-Dxattr=false \
-Dtests=false \
-Doss_fuzz=disabled
LIBGLIB2_DEPENDENCIES = \
host-pkgconf host-libglib2 \
libffi pcre2 zlib $(TARGET_NLS_DEPENDENCIES)
HOST_LIBGLIB2_DEPENDENCIES = \
host-gettext \
host-libffi \
host-pcre2 \
host-pkgconf \
host-util-linux \
host-zlib
# We explicitly specify a giomodule-dir to avoid having a value
# containing ${libdir} in gio-2.0.pc. Indeed, a value depending on
# ${libdir} would be prefixed by the sysroot by pkg-config, causing a
# bogus installation path once combined with $(DESTDIR).
LIBGLIB2_CONF_OPTS = \
-Dglib_debug=disabled \
-Dlibelf=disabled \
-Dgio_module_dir=/usr/lib/gio/modules \
-Dtests=false \
-Doss_fuzz=disabled
LIBGLIB2_MESON_EXTRA_PROPERTIES = \
have_c99_vsnprintf=true \
have_c99_snprintf=true \
have_unix98_printf=true
ifneq ($(BR2_ENABLE_LOCALE),y)
LIBGLIB2_DEPENDENCIES += libiconv
endif
ifeq ($(BR2_PACKAGE_ELFUTILS),y)
LIBGLIB2_DEPENDENCIES += elfutils
endif
# Uses __atomic_compare_exchange_4
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
LIBGLIB2_LDFLAGS += -latomic
endif
ifeq ($(BR2_PACKAGE_LIBICONV),y)
LIBGLIB2_CONF_OPTS += -Diconv=external
LIBGLIB2_DEPENDENCIES += libiconv
endif
ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
LIBGLIB2_CONF_OPTS += -Dselinux=enabled -Dxattr=true
LIBGLIB2_DEPENDENCIES += libselinux
else
LIBGLIB2_CONF_OPTS += -Dselinux=disabled -Dxattr=false
endif
# Purge gdb-related files
ifneq ($(BR2_PACKAGE_GDB),y)
define LIBGLIB2_REMOVE_GDB_FILES
rm -rf $(TARGET_DIR)/usr/share/glib-2.0/gdb
endef
endif
ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT),y)
LIBGLIB2_CONF_OPTS += -Dlibmount=enabled
ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBS),y)
LIBGLIB2_DEPENDENCIES += util-linux-libs
else
LIBGLIB2_DEPENDENCIES += util-linux
endif
else
LIBGLIB2_CONF_OPTS += -Dlibmount=disabled
endif
# Purge useless binaries from target
define LIBGLIB2_REMOVE_DEV_FILES
rm -rf $(TARGET_DIR)/usr/lib/glib-2.0
rm -rf $(addprefix $(TARGET_DIR)/usr/share/glib-2.0/,codegen gettext)
rm -f $(addprefix $(TARGET_DIR)/usr/bin/,gdbus-codegen glib-compile-schemas glib-compile-resources glib-genmarshal glib-gettextize glib-mkenums gobject-query gtester gtester-report)
$(LIBGLIB2_REMOVE_GDB_FILES)
endef
LIBGLIB2_POST_INSTALL_TARGET_HOOKS += LIBGLIB2_REMOVE_DEV_FILES
# Newer versions of libglib2 prefix glib-genmarshal, gobject-query,
# glib-mkenums, glib_compile_schemas, glib_compile_resources and gdbus-codegen
# with ${bindir}. Unfortunately, this will resolve to the host systems /bin/
# directory, which will cause compilation issues if the host does not have these
# programs. By removing the ${bindir}/ prefix, these programs are resolved in
# PATH instead.
define LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE
$(SED) 's%$${bindir}/%%g' $(addprefix $(STAGING_DIR)/usr/lib/pkgconfig/, glib-2.0.pc gio-2.0.pc)
endef
LIBGLIB2_POST_INSTALL_TARGET_HOOKS += LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE
# Remove schema sources/DTDs, we use staging ones to compile them.
# Do so at target finalization since other packages install additional
# ones and we want to deal with it in a single place.
define LIBGLIB2_REMOVE_TARGET_SCHEMAS
rm -f $(TARGET_DIR)/usr/share/glib-2.0/schemas/*.xml \
$(TARGET_DIR)/usr/share/glib-2.0/schemas/*.dtd
endef
# Compile schemas at target finalization since other packages install
# them as well, and better do it in a central place.
# It's used at run time so it doesn't matter defering it.
define LIBGLIB2_COMPILE_SCHEMAS
$(HOST_DIR)/bin/glib-compile-schemas \
$(STAGING_DIR)/usr/share/glib-2.0/schemas \
--targetdir=$(TARGET_DIR)/usr/share/glib-2.0/schemas
endef
LIBGLIB2_TARGET_FINALIZE_HOOKS += LIBGLIB2_REMOVE_TARGET_SCHEMAS
LIBGLIB2_TARGET_FINALIZE_HOOKS += LIBGLIB2_COMPILE_SCHEMAS
$(eval $(meson-package))
$(eval $(host-meson-package))
LIBGLIB2_HOST_BINARY = $(HOST_DIR)/bin/glib-genmarshal