postgresql.mk 4.1 KB

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