libglib2.mk 4.4 KB

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