2
1

postgresql.mk 4.1 KB

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