diff --git a/sapi/src/builder/library/pgsql.php b/sapi/src/builder/library/pgsql.php index d5502a9a77..709151a8b2 100644 --- a/sapi/src/builder/library/pgsql.php +++ b/sapi/src/builder/library/pgsql.php @@ -6,6 +6,7 @@ return function (Preprocessor $p) { $pgsql_prefix = PGSQL_PREFIX; $option = ''; + $ldflags = $p->getOsType() == 'macos' ? '' : ' -static '; if ($p->getOsType() == 'macos') { $option = '--disable-thread-safety'; } @@ -31,6 +32,8 @@ # 121行 替换内容 sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile + sed -i.backup "293 s/^/#$/" ../src/Makefile.shlib + sed -i.backup "441 s/^/#$/" ../src/Makefile.shlib # 静态链接方法二: # 102行,整行替换 @@ -38,7 +41,7 @@ PACKAGES="openssl zlib icu-uc icu-io icu-i18n readline libxml-2.0 libxslt libzstd liblz4" CPPFLAGS="$(pkg-config --cflags-only-I --static \$PACKAGES )" \ - LDFLAGS="$(pkg-config --libs-only-L --static \$PACKAGES )" \ + LDFLAGS="$(pkg-config --libs-only-L --static \$PACKAGES ) {$ldflags} " \ LIBS="$(pkg-config --libs-only-l --static \$PACKAGES )" \ ../configure \ --prefix={$pgsql_prefix} \