libglib2.mk 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. ################################################################################
  2. #
  3. # libglib2
  4. #
  5. ################################################################################
  6. LIBGLIB2_VERSION_MAJOR = 2.76
  7. LIBGLIB2_VERSION = $(LIBGLIB2_VERSION_MAJOR).1
  8. LIBGLIB2_SOURCE = glib-$(LIBGLIB2_VERSION).tar.xz
  9. LIBGLIB2_SITE = https://download.gnome.org/sources/glib/$(LIBGLIB2_VERSION_MAJOR)
  10. LIBGLIB2_LICENSE = LGPL-2.1+
  11. LIBGLIB2_LICENSE_FILES = COPYING
  12. LIBGLIB2_CPE_ID_VENDOR = gnome
  13. LIBGLIB2_CPE_ID_PRODUCT = glib
  14. LIBGLIB2_INSTALL_STAGING = YES
  15. LIBGLIB2_CFLAGS = $(TARGET_CFLAGS)
  16. LIBGLIB2_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
  17. # glib/valgrind.h contains inline asm not compatible with thumb1
  18. ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
  19. LIBGLIB2_CFLAGS += -marm
  20. endif
  21. HOST_LIBGLIB2_CONF_OPTS = \
  22. -Ddtrace=false \
  23. -Dglib_debug=disabled \
  24. -Dlibelf=disabled \
  25. -Dselinux=disabled \
  26. -Dsystemtap=false \
  27. -Dxattr=false \
  28. -Dtests=false \
  29. -Doss_fuzz=disabled
  30. LIBGLIB2_DEPENDENCIES = \
  31. host-pkgconf host-libglib2 \
  32. libffi pcre2 zlib $(TARGET_NLS_DEPENDENCIES)
  33. HOST_LIBGLIB2_DEPENDENCIES = \
  34. host-gettext \
  35. host-libffi \
  36. host-pcre2 \
  37. host-pkgconf \
  38. host-util-linux \
  39. host-zlib
  40. # We explicitly specify a giomodule-dir to avoid having a value
  41. # containing ${libdir} in gio-2.0.pc. Indeed, a value depending on
  42. # ${libdir} would be prefixed by the sysroot by pkg-config, causing a
  43. # bogus installation path once combined with $(DESTDIR).
  44. LIBGLIB2_CONF_OPTS = \
  45. -Dglib_debug=disabled \
  46. -Dlibelf=disabled \
  47. -Dgio_module_dir=/usr/lib/gio/modules \
  48. -Dtests=false \
  49. -Doss_fuzz=disabled
  50. LIBGLIB2_MESON_EXTRA_PROPERTIES = \
  51. have_c99_vsnprintf=true \
  52. have_c99_snprintf=true \
  53. have_unix98_printf=true
  54. ifeq ($(BR2_PACKAGE_ELFUTILS),y)
  55. LIBGLIB2_DEPENDENCIES += elfutils
  56. endif
  57. ifeq ($(BR2_PACKAGE_LIBICONV),y)
  58. LIBGLIB2_DEPENDENCIES += libiconv
  59. endif
  60. ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
  61. LIBGLIB2_CONF_OPTS += -Dselinux=enabled -Dxattr=true
  62. LIBGLIB2_DEPENDENCIES += libselinux
  63. else
  64. LIBGLIB2_CONF_OPTS += -Dselinux=disabled -Dxattr=false
  65. endif
  66. # Purge gdb-related files
  67. ifneq ($(BR2_PACKAGE_GDB),y)
  68. define LIBGLIB2_REMOVE_GDB_FILES
  69. rm -rf $(TARGET_DIR)/usr/share/glib-2.0/gdb
  70. endef
  71. endif
  72. ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT),y)
  73. LIBGLIB2_CONF_OPTS += -Dlibmount=enabled
  74. ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBS),y)
  75. LIBGLIB2_DEPENDENCIES += util-linux-libs
  76. else
  77. LIBGLIB2_DEPENDENCIES += util-linux
  78. endif
  79. else
  80. LIBGLIB2_CONF_OPTS += -Dlibmount=disabled
  81. endif
  82. # Purge useless binaries from target
  83. define LIBGLIB2_REMOVE_DEV_FILES
  84. rm -rf $(TARGET_DIR)/usr/lib/glib-2.0
  85. rm -rf $(addprefix $(TARGET_DIR)/usr/share/glib-2.0/,codegen gettext)
  86. 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)
  87. $(LIBGLIB2_REMOVE_GDB_FILES)
  88. endef
  89. LIBGLIB2_POST_INSTALL_TARGET_HOOKS += LIBGLIB2_REMOVE_DEV_FILES
  90. # Newer versions of libglib2 prefix glib-genmarshal, gobject-query,
  91. # glib-mkenums, glib_compile_schemas, glib_compile_resources and gdbus-codegen
  92. # with ${bindir}. Unfortunately, this will resolve to the host systems /bin/
  93. # directory, which will cause compilation issues if the host does not have these
  94. # programs. By removing the ${bindir}/ prefix, these programs are resolved in
  95. # PATH instead.
  96. define LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE
  97. $(SED) 's%$${bindir}/%%g' $(addprefix $(STAGING_DIR)/usr/lib/pkgconfig/, glib-2.0.pc gio-2.0.pc)
  98. endef
  99. LIBGLIB2_POST_INSTALL_TARGET_HOOKS += LIBGLIB2_REMOVE_BINDIR_PREFIX_FROM_PC_FILE
  100. # Remove schema sources/DTDs, we use staging ones to compile them.
  101. # Do so at target finalization since other packages install additional
  102. # ones and we want to deal with it in a single place.
  103. define LIBGLIB2_REMOVE_TARGET_SCHEMAS
  104. rm -f $(TARGET_DIR)/usr/share/glib-2.0/schemas/*.xml \
  105. $(TARGET_DIR)/usr/share/glib-2.0/schemas/*.dtd
  106. endef
  107. # Compile schemas at target finalization since other packages install
  108. # them as well, and better do it in a central place.
  109. # It's used at run time so it doesn't matter deferring it.
  110. define LIBGLIB2_COMPILE_SCHEMAS
  111. $(HOST_DIR)/bin/glib-compile-schemas \
  112. $(STAGING_DIR)/usr/share/glib-2.0/schemas \
  113. --targetdir=$(TARGET_DIR)/usr/share/glib-2.0/schemas
  114. endef
  115. LIBGLIB2_TARGET_FINALIZE_HOOKS += LIBGLIB2_REMOVE_TARGET_SCHEMAS
  116. LIBGLIB2_TARGET_FINALIZE_HOOKS += LIBGLIB2_COMPILE_SCHEMAS
  117. $(eval $(meson-package))
  118. $(eval $(host-meson-package))
  119. LIBGLIB2_HOST_BINARY = $(HOST_DIR)/bin/glib-genmarshal