Merge pull request #1871 from dangowrt/update-postgresql-for-15.05
update PostgreSQL
This commit is contained in:
commit
a7cd2d9438
5 changed files with 100 additions and 120 deletions
|
@ -8,7 +8,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=postgresql
|
PKG_NAME:=postgresql
|
||||||
PKG_VERSION:=9.0.17
|
PKG_VERSION:=9.4.4
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
|
PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
|
||||||
PKG_LICENSE:=PostgreSQL
|
PKG_LICENSE:=PostgreSQL
|
||||||
|
@ -18,10 +18,11 @@ PKG_SOURCE_URL:=\
|
||||||
http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v$(PKG_VERSION) \
|
http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v$(PKG_VERSION) \
|
||||||
http://ftp.be.postgresql.org/postgresql/source/v$(PKG_VERSION) \
|
http://ftp.be.postgresql.org/postgresql/source/v$(PKG_VERSION) \
|
||||||
ftp://ftp-archives.postgresql.org/pub/source/v$(PKG_VERSION)
|
ftp://ftp-archives.postgresql.org/pub/source/v$(PKG_VERSION)
|
||||||
PKG_MD5SUM:=46bf3ef3761c091fb0d2e25012c1709e
|
PKG_MD5SUM:=1fe952c44ed26d7e6a335cf991a9c1c6
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
PKG_USE_MIPS16:=0
|
PKG_USE_MIPS16:=0
|
||||||
PKG_FIXUP:=autoreconf
|
PKG_FIXUP:=autoreconf
|
||||||
|
PKG_MACRO_PATHS:=config
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ endef
|
||||||
define Package/pgsql-cli
|
define Package/pgsql-cli
|
||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
DEPENDS:=+libpq
|
DEPENDS:=+libpq @USE_UCLIBC:+librt
|
||||||
TITLE:=Command Line Interface (CLI) to PostgreSQL databases
|
TITLE:=Command Line Interface (CLI) to PostgreSQL databases
|
||||||
URL:=http://www.postgresql.org/
|
URL:=http://www.postgresql.org/
|
||||||
SUBMENU:=database
|
SUBMENU:=database
|
||||||
|
@ -54,19 +55,36 @@ endef
|
||||||
define Package/pgsql-server
|
define Package/pgsql-server
|
||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
DEPENDS:=+libpq
|
DEPENDS:=+libpq @USE_UCLIBC:+librt
|
||||||
TITLE:=PostgreSQL databases Server
|
TITLE:=PostgreSQL databases Server
|
||||||
URL:=http://www.postgresql.org/
|
URL:=http://www.postgresql.org/
|
||||||
SUBMENU:=database
|
SUBMENU:=database
|
||||||
|
USERID:=postgres=5432:postgres=5432
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/pgsql-server/description
|
define Package/pgsql-server/description
|
||||||
PostgreSQL databases Server.
|
PostgreSQL databases Server.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
PGSQL_CONFIG_VARS:= \
|
||||||
|
pgac_cv_snprintf_long_long_int_format="%lld" \
|
||||||
|
pgac_cv_snprintf_size_t_support=yes
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_USE_UCLIBC),y)
|
||||||
|
# PostgreSQL does not build against uClibc with locales
|
||||||
|
# enabled, due to an uClibc bug, see
|
||||||
|
# http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
|
||||||
|
# so overwrite automatic detection and disable locale support
|
||||||
|
PGSQL_CONFIG_VARS+= \
|
||||||
|
pgac_cv_type_locale_t=no
|
||||||
|
endif
|
||||||
|
|
||||||
|
TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
|
||||||
|
|
||||||
# Need a native ecpg ,pg_config, and zic for build
|
# Need a native ecpg ,pg_config, and zic for build
|
||||||
define Build/Configure
|
define Build/Configure
|
||||||
(cd $(PKG_BUILD_DIR); rm -f config.cache; \
|
(cd $(PKG_BUILD_DIR); rm -f config.cache; \
|
||||||
|
$(PGSQL_CONFIG_VARS) \
|
||||||
./configure \
|
./configure \
|
||||||
--prefix=/usr \
|
--prefix=/usr \
|
||||||
--exec-prefix=/usr \
|
--exec-prefix=/usr \
|
||||||
|
@ -85,17 +103,15 @@ define Build/Configure
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-integer-datetimes \
|
--disable-integer-datetimes \
|
||||||
--disable-rpath \
|
--disable-rpath \
|
||||||
--without-java \
|
--without-bonjour \
|
||||||
--without-krb4 \
|
--without-gssapi \
|
||||||
--without-krb5 \
|
--without-ldap \
|
||||||
--without-openssl \
|
--without-openssl \
|
||||||
--without-pam \
|
--without-pam \
|
||||||
--without-perl \
|
--without-perl \
|
||||||
--without-python \
|
--without-python \
|
||||||
--without-readline \
|
--without-readline \
|
||||||
--without-rendezvous \
|
|
||||||
--without-tcl \
|
--without-tcl \
|
||||||
--without-tk \
|
|
||||||
--with-zlib="yes" \
|
--with-zlib="yes" \
|
||||||
--enable-depend \
|
--enable-depend \
|
||||||
--with-system-timezone=/tmp \
|
--with-system-timezone=/tmp \
|
||||||
|
@ -141,16 +157,14 @@ define Build/Configure
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-integer-datetimes \
|
--disable-integer-datetimes \
|
||||||
--disable-rpath \
|
--disable-rpath \
|
||||||
--without-java \
|
--without-bonjour \
|
||||||
--without-krb4 \
|
--without-gssapi \
|
||||||
--without-krb5 \
|
--without-ldap \
|
||||||
--without-openssl \
|
--without-openssl \
|
||||||
--without-pam \
|
--without-pam \
|
||||||
--without-perl \
|
--without-perl \
|
||||||
--without-python \
|
--without-python \
|
||||||
--without-rendezvous \
|
|
||||||
--without-tcl \
|
--without-tcl \
|
||||||
--without-tk \
|
|
||||||
--with-zlib="yes" \
|
--with-zlib="yes" \
|
||||||
--enable-depend \
|
--enable-depend \
|
||||||
$(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
|
$(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
|
||||||
|
@ -207,32 +221,6 @@ define Package/pgsql-server/conffiles
|
||||||
/etc/config/postgresql
|
/etc/config/postgresql
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/pgsql-server/postinst
|
|
||||||
#!/bin/sh
|
|
||||||
grep -q '^postgres:' /etc/passwd && exit 0
|
|
||||||
group=$$(grep '^postgres:' /etc/group | cut -f3 -d:)
|
|
||||||
if [ -z "$${group}" ] ; then
|
|
||||||
group=1000
|
|
||||||
tst=$$(cat /etc/group | grep ":$${group}:")
|
|
||||||
while [ -n "$${tst}" ] ; do
|
|
||||||
group=$$(($${group}+1))
|
|
||||||
tst=$$(cat /etc/group | grep ":$${group}:")
|
|
||||||
done
|
|
||||||
echo "postgres:x:$${group}:" >>/etc/group
|
|
||||||
fi
|
|
||||||
|
|
||||||
user=$$(cat /etc/passwd | grep "^postgres:")
|
|
||||||
if [ -z "$${user}" ] ; then
|
|
||||||
num="$${group}"
|
|
||||||
tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
|
|
||||||
while [ -n "$${tst}" ] ; do
|
|
||||||
num=$$(($${num}+1))
|
|
||||||
tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
|
|
||||||
done
|
|
||||||
echo "postgres:*:$${num}:$${group}:PostgreSQL administrator:/tmp:/bin/ash" >>/etc/passwd
|
|
||||||
fi
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/InstallDev
|
define Build/InstallDev
|
||||||
$(INSTALL_DIR) $(1)/usr/bin
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
|
||||||
|
@ -242,6 +230,7 @@ define Build/InstallDev
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
|
||||||
|
|
|
@ -1,93 +1,73 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2006 OpenWrt.org
|
# Copyright (C) 2006-2015 OpenWrt.org
|
||||||
START=50
|
START=50
|
||||||
|
|
||||||
EXTRA_COMMANDS="status reload"
|
PROG=/usr/bin/postmaster
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
EXTRA_COMMANDS="status"
|
||||||
|
EXTRA_HELP=" status Show current status of the PostgreSQL server"
|
||||||
|
|
||||||
|
fix_hosts() {
|
||||||
|
# make sure localhost (without a dot) is in /etc/hosts
|
||||||
|
grep -q 'localhost$' /etc/hosts || echo '127.0.0.1 localhost' >> /etc/hosts
|
||||||
|
}
|
||||||
|
|
||||||
|
fix_perms() {
|
||||||
|
# for whatever reason, /dev/null gets wrong perms
|
||||||
|
chmod a+w /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
if [ -f "$1/postmaster.pid" ]; then
|
||||||
|
rm "$1/postmaster.pid"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
config_load "postgresql"
|
config_load "postgresql"
|
||||||
config_get pgdata config PGDATA
|
config_get pgdata config PGDATA
|
||||||
config_get pguser config PGUSER
|
config_get pguser config PGUSER
|
||||||
config_get pgctl config PG_CTL
|
config_get pgctl config PG_CTL
|
||||||
config_get pglog config PGLOG
|
|
||||||
|
|
||||||
start() {
|
|
||||||
if [ ! -e /usr/bin/su ]; then
|
|
||||||
echo "The su command is requred to run postgres"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d ${pgdata} ]; then
|
|
||||||
echo "Create the data directory (${pgdata}) and try again"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "starting postgres..."
|
|
||||||
# make sure localhost (without a dot) is in /etc/hosts
|
|
||||||
grep -q 'localhost$' /etc/hosts || echo '127.0.0.1 localhost' >> /etc/hosts
|
|
||||||
|
|
||||||
# for whatever reason, /dev/null gets wrong perms
|
|
||||||
chmod a+w /dev/null
|
|
||||||
|
|
||||||
if [ -f ${pgdata}/postmaster.pid ]; then
|
|
||||||
rm ${pgdata}/postmaster.pid
|
|
||||||
fi
|
|
||||||
|
|
||||||
config_get pgopts config PGOPTS
|
config_get pgopts config PGOPTS
|
||||||
if [ -n "${pgopts}" ]; then
|
|
||||||
pgopts="-o ${pgopts}"
|
|
||||||
fi
|
|
||||||
/usr/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1
|
|
||||||
|
|
||||||
while :
|
user_exists postgres 5432 || user_add postgres 5432
|
||||||
do
|
group_exists postgres 5432 || group_add postgres 5432
|
||||||
cnt=$((${cnt} + 1))
|
|
||||||
if [ -f "${pgdata}/postmaster.pid" ]; then
|
if [ ! -d "${pgdata}" ]; then
|
||||||
ret=0
|
echo "Create the data directory (${pgdata}) and try again"
|
||||||
break
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${cnt} -eq 30 ]; then
|
fix_perms
|
||||||
echo "Postgres failed to start. See ${pglog} for details"
|
fix_hosts
|
||||||
ret=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "ok"
|
procd_open_instance
|
||||||
return ${ret}
|
|
||||||
|
procd_set_param user ${pguser}
|
||||||
|
procd_set_param command $PROG
|
||||||
|
procd_append_param command -D "${pgdata}"
|
||||||
|
[ -n "${pgopts}" ] && procd_append_param command -o "${pgopts}"
|
||||||
|
|
||||||
|
procd_set_param respawn retry=60
|
||||||
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
reload_service() {
|
||||||
echo "stopping postgres..."
|
config_load "postgresql"
|
||||||
/usr/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast"
|
config_get pgdata config PGDATA
|
||||||
ret=$?
|
config_get pguser config PGUSER
|
||||||
if [ -f ${pgdata}/postmaster.pid ]; then
|
config_get pgctl config PG_CTL
|
||||||
rm ${pgdata}/postmaster.pid
|
${pgctl} reload -U ${pguser} -D '${pgdata}' -s
|
||||||
fi
|
|
||||||
echo "ok"
|
|
||||||
return ${ret}
|
|
||||||
}
|
|
||||||
|
|
||||||
restart() {
|
|
||||||
echo "restarting postgres..."
|
|
||||||
/usr/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast -w"
|
|
||||||
if [ -f ${pgdata}/postmaster.pid ]; then
|
|
||||||
rm ${pgdata}/postmaster.pid
|
|
||||||
fi
|
|
||||||
/usr/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1
|
|
||||||
echo "ok"
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
||||||
reload() {
|
|
||||||
echo "reloading postgres..."
|
|
||||||
/usr/bin/su ${pguser} -c "${pgctl} reload -D '${pgdata}' -s"
|
|
||||||
echo "ok"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
|
config_load "postgresql"
|
||||||
|
config_get pgdata config PGDATA
|
||||||
|
config_get pguser config PGUSER
|
||||||
|
config_get pgctl config PG_CTL
|
||||||
echo "status postgres..."
|
echo "status postgres..."
|
||||||
/usr/bin/su ${pguser} -c "${pgctl} status -D '${pgdata}'"
|
${pgctl} status -U ${pguser} -D '${pgdata}'
|
||||||
echo "ok"
|
echo "ok"
|
||||||
}
|
}
|
||||||
|
|
11
libs/postgresql/patches/001-configure_fixes.patch
Normal file
11
libs/postgresql/patches/001-configure_fixes.patch
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
--- a/configure.in
|
||||||
|
+++ b/configure.in
|
||||||
|
@@ -25,7 +25,7 @@ recommended. You can remove the check f
|
||||||
|
your responsibility whether the result works or not.])])
|
||||||
|
AC_COPYRIGHT([Copyright (c) 1996-2014, PostgreSQL Global Development Group])
|
||||||
|
AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
|
||||||
|
-AC_CONFIG_AUX_DIR(config)
|
||||||
|
+AC_CONFIG_AUX_DIR([config])
|
||||||
|
AC_PREFIX_DEFAULT(/usr/local/pgsql)
|
||||||
|
AC_SUBST(configure_args, [$ac_configure_args])
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
--- a/src/port/Makefile
|
--- a/src/port/Makefile
|
||||||
+++ b/src/port/Makefile
|
+++ b/src/port/Makefile
|
||||||
@@ -53,6 +53,7 @@ uninstall:
|
@@ -52,6 +52,7 @@ uninstall:
|
||||||
|
|
||||||
libpgport.a: $(OBJS)
|
libpgport.a: $(OBJS)
|
||||||
$(AR) $(AROPT) $@ $^
|
$(AR) $(AROPT) $@ $^
|
||||||
+ $(RANLIB) libpgport.a
|
+ $(RANLIB) libpgport.a
|
||||||
|
|
||||||
# thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not)
|
# thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not)
|
||||||
thread.o: thread.c
|
thread.o: CFLAGS+=$(PTHREAD_CFLAGS)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/src/bin/psql/print.h
|
--- a/src/bin/psql/print.h
|
||||||
+++ b/src/bin/psql/print.h
|
+++ b/src/bin/psql/print.h
|
||||||
@@ -171,10 +171,6 @@ extern void printQuery(const PGresult *r
|
@@ -179,10 +179,6 @@ extern void printQuery(const PGresult *r
|
||||||
extern void setDecimalLocale(void);
|
extern void setDecimalLocale(void);
|
||||||
extern const printTextFormat *get_line_style(const printTableOpt *opt);
|
extern const printTextFormat *get_line_style(const printTableOpt *opt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue