Skip to contentSkip to conversation

postgresql: add replacement pg_config

PATCH New Floris Bos 2 participants 8 messages Aug 13, 2014 – Aug 17, 2014

lore
Share & tools
lore

Floris Bos

author
#0 lore raw

PATCH v2 1/3 postgresql: add replacement pg_config

Normally pg_config is a native application compiled for the target architecture. Since we cannot execute those on the host system, provide a simple shell script as replacement.

---
 package/postgresql/pg_config     | 19 +++++++++++++++++++
 package/postgresql/postgresql.mk |  8 ++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 package/postgresql/pg_config
package/postgresql/pg_config new file +19 -0
new file mode 100644
index 0000000..85c0e63
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#
+# Minimal pg_config implementation as replacement for the native pg_config application
+# Only implements --includedir and --libdir
+#
+
+prefix=/usr
+
+case "$1" in
+  --includedir)
+	echo "$prefix/include"
+	;;
+  --libdir)
+	echo "$prefix/lib"
+	;;
+  *)
+	echo "Usage: $0 {--includedir|--libdir}"
+esac
package/postgresql/postgresql.mk +8 -0
index 6941e55..dd2e678 100644
@@ -11,6 +11,7 @@ POSTGRESQL_LICENSE = PostgreSQL
 POSTGRESQL_LICENSE_FILES = COPYRIGHT
 
 POSTGRESQL_INSTALL_STAGING = YES
+POSTGRESQL_CONFIG_SCRIPTS = pg_config
 
 ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
 	POSTGRESQL_CONF_OPT += --disable-thread-safety
@@ -55,6 +56,13 @@ endef
 
 POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP
 
+define POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
+	$(INSTALL) -m 0755 -D package/postgresql/pg_config \
+		$(STAGING_DIR)/usr/bin/pg_config
+endef
+
+POSTGRESQL_POST_INSTALL_STAGING_HOOKS += POSTGRESQL_INSTALL_CUSTOM_PG_CONFIG
+
 define POSTGRESQL_INSTALL_INIT_SYSV
 	$(INSTALL) -m 0755 -D package/postgresql/S50postgresql \
 		$(TARGET_DIR)/etc/init.d/S50postgresql
Signature · 1 line
1.8.3.2
author
#1 lore raw

PATCH v2 2/3 postgresql: remove devfiles from target

---
 package/postgresql/postgresql.mk | 1 +
 1 file changed, 1 insertion(+)
package/postgresql/postgresql.mk +1 -0
index dd2e678..19f9163 100644
@@ -52,6 +52,7 @@ endef
 
 define POSTGRESQL_INSTALL_TARGET_FIXUP
 	$(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
+	$(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs
 endef
 
 POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH v2 2/3 postgresql: remove devfiles from target

Dear Floris Bos,

Quoted 10 lines · Floris Bos
---
 package/postgresql/postgresql.mk | 1 +
 1 file changed, 1 insertion(+)
package/postgresql/postgresql.mk +0 -0
index dd2e678..19f9163 100644

package/postgresql/postgresql.mk endef · line 58

Quoted 7 lines
package/postgresql/postgresql.mk +1 -0
@@ -52,6 +52,7 @@ endef
 
 define POSTGRESQL_INSTALL_TARGET_FIXUP
 	$(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
+	$(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs
 endef
 
 POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP

I've applied the patch, thanks. However, I'm not sure to understand why you're not removing 'pg_config' from the target.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#3 lore raw

PATCH v2 2/3 postgresql: remove devfiles from target

Quoted 12 lines · Thomas Petazzoni
Quoted 11 lines · Floris Bos
---
  package/postgresql/postgresql.mk | 1 +
  1 file changed, 1 insertion(+)
package/postgresql/postgresql.mk +0 -0
index dd2e678..19f9163 100644
@@ -52,6 +52,7 @@ endef
 
Quoted 8 lines

package/postgresql/postgresql.mk endef · line 58

Quoted 6 lines
package/postgresql/postgresql.mk +1 -0
  define POSTGRESQL_INSTALL_TARGET_FIXUP
  	$(INSTALL) -dm 0700 $(TARGET_DIR)/var/lib/pgsql
+	$(RM) -rf $(TARGET_DIR)/usr/lib/postgresql/pgxs
  endef
 
  POSTGRESQL_POST_INSTALL_TARGET_HOOKS += POSTGRESQL_INSTALL_TARGET_FIXUP

I've applied the patch, thanks. However, I'm not sure to understand why you're not removing 'pg_config' from the target.

Thomas DS mentioned that having "POSTGRESQL_CONFIG_SCRIPTS = pg_config" also causes automatic removal from the target
And have that in the first patch of the patch series that adds the fake pg_config file.

Yours sincerely,

Floris Bos

author
#4 lore raw

PATCH v2 3/3 php: add pdo_pgsql extension

In reply to Floris Bos

Adds support for the PDO PostgreSQL extension to the PHP package.

---
 package/php/Config.ext | 10 ++++++++++
 package/php/php.mk     |  4 ++++
 2 files changed, 14 insertions(+)
package/php/Config.ext +10 -0
index 078be8d..f0719bb 100644
@@ -135,6 +135,16 @@ comment "MySQL drivers need a toolchain w/ C++"
 	depends on BR2_USE_MMU
 	depends on !BR2_INSTALL_LIBSTDCPP
 
+config BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL
+	bool "PostgreSQL"
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	select BR2_PACKAGE_POSTGRESQL
+	help
+	  PDO driver for PostgreSQL
+
+comment "PostgreSQL needs an (e)glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC
+
 config BR2_PACKAGE_PHP_EXT_PDO_SQLITE
 	bool "SQLite3"
 	select BR2_PACKAGE_SQLITE
package/php/php.mk +4 -0
index de7d668..d0418ad 100644
@@ -162,6 +162,10 @@ ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_MYSQL),y)
 	PHP_CONF_OPT += --with-pdo-mysql=$(STAGING_DIR)/usr
 	PHP_DEPENDENCIES += mysql
 endif
+ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL),y)
+	PHP_CONF_OPT += --with-pdo-pgsql=$(STAGING_DIR)/usr
+	PHP_DEPENDENCIES += postgresql
+endif
 endif
 
 ### Use external PCRE if it's available
Signature · 1 line
1.8.3.2
#5 lore raw

PATCH v2 3/3 php: add pdo_pgsql extension

Dear Floris Bos,

Quoted 7 lines · Floris Bos

Adds support for the PDO PostgreSQL extension to the PHP package.

---
 package/php/Config.ext | 10 ++++++++++
 package/php/php.mk     |  4 ++++
 2 files changed, 14 insertions(+)

Applied to next, with a minor change.

package/php/Config.ext comment "MySQL drivers need a toolchain w/ C++" · line 146

Quoted 2 lines
package/php/Config.ext +2 -0
+comment "PostgreSQL needs an (e)glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC

I've changed this to "PostgreSQL driver needs..."

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH v2 1/3 postgresql: add replacement pg_config

In reply to Floris Bos

Dear Floris Bos,

Quoted 10 lines · Floris Bos

Normally pg_config is a native application compiled for the target architecture. Since we cannot execute those on the host system, provide a simple shell script as replacement.

---
 package/postgresql/pg_config     | 19 +++++++++++++++++++
 package/postgresql/postgresql.mk |  8 ++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 package/postgresql/pg_config

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH v2 1/3 postgresql: add replacement pg_config

Hello,

Quoted 7 lines · Thomas Petazzoni

Dear Floris Bos,

Quoted 4 lines · Floris Bos

Normally pg_config is a native application compiled for the target architecture. Since we cannot execute those on the host system, provide a simple shell script as replacement.

Quoted 8 lines
Quoted 6 lines
---
 package/postgresql/pg_config     | 19 +++++++++++++++++++
 package/postgresql/postgresql.mk |  8 ++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 package/postgresql/pg_config

Applied, thanks.

Sorry forgot to mention this: I applied this to the next branch, not the master branch.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com