1 ################################################################################
5 ################################################################################
7 POSTGRESQL_VERSION = 12.5
8 POSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2
9 POSTGRESQL_SITE = https://ftp.postgresql.org/pub/source/v$(POSTGRESQL_VERSION)
10 POSTGRESQL_LICENSE = PostgreSQL
11 POSTGRESQL_LICENSE_FILES = COPYRIGHT
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)
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
25 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
26 # PostgreSQL does not build against uClibc with locales
27 # enabled, due to an uClibc bug, see
28 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
29 # so overwrite automatic detection and disable locale support
30 POSTGRESQL_CONF_ENV += pgac_cv_type_locale_t=no
33 ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
34 POSTGRESQL_CONF_OPTS += --disable-thread-safety
37 ifeq ($(BR2_arcle)$(BR2_arceb)$(BR2_microblazeel)$(BR2_microblazebe)$(BR2_or1k)$(BR2_nios2)$(BR2_riscv)$(BR2_xtensa)$(BR2_nds32),y)
38 POSTGRESQL_CONF_OPTS += --disable-spinlocks
41 ifeq ($(BR2_PACKAGE_READLINE),y)
42 POSTGRESQL_DEPENDENCIES += readline
44 POSTGRESQL_CONF_OPTS += --without-readline
47 ifeq ($(BR2_PACKAGE_ZLIB),y)
48 POSTGRESQL_DEPENDENCIES += zlib
50 POSTGRESQL_CONF_OPTS += --without-zlib
53 ifeq ($(BR2_PACKAGE_TZDATA),y)
54 POSTGRESQL_DEPENDENCIES += tzdata
55 POSTGRESQL_CONF_OPTS += --with-system-tzdata=/usr/share/zoneinfo
57 POSTGRESQL_DEPENDENCIES += host-zic
58 POSTGRESQL_CONF_ENV += ZIC="$(ZIC)"
61 ifeq ($(BR2_PACKAGE_OPENSSL),y)
62 POSTGRESQL_DEPENDENCIES += openssl
63 POSTGRESQL_CONF_OPTS += --with-openssl
65 # PostgreSQL checks for /dev/urandom and fails if it's being cross-compiled and
66 # an SSL library isn't found. Since /dev/urandom is guaranteed to be provided
67 # on Linux systems, explicitly tell the configure script it's available.
68 POSTGRESQL_CONF_ENV += ac_cv_file__dev_urandom=yes
71 ifeq ($(BR2_PACKAGE_OPENLDAP),y)
72 POSTGRESQL_DEPENDENCIES += openldap
73 POSTGRESQL_CONF_OPTS += --with-ldap
75 POSTGRESQL_CONF_OPTS += --without-ldap
78 ifeq ($(BR2_PACKAGE_LIBXML2),y)
79 POSTGRESQL_DEPENDENCIES += libxml2
80 POSTGRESQL_CONF_OPTS += --with-libxml
81 POSTGRESQL_CONF_ENV += XML2_CONFIG=$(STAGING_DIR)/usr/bin/xml2-config
83 POSTGRESQL_CONF_OPTS += --without-libxml
86 # required for postgresql.service Type=notify
87 ifeq ($(BR2_PACKAGE_SYSTEMD),y)
88 POSTGRESQL_DEPENDENCIES += systemd
89 POSTGRESQL_CONF_OPTS += --with-systemd
91 POSTGRESQL_CONF_OPTS += --without-systemd
94 POSTGRESQL_CFLAGS = $(TARGET_CFLAGS)
96 ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
97 POSTGRESQL_CFLAGS += -O0
100 POSTGRESQL_CONF_ENV += CFLAGS="$(POSTGRESQL_CFLAGS)"
102 define POSTGRESQL_USERS
103 postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server
106 define POSTGRESQL_INSTALL_TARGET_FIXUP
107 $(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
108 $(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs
111 POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP
113 define POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
114 $(INSTALL) -m 0755 -D package/postgresql/pg_config \
115 $(STAGING_DIR)/usr/bin/pg_config
116 $(SED) "s|@POSTGRESQL_CONF_OPTIONS@|$(POSTGRESQL_CONF_OPTS)|g" $(STAGING_DIR)/usr/bin/pg_config
117 $(SED) "s|@POSTGRESQL_VERSION@|$(POSTGRESQL_VERSION)|g" $(STAGING_DIR)/usr/bin/pg_config
120 POSTGRESQL_POST_INSTALL_STAGING_HOOKS += POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
122 define POSTGRESQL_INSTALL_INIT_SYSV
123 $(INSTALL) -m 0755 -D package/postgresql/S50postgresql \
124 $(TARGET_DIR)/etc/init.d/S50postgresql
127 define POSTGRESQL_INSTALL_INIT_SYSTEMD
128 $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
129 $(TARGET_DIR)/usr/lib/systemd/system/postgresql.service
132 $(eval $(autotools-package))