Extract default build env to unix shell

This commit is contained in:
crazywhalecc
2025-06-09 10:24:06 +08:00
parent 9babe7f1d2
commit 123cc92756
29 changed files with 166 additions and 196 deletions

View File

@@ -16,13 +16,9 @@ trait gettext
$cflags = $this->builder->getOption('enable-zts') ? '-lpthread -D_REENTRANT' : '';
$ldflags = $this->builder->getOption('enable-zts') ? '-lpthread' : '';
shell()->cd($this->source_dir)
->setEnv([
'CFLAGS' => "{$this->getLibExtraCFlags()} {$cflags}",
'LDFLAGS' => $this->getLibExtraLdFlags() ?: $ldflags,
'LIBS' => $this->getLibExtraLibs(),
])
->execWithEnv(
shell()->cd($this->source_dir)->initLibBuildEnv($this)
->appendEnv(['CFLAGS' => $cflags, 'LDFLAGS' => $ldflags])
->exec(
'./configure ' .
'--enable-static ' .
'--disable-shared ' .
@@ -34,8 +30,8 @@ trait gettext
'--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' .
'--prefix=' . BUILD_ROOT_PATH
)
->execWithEnv('make clean')
->execWithEnv("make -j{$this->builder->concurrency}")
->execWithEnv('make install');
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install');
}
}