postgresql.mk 5.2 KB

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