buildroot/package/libglib2/libglib2.mk

146 lines
4.5 KiB
Makefile
Raw Normal View History

################################################################################
2007-01-09 23:54:04 -07:00
#
# 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
2008-03-06 11:15:25 -07:00
LIBGLIB2_INSTALL_STAGING = YES
package/libglib2: fix build on ARM in Thumb mode Commit 4102db0f7 (package/libglib2: bump to version 2.60.3) did convert libglib2 over to meson. In doing so, it left a very corner-case along. When the target is an ARM CPU and the build is in thumb mode, then we want to ensure that libglib2 is still built in arm mode (because of inline asm). But with meson, CFLAGS from the environment are passed to the host compiler, so the build breaks, and the meson log contains: Appending CFLAGS from environment: '-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -marm' No LDFLAGS in the environment, not changing global flags. No CPPFLAGS in the environment, not changing global flags. Sanity testing C compiler: cc Is cross compiler: False. Sanity check compiler command line: cc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -marm [...]/build/libglib2-2.60.4/build/meson-private/sanitycheckc.c -o [...]/build/libglib2-2.60.4/build/meson-private/sanitycheckc.exe Sanity check compile stdout: ----- Sanity check compile stderr: cc: error: unrecognized command line option ‘-marm’; did you mean ‘-mabm’? ----- meson.build:1:0: ERROR: Compiler cc can not compile programs. Fix that by using the new per-package CFLAGS feature of the meson infra. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr> Cc: Adam Duskett <aduskett@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-06-24 14:25:50 -06:00
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)
package/libglib2: fix build on ARM in Thumb mode Commit 4102db0f7 (package/libglib2: bump to version 2.60.3) did convert libglib2 over to meson. In doing so, it left a very corner-case along. When the target is an ARM CPU and the build is in thumb mode, then we want to ensure that libglib2 is still built in arm mode (because of inline asm). But with meson, CFLAGS from the environment are passed to the host compiler, so the build breaks, and the meson log contains: Appending CFLAGS from environment: '-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -marm' No LDFLAGS in the environment, not changing global flags. No CPPFLAGS in the environment, not changing global flags. Sanity testing C compiler: cc Is cross compiler: False. Sanity check compiler command line: cc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -marm [...]/build/libglib2-2.60.4/build/meson-private/sanitycheckc.c -o [...]/build/libglib2-2.60.4/build/meson-private/sanitycheckc.exe Sanity check compile stdout: ----- Sanity check compile stderr: cc: error: unrecognized command line option ‘-marm’; did you mean ‘-mabm’? ----- meson.build:1:0: ERROR: Compiler cc can not compile programs. Fix that by using the new per-package CFLAGS feature of the meson infra. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr> Cc: Adam Duskett <aduskett@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-06-24 14:25:50 -06:00
LIBGLIB2_CFLAGS += -marm
endif
HOST_LIBGLIB2_CONF_OPTS = \
package/libglib2: bump to version 2.60.3 Changes include: - Change the package type to meson, as autoconf is no longer supported. - Add 0002-add-option-to-build-tests.patch Upstream won't build tests when cross-compiling. However; this means still building the tests during a host build. Building the tests causes build failures on older distributions such as CentOS 6 and Debian 7 because of the command `objcopy --add-symbol` is used when building the test "test_resources2," which is not available with the older version of objcopy provided by the distributions. - Add 0003-remove-cpp-requirement.patch: C++ is not needed when just compiling. The inclusion of C++ in meson.build is to ensure libglib doesn't accidentally use C++ reserved keywords in public headers. Because tests aren't being compiled, there is no need for C++ as a requirement. (https://gitlab.gnome.org/GNOME/glib/issues/1748) - Add 0004-Add-Wno-format-nonliteral-to-compiler-arguments.patch: This prevents a false error when compiling against older gcc versions. (https://gitlab.gnome.org/GNOME/glib/issues/1744) - Remove 0004-Do-not-hardcode-python-path-into-various-tools.patch: The switch to meson makes this obsolete. - Remove LIBGLIB2_AUTORECONF = YES from libglib2.mk: Now that libglib2 is a meson package, there is no need for AUTORECONF. - Remove LIBGLIB2_INSTALL_STAGING_OPTS from libglib2.mk: Meson resolves these correctly. - Add LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE in libglib2.mk: Newer versions of libglib2 prefix glib-genmarshal, gobject-query, and glib-mkenums 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. Signed-off-by: Adam Duskett <Aduskett@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-05-28 13:48:11 -06:00
-Ddtrace=false \
-Dglib_debug=disabled \
-Dlibelf=disabled \
package/libglib2: bump to version 2.60.3 Changes include: - Change the package type to meson, as autoconf is no longer supported. - Add 0002-add-option-to-build-tests.patch Upstream won't build tests when cross-compiling. However; this means still building the tests during a host build. Building the tests causes build failures on older distributions such as CentOS 6 and Debian 7 because of the command `objcopy --add-symbol` is used when building the test "test_resources2," which is not available with the older version of objcopy provided by the distributions. - Add 0003-remove-cpp-requirement.patch: C++ is not needed when just compiling. The inclusion of C++ in meson.build is to ensure libglib doesn't accidentally use C++ reserved keywords in public headers. Because tests aren't being compiled, there is no need for C++ as a requirement. (https://gitlab.gnome.org/GNOME/glib/issues/1748) - Add 0004-Add-Wno-format-nonliteral-to-compiler-arguments.patch: This prevents a false error when compiling against older gcc versions. (https://gitlab.gnome.org/GNOME/glib/issues/1744) - Remove 0004-Do-not-hardcode-python-path-into-various-tools.patch: The switch to meson makes this obsolete. - Remove LIBGLIB2_AUTORECONF = YES from libglib2.mk: Now that libglib2 is a meson package, there is no need for AUTORECONF. - Remove LIBGLIB2_INSTALL_STAGING_OPTS from libglib2.mk: Meson resolves these correctly. - Add LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE in libglib2.mk: Newer versions of libglib2 prefix glib-genmarshal, gobject-query, and glib-mkenums 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. Signed-off-by: Adam Duskett <Aduskett@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-05-28 13:48:11 -06:00
-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
package/libglib2: explicitly specify gio module path Since the switch to pkgconf 1.5.3 in commit 4e423669399ad8389edd81761ea5c9cc26bf312d, the glib-networking package has been failing to build with: glib-networking: installs files in /home/naourr/work/instance-0/output/host/i686-buildroot-linux-uclibc/sysroot//home/naourr/work/instance-0/output This error is due to glib-networking having installed its GIO GnuTLS module into an invalid location. This invalid location is $(DESTDIR)$(GIO_MODULE_DIR). GIO_MODULE_DIR is found by using: pkg-config --variable giomoduledir gio-2.0 Unfortunately, despite the pkgconf fix in commit 7125fc5c1a8a96ff8eee057789358702e1b55835 ("package/pkgconf: add patch to restore pre-1.5.3 behavior for sysroot prefixing"), the value returned by pkg-config for giomoduledir remains prefixed by the sysroot. This is due to the fact that giomoduledir is defined by default with the value ${libdir}/gio/modules. When running pkg-config --variable giomoduledir gio-2.0 with the new pkg-config version, what happens is that libdir is resolved first, and libdir is one of the variable for which we add the sysroot prefix. Then later, giomoduledir is resolved. For this variable, we don't prefix with the sysroot. However, when resolving the value of giomoduledir, it re-uses the value of libdir that was already resolved, and this value includes the sysroot prefix. There is no simple way to solve this problem within pkg-config. So for the time being, we take a simple route: make sure giomoduledir isn't defined in terms of ${libdir}. This is easily done by passing --with-gio-module-dir to libglib2 configure script. Fixes: http://autobuild.buildroot.net/results/4167159c4a03f5a72dbd7e286aedb3845164cc22/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-12-27 03:33:51 -07:00
# 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 \
package/libglib2: bump to version 2.60.3 Changes include: - Change the package type to meson, as autoconf is no longer supported. - Add 0002-add-option-to-build-tests.patch Upstream won't build tests when cross-compiling. However; this means still building the tests during a host build. Building the tests causes build failures on older distributions such as CentOS 6 and Debian 7 because of the command `objcopy --add-symbol` is used when building the test "test_resources2," which is not available with the older version of objcopy provided by the distributions. - Add 0003-remove-cpp-requirement.patch: C++ is not needed when just compiling. The inclusion of C++ in meson.build is to ensure libglib doesn't accidentally use C++ reserved keywords in public headers. Because tests aren't being compiled, there is no need for C++ as a requirement. (https://gitlab.gnome.org/GNOME/glib/issues/1748) - Add 0004-Add-Wno-format-nonliteral-to-compiler-arguments.patch: This prevents a false error when compiling against older gcc versions. (https://gitlab.gnome.org/GNOME/glib/issues/1744) - Remove 0004-Do-not-hardcode-python-path-into-various-tools.patch: The switch to meson makes this obsolete. - Remove LIBGLIB2_AUTORECONF = YES from libglib2.mk: Now that libglib2 is a meson package, there is no need for AUTORECONF. - Remove LIBGLIB2_INSTALL_STAGING_OPTS from libglib2.mk: Meson resolves these correctly. - Add LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE in libglib2.mk: Newer versions of libglib2 prefix glib-genmarshal, gobject-query, and glib-mkenums 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. Signed-off-by: Adam Duskett <Aduskett@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-05-28 13:48:11 -06:00
-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
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_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.
package/libglib2: bump to version 2.60.3 Changes include: - Change the package type to meson, as autoconf is no longer supported. - Add 0002-add-option-to-build-tests.patch Upstream won't build tests when cross-compiling. However; this means still building the tests during a host build. Building the tests causes build failures on older distributions such as CentOS 6 and Debian 7 because of the command `objcopy --add-symbol` is used when building the test "test_resources2," which is not available with the older version of objcopy provided by the distributions. - Add 0003-remove-cpp-requirement.patch: C++ is not needed when just compiling. The inclusion of C++ in meson.build is to ensure libglib doesn't accidentally use C++ reserved keywords in public headers. Because tests aren't being compiled, there is no need for C++ as a requirement. (https://gitlab.gnome.org/GNOME/glib/issues/1748) - Add 0004-Add-Wno-format-nonliteral-to-compiler-arguments.patch: This prevents a false error when compiling against older gcc versions. (https://gitlab.gnome.org/GNOME/glib/issues/1744) - Remove 0004-Do-not-hardcode-python-path-into-various-tools.patch: The switch to meson makes this obsolete. - Remove LIBGLIB2_AUTORECONF = YES from libglib2.mk: Now that libglib2 is a meson package, there is no need for AUTORECONF. - Remove LIBGLIB2_INSTALL_STAGING_OPTS from libglib2.mk: Meson resolves these correctly. - Add LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE in libglib2.mk: Newer versions of libglib2 prefix glib-genmarshal, gobject-query, and glib-mkenums 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. Signed-off-by: Adam Duskett <Aduskett@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-05-28 13:48:11 -06:00
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)
package/libglib2: bump to version 2.60.3 Changes include: - Change the package type to meson, as autoconf is no longer supported. - Add 0002-add-option-to-build-tests.patch Upstream won't build tests when cross-compiling. However; this means still building the tests during a host build. Building the tests causes build failures on older distributions such as CentOS 6 and Debian 7 because of the command `objcopy --add-symbol` is used when building the test "test_resources2," which is not available with the older version of objcopy provided by the distributions. - Add 0003-remove-cpp-requirement.patch: C++ is not needed when just compiling. The inclusion of C++ in meson.build is to ensure libglib doesn't accidentally use C++ reserved keywords in public headers. Because tests aren't being compiled, there is no need for C++ as a requirement. (https://gitlab.gnome.org/GNOME/glib/issues/1748) - Add 0004-Add-Wno-format-nonliteral-to-compiler-arguments.patch: This prevents a false error when compiling against older gcc versions. (https://gitlab.gnome.org/GNOME/glib/issues/1744) - Remove 0004-Do-not-hardcode-python-path-into-various-tools.patch: The switch to meson makes this obsolete. - Remove LIBGLIB2_AUTORECONF = YES from libglib2.mk: Now that libglib2 is a meson package, there is no need for AUTORECONF. - Remove LIBGLIB2_INSTALL_STAGING_OPTS from libglib2.mk: Meson resolves these correctly. - Add LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE in libglib2.mk: Newer versions of libglib2 prefix glib-genmarshal, gobject-query, and glib-mkenums 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. Signed-off-by: Adam Duskett <Aduskett@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-05-28 13:48:11 -06:00
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
package/libglib2: bump to version 2.60.3 Changes include: - Change the package type to meson, as autoconf is no longer supported. - Add 0002-add-option-to-build-tests.patch Upstream won't build tests when cross-compiling. However; this means still building the tests during a host build. Building the tests causes build failures on older distributions such as CentOS 6 and Debian 7 because of the command `objcopy --add-symbol` is used when building the test "test_resources2," which is not available with the older version of objcopy provided by the distributions. - Add 0003-remove-cpp-requirement.patch: C++ is not needed when just compiling. The inclusion of C++ in meson.build is to ensure libglib doesn't accidentally use C++ reserved keywords in public headers. Because tests aren't being compiled, there is no need for C++ as a requirement. (https://gitlab.gnome.org/GNOME/glib/issues/1748) - Add 0004-Add-Wno-format-nonliteral-to-compiler-arguments.patch: This prevents a false error when compiling against older gcc versions. (https://gitlab.gnome.org/GNOME/glib/issues/1744) - Remove 0004-Do-not-hardcode-python-path-into-various-tools.patch: The switch to meson makes this obsolete. - Remove LIBGLIB2_AUTORECONF = YES from libglib2.mk: Now that libglib2 is a meson package, there is no need for AUTORECONF. - Remove LIBGLIB2_INSTALL_STAGING_OPTS from libglib2.mk: Meson resolves these correctly. - Add LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE in libglib2.mk: Newer versions of libglib2 prefix glib-genmarshal, gobject-query, and glib-mkenums 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. Signed-off-by: Adam Duskett <Aduskett@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-05-28 13:48:11 -06:00
$(eval $(meson-package))
$(eval $(host-meson-package))
LIBGLIB2_HOST_BINARY = $(HOST_DIR)/bin/glib-genmarshal