Skip to contentSkip to conversation

package/postgresql: add some additional output to pg_config

PATCH New Maxim Kochetkov 3 participants 5 messages Jan 25, 2021 – Jan 28, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/postgresql: add some additional output to pg_config

Some external packages call pg_config to determine the installed PostgreSQL options. Add this output to Buildroots own pg_config, so these packages correctly compile.

Added options:

	--pkgincludedir
	--pgxs
	--cflags
	--cc
	--pkglibdir
	--bindir
	--sharedir
	--localedir
	--docdir
	--mandir
---
 package/postgresql/pg_config     | 51 ++++++++++++++++++++++++++++++--
 package/postgresql/postgresql.mk |  2 ++
 2 files changed, 51 insertions(+), 2 deletions(-)
package/postgresql/pg_config +49 -2
index 59a9e6cfad..3b0cb35f2c 100644
@@ -2,7 +2,6 @@
 
 #
 # Minimal pg_config implementation as replacement for the native pg_config application
-# Only implements --includedir and --libdir
 #
 
 prefix=/usr
@@ -11,6 +10,9 @@ case "$1" in
   --includedir)
 	echo "$prefix/include"
 	;;
+  --pkgincludedir)
+	echo "$prefix/include/postgresql"
+	;;
   --includedir-server)
 	echo "$prefix/include/postgresql/server"
 	;;
@@ -23,6 +25,51 @@ case "$1" in
   --configure)
 	echo "@POSTGRESQL_CONF_OPTIONS@"
 	;;
+  --pgxs)
+	echo "$prefix/lib/postgresql/pgxs/src/makefiles/pgxs.mk"
+	;;
+  --cflags)
+	echo "@TARGET_CFLAGS@"
+	;;
+  --cc)
+	echo "@TARGET_CC@"
+	;;
+  --pkglibdir)
+	echo "/usr/lib/postgresql"
+	;;
+  --bindir)
+	echo "/usr/bin"
+	;;
+  --sharedir)
+	echo "/usr/share/postgresql"
+	;;
+  --localedir)
+	echo "/usr/share/locale"
+	;;
+  --docdir)
+	echo "/usr/share/doc/postgresql"
+	;;
+  --mandir)
+	echo "/usr/share/man"
+	;;
   *)
-	echo "Usage: $0 {--includedir|--includedir-server|--libdir|--version|--configure}"
+	echo "Usage: $0 {OPTION}"
+	echo
+	echo "Options:"
+	echo
+	echo "	--includedir		show location of C header files of the client interfaces"
+	echo "	--pkgincludedir		show location of other C header files"
+	echo "	--includedir-server	show location of C header files for the server"
+	echo "	--libdir		show location of object code libraries"
+	echo "	--version		show the PostgreSQL version"
+	echo "	--configure		show options given to configure script"
+	echo "	--pgxs			show location of extension makefile"
+	echo "	--cflags		show CFLAGS value used when PostgreSQL was built"
+	echo "	--cc			show CC value used when PostgreSQL was built"
+	echo "	--pkglibdir		show location of dynamically loadable modules"
+	echo "	--bindir		show location of user executables"
+	echo "	--sharedir		show location of architecture-independent support files"
+	echo "	--localedir		show location of locale support files"
+	echo "	--docdir		show location of documentation files"
+	echo "	--mandir		show location of manual pages"
 esac
package/postgresql/postgresql.mk +2 -0
index 31c83d64c7..6c0726e88b 100644
@@ -116,6 +116,8 @@ define POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
 		$(STAGING_DIR)/usr/bin/pg_config
 	$(SED) "s|@POSTGRESQL_CONF_OPTIONS@|$(POSTGRESQL_CONF_OPTS)|g" $(STAGING_DIR)/usr/bin/pg_config
 	$(SED) "s|@POSTGRESQL_VERSION@|$(POSTGRESQL_VERSION)|g" $(STAGING_DIR)/usr/bin/pg_config
+	$(SED) "s|@TARGET_CFLAGS@|$(TARGET_CFLAGS)|g" $(STAGING_DIR)/usr/bin/pg_config
+	$(SED) "s|@TARGET_CC@|$(TARGET_CC)|g" $(STAGING_DIR)/usr/bin/pg_config
 endef
 
 POSTGRESQL_POST_INSTALL_STAGING_HOOKS += POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 package/postgresql: add full build option

Postgresql includes some extra additional loadable modules. We need just to pass "world/install-world" as make/install targets to build this modules.

As a side effect documentation will also be built by "make world".

---
 package/postgresql/Config.in     | 9 +++++++++
 package/postgresql/postgresql.mk | 6 ++++++
 2 files changed, 15 insertions(+)
package/postgresql/Config.in +9 -0
index 2f677daf5b..d162ab2bab 100644
@@ -22,3 +22,12 @@ config BR2_PACKAGE_POSTGRESQL
 comment "postgresql needs a toolchain w/ dynamic library, wchar"
 	depends on BR2_USE_MMU
 	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR
+
+if BR2_PACKAGE_POSTGRESQL
+
+config BR2_PACKAGE_POSTGRESQL_FULL
+	bool "postgresql-full"
+	help
+	  Build PostgreSQL, contrib, and documentation.
+
+endif
package/postgresql/postgresql.mk +6 -0
index 6c0726e88b..76d1202de0 100644
@@ -23,6 +23,12 @@ POSTGRESQL_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
 # manually, you must unset MAKELEVEL or set it to zero"
 POSTGRESQL_MAKE_OPTS = MAKELEVEL=0
 
+ifeq ($(BR2_PACKAGE_POSTGRESQL_FULL),y)
+POSTGRESQL_MAKE_OPTS += world
+POSTGRESQL_INSTALL_TARGET_OPTS += DESTDIR=$(TARGET_DIR) install-world
+POSTGRESQL_INSTALL_STAGING_OPTS += DESTDIR=$(STAGING_DIR) install-world
+endif
+
 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
 # PostgreSQL does not build against uClibc with locales
 # enabled, due to an uClibc bug, see
Signature · 1 line
2.29.2
#2 lore raw

PATCH 1/1 package/postgresql: add full build option

Quoted 11 lines · On Mon, 25 Jan 2021 14:36:13 +0300 Maxim Kochetkov <[email protected]> wrote:

Postgresql includes some extra additional loadable modules. We need just to pass "world/install-world" as make/install targets to build this modules.

As a side effect documentation will also be built by "make world".

---
 package/postgresql/Config.in     | 9 +++++++++
 package/postgresql/postgresql.mk | 6 ++++++
 2 files changed, 15 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 package/postgresql: add some additional output to pg_config

In reply to Maxim Kochetkov
Quoted 16 lines · On Mon, 25 Jan 2021 14:36:12 +0300 Maxim Kochetkov via buildroot…

Some external packages call pg_config to determine the installed PostgreSQL options. Add this output to Buildroots own pg_config, so these packages correctly compile.

Added options:

	--pkgincludedir
	--pgxs
	--cflags
	--cc
	--pkglibdir
	--bindir
	--sharedir
	--localedir
	--docdir
	--mandir
Quoted 5 lines
---
 package/postgresql/pg_config     | 51 ++++++++++++++++++++++++++++++--
 package/postgresql/postgresql.mk |  2 ++
 2 files changed, 51 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 package/postgresql: add some additional output to pg_config

In reply to Maxim Kochetkov
Quoted 18 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Maxim" == Maxim Kochetkov via buildroot <[email protected]> writes:

Some external packages call pg_config to determine the installed PostgreSQL options. Add this output to Buildroots own pg_config, so these packages correctly compile.

Added options:

	--pkgincludedir
	--pgxs
	--cflags
	--cc
	--pkglibdir
	--bindir
	--sharedir
	--localedir
	--docdir
	--mandir
Quoted 1 line

Committed to 2020.02.x and 2020.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard