From dac14ae16e38252e3d5b7eb6f63c6e53144376e1 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Fri, 30 Jun 2023 20:36:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0pgsql=20=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SPC/builder/linux/library/postgresql.php | 12 +++ src/SPC/builder/macos/library/postgresql.php | 12 +++ src/SPC/builder/unix/library/postgresql.php | 98 ++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 src/SPC/builder/linux/library/postgresql.php create mode 100644 src/SPC/builder/macos/library/postgresql.php create mode 100644 src/SPC/builder/unix/library/postgresql.php diff --git a/src/SPC/builder/linux/library/postgresql.php b/src/SPC/builder/linux/library/postgresql.php new file mode 100644 index 00000000..04fb76e7 --- /dev/null +++ b/src/SPC/builder/linux/library/postgresql.php @@ -0,0 +1,12 @@ +builder->configure_env; + $packages = 'openssl zlib icu-uc icu-io icu-i18n readline libxml-2.0 libzstd'; + + $output = shell()->execWithResult($envs . ' pkg-config --cflags-only-I --static ' . $packages); + if (!empty($output[1][0])) { + $cppflags = $output[1][0]; + $envs .= " CPPFLAGS=\"{$cppflags}\""; + } + $output = shell()->execWithResult($envs . ' pkg-config --libs-only-L --static ' . $packages); + if (!empty($output[1][0])) { + $ldflags = $output[1][0]; + $envs .= " LDFLAGS=\"{$ldflags}\" "; + } + $output = shell()->execWithResult($envs . ' pkg-config --libs-only-l --static ' . $packages); + if (!empty($output[1][0])) { + $libs = $output[1][0]; + $envs .= " LIBS=\"{$libs}\" "; + } + + FileSystem::resetDir($this->source_dir . '/build'); + + # 有静态链接配置 参考文件: src/interfaces/libpq/Makefile + shell()->cd($this->source_dir . '/build')->exec( + <<<'EOF' + sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile +EOF + ); + + shell()->cd($this->source_dir . '/build') + ->exec( + <<cd($this->source_dir . '/build')->exec( + <<<'EOF' + make -C src/bin/pg_config install + make -C src/include install + + make -C src/common install + + make -C src/backend/port install + make -C src/port install + + make -C src/backend/libpq install + make -C src/interfaces/libpq install + +EOF + ); + + shell()->cd($this->source_dir . '/build')->exec( + <<