postgresql.mk 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. ################################################################################
  2. #
  3. # postgresql
  4. #
  5. ################################################################################
  6. POSTGRESQL_VERSION = 12.5
  7. POSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2
  8. POSTGRESQL_SITE = https://ftp.postgresql.org/pub/source/v$(POSTGRESQL_VERSION)
  9. POSTGRESQL_LICENSE = PostgreSQL
  10. POSTGRESQL_LICENSE_FILES = COPYRIGHT
  11. POSTGRESQL_INSTALL_STAGING = YES
  12. POSTGRESQL_CONFIG_SCRIPTS = pg_config
  13. POSTGRESQL_CONF_ENV = \
  14. ac_cv_type_struct_sockaddr_in6=yes \
  15. pgac_cv_snprintf_long_long_int_modifier="ll" \
  16. pgac_cv_snprintf_size_t_support=yes \
  17. LIBS=$(TARGET_NLS_LIBS)
  18. POSTGRESQL_CONF_OPTS = --disable-rpath
  19. POSTGRESQL_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
  20. # https://www.postgresql.org/docs/11/static/install-procedure.html:
  21. # "If you want to invoke the build from another makefile rather than
  22. # manually, you must unset MAKELEVEL or set it to zero"
  23. POSTGRESQL_MAKE_OPTS = MAKELEVEL=0
  24. ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
  25. # PostgreSQL does not build against uClibc with locales
  26. # enabled, due to an uClibc bug, see
  27. # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
  28. # so overwrite automatic detection and disable locale support
  29. POSTGRESQL_CONF_ENV += pgac_cv_type_locale_t=no
  30. endif
  31. ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
  32. POSTGRESQL_CONF_OPTS += --disable-thread-safety
  33. endif
  34. ifeq ($(BR2_arcle)$(BR2_arceb)$(BR2_microblazeel)$(BR2_microblazebe)$(BR2_or1k)$(BR2_nios2)$(BR2_riscv)$(BR2_xtensa)$(BR2_nds32),y)
  35. POSTGRESQL_CONF_OPTS += --disable-spinlocks
  36. endif
  37. ifeq ($(BR2_PACKAGE_READLINE),y)
  38. POSTGRESQL_DEPENDENCIES += readline
  39. else
  40. POSTGRESQL_CONF_OPTS += --without-readline
  41. endif
  42. ifeq ($(BR2_PACKAGE_ZLIB),y)
  43. POSTGRESQL_DEPENDENCIES += zlib
  44. else
  45. POSTGRESQL_CONF_OPTS += --without-zlib
  46. endif
  47. ifeq ($(BR2_PACKAGE_TZDATA),y)
  48. POSTGRESQL_DEPENDENCIES += tzdata
  49. POSTGRESQL_CONF_OPTS += --with-system-tzdata=/usr/share/zoneinfo
  50. else
  51. POSTGRESQL_DEPENDENCIES += host-zic
  52. POSTGRESQL_CONF_ENV += ZIC="$(ZIC)"
  53. endif
  54. ifeq ($(BR2_PACKAGE_OPENSSL),y)
  55. POSTGRESQL_DEPENDENCIES += openssl
  56. POSTGRESQL_CONF_OPTS += --with-openssl
  57. else
  58. # PostgreSQL checks for /dev/urandom and fails if it's being cross-compiled and
  59. # an SSL library isn't found. Since /dev/urandom is guaranteed to be provided
  60. # on Linux systems, explicitly tell the configure script it's available.
  61. POSTGRESQL_CONF_ENV += ac_cv_file__dev_urandom=yes
  62. endif
  63. ifeq ($(BR2_PACKAGE_OPENLDAP),y)
  64. POSTGRESQL_DEPENDENCIES += openldap
  65. POSTGRESQL_CONF_OPTS += --with-ldap
  66. else
  67. POSTGRESQL_CONF_OPTS += --without-ldap
  68. endif
  69. ifeq ($(BR2_PACKAGE_LIBXML2),y)
  70. POSTGRESQL_DEPENDENCIES += libxml2
  71. POSTGRESQL_CONF_OPTS += --with-libxml
  72. POSTGRESQL_CONF_ENV += XML2_CONFIG=$(STAGING_DIR)/usr/bin/xml2-config
  73. else
  74. POSTGRESQL_CONF_OPTS += --without-libxml
  75. endif
  76. # required for postgresql.service Type=notify
  77. ifeq ($(BR2_PACKAGE_SYSTEMD),y)
  78. POSTGRESQL_DEPENDENCIES += systemd
  79. POSTGRESQL_CONF_OPTS += --with-systemd
  80. else
  81. POSTGRESQL_CONF_OPTS += --without-systemd
  82. endif
  83. POSTGRESQL_CFLAGS = $(TARGET_CFLAGS)
  84. ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
  85. POSTGRESQL_CFLAGS += -O0
  86. endif
  87. POSTGRESQL_CONF_ENV += CFLAGS="$(POSTGRESQL_CFLAGS)"
  88. define POSTGRESQL_USERS
  89. postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server
  90. endef
  91. define POSTGRESQL_INSTALL_TARGET_FIXUP
  92. $(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
  93. $(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs
  94. endef
  95. POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP
  96. define POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
  97. $(INSTALL) -m 0755 -D package/postgresql/pg_config \
  98. $(STAGING_DIR)/usr/bin/pg_config
  99. $(SED) "s|@POSTGRESQL_CONF_OPTIONS@|$(POSTGRESQL_CONF_OPTS)|g" $(STAGING_DIR)/usr/bin/pg_config
  100. $(SED) "s|@POSTGRESQL_VERSION@|$(POSTGRESQL_VERSION)|g" $(STAGING_DIR)/usr/bin/pg_config
  101. endef
  102. POSTGRESQL_POST_INSTALL_STAGING_HOOKS += POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
  103. define POSTGRESQL_INSTALL_INIT_SYSV
  104. $(INSTALL) -m 0755 -D package/postgresql/S50postgresql \
  105. $(TARGET_DIR)/etc/init.d/S50postgresql
  106. endef
  107. define POSTGRESQL_INSTALL_INIT_SYSTEMD
  108. $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
  109. $(TARGET_DIR)/usr/lib/systemd/system/postgresql.service
  110. endef
  111. $(eval $(autotools-package))