postgresql.mk 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ################################################################################
  2. #
  3. # postgresql
  4. #
  5. ################################################################################
  6. POSTGRESQL_VERSION = 10.3
  7. POSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2
  8. POSTGRESQL_SITE = http://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. POSTGRESQL_CONF_OPTS = --disable-rpath
  18. ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
  19. # PostgreSQL does not build against uClibc with locales
  20. # enabled, due to an uClibc bug, see
  21. # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
  22. # so overwrite automatic detection and disable locale support
  23. POSTGRESQL_CONF_ENV += pgac_cv_type_locale_t=no
  24. endif
  25. ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
  26. POSTGRESQL_CONF_OPTS += --disable-thread-safety
  27. endif
  28. ifeq ($(BR2_arcle)$(BR2_arceb)$(BR2_microblazeel)$(BR2_microblazebe)$(BR2_or1k)$(BR2_nios2)$(BR2_xtensa),y)
  29. POSTGRESQL_CONF_OPTS += --disable-spinlocks
  30. endif
  31. ifeq ($(BR2_PACKAGE_READLINE),y)
  32. POSTGRESQL_DEPENDENCIES += readline
  33. else
  34. POSTGRESQL_CONF_OPTS += --without-readline
  35. endif
  36. ifeq ($(BR2_PACKAGE_ZLIB),y)
  37. POSTGRESQL_DEPENDENCIES += zlib
  38. else
  39. POSTGRESQL_CONF_OPTS += --without-zlib
  40. endif
  41. ifeq ($(BR2_PACKAGE_TZDATA),y)
  42. POSTGRESQL_DEPENDENCIES += tzdata
  43. POSTGRESQL_CONF_OPTS += --with-system-tzdata=/usr/share/zoneinfo
  44. else
  45. POSTGRESQL_DEPENDENCIES += host-zic
  46. POSTGRESQL_CONF_ENV += ZIC="$(ZIC)"
  47. endif
  48. ifeq ($(BR2_PACKAGE_OPENSSL),y)
  49. POSTGRESQL_DEPENDENCIES += openssl
  50. POSTGRESQL_CONF_OPTS += --with-openssl
  51. else
  52. # PostgreSQL checks for /dev/urandom and fails if it's being cross-compiled and
  53. # an SSL library isn't found. Since /dev/urandom is guaranteed to be provided
  54. # on Linux systems, explicitly tell the configure script it's available.
  55. POSTGRESQL_CONF_ENV += ac_cv_file__dev_urandom=yes
  56. endif
  57. ifeq ($(BR2_PACKAGE_OPENLDAP),y)
  58. POSTGRESQL_DEPENDENCIES += openldap
  59. POSTGRESQL_CONF_OPTS += --with-ldap
  60. else
  61. POSTGRESQL_CONF_OPTS += --without-ldap
  62. endif
  63. ifeq ($(BR2_PACKAGE_LIBXML2),y)
  64. POSTGRESQL_DEPENDENCIES += libxml2
  65. POSTGRESQL_CONF_OPTS += --with-libxml
  66. POSTGRESQL_CONF_ENV += XML2_CONFIG=$(STAGING_DIR)/usr/bin/xml2-config
  67. else
  68. POSTGRESQL_CONF_OPTS += --without-libxml
  69. endif
  70. define POSTGRESQL_USERS
  71. postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server
  72. endef
  73. define POSTGRESQL_INSTALL_TARGET_FIXUP
  74. $(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
  75. $(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs
  76. endef
  77. POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP
  78. define POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
  79. $(INSTALL) -m 0755 -D package/postgresql/pg_config \
  80. $(STAGING_DIR)/usr/bin/pg_config
  81. $(SED) "s|@POSTGRESQL_VERSION@|$(POSTGRESQL_VERSION)|g" $(STAGING_DIR)/usr/bin/pg_config
  82. endef
  83. POSTGRESQL_POST_INSTALL_STAGING_HOOKS += POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
  84. define POSTGRESQL_INSTALL_INIT_SYSV
  85. $(INSTALL) -m 0755 -D package/postgresql/S50postgresql \
  86. $(TARGET_DIR)/etc/init.d/S50postgresql
  87. endef
  88. define POSTGRESQL_INSTALL_INIT_SYSTEMD
  89. $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
  90. $(TARGET_DIR)/usr/lib/systemd/system/postgresql.service
  91. mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
  92. ln -fs ../../../../usr/lib/systemd/system/postgresql.service \
  93. $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service
  94. endef
  95. $(eval $(autotools-package))