diff --git a/prepare.php b/prepare.php index 013c81998c..065aabe0a9 100755 --- a/prepare.php +++ b/prepare.php @@ -12,17 +12,18 @@ $p->parseArguments($argc, $argv); +# clean # clean old make.sh -if (file_exists(__DIR__ . '/make.sh')) { - unlink(__DIR__ . '/make.sh'); - unlink(__DIR__ . '/make-install-deps.sh'); - unlink(__DIR__ . '/make-env.sh'); - unlink(__DIR__ . '/make-export-variables.sh'); -} +$p->cleanFile(__DIR__ . '/make.sh'); +$p->cleanFile(__DIR__ . '/make-install-deps.sh'); +$p->cleanFile(__DIR__ . '/make-env.sh'); +$p->cleanFile(__DIR__ . '/make-export-variables.sh'); +$p->cleanFile(__DIR__ . '/make-download-box.sh'); +$p->cleanFile(__DIR__ . '/cppflags.log'); +$p->cleanFile(__DIR__ . '/ldflags.log'); +$p->cleanFile(__DIR__ . '/libs.log'); +$p->cleanFile(__DIR__ . '/configure.backup'); -if (file_exists(__DIR__ . '/make-download-box.sh')) { - unlink(__DIR__ . '/make-download-box.sh'); -} // Sync code from php-src $p->setPhpSrcDir($homeDir . '/.phpbrew/build/php-' . BUILD_PHP_VERSION); diff --git a/sapi/src/Preprocessor.php b/sapi/src/Preprocessor.php index 6f915c45cd..556769f910 100644 --- a/sapi/src/Preprocessor.php +++ b/sapi/src/Preprocessor.php @@ -1223,4 +1223,13 @@ public function hasExtension(string $ext): bool { return isset($this->extensionMap[$ext]); } + + public function cleanFile(string $file): bool + { + if (is_file($file)) { + unlink($file); + return true; + } + return false; + } }