Add postgres server/client options
cover Add postgres server/client options
Currently it is possible to turn on postgres and have both client and server off. Making it an either/or seemed like too much of a break for those wanting both, but I'm unsure of how to enforce at-least-one-of a set not available until the postgres package is enabled.
Both options default to 'y' for backwards compat.
The procedure is as documented here (at the end):
http://www.postgresql.org/docs/9.4/static/install-procedure.html
but I used FreeBSD's directory listing which also excludes the other server-only bits and allows server-without-client mode as well.
If the simpler procedure on the webpage is wanted, I'm fine with that as well.
Tested in client, server, and client+server mode locally on x86_64.
Thanks,
--Ben
Ben Boeckel (1):
postgresql: add an option to build the server
package/bandwidthd/Config.in | 1 + package/collectd/Config.in | 1 + package/cppdb/Config.in | 2 +- package/php/Config.ext | 1 + package/postgresql/Config.in | 16 ++++++++++++++ package/postgresql/postgresql.mk | 48 ++++++++++++++++++++++++++++++++++++++++ package/qt/Config.sql.in | 1 + package/qt5/qt5base/Config.in | 1 + 8 files changed, 70 insertions(+), 1 deletion(-)
Signature · 1 line
2.6.1
PATCH 1/1 postgresql: add an option to build the server
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
--- package/bandwidthd/Config.in | 1 + package/collectd/Config.in | 1 + package/cppdb/Config.in | 2 +- package/php/Config.ext | 1 + package/postgresql/Config.in | 16 ++++++++++++++ package/postgresql/postgresql.mk | 48 ++++++++++++++++++++++++++++++++++++++++ package/qt/Config.sql.in | 1 + package/qt5/qt5base/Config.in | 1 + 8 files changed, 70 insertions(+), 1 deletion(-)
package/bandwidthd/Config.in +1 -0
@@ -33,6 +33,7 @@ if BR2_PACKAGE_BANDWIDTHD config BR2_PACKAGE_BANDWIDTHD_POSTGRESQL bool "enable postgresql log target support" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on !BR2_STATIC_LIBS help Enable support for logging the bandwidthd data to a remote
package/collectd/Config.in +1 -0
@@ -349,6 +349,7 @@ config BR2_PACKAGE_COLLECTD_PING config BR2_PACKAGE_COLLECTD_POSTGRESQL bool "postgresql" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT help Connects to and executes SQL statements on a PostgreSQL database. It then reads back the results and, depending on the
package/cppdb/Config.in +1 -1
@@ -5,7 +5,7 @@ config BR2_PACKAGE_CPPDB depends on BR2_INSTALL_LIBSTDCPP depends on BR2_TOOLCHAIN_HAS_THREADS # Can be built without them but it's useless - depends on BR2_PACKAGE_MYSQL || BR2_PACKAGE_POSTGRESQL || BR2_PACKAGE_SQLITE + depends on BR2_PACKAGE_MYSQL || BR2_PACKAGE_POSTGRESQL_CLIENT || BR2_PACKAGE_SQLITE help CppDB is an SQL connectivity library that is designed to provide platform and Database independent connectivity API similarly
package/php/Config.ext +1 -0
@@ -158,6 +158,7 @@ comment "MySQL drivers need a toolchain w/ C++, threads" config BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL bool "PostgreSQL" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on BR2_USE_MMU # postgresql depends on !BR2_STATIC_LIBS help
package/postgresql/Config.in +16 -0
@@ -18,5 +18,21 @@ config BR2_PACKAGE_POSTGRESQL http://www.postgresql.org +if BR2_PACKAGE_POSTGRESQL + +config BR2_PACKAGE_POSTGRESQL_CLIENT + bool "PostgreSQL client libraries" + default y + help + Install the PostgreSQL client libraries on the target. + +config BR2_PACKAGE_POSTGRESQL_SERVER + bool "PostgreSQL server" + default y + help + Install the PostgreSQL server on the target. + +endif + comment "postgresql needs a toolchain w/ dynamic library" depends on BR2_STATIC_LIBS
package/postgresql/postgresql.mk +48 -0
58 lines not on this page · raw message
package/qt/Config.sql.in +1 -0
@@ -31,6 +31,7 @@ config BR2_PACKAGE_QT_ODBC config BR2_PACKAGE_QT_PSQL bool "PostgreSQL Driver" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on !BR2_STATIC_LIBS help Build PostgreSQL driver
package/qt5/qt5base/Config.in +1 -0
@@ -73,6 +73,7 @@ config BR2_PACKAGE_QT5BASE_MYSQL config BR2_PACKAGE_QT5BASE_PSQL bool "PostgreSQL Plugin" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on BR2_USE_MMU # postgresql depends on !BR2_STATIC_LIBS help
Signature · 1 line
2.6.1
PATCH 1/1 postgresql: add an option to build the server
Ben,
Quoted 7 lines · Ben Boeckel
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
Signed-off-by Ben Boeckel <[email protected]>
Just to clarify: in our current packaging, we build and install both server and client?
package/postgresql/Config.in config BR2_PACKAGE_POSTGRESQL · line 19
Quoted 7 lines
package/postgresql/Config.in +0
-0@@ -18,5 +18,21 @@ config BR2_PACKAGE_POSTGRESQL http://www.postgresql.org
As I suggested, doing:
select BR2_PACKAGE_POSTGRESQL_CLIENT if !BR2_PACKAGE_POSTGRESQL_SERVER
woudl be good.
package/postgresql/postgresql.mk POSTGRESQL_DEPENDENCIES += openssl · line 62
Quoted 10 lines
package/postgresql/postgresql.mk +2
-0@@ -58,6 +58,21 @@ POSTGRESQL_DEPENDENCIES += openssl POSTGRESQL_CONF_OPTS += --with-openssl endif +POSTGRESQL_BUILD_DIRECTORIES = +POSTGRESQL_INSTALL_DIRECTORIES =
Not needed, variables are empty by default.
package/postgresql/postgresql.mk POSTGRESQL_DEPENDENCIES += openssl · line 68
Quoted 6 lines
package/postgresql/postgresql.mk +6
-0+ +ifeq ($(BR2_PACKAGE_POSTGRESQL_CLIENT),y) + +POSTGRESQL_CLIENT_DIRECTORIES += config src/include src/interfaces src/port \ + src/bin/pg_dump src/bin/psql src/bin/scripts src/bin/pg_config \ + src/backend
Lines are a bit too long. What about instead:
POSTGRESQL_CLIENT_DIRECTORIES = \ config src/include src/interfaces src/port src/backend \ src/bin/pg_dump src/bin/psql src/bin/scripts src/bin/pg_config \
Quoted 11 lines
package/postgresql/postgresql.mk +7
-0+POSTGRESQL_BUILD_DIRECTORIES += $(POSTGRESQL_CLIENT_DIRECTORIES) +POSTGRESQL_INSTALL_DIRECTORIES += $(POSTGRESQL_CLIENT_DIRECTORIES) + +endif + +ifeq ($(BR2_PACKAGE_POSTGRESQL_SERVER),y) + define POSTGRESQL_USERS postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server endef
package/postgresql/postgresql.mk define POSTGRESQL_INSTALL_INIT_SYSTEMD · line 112
Quoted 9 lines
package/postgresql/postgresql.mk +6
-0@@ -89,4 +104,37 @@ define POSTGRESQL_INSTALL_INIT_SYSTEMD $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service endef +POSTGRESQL_SERVER_DIRECTORIES = src/common src/timezone src/backend \ + src/backend/utils/mb/conversion_procs \ + src/backend/snowball src/backend/replication/libpqwalreceiver \ + src/bin/initdb src/bin/pg_ctl \ + src/bin/pg_controldata src/bin/pg_resetxlog src/pl \ + src/bin/pg_basebackup
Ditto.
package/postgresql/postgresql.mk define POSTGRESQL_INSTALL_INIT_SYSTEMD · line 115
Quoted 3 lines
package/postgresql/postgresql.mk +3
-0+ +POSTGRESQL_INSTALL_DIRECTORIES += $(POSTGRESQL_SERVER_DIRECTORIES) +POSTGRESQL_BUILD_DIRECTORIES += src/port $(POSTGRESQL_SERVER_DIRECTORIES)
Is it problematic if src/port gets installed in the server case? If not, then you don't need to have this difference between POSTGRESQL_INSTALL_DIRECTORIES and POSTGRESQL_BUILD_DIRECTORIES.
package/postgresql/postgresql.mk define POSTGRESQL_INSTALL_INIT_SYSTEMD · line 121
Quoted 6 lines
package/postgresql/postgresql.mk +6
-0+ +endif + +define POSTGRESQL_BUILD_CMDS + for dir in $(POSTGRESQL_BUILD_DIRECTORIES); do \ + echo $${dir}; \
Left-over debugging?
package/postgresql/postgresql.mk define POSTGRESQL_INSTALL_INIT_SYSTEMD · line 123
Quoted 2 lines
package/postgresql/postgresql.mk +2
-0+ $(MAKE) -C $(@D)/$${dir} || exit 1; \ + done
Could you use a foreach loop instead ?
$(foreach d,$(POSTGRESQL_BUILD_DIRECTORIES),\ $(MAKE) -C $(@D)/$(d)$(sep))
package/postgresql/postgresql.mk define POSTGRESQL_INSTALL_INIT_SYSTEMD · line 130
Quoted 7 lines
package/postgresql/postgresql.mk +7
-0+endef + +define POSTGRESQL_INSTALL_TARGET_CMDS + for dir in $(POSTGRESQL_INSTALL_DIRECTORIES); do \ + echo $${dir}; \ + $(MAKE) -C $(@D)/$${dir} DESTDIR=$(TARGET_DIR) install || exit 1; \ + done
Ditto.
package/postgresql/postgresql.mk define POSTGRESQL_INSTALL_INIT_SYSTEMD · line 137
Quoted 7 lines
package/postgresql/postgresql.mk +7
-0+endef + +define POSTGRESQL_INSTALL_STAGING_CMDS + for dir in $(POSTGRESQL_INSTALL_DIRECTORIES); do \ + echo $${dir}; \ + $(MAKE) -C $(@D)/$${dir} DESTDIR=$(STAGING_DIR) install || exit 1; \ + done
Ditto.
Also, above the definition of POSTGRESQL_CLIENT_DIRECTORIES or POSTGRESQL_SERVER_DIRECTORIES, can you add a comment with a reference to the postgresql documentation that says which directories should be built/installed for the client and server cases? This way if we need to update the postgresql package in the future, we can do it by looking at the documentation.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 postgresql: add an option to build the server
Quoted 11 lines · Thomas Petazzoni
Quoted 7 lines · Ben Boeckel
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
Signed-off-by Ben Boeckel <[email protected]>Just to clarify: in our current packaging, we build and install both server and client?
Correct.
Quoted 5 lines
As I suggested, doing:
select
BR2_PACKAGE_POSTGRESQL_CLIENTif !BR2_PACKAGE_POSTGRESQL_SERVERwoudl be good.
Yeah, that looks much better.
Quoted 4 lines
package/postgresql/postgresql.mk POSTGRESQL_DEPENDENCIES += openssl · line 62
Quoted 2 lines
package/postgresql/postgresql.mk +2
-0+POSTGRESQL_BUILD_DIRECTORIES = +POSTGRESQL_INSTALL_DIRECTORIES =Not needed, variables are empty by default.
I know; it was for clarity (which is an "IMO" thing). I'll remove them.
Quoted 10 lines
package/postgresql/postgresql.mk POSTGRESQL_DEPENDENCIES += openssl · line 68
Quoted 3 lines
package/postgresql/postgresql.mk +3
-0+POSTGRESQL_CLIENT_DIRECTORIES += config src/include src/interfaces src/port \ + src/bin/pg_dump src/bin/psql src/bin/scripts src/bin/pg_config \ + src/backendLines are a bit too long. What about instead:
POSTGRESQL_CLIENT_DIRECTORIES = \ config src/include src/interfaces src/port src/backend \ src/bin/pg_dump src/bin/psql src/bin/scripts src/bin/pg_config \
Quoted 8 lines
package/postgresql/postgresql.mk define POSTGRESQL_INSTALL_INIT_SYSTEMD · line 112
Quoted 6 lines
package/postgresql/postgresql.mk +6
-0+POSTGRESQL_SERVER_DIRECTORIES = src/common src/timezone src/backend \ + src/backend/utils/mb/conversion_procs \ + src/backend/snowball src/backend/replication/libpqwalreceiver \ + src/bin/initdb src/bin/pg_ctl \ + src/bin/pg_controldata src/bin/pg_resetxlog src/pl \ + src/bin/pg_basebackupDitto.
I'm fine with this.
Quoted 6 lines
package/postgresql/postgresql.mk define POSTGRESQL_INSTALL_INIT_SYSTEMD · line 115
Quoted 2 lines
package/postgresql/postgresql.mk +2
-0+POSTGRESQL_INSTALL_DIRECTORIES += $(POSTGRESQL_SERVER_DIRECTORIES) +POSTGRESQL_BUILD_DIRECTORIES += src/port $(POSTGRESQL_SERVER_DIRECTORIES)Is it problematic if src/port gets installed in the server case? If not, then you don't need to have this difference between
POSTGRESQL_INSTALL_DIRECTORIESandPOSTGRESQL_BUILD_DIRECTORIES.
I'm not sure; I think it may have just client-related things which are needed by the server build, but not install (e.g., headers). See below for more.
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ echo $${dir}; \Left-over debugging?
Indeed. Will remove.
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ $(MAKE) -C $(@D)/$${dir} || exit 1; \ + doneCould you use a foreach loop instead ?
$(foreach d,$(POSTGRESQL_BUILD_DIRECTORIES),\ $(MAKE) -C $(@D)/$(d)$(sep))
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ for dir in $(POSTGRESQL_INSTALL_DIRECTORIES); do \Ditto.
Review
Quoted 1 line
(quoted diff) +1
-0+ for dir in $(POSTGRESQL_INSTALL_DIRECTORIES); do \Ditto.
Ah, yes, this is better.
Quoted 6 lines
Also, above the definition of
POSTGRESQL_CLIENT_DIRECTORIESorPOSTGRESQL_SERVER_DIRECTORIES, can you add a comment with a reference to the postgresql documentation that says which directories should be built/installed for the client and server cases? This way if we need to update the postgresql package in the future, we can do it by looking at the documentation.
The documentation just tells how to install just the client bits from a full build; there is no mention of a client-less server install. These bits are cribbed from the postgresql94-{server,client} ports from FreeBSD where the two are completely separate ports. This is likely the reason for src/port not being in the install for the server, but it is built. Here, since there's a single build, it isn't such a problem.
I'll try using the specified directories in the documentation for the client side. For the server side, comments could be added to the src/bin/ directories for the server side, but the other bits are likely "what it takes to build the binaries".
--Ben
cover Add postgres server/client options
In reply to Ben BoeckelBen,
Quoted 4 lines · Ben Boeckel
Currently it is possible to turn on postgres and have both client and server off. Making it an either/or seemed like too much of a break for those wanting both, but I'm unsure of how to enforce at-least-one-of a set not available until the postgres package is enabled.
You can do:
select BR2_PACKAGE_POSTGRESQL_CLIENT if !BR2_PACKAGE_POSTGRESQL_SERVER
This does not scale well if you have a lot of choices, but since there is only a choice between two possibilities here, it's quite reasonable to do that.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 postgresql: add an option to build the server
In reply to Ben BoeckelUnfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
---
Changes v1 -> v2:
- review by Thomas Petazzoni
- add client-if-not-server select for the postgresql package
- shell for -> $(foreach)
- remove empty variable "declarations"
- rewrap directory list variables
- simplify the directory listing variables
- document the directories being installed
- install fmgroids.h explicitly
--- package/bandwidthd/Config.in | 1 + package/collectd/Config.in | 1 + package/cppdb/Config.in | 2 +- package/php/Config.ext | 1 + package/postgresql/Config.in | 17 ++++++++++ package/postgresql/postgresql.mk | 71 ++++++++++++++++++++++++++++++++++++++++ package/qt/Config.sql.in | 1 + package/qt5/qt5base/Config.in | 1 + 8 files changed, 94 insertions(+), 1 deletion(-)
package/bandwidthd/Config.in +1 -0
@@ -33,6 +33,7 @@ if BR2_PACKAGE_BANDWIDTHD config BR2_PACKAGE_BANDWIDTHD_POSTGRESQL bool "enable postgresql log target support" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on !BR2_STATIC_LIBS help Enable support for logging the bandwidthd data to a remote
package/collectd/Config.in +1 -0
@@ -349,6 +349,7 @@ config BR2_PACKAGE_COLLECTD_PING config BR2_PACKAGE_COLLECTD_POSTGRESQL bool "postgresql" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT help Connects to and executes SQL statements on a PostgreSQL database. It then reads back the results and, depending on the
package/cppdb/Config.in +1 -1
@@ -5,7 +5,7 @@ config BR2_PACKAGE_CPPDB depends on BR2_INSTALL_LIBSTDCPP depends on BR2_TOOLCHAIN_HAS_THREADS # Can be built without them but it's useless - depends on BR2_PACKAGE_MYSQL || BR2_PACKAGE_POSTGRESQL || BR2_PACKAGE_SQLITE + depends on BR2_PACKAGE_MYSQL || BR2_PACKAGE_POSTGRESQL_CLIENT || BR2_PACKAGE_SQLITE help CppDB is an SQL connectivity library that is designed to provide platform and Database independent connectivity API similarly
package/php/Config.ext +1 -0
@@ -158,6 +158,7 @@ comment "MySQL drivers need a toolchain w/ C++, threads" config BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL bool "PostgreSQL" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on BR2_USE_MMU # postgresql depends on !BR2_STATIC_LIBS help
package/postgresql/Config.in +17 -0
@@ -5,6 +5,7 @@ config BR2_PACKAGE_POSTGRESQL # postgresql is unlikely to be used in a pure statically # linked environment. depends on !BR2_STATIC_LIBS + select BR2_PACKAGE_POSTGRESQL_CLIENT if !BR2_PACKAGE_POSTGRESQL_SERVER help PostgreSQL is a powerful, open source object-relational database system.
@@ -18,5 +19,21 @@ config BR2_PACKAGE_POSTGRESQL http://www.postgresql.org +if BR2_PACKAGE_POSTGRESQL + +config BR2_PACKAGE_POSTGRESQL_CLIENT + bool "PostgreSQL client libraries" + default y + help + Install the PostgreSQL client libraries on the target. + +config BR2_PACKAGE_POSTGRESQL_SERVER + bool "PostgreSQL server" + default y + help + Install the PostgreSQL server on the target. + +endif + comment "postgresql needs a toolchain w/ dynamic library" depends on BR2_STATIC_LIBS
package/postgresql/postgresql.mk +71 -0
81 lines not on this page · raw message
package/qt/Config.sql.in +1 -0
@@ -31,6 +31,7 @@ config BR2_PACKAGE_QT_ODBC config BR2_PACKAGE_QT_PSQL bool "PostgreSQL Driver" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on !BR2_STATIC_LIBS help Build PostgreSQL driver
package/qt5/qt5base/Config.in +1 -0
@@ -73,6 +73,7 @@ config BR2_PACKAGE_QT5BASE_MYSQL config BR2_PACKAGE_QT5BASE_PSQL bool "PostgreSQL Plugin" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on BR2_USE_MMU # postgresql depends on !BR2_STATIC_LIBS help
Signature · 1 line
2.6.2
PATCH v2 1/1 postgresql: add an option to build the server
Quoted 19 lines · Ben Boeckel
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
Signed-off-by Ben Boeckel <[email protected]>---
Changes v1 -> v2:
- review by Thomas Petazzoni
- add client-if-not-server select for the postgresql package
- shell for -> $(foreach)
- remove empty variable "declarations"
- rewrap directory list variables
- simplify the directory listing variables
- document the directories being installed
- installfmgroids.hexplicitly
Quoted 1 line
Signed-off-by Ben Boeckel <[email protected]>
Hi,
Is there anything else I need to do here?
Thanks,
--Ben
PATCH v2 1/1 postgresql: add an option to build the server
In reply to Ben BoeckelQuoted 5 lines · Ben Boeckel
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
Bump.
--Ben
PATCH v2 1/1 postgresql: add an option to build the server
In reply to Ben BoeckelBen,
Quoted 7 lines · Ben Boeckel
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
Signed-off-by Ben Boeckel <[email protected]>
Sorry for the slow response. I finally had a closer look at this tonight. I'm adding in Cc Yann, Arnout and Peter to get their feedback on this, which is why I'm going to keep the entire patch below.
If I understand correctly, the current postgresql package is building both the client and server parts unconditionally, and the purpose of your patch is to make each of them conditional.
I am wondering if it is really worth the effort trying to build the relevant directories in each case. The build phase of postgresql (in the current package, building both client and server) takes 77 seconds on my machine, which is not that long.
Since this logic that consists in filtering which directory needs to be built or not is very likely to break/change when upgrading the PostgreSQL package version, I would personally be in favor of always building the whole thing, and then have a post-install hook that removes the useless files.
If you really want to save the build time, then I would suggest to work with the PostgreSQL upstream developers to get configure options to do this.
Peter, Yann, Arnout, what do you think? See below for the full patch.
Thanks!
Thomas
Quoted 217 lines
---
Changes v1 -> v2:
- review by Thomas Petazzoni
- add client-if-not-server select for the postgresql package
- shell for -> $(foreach)
- remove empty variable "declarations"
- rewrap directory list variables
- simplify the directory listing variables
- document the directories being installed
- installfmgroids.hexplicitlySigned-off-by Ben Boeckel <[email protected]>--- package/bandwidthd/Config.in | 1 + package/collectd/Config.in | 1 + package/cppdb/Config.in | 2 +- package/php/Config.ext | 1 + package/postgresql/Config.in | 17 ++++++++++ package/postgresql/postgresql.mk | 71 ++++++++++++++++++++++++++++++++++++++++ package/qt/Config.sql.in | 1 + package/qt5/qt5base/Config.in | 1 + 8 files changed, 94 insertions(+), 1 deletion(-)package/bandwidthd/Config.in +1
-0@@ -33,6 +33,7 @@ if BR2_PACKAGE_BANDWIDTHD config BR2_PACKAGE_BANDWIDTHD_POSTGRESQL bool "enable postgresql log target support" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on !BR2_STATIC_LIBS help Enable support for logging the bandwidthd data to a remotepackage/collectd/Config.in +1
-0@@ -349,6 +349,7 @@ config BR2_PACKAGE_COLLECTD_PING config BR2_PACKAGE_COLLECTD_POSTGRESQL bool "postgresql" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT help Connects to and executes SQL statements on a PostgreSQL database. It then reads back the results and, depending on thepackage/cppdb/Config.in +1
-1@@ -5,7 +5,7 @@ config BR2_PACKAGE_CPPDB depends on BR2_INSTALL_LIBSTDCPP depends on BR2_TOOLCHAIN_HAS_THREADS # Can be built without them but it's useless - depends on BR2_PACKAGE_MYSQL || BR2_PACKAGE_POSTGRESQL || BR2_PACKAGE_SQLITE + depends on BR2_PACKAGE_MYSQL || BR2_PACKAGE_POSTGRESQL_CLIENT || BR2_PACKAGE_SQLITE help CppDB is an SQL connectivity library that is designed to provide platform and Database independent connectivity API similarlypackage/php/Config.ext +1
-0@@ -158,6 +158,7 @@ comment "MySQL drivers need a toolchain w/ C++, threads" config BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL bool "PostgreSQL" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on BR2_USE_MMU # postgresql depends on !BR2_STATIC_LIBS helppackage/postgresql/Config.in +17
-0@@ -5,6 +5,7 @@ config BR2_PACKAGE_POSTGRESQL # postgresql is unlikely to be used in a pure statically # linked environment. depends on !BR2_STATIC_LIBS + select BR2_PACKAGE_POSTGRESQL_CLIENT if !BR2_PACKAGE_POSTGRESQL_SERVER help PostgreSQL is a powerful, open source object-relational database system.@@ -18,5 +19,21 @@ config BR2_PACKAGE_POSTGRESQL http://www.postgresql.org +if BR2_PACKAGE_POSTGRESQL + +config BR2_PACKAGE_POSTGRESQL_CLIENT + bool "PostgreSQL client libraries" + default y + help + Install the PostgreSQL client libraries on the target. + +config BR2_PACKAGE_POSTGRESQL_SERVER + bool "PostgreSQL server" + default y + help + Install the PostgreSQL server on the target. + +endif + comment "postgresql needs a toolchain w/ dynamic library" depends on BR2_STATIC_LIBSpackage/postgresql/postgresql.mk +71
-0@@ -58,6 +58,34 @@ POSTGRESQL_DEPENDENCIES += openssl POSTGRESQL_CONF_OPTS += --with-openssl endif +ifeq ($(BR2_PACKAGE_POSTGRESQL_CLIENT),y) + +# Install the binaries: +# clusterdb +# createdb +# createlang +# createuser +# dropdb +# droplang +# dropuser +# ecpg +# pg_dump +# pg_dumpall +# pg_isready +# pg_restore +# psql +# reindexdb +# vacuumdb +# +# and the directories required to build them. +POSTGRESQL_INSTALL_DIRECTORIES += \ + config src/include src/interfaces src/port \ + src/bin/pg_dump src/bin/psql src/bin/scripts src/bin/pg_config + +endif + +ifeq ($(BR2_PACKAGE_POSTGRESQL_SERVER),y) + define POSTGRESQL_USERS postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server endef@@ -89,4 +117,47 @@ define POSTGRESQL_INSTALL_INIT_SYSTEMD $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service endef +# Install the binaries: +# initdb +# pg_basebackup +# pg_controldata +# pg_ctl +# pg_receivexlog +# pg_recvlogical +# pg_resetxlog +# postgres +# postmaster +# +# and the directories required to build them. +POSTGRESQL_INSTALL_DIRECTORIES += \ + src/port src/common src/backend \ + src/backend/utils/mb/conversion_procs \ + src/backend/snowball src/backend/replication/libpqwalreceiver \ + src/bin/initdb src/bin/pg_ctl \ + src/bin/pg_controldata src/bin/pg_resetxlog src/pl \ + src/bin/pg_basebackup + +ifeq ($(BR2_PACKAGE_TZDATA),y) +POSTGRESQL_INSTALL_DIRECTORIES += src/timezone +endif + +endif + +define POSTGRESQL_BUILD_CMDS + $(foreach d,$(POSTGRESQL_INSTALL_DIRECTORIES), + $(MAKE) -C $(@D)/$(d)$(sep)) + # Required for the installation. + $(MAKE) -C $(@D)/src/backend ../../src/include/utils/fmgroids.h +endef + +define POSTGRESQL_INSTALL_TARGET_CMDS + $(foreach d,$(POSTGRESQL_INSTALL_DIRECTORIES), + $(MAKE) -C $(@D)/$(d) DESTDIR=$(TARGET_DIR) install$(sep)) +endef + +define POSTGRESQL_INSTALL_STAGING_CMDS + $(foreach d,$(POSTGRESQL_INSTALL_DIRECTORIES), + $(MAKE) -C $(@D)/$(d) DESTDIR=$(STAGING_DIR) install$(sep)) +endef + $(eval $(autotools-package))package/qt/Config.sql.in +1
-0@@ -31,6 +31,7 @@ config BR2_PACKAGE_QT_ODBC config BR2_PACKAGE_QT_PSQL bool "PostgreSQL Driver" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on !BR2_STATIC_LIBS help Build PostgreSQL driverpackage/qt5/qt5base/Config.in +1
-0@@ -73,6 +73,7 @@ config BR2_PACKAGE_QT5BASE_MYSQL config BR2_PACKAGE_QT5BASE_PSQL bool "PostgreSQL Plugin" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on BR2_USE_MMU # postgresql depends on !BR2_STATIC_LIBS help
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 postgresql: add an option to build the server
Quoted 23 lines · Thomas Petazzoni
Ben,
Quoted 7 lines · Ben Boeckel
Quoted 7 lines
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
Signed-off-by Ben Boeckel <[email protected]>Sorry for the slow response. I finally had a closer look at this tonight. I'm adding in Cc Yann, Arnout and Peter to get their feedback on this, which is why I'm going to keep the entire patch below.
If I understand correctly, the current postgresql package is building both the client and server parts unconditionally, and the purpose of your patch is to make each of them conditional.
I am wondering if it is really worth the effort trying to build the relevant directories in each case. The build phase of postgresql (in the current package, building both client and server) takes 77 seconds on my machine, which is not that long.
Quoted 5 lines
Since this logic that consists in filtering which directory needs to be built or not is very likely to break/change when upgrading the PostgreSQL package version, I would personally be in favor of always building the whole thing, and then have a post-install hook that removes the useless files.
I agree that it is fragile. However, it will be needed anyway. With the current
approach, it would still be needed in the _INSTALL_CMDS. Or if you'd take the approach to remove unnecessary stuff post-build, you'd need a list of things to remove.
So given that there is anyway a list of things that has to be maintained, using
that list in the build step as well is OK for me. The only additional complexity is the fmgroids.h thingy.
Quoted 3 lines
If you really want to save the build time, then I would suggest to work with the PostgreSQL upstream developers to get configure options to do this.
That, of course, would be the preferred option.
Regards,
Arnout
Quoted 4 lines
Peter, Yann, Arnout, what do you think? See below for the full patch.
Thanks!
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 postgresql: add an option to build the server
Arnout, Thomas, Ben, All,
On 2015-12-14 01:08 +0100, Arnout Vandecappelle spake thusly:
Quoted 28 lines · Thomas Petazzoni
Quoted 21 lines · Ben Boeckel
Quoted 7 lines
Quoted 7 lines
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
Signed-off-by Ben Boeckel <[email protected]>Sorry for the slow response. I finally had a closer look at this tonight. I'm adding in Cc Yann, Arnout and Peter to get their feedback on this, which is why I'm going to keep the entire patch below.
If I understand correctly, the current postgresql package is building both the client and server parts unconditionally, and the purpose of your patch is to make each of them conditional.
I am wondering if it is really worth the effort trying to build the relevant directories in each case. The build phase of postgresql (in the current package, building both client and server) takes 77 seconds on my machine, which is not that long.
Quoted 5 lines
Since this logic that consists in filtering which directory needs to be built or not is very likely to break/change when upgrading the PostgreSQL package version, I would personally be in favor of always building the whole thing, and then have a post-install hook that removes the useless files.
Quoted 7 lines
I agree that it is fragile. However, it will be needed anyway. With the current
approach, it would still be needed in the_INSTALL_CMDS. Or if you'd take the approach to remove unnecessary stuff post-build, you'd need a list of things to remove.So given that there is anyway a list of things that has to be maintained, using
that list in the build step as well is OK for me.
I think I would side with Arnout on that one.
Quoted 2 lines
The only additional complexity
is thefmgroids.hthingy.
However, I think it can be mad emuch simpler:
- do the build unconditionally, so we get a simple build command and get rid of the fmgroids.h oddity
- do a selective installation
Regards,
Yann E. MORIN.
Quoted 27 lines
Quoted 3 lines
If you really want to save the build time, then I would suggest to work with the PostgreSQL upstream developers to get configure options to do this.
That, of course, would be the preferred option.
Regards,
ArnoutQuoted 4 lines
Peter, Yann, Arnout, what do you think? See below for the full patch.
Thanks!
Signature · 10 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/1 postgresql: add an option to build the server
In reply to Ben BoeckelBen, All,
On 2015-10-23 00:43 -0400, Ben Boeckel spake thusly:
Quoted 5 lines
Unfortunately, postgresql upstream doesn't have a configure option for this. Instead, to get bits of the build, compiling and installing different subdirectories is the preferred way.
The directories come from those used in the FreeBSD port.
This patch has had some comments, and I especially suggested we do a full build unconditionally, only doing a selective install (to get rid of the fmgroids oddity).
I've marked this patch as "changes requested" in our patchwork, which means we'll no longer be tracking it. If you're still interested, please send an updated version.
Regards,
Yann E. MORIN.
Quoted 226 lines
Signed-off-by Ben Boeckel <[email protected]>---
Changes v1 -> v2:
- review by Thomas Petazzoni
- add client-if-not-server select for the postgresql package
- shell for -> $(foreach)
- remove empty variable "declarations"
- rewrap directory list variables
- simplify the directory listing variables
- document the directories being installed
- installfmgroids.hexplicitlySigned-off-by Ben Boeckel <[email protected]>--- package/bandwidthd/Config.in | 1 + package/collectd/Config.in | 1 + package/cppdb/Config.in | 2 +- package/php/Config.ext | 1 + package/postgresql/Config.in | 17 ++++++++++ package/postgresql/postgresql.mk | 71 ++++++++++++++++++++++++++++++++++++++++ package/qt/Config.sql.in | 1 + package/qt5/qt5base/Config.in | 1 + 8 files changed, 94 insertions(+), 1 deletion(-)package/bandwidthd/Config.in +1
-0@@ -33,6 +33,7 @@ if BR2_PACKAGE_BANDWIDTHD config BR2_PACKAGE_BANDWIDTHD_POSTGRESQL bool "enable postgresql log target support" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on !BR2_STATIC_LIBS help Enable support for logging the bandwidthd data to a remotepackage/collectd/Config.in +1
-0@@ -349,6 +349,7 @@ config BR2_PACKAGE_COLLECTD_PING config BR2_PACKAGE_COLLECTD_POSTGRESQL bool "postgresql" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT help Connects to and executes SQL statements on a PostgreSQL database. It then reads back the results and, depending on thepackage/cppdb/Config.in +1
-1@@ -5,7 +5,7 @@ config BR2_PACKAGE_CPPDB depends on BR2_INSTALL_LIBSTDCPP depends on BR2_TOOLCHAIN_HAS_THREADS # Can be built without them but it's useless - depends on BR2_PACKAGE_MYSQL || BR2_PACKAGE_POSTGRESQL || BR2_PACKAGE_SQLITE + depends on BR2_PACKAGE_MYSQL || BR2_PACKAGE_POSTGRESQL_CLIENT || BR2_PACKAGE_SQLITE help CppDB is an SQL connectivity library that is designed to provide platform and Database independent connectivity API similarlypackage/php/Config.ext +1
-0@@ -158,6 +158,7 @@ comment "MySQL drivers need a toolchain w/ C++, threads" config BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL bool "PostgreSQL" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on BR2_USE_MMU # postgresql depends on !BR2_STATIC_LIBS helppackage/postgresql/Config.in +17
-0@@ -5,6 +5,7 @@ config BR2_PACKAGE_POSTGRESQL # postgresql is unlikely to be used in a pure statically # linked environment. depends on !BR2_STATIC_LIBS + select BR2_PACKAGE_POSTGRESQL_CLIENT if !BR2_PACKAGE_POSTGRESQL_SERVER help PostgreSQL is a powerful, open source object-relational database system.@@ -18,5 +19,21 @@ config BR2_PACKAGE_POSTGRESQL http://www.postgresql.org +if BR2_PACKAGE_POSTGRESQL + +config BR2_PACKAGE_POSTGRESQL_CLIENT + bool "PostgreSQL client libraries" + default y + help + Install the PostgreSQL client libraries on the target. + +config BR2_PACKAGE_POSTGRESQL_SERVER + bool "PostgreSQL server" + default y + help + Install the PostgreSQL server on the target. + +endif + comment "postgresql needs a toolchain w/ dynamic library" depends on BR2_STATIC_LIBSpackage/postgresql/postgresql.mk +71
-0@@ -58,6 +58,34 @@ POSTGRESQL_DEPENDENCIES += openssl POSTGRESQL_CONF_OPTS += --with-openssl endif +ifeq ($(BR2_PACKAGE_POSTGRESQL_CLIENT),y) + +# Install the binaries: +# clusterdb +# createdb +# createlang +# createuser +# dropdb +# droplang +# dropuser +# ecpg +# pg_dump +# pg_dumpall +# pg_isready +# pg_restore +# psql +# reindexdb +# vacuumdb +# +# and the directories required to build them. +POSTGRESQL_INSTALL_DIRECTORIES += \ + config src/include src/interfaces src/port \ + src/bin/pg_dump src/bin/psql src/bin/scripts src/bin/pg_config + +endif + +ifeq ($(BR2_PACKAGE_POSTGRESQL_SERVER),y) + define POSTGRESQL_USERS postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server endef@@ -89,4 +117,47 @@ define POSTGRESQL_INSTALL_INIT_SYSTEMD $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service endef +# Install the binaries: +# initdb +# pg_basebackup +# pg_controldata +# pg_ctl +# pg_receivexlog +# pg_recvlogical +# pg_resetxlog +# postgres +# postmaster +# +# and the directories required to build them. +POSTGRESQL_INSTALL_DIRECTORIES += \ + src/port src/common src/backend \ + src/backend/utils/mb/conversion_procs \ + src/backend/snowball src/backend/replication/libpqwalreceiver \ + src/bin/initdb src/bin/pg_ctl \ + src/bin/pg_controldata src/bin/pg_resetxlog src/pl \ + src/bin/pg_basebackup + +ifeq ($(BR2_PACKAGE_TZDATA),y) +POSTGRESQL_INSTALL_DIRECTORIES += src/timezone +endif + +endif + +define POSTGRESQL_BUILD_CMDS + $(foreach d,$(POSTGRESQL_INSTALL_DIRECTORIES), + $(MAKE) -C $(@D)/$(d)$(sep)) + # Required for the installation. + $(MAKE) -C $(@D)/src/backend ../../src/include/utils/fmgroids.h +endef + +define POSTGRESQL_INSTALL_TARGET_CMDS + $(foreach d,$(POSTGRESQL_INSTALL_DIRECTORIES), + $(MAKE) -C $(@D)/$(d) DESTDIR=$(TARGET_DIR) install$(sep)) +endef + +define POSTGRESQL_INSTALL_STAGING_CMDS + $(foreach d,$(POSTGRESQL_INSTALL_DIRECTORIES), + $(MAKE) -C $(@D)/$(d) DESTDIR=$(STAGING_DIR) install$(sep)) +endef + $(eval $(autotools-package))package/qt/Config.sql.in +1
-0@@ -31,6 +31,7 @@ config BR2_PACKAGE_QT_ODBC config BR2_PACKAGE_QT_PSQL bool "PostgreSQL Driver" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on !BR2_STATIC_LIBS help Build PostgreSQL driverpackage/qt5/qt5base/Config.in +1
-0@@ -73,6 +73,7 @@ config BR2_PACKAGE_QT5BASE_MYSQL config BR2_PACKAGE_QT5BASE_PSQL bool "PostgreSQL Plugin" select BR2_PACKAGE_POSTGRESQL + select BR2_PACKAGE_POSTGRESQL_CLIENT depends on BR2_USE_MMU # postgresql depends on !BR2_STATIC_LIBS helpSignature · 6 lines
2.6.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'