[package] update postgresql to 9.0.0 (#7999)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@23755 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2010-10-31 23:30:04 +00:00
parent ff2ac2bebe
commit c7d8111da0
3 changed files with 39 additions and 101 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2006-2009 OpenWrt.org # Copyright (C) 2006-2010 OpenWrt.org
# #
# This is free software, licensed under the GNU General Public License v2. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=postgresql PKG_NAME:=postgresql
PKG_VERSION:=8.3.3 PKG_VERSION:=9.0.0
PKG_RELEASE:=2 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=\ PKG_SOURCE_URL:=\
@ -18,7 +18,7 @@ PKG_SOURCE_URL:=\
http://ftp9.us.postgresql.org/pub/postgresql/source/v$(PKG_VERSION) \ http://ftp9.us.postgresql.org/pub/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:=0ae4bd9620e84d3e08dcf923808d14d0 PKG_MD5SUM:=14c2122cc322e69ab2ab702ed7714bbe
PKG_BUILD_PARALLEL:=1 PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -26,7 +26,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/libpq define Package/libpq
SECTION:=libs SECTION:=libs
CATEGORY:=Libraries CATEGORY:=Libraries
DEPENDS:=+zlib +libreadline +libncurses DEPENDS:=+zlib +libreadline +libncurses +coreutils-su
TITLE:=PostgreSQL client library TITLE:=PostgreSQL client library
URL:=http://www.postgresql.org/ URL:=http://www.postgresql.org/
SUBMENU:=database SUBMENU:=database
@ -97,12 +97,13 @@ define Build/Configure
--without-tk \ --without-tk \
--with-zlib="yes" \ --with-zlib="yes" \
--enable-depend \ --enable-depend \
--with-system-timezone=/tmp \
); );
$(MAKE) -C $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)" CFLAGS+="-I../../libpq" $(MAKE) -C $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)" CFLAGS+="-I../../libpq"
mv $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg \ mv $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg \
$(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host
$(MAKE) -C $(PKG_BUILD_DIR)/src/timezone CC="$(HOSTCC)" $(MAKE) -C $(PKG_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
mv $(PKG_BUILD_DIR)/src/timezone/zic $(PKG_BUILD_DIR)/src/timezone/zic.host mv $(PKG_BUILD_DIR)/src/timezone/zic $(STAGING_DIR)/host/bin/zic
$(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)" $(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
mv $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config \ mv $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config \
$(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host
@ -152,9 +153,6 @@ define Build/Configure
$(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \ $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
); );
$(SED) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
$(SED) 's@\./zic -d@./zic.host -d@' $(PKG_BUILD_DIR)/src/timezone/Makefile
# note: unclear if this is needed yet, commenting out for the moment
#$(SED) 's@US/Eastern@America/New_York@' $(PKG_BUILD_DIR)/src/timezone/Makefile
endef endef
TARGET_CFLAGS += $(FPIC) TARGET_CFLAGS += $(FPIC)
@ -184,82 +182,44 @@ define Package/pgsql-server/install
$(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config $(INSTALL_DIR) $(1)/etc/config
$(INSTALL_BIN) \ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
$(PKG_INSTALL_DIR)/usr/bin/postgres \
$(PKG_INSTALL_DIR)/usr/bin/dropdb \
$(PKG_INSTALL_DIR)/usr/bin/clusterdb \
$(PKG_INSTALL_DIR)/usr/bin/createdb \
$(PKG_INSTALL_DIR)/usr/bin/createlang \
$(PKG_INSTALL_DIR)/usr/bin/createuser \
$(PKG_INSTALL_DIR)/usr/bin/droplang \
$(PKG_INSTALL_DIR)/usr/bin/dropuser \
$(PKG_INSTALL_DIR)/usr/bin/initdb \
$(PKG_INSTALL_DIR)/usr/bin/ipcclean \
$(PKG_INSTALL_DIR)/usr/bin/pg_config \
$(PKG_INSTALL_DIR)/usr/bin/pg_controldata \
$(PKG_INSTALL_DIR)/usr/bin/pg_ctl \
$(PKG_INSTALL_DIR)/usr/bin/pg_dump \
$(PKG_INSTALL_DIR)/usr/bin/pg_dumpall \
$(PKG_INSTALL_DIR)/usr/bin/pg_restore \
$(PKG_INSTALL_DIR)/usr/bin/pg_resetxlog \
$(PKG_INSTALL_DIR)/usr/bin/reindexdb \
$(PKG_INSTALL_DIR)/usr/bin/vacuumdb \
$(1)/usr/bin
ln -sf postgres $(1)/usr/bin/postmaster ln -sf postgres $(1)/usr/bin/postmaster
$(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
$(INSTALL_DATA) \ $(CP) -r $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
$(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.bki \
$(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.description \
$(PKG_INSTALL_DIR)/usr/share/postgresql/conversion_create.sql \
$(PKG_INSTALL_DIR)/usr/share/postgresql/information_schema.sql \
$(PKG_INSTALL_DIR)/usr/share/postgresql/pg_hba.conf.sample \
$(PKG_INSTALL_DIR)/usr/share/postgresql/pg_ident.conf.sample \
$(PKG_INSTALL_DIR)/usr/share/postgresql/pg_service.conf.sample \
$(PKG_INSTALL_DIR)/usr/share/postgresql/postgresql.conf.sample \
$(PKG_INSTALL_DIR)/usr/share/postgresql/sql_features.txt \
$(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.shdescription \
$(PKG_INSTALL_DIR)/usr/share/postgresql/psqlrc.sample \
$(PKG_INSTALL_DIR)/usr/share/postgresql/recovery.conf.sample \
$(PKG_INSTALL_DIR)/usr/share/postgresql/system_views.sql \
$(PKG_INSTALL_DIR)/usr/share/postgresql/snowball_create.sql \
$(1)/usr/share/postgresql $(1)/usr/share/postgresql
$(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
$(CP) -r \ $(CP) -r \
$(PKG_INSTALL_DIR)/usr/share/postgresql/timezone \ $(PKG_INSTALL_DIR)/usr/lib/postgresql \
$(PKG_INSTALL_DIR)/usr/share/postgresql/timezonesets \ $(1)/usr/lib
$(1)/usr/share/postgresql
$(CP) -r \
$(PKG_INSTALL_DIR)/usr/lib/postgresql \
$(1)/usr/lib
endef endef
define Package/pgsql-server/postinst define Package/pgsql-server/postinst
#!/bin/sh #!/bin/sh
grep -q '^postgres:' /etc/passwd && exit 0 grep -q '^postgres:' /etc/passwd && exit 0
group=$$(grep '^postgres:' /etc/group | cut -f3 -d:)
if [ -e /bin/addgroup ]; then if [ -z "$${group}" ] ; then
/bin/addgroup postgres group=1000
RG=$$? tst=$$(cat /etc/group | grep ":$${group}:")
while [ -n "$${tst}" ] ; do
if [ -e /bin/adduser ]; then group=$$(($${group}+1))
/bin/adduser -h /tmp -H -g 'PostgreSQL administrator' -s /bin/ash -D -H -G postgres postgres tst=$$(cat /etc/group | grep ":$${group}:")
RU=$$? done
fi echo "postgres:x:$${group}:" >>/etc/group
fi fi
if [ -z "$${RG}" -o -z "$${RU}" ]; then user=$$(cat /etc/passwd | grep "^postgres:")
echo "Could not find user utils, you will need to create the postgres user by hand" if [ -z "$${user}" ] ; then
exit num="$${group}"
fi tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
while [ -n "$${tst}" ] ; do
if [ "$${RG}" != "0" -o "$${RU}" != "0" ]; then num=$$(($${num}+1))
echo "Failed to created postgres user" tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
exit 1 done
echo "postgres:*:$${num}:$${group}:PostgreSQL administrator:/tmp:/bin/ash" >>/etc/passwd
fi fi
endef endef
@ -276,7 +236,7 @@ define Build/InstallDev
$(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/
$(CP) $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(1)/usr/bin/ecpg $(CP) $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(1)/usr/bin/ecpg
$(CP) $(PKG_BUILD_DIR)/src/timezone/zic.host $(1)/usr/bin/zic $(CP) $(STAGING_DIR)/host/bin/zic $(1)/usr/bin/zic
endef endef
$(eval $(call BuildPackage,libpq)) $(eval $(call BuildPackage,libpq))

View File

@ -11,7 +11,7 @@ config_get pgctl config PG_CTL
config_get pglog config PGLOG config_get pglog config PGLOG
start() { start() {
if [ ! -e /bin/su ]; then if [ ! -e /usr/bin/su ]; then
echo "The su command is requred to run postgres" echo "The su command is requred to run postgres"
exit 1 exit 1
fi fi
@ -36,7 +36,7 @@ start() {
if [ -n "${pgopts}" ]; then if [ -n "${pgopts}" ]; then
pgopts="-o ${pgopts}" pgopts="-o ${pgopts}"
fi fi
/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1 /usr/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1
while : while :
do do
@ -60,7 +60,7 @@ start() {
stop() { stop() {
echo "stopping postgres..." echo "stopping postgres..."
/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast" /usr/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast"
ret=$? ret=$?
if [ -f ${pgdata}/postmaster.pid ]; then if [ -f ${pgdata}/postmaster.pid ]; then
rm ${pgdata}/postmaster.pid rm ${pgdata}/postmaster.pid
@ -71,23 +71,23 @@ stop() {
restart() { restart() {
echo "restarting postgres..." echo "restarting postgres..."
/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast -w" /usr/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast -w"
if [ -f ${pgdata}/postmaster.pid ]; then if [ -f ${pgdata}/postmaster.pid ]; then
rm ${pgdata}/postmaster.pid rm ${pgdata}/postmaster.pid
fi fi
/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1 /usr/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1
echo "ok" echo "ok"
return $? return $?
} }
reload() { reload() {
echo "reloading postgres..." echo "reloading postgres..."
/bin/su ${pguser} -c "${pgctl} reload -D '${pgdata}' -s" /usr/bin/su ${pguser} -c "${pgctl} reload -D '${pgdata}' -s"
echo "ok" echo "ok"
} }
status() { status() {
echo "status postgres..." echo "status postgres..."
/bin/su ${pguser} -c "${pgctl} status -D '${pgdata}'" /usr/bin/su ${pguser} -c "${pgctl} status -D '${pgdata}'"
echo "ok" echo "ok"
} }

View File

@ -1,22 +0,0 @@
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -71,7 +71,9 @@
static int float8_cmp_internal(float8 a, float8 b);
#ifndef HAVE_CBRT
-static double cbrt(double x);
+#undef cbrt
+#define cbrt(x) pg_cbrt(x)
+static double pg_cbrt(double x);
#endif /* HAVE_CBRT */
@@ -2733,7 +2735,7 @@
#ifndef HAVE_CBRT
static double
-cbrt(double x)
+pg_cbrt(double x)
{
int isneg = (x < 0.0);
double absx = fabs(x);