open-plc-utils: new package
[buildroot-gz.git] / package / postgresql / postgresql.mk
blob006e79b83c977e0b0f71f451c492ad89c5873f19
1 ################################################################################
3 # postgresql
5 ################################################################################
7 POSTGRESQL_VERSION = 9.4.1
8 POSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2
9 POSTGRESQL_SITE = http://ftp.postgresql.org/pub/source/v$(POSTGRESQL_VERSION)
10 POSTGRESQL_LICENSE = PostgreSQL
11 POSTGRESQL_LICENSE_FILES = COPYRIGHT
13 POSTGRESQL_INSTALL_STAGING = YES
14 POSTGRESQL_CONFIG_SCRIPTS = pg_config
16 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
17 # overwrite IPV6 detection
18 ifeq ($(BR2_INET_IPV6),y)
19 POSTGRESQL_CONF_ENV += ac_cv_type_struct_sockaddr_in6=yes
20 else
21 POSTGRESQL_CONF_ENV += ac_cv_type_struct_sockaddr_in6=no
22 endif
23 # PostgreSQL does not build against uClibc with locales
24 # enabled, due to an uClibc bug, see
25 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
26 # so overwrite automatic detection and disable locale support
27 POSTGRESQL_CONF_ENV += pgac_cv_type_locale_t=no
28 endif
30 ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
31 POSTGRESQL_CONF_OPTS += --disable-thread-safety
32 endif
34 ifeq ($(BR2_arcle)$(BR2_arceb)$(BR2_microblazeel)$(BR2_microblazebe)$(BR2_nios2)$(BR2_xtensa),y)
35 POSTGRESQL_CONF_OPTS += --disable-spinlocks
36 endif
38 ifeq ($(BR2_PACKAGE_READLINE),y)
39 POSTGRESQL_DEPENDENCIES += readline
40 else
41 POSTGRESQL_CONF_OPTS += --without-readline
42 endif
44 ifeq ($(BR2_PACKAGE_ZLIB),y)
45 POSTGRESQL_DEPENDENCIES += zlib
46 else
47 POSTGRESQL_CONF_OPTS += --without-zlib
48 endif
50 ifeq ($(BR2_PACKAGE_TZDATA),y)
51 POSTGRESQL_DEPENDENCIES += tzdata
52 POSTGRESQL_CONF_OPTS += --with-system-tzdata=/usr/share/zoneinfo
53 else
54 POSTGRESQL_DEPENDENCIES += host-zic
55 POSTGRESQL_CONF_ENV += ZIC=$$(ZIC)
56 endif
58 ifeq ($(BR2_PACKAGE_OPENSSL),y)
59 POSTGRESQL_DEPENDENCIES += openssl
60 POSTGRESQL_CONF_OPTS += --with-openssl
61 endif
63 define POSTGRESQL_USERS
64 postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server
65 endef
67 define POSTGRESQL_INSTALL_TARGET_FIXUP
68 $(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
69 $(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs
70 endef
72 POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP
74 define POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
75 $(INSTALL) -m 0755 -D package/postgresql/pg_config \
76 $(STAGING_DIR)/usr/bin/pg_config
77 endef
79 POSTGRESQL_POST_INSTALL_STAGING_HOOKS += POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
81 define POSTGRESQL_INSTALL_INIT_SYSV
82 $(INSTALL) -m 0755 -D package/postgresql/S50postgresql \
83 $(TARGET_DIR)/etc/init.d/S50postgresql
84 endef
86 define POSTGRESQL_INSTALL_INIT_SYSTEMD
87 $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
88 $(TARGET_DIR)/usr/lib/systemd/system/postgresql.service
89 mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
90 ln -fs ../../../../usr/lib/systemd/system/postgresql.service \
91 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service
92 endef
94 $(eval $(autotools-package))