From 17d699d4a58191a3ef64460b42eb4662a7832461 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 20 Feb 2026 13:05:49 +0700 Subject: [PATCH] fix xz shared build --- src/SPC/builder/unix/library/xz.php | 9 ++++++++- src/SPC/util/SPCConfigUtil.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/xz.php b/src/SPC/builder/unix/library/xz.php index e17f92b1..0ceb3173 100644 --- a/src/SPC/builder/unix/library/xz.php +++ b/src/SPC/builder/unix/library/xz.php @@ -10,7 +10,14 @@ trait xz { public function build(): void { - UnixAutoconfExecutor::create($this) + $make = UnixAutoconfExecutor::create($this); + if (!getenv('SPC_LINK_STATIC')) { + // liblzma can only build one of static or shared at a time + $make + ->removeConfigureArgs('--enable-static') + ->addConfigureArgs('--disable-static'); + } + $make ->configure( '--disable-scripts', '--disable-doc', diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 2f1de56d..3be152f8 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -283,7 +283,7 @@ class SPCConfigUtil $libs = array_reverse(Config::getLib($library, 'static-libs', [])); foreach ($libs as $lib) { // check file existence - if (!file_exists(BUILD_LIB_PATH . "/{$lib}")) { + if (!file_exists(BUILD_LIB_PATH . "/{$lib}") && getenv('SPC_LINK_STATIC')) { throw new WrongUsageException("Library file '{$lib}' for lib [{$library}] does not exist in '" . BUILD_LIB_PATH . "'. Please build it first."); } $lib_names[] = $this->getShortLibName($lib);