1*4882a593Smuzhiyun################################################################################ 2*4882a593Smuzhiyun# 3*4882a593Smuzhiyun# postgresql 4*4882a593Smuzhiyun# 5*4882a593Smuzhiyun################################################################################ 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunPOSTGRESQL_VERSION = 13.5 8*4882a593SmuzhiyunPOSTGRESQL_SOURCE = postgresql-$(POSTGRESQL_VERSION).tar.bz2 9*4882a593SmuzhiyunPOSTGRESQL_SITE = https://ftp.postgresql.org/pub/source/v$(POSTGRESQL_VERSION) 10*4882a593SmuzhiyunPOSTGRESQL_LICENSE = PostgreSQL 11*4882a593SmuzhiyunPOSTGRESQL_LICENSE_FILES = COPYRIGHT 12*4882a593SmuzhiyunPOSTGRESQL_CPE_ID_VENDOR = postgresql 13*4882a593SmuzhiyunPOSTGRESQL_SELINUX_MODULES = postgresql 14*4882a593SmuzhiyunPOSTGRESQL_INSTALL_STAGING = YES 15*4882a593SmuzhiyunPOSTGRESQL_CONFIG_SCRIPTS = pg_config 16*4882a593SmuzhiyunPOSTGRESQL_CONF_ENV = \ 17*4882a593Smuzhiyun ac_cv_type_struct_sockaddr_in6=yes \ 18*4882a593Smuzhiyun LIBS=$(TARGET_NLS_LIBS) 19*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS = --disable-rpath 20*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES) 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun# https://www.postgresql.org/docs/11/static/install-procedure.html: 23*4882a593Smuzhiyun# "If you want to invoke the build from another makefile rather than 24*4882a593Smuzhiyun# manually, you must unset MAKELEVEL or set it to zero" 25*4882a593SmuzhiyunPOSTGRESQL_MAKE_OPTS = MAKELEVEL=0 26*4882a593Smuzhiyun 27*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_POSTGRESQL_FULL),y) 28*4882a593SmuzhiyunPOSTGRESQL_MAKE_OPTS += world 29*4882a593SmuzhiyunPOSTGRESQL_INSTALL_TARGET_OPTS += DESTDIR=$(TARGET_DIR) install-world 30*4882a593SmuzhiyunPOSTGRESQL_INSTALL_STAGING_OPTS += DESTDIR=$(STAGING_DIR) install-world 31*4882a593Smuzhiyunendif 32*4882a593Smuzhiyun 33*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y) 34*4882a593Smuzhiyun# PostgreSQL does not build against uClibc with locales 35*4882a593Smuzhiyun# enabled, due to an uClibc bug, see 36*4882a593Smuzhiyun# http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html 37*4882a593Smuzhiyun# so overwrite automatic detection and disable locale support 38*4882a593SmuzhiyunPOSTGRESQL_CONF_ENV += pgac_cv_type_locale_t=no 39*4882a593Smuzhiyunendif 40*4882a593Smuzhiyun 41*4882a593Smuzhiyunifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y) 42*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --disable-thread-safety 43*4882a593Smuzhiyunendif 44*4882a593Smuzhiyun 45*4882a593Smuzhiyunifeq ($(BR2_arcle)$(BR2_arceb)$(BR2_microblazeel)$(BR2_microblazebe)$(BR2_or1k)$(BR2_nios2)$(BR2_riscv)$(BR2_xtensa)$(BR2_nds32),y) 46*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --disable-spinlocks 47*4882a593Smuzhiyunendif 48*4882a593Smuzhiyun 49*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_READLINE),y) 50*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES += readline 51*4882a593Smuzhiyunelse 52*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --without-readline 53*4882a593Smuzhiyunendif 54*4882a593Smuzhiyun 55*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_ZLIB),y) 56*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES += zlib 57*4882a593Smuzhiyunelse 58*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --without-zlib 59*4882a593Smuzhiyunendif 60*4882a593Smuzhiyun 61*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_TZDATA),y) 62*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES += tzdata 63*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --with-system-tzdata=/usr/share/zoneinfo 64*4882a593Smuzhiyunelse 65*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES += host-zic 66*4882a593SmuzhiyunPOSTGRESQL_CONF_ENV += ZIC="$(ZIC)" 67*4882a593Smuzhiyunendif 68*4882a593Smuzhiyun 69*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_OPENSSL),y) 70*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES += openssl 71*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --with-openssl 72*4882a593Smuzhiyunelse 73*4882a593Smuzhiyun# PostgreSQL checks for /dev/urandom and fails if it's being cross-compiled and 74*4882a593Smuzhiyun# an SSL library isn't found. Since /dev/urandom is guaranteed to be provided 75*4882a593Smuzhiyun# on Linux systems, explicitly tell the configure script it's available. 76*4882a593SmuzhiyunPOSTGRESQL_CONF_ENV += ac_cv_file__dev_urandom=yes 77*4882a593Smuzhiyunendif 78*4882a593Smuzhiyun 79*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_OPENLDAP),y) 80*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES += openldap 81*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --with-ldap 82*4882a593Smuzhiyunelse 83*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --without-ldap 84*4882a593Smuzhiyunendif 85*4882a593Smuzhiyun 86*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_LIBXML2),y) 87*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES += libxml2 88*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --with-libxml 89*4882a593SmuzhiyunPOSTGRESQL_CONF_ENV += XML2_CONFIG=$(STAGING_DIR)/usr/bin/xml2-config 90*4882a593Smuzhiyunelse 91*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --without-libxml 92*4882a593Smuzhiyunendif 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun# required for postgresql.service Type=notify 95*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_SYSTEMD),y) 96*4882a593SmuzhiyunPOSTGRESQL_DEPENDENCIES += systemd 97*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --with-systemd 98*4882a593Smuzhiyunelse 99*4882a593SmuzhiyunPOSTGRESQL_CONF_OPTS += --without-systemd 100*4882a593Smuzhiyunendif 101*4882a593Smuzhiyun 102*4882a593SmuzhiyunPOSTGRESQL_CFLAGS = $(TARGET_CFLAGS) 103*4882a593Smuzhiyun 104*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y) 105*4882a593SmuzhiyunPOSTGRESQL_CFLAGS += -O0 106*4882a593Smuzhiyunendif 107*4882a593Smuzhiyun 108*4882a593SmuzhiyunPOSTGRESQL_CONF_ENV += CFLAGS="$(POSTGRESQL_CFLAGS)" 109*4882a593Smuzhiyun 110*4882a593Smuzhiyundefine POSTGRESQL_USERS 111*4882a593Smuzhiyun postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server 112*4882a593Smuzhiyunendef 113*4882a593Smuzhiyun 114*4882a593Smuzhiyundefine POSTGRESQL_INSTALL_TARGET_FIXUP 115*4882a593Smuzhiyun $(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql 116*4882a593Smuzhiyun $(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs 117*4882a593Smuzhiyunendef 118*4882a593Smuzhiyun 119*4882a593SmuzhiyunPOSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP 120*4882a593Smuzhiyun 121*4882a593Smuzhiyundefine POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG 122*4882a593Smuzhiyun $(INSTALL) -m 0755 -D package/postgresql/pg_config \ 123*4882a593Smuzhiyun $(STAGING_DIR)/usr/bin/pg_config 124*4882a593Smuzhiyun $(SED) "s|@POSTGRESQL_CONF_OPTIONS@|$(POSTGRESQL_CONF_OPTS)|g" $(STAGING_DIR)/usr/bin/pg_config 125*4882a593Smuzhiyun $(SED) "s|@POSTGRESQL_VERSION@|$(POSTGRESQL_VERSION)|g" $(STAGING_DIR)/usr/bin/pg_config 126*4882a593Smuzhiyun $(SED) "s|@TARGET_CFLAGS@|$(TARGET_CFLAGS)|g" $(STAGING_DIR)/usr/bin/pg_config 127*4882a593Smuzhiyun $(SED) "s|@TARGET_CC@|$(TARGET_CC)|g" $(STAGING_DIR)/usr/bin/pg_config 128*4882a593Smuzhiyunendef 129*4882a593Smuzhiyun 130*4882a593SmuzhiyunPOSTGRESQL_POST_INSTALL_STAGING_HOOKS += POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG 131*4882a593Smuzhiyun 132*4882a593Smuzhiyundefine POSTGRESQL_INSTALL_INIT_SYSV 133*4882a593Smuzhiyun $(INSTALL) -m 0755 -D package/postgresql/S50postgresql \ 134*4882a593Smuzhiyun $(TARGET_DIR)/etc/init.d/S50postgresql 135*4882a593Smuzhiyunendef 136*4882a593Smuzhiyun 137*4882a593Smuzhiyundefine POSTGRESQL_INSTALL_INIT_SYSTEMD 138*4882a593Smuzhiyun $(INSTALL) -D -m 644 package/postgresql/postgresql.service \ 139*4882a593Smuzhiyun $(TARGET_DIR)/usr/lib/systemd/system/postgresql.service 140*4882a593Smuzhiyunendef 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun$(eval $(autotools-package)) 143