]> Git Repo - buildroot-mgba.git/blob - package/postgresql/postgresql.mk
Merge branch 'master' into next
[buildroot-mgba.git] / package / postgresql / postgresql.mk
1 ################################################################################
2 #
3 # postgresql
4 #
5 ################################################################################
6
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)
19
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
24
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
31 endif
32
33 ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
34 POSTGRESQL_CONF_OPTS += --disable-thread-safety
35 endif
36
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
39 endif
40
41 ifeq ($(BR2_PACKAGE_READLINE),y)
42 POSTGRESQL_DEPENDENCIES += readline
43 else
44 POSTGRESQL_CONF_OPTS += --without-readline
45 endif
46
47 ifeq ($(BR2_PACKAGE_ZLIB),y)
48 POSTGRESQL_DEPENDENCIES += zlib
49 else
50 POSTGRESQL_CONF_OPTS += --without-zlib
51 endif
52
53 ifeq ($(BR2_PACKAGE_TZDATA),y)
54 POSTGRESQL_DEPENDENCIES += tzdata
55 POSTGRESQL_CONF_OPTS += --with-system-tzdata=/usr/share/zoneinfo
56 else
57 POSTGRESQL_DEPENDENCIES += host-zic
58 POSTGRESQL_CONF_ENV += ZIC="$(ZIC)"
59 endif
60
61 ifeq ($(BR2_PACKAGE_OPENSSL),y)
62 POSTGRESQL_DEPENDENCIES += openssl
63 POSTGRESQL_CONF_OPTS += --with-openssl
64 else
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
69 endif
70
71 ifeq ($(BR2_PACKAGE_OPENLDAP),y)
72 POSTGRESQL_DEPENDENCIES += openldap
73 POSTGRESQL_CONF_OPTS += --with-ldap
74 else
75 POSTGRESQL_CONF_OPTS += --without-ldap
76 endif
77
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
82 else
83 POSTGRESQL_CONF_OPTS += --without-libxml
84 endif
85
86 # required for postgresql.service Type=notify
87 ifeq ($(BR2_PACKAGE_SYSTEMD),y)
88 POSTGRESQL_DEPENDENCIES += systemd
89 POSTGRESQL_CONF_OPTS += --with-systemd
90 else
91 POSTGRESQL_CONF_OPTS += --without-systemd
92 endif
93
94 POSTGRESQL_CFLAGS = $(TARGET_CFLAGS)
95
96 ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
97 POSTGRESQL_CFLAGS += -O0
98 endif
99
100 POSTGRESQL_CONF_ENV += CFLAGS="$(POSTGRESQL_CFLAGS)"
101
102 define POSTGRESQL_USERS
103         postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server
104 endef
105
106 define POSTGRESQL_INSTALL_TARGET_FIXUP
107         $(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
108         $(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs
109 endef
110
111 POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP
112
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
118 endef
119
120 POSTGRESQL_POST_INSTALL_STAGING_HOOKS += POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
121
122 define POSTGRESQL_INSTALL_INIT_SYSV
123         $(INSTALL) -m 0755 -D package/postgresql/S50postgresql \
124                 $(TARGET_DIR)/etc/init.d/S50postgresql
125 endef
126
127 define POSTGRESQL_INSTALL_INIT_SYSTEMD
128         $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
129                 $(TARGET_DIR)/usr/lib/systemd/system/postgresql.service
130 endef
131
132 $(eval $(autotools-package))
This page took 0.034012 seconds and 4 git commands to generate.