diff --git a/config/artifact/musl-wrapper.yml b/config/artifact/musl-wrapper.yml new file mode 100644 index 00000000..9ae3ec49 --- /dev/null +++ b/config/artifact/musl-wrapper.yml @@ -0,0 +1,2 @@ +musl-wrapper: + source: 'https://musl.libc.org/releases/musl-1.2.5.tar.gz' diff --git a/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php b/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php index b64df85b..b01b7b7b 100644 --- a/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php +++ b/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php @@ -73,10 +73,14 @@ class LinuxMuslCheck $prefix = 'sudo '; logger()->warning('Current user is not root, using sudo for running command'); } - shell()->cd(SOURCE_PATH . '/musl-wrapper') + $shell = shell()->cd(SOURCE_PATH . '/musl-wrapper') ->exec('CC=gcc CXX=g++ AR=ar LD=ld ./configure --disable-gcc-wrapper') - ->exec('CC=gcc CXX=g++ AR=ar LD=ld make -j') - ->exec("CC=gcc CXX=g++ AR=ar LD=ld {$prefix}make install"); + ->exec('CC=gcc CXX=g++ AR=ar LD=ld make -j'); + if ($prefix !== '') { + f_passthru('cd ' . SOURCE_PATH . "/musl-wrapper && CC=gcc CXX=g++ AR=ar LD=ld {$prefix}make install"); + } else { + $shell->exec("CC=gcc CXX=g++ AR=ar LD=ld {$prefix}make install"); + } return true; } @@ -97,7 +101,7 @@ class LinuxMuslCheck $downloader->add('musl-toolchain')->download(false); $extractor->extract('musl-toolchain'); $pkg_root = PKG_ROOT_PATH . '/musl-toolchain'; - shell()->exec("{$prefix}cp -rf {$pkg_root}/* /usr/local/musl"); + f_passthru("{$prefix}cp -rf {$pkg_root}/* /usr/local/musl"); FileSystem::removeDir($pkg_root); return true; } diff --git a/src/StaticPHP/Doctor/Item/LinuxToolCheck.php b/src/StaticPHP/Doctor/Item/LinuxToolCheck.php index f4cdc311..b44bcb9d 100644 --- a/src/StaticPHP/Doctor/Item/LinuxToolCheck.php +++ b/src/StaticPHP/Doctor/Item/LinuxToolCheck.php @@ -71,7 +71,7 @@ class LinuxToolCheck } } if (!empty($missing)) { - return CheckResult::fail(implode(', ', $missing) . ' not installed on your system', 'install-linux-tools', [$distro, $missing]); + return CheckResult::fail(implode(', ', $missing) . ' not installed on your system', 'install-linux-tools', ['distro' => $distro, 'missing' => $missing]); } return CheckResult::ok(); } @@ -96,7 +96,7 @@ class LinuxToolCheck if (LinuxUtil::isMuslDist()) { // check linux-headers installation if (!file_exists('/usr/include/linux/mman.h')) { - return CheckResult::fail('linux-headers not installed on your system', 'install-linux-tools', [LinuxUtil::getOSRelease(), ['linux-headers']]); + return CheckResult::fail('linux-headers not installed on your system', 'install-linux-tools', ['distro' => LinuxUtil::getOSRelease(), 'missing' => ['linux-headers']]); } } return CheckResult::ok(); @@ -137,7 +137,7 @@ class LinuxToolCheck $to_install = $is_debian ? str_replace('xz', 'xz-utils', $missing) : $missing; // debian, alpine libtool -> libtoolize $to_install = str_replace('libtoolize', 'libtool', $to_install); - shell()->exec($prefix . $install_cmd . ' ' . implode(' ', $to_install)); + f_passthru($prefix . $install_cmd . ' ' . implode(' ', $to_install)); return true; } diff --git a/src/StaticPHP/Doctor/Item/MacOSToolCheck.php b/src/StaticPHP/Doctor/Item/MacOSToolCheck.php index d9c869ea..b69528ad 100644 --- a/src/StaticPHP/Doctor/Item/MacOSToolCheck.php +++ b/src/StaticPHP/Doctor/Item/MacOSToolCheck.php @@ -53,7 +53,7 @@ class MacOSToolCheck } } if (!empty($missing)) { - return CheckResult::fail('missing system commands: ' . implode(', ', $missing), 'build-tools', [$missing]); + return CheckResult::fail('missing system commands: ' . implode(', ', $missing), 'build-tools', ['missing' => $missing]); } return CheckResult::ok(); } @@ -63,7 +63,7 @@ class MacOSToolCheck { // if the bison command is /usr/bin/bison, it is the system bison that may be too old if (($bison = MacOSUtil::findCommand('bison', $command_path)) === null) { - return CheckResult::fail('bison is not installed or too old', 'build-tools', [['bison']]); + return CheckResult::fail('bison is not installed or too old', 'build-tools', ['missing' => ['bison']]); } // check version: bison (GNU Bison) x.y(.z) $version = shell()->execWithResult("{$bison} --version", false);