Merge branch 'main' into ext/rar

This commit is contained in:
crazywhalecc 2023-11-19 13:39:23 +08:00
commit c94afb5fc4
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
18 changed files with 570 additions and 133 deletions

12
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,12 @@
## What does this PR do?
## Checklist before merging
> If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
> If a modification is not involved, please skip it directly.
- [ ] If it's a extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`.
- [ ] If you changed the behavior of static-php-cli, add docs in [static-php/static-php-cli-docs](https://github.com/static-php/static-php-cli-docs) .
- [ ] If you updated `config/xxxx.json` content, run `bin/spc dev:sort-config xxx`.

View File

@ -51,7 +51,7 @@ jobs:
uses: actions/cache@v3
with:
path: downloads
key: php-${{ inputs.version }}-dependencies
key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }}
# With or without debug
- if: inputs.debug == true
@ -67,7 +67,7 @@ jobs:
# If there's no dependencies cache, fetch sources, with or without debug
- if: steps.cache-download.outputs.cache-hit != 'true'
run: SPC_USE_ARCH=${{ inputs.operating-system }} ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }}
run: SPC_USE_ARCH=${{ inputs.operating-system }} ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
# Run build command
- run: SPC_USE_ARCH=${{ inputs.operating-system }} ./bin/spc-alpine-docker build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}

View File

@ -56,7 +56,7 @@ jobs:
uses: actions/cache@v3
with:
path: downloads
key: php-${{ inputs.version }}-dependencies
key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }}
# With or without debug
- if: inputs.debug == true
@ -72,7 +72,7 @@ jobs:
# If there's no dependencies cache, fetch sources, with or without debug
- if: steps.cache-download.outputs.cache-hit != 'true'
run: CACHE_API_EXEC=yes ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }}
run: CACHE_API_EXEC=yes ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
# Run build command
- run: ./bin/spc-alpine-docker build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}

View File

@ -61,7 +61,7 @@ jobs:
uses: actions/cache@v3
with:
path: downloads
key: php-${{ inputs.version }}-dependencies
key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }}
# With or without debug
- if: inputs.debug == true
@ -77,7 +77,7 @@ jobs:
# If there's no dependencies cache, fetch sources, with or without debug
- if: steps.cache-download.outputs.cache-hit != 'true'
run: ./bin/spc download --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }}
run: ./bin/spc download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
# Run build command
- run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}

View File

@ -1,98 +1,145 @@
name: Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
contents: read
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
php-cs-fixer:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
tools: pecl, composer, php-cs-fixer
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
tools: pecl, composer, php-cs-fixer
- name: Run PHP-CS-Fixer fix
run: php-cs-fixer fix --dry-run --diff --ansi
- name: Run PHP-CS-Fixer fix
run: php-cs-fixer fix --dry-run --diff --ansi
phpstan:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
phpstan:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
tools: composer
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
tools: composer
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-phpstan-
- name: "Cache Composer packages"
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-phpstan-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: "Install Dependencies"
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Run phpstan
run: vendor/bin/phpstan analyse
- name: "Run phpstan"
run: vendor/bin/phpstan analyse
phpunit:
name: PHPUnit (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
include:
- php: '8.1'
- php: '8.2'
fail-fast: false
phpunit:
name: "PHPUnit (PHP ${{ matrix.php }})"
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
include:
- php: '8.1'
- php: '8.2'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
tools: pecl, composer
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
tools: pecl, composer
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: "Cache Composer packages"
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: "Install Dependencies"
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Run PHPUnit tests
run: |
vendor/bin/phpunit tests/ --no-coverage
- name: "Run PHPUnit Tests"
run: |
vendor/bin/phpunit tests/ --no-coverage
build:
name: "Build PHP Test (PHP ${{ matrix.php }})"
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
php:
- 8.0
- 8.1
- 8.2
os:
- ubuntu-latest
- macos-latest
fail-fast: false
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
tools: pecl, composer
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
- name: "Cache Composer packages"
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: "Install Dependencies"
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: "Run Build Tests (doctor)"
run: bin/spc doctor --auto-fix
- name: "Run Build Tests (download)"
run: bin/spc download --for-extensions="$(php src/globals/test-extensions.php)" --with-php=${{ matrix.php }} --debug
- name: "Run Build Tests (build)"
run: bin/spc build "$(php src/globals/test-extensions.php)" --build-cli --build-micro --build-fpm --debug

View File

@ -118,7 +118,7 @@
"iconv": {
"type": "builtin",
"arg-type": "with-prefix",
"lib-depends-windows": [
"lib-depends": [
"libiconv"
]
},
@ -132,12 +132,12 @@
},
"imap": {
"type": "builtin",
"arg-type": "with",
"arg-type": "custom",
"lib-depends": [
"imap"
],
"lib-suggests": [
"kerberos"
"openssl"
]
},
"inotify": {
@ -234,7 +234,8 @@
"type": "builtin",
"arg-type": "custom",
"lib-depends": [
"openssl"
"openssl",
"zlib"
],
"ext-depends": [
"zlib"

View File

@ -141,6 +141,15 @@
"libxml2"
]
},
"imap": {
"source": "imap",
"static-libs-unix": [
"libc-client.a"
],
"lib-suggests": [
"openssl"
]
},
"ldap": {
"source": "ldap",
"static-libs-unix": [
@ -302,8 +311,7 @@
],
"lib-suggests-windows": [
"icu",
"xz",
"pthreads4w"
"xz"
]
},
"libxslt": {
@ -441,18 +449,6 @@
"zstd"
]
},
"pthreads4w": {
"source": "pthreads4w",
"static-libs-windows": [
"libpthreadVC3.lib"
],
"headers-windows": [
"_ptw32.h",
"pthread.h",
"sched.h",
"semaphore.h"
]
},
"readline": {
"source": "readline",
"static-libs-unix": [

View File

@ -121,9 +121,9 @@
}
},
"freetype": {
"type": "filelist",
"url": "https://download-mirror.savannah.gnu.org/releases/freetype/",
"regex": "/href=\"(?<file>freetype-(?<version>[^\"]+)\\.tar\\.xz)\"/",
"type": "git",
"rev": "VER-2-13-2",
"url": "https://github.com/freetype/freetype",
"license": {
"type": "file",
"path": "LICENSE.TXT"
@ -154,6 +154,15 @@
"path": "LICENSE"
}
},
"imap": {
"type": "git",
"url": "https://github.com/static-php/imap.git",
"rev": "master",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"inotify": {
"type": "url",
"url": "https://pecl.php.net/get/inotify",
@ -218,7 +227,7 @@
},
"libmcrypt": {
"type": "url",
"url": "https://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz",
"url": "https://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz",
"license": {
"type": "file",
"path": "COPYING"
@ -235,7 +244,7 @@
},
"libpng": {
"type": "git",
"url": "https://git.code.sf.net/p/libpng/code",
"url": "https://github.com/glennrp/libpng.git",
"rev": "libpng16",
"license": {
"type": "file",
@ -304,7 +313,7 @@
},
"mcrypt": {
"type": "url",
"url": "https://jaist.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz",
"url": "https://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz",
"license": {
"type": "file",
"path": "COPYING"
@ -403,15 +412,6 @@
"path": "LICENSE"
}
},
"pthreads4w": {
"type": "git",
"rev": "master",
"url": "https://git.code.sf.net/p/pthreads4w/code",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"readline": {
"type": "filelist",
"url": "https://ftp.gnu.org/pub/gnu/readline/",

View File

@ -69,7 +69,7 @@ abstract class BuilderBase
foreach ($libraries as $library) {
// if some libs are not supported (but in config "lib.json", throw exception)
if (!isset($support_lib_list[$library])) {
throw new RuntimeException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!');
throw new WrongUsageException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!');
}
$lib = new ($support_lib_list[$library])($this);
$this->addLib($lib);

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\WrongUsageException;
use SPC\util\CustomExt;
#[CustomExt('imap')]
class imap extends Extension
{
/**
* @throws WrongUsageException
*/
public function getUnixConfigureArg(): string
{
if ($this->builder->getOption('enable-zts')) {
throw new WrongUsageException('ext-imap is not thread safe, do not build it with ZTS builds');
}
$arg = '--with-imap=' . BUILD_ROOT_PATH;
if ($this->builder->getLib('openssl') !== null) {
$arg .= ' --with-imap-ssl=' . BUILD_ROOT_PATH;
}
return $arg;
}
}

View File

@ -16,7 +16,7 @@ class swoole extends Extension
// pgsql hook is buggy for static php
$arg .= ' --disable-swoole-pgsql';
$arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl';
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli';
$arg .= $this->builder->getExt('curl') ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
return $arg;
}

View File

@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
class imap extends LinuxLibraryBase
{
public const NAME = 'imap';
/**
* @throws FileSystemException
*/
public function patchBeforeBuild(): bool
{
$cc = getenv('CC') ?: 'gcc';
// FileSystem::replaceFileStr($this->source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', '');
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', 'CC=cc', "CC={$cc}");
/* FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto');
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto', '-lcrypto -lz');
FileSystem::replaceFileStr(
$this->source_dir . '/src/osdep/unix/ssl_unix.c',
"#include <x509v3.h>\n#include <ssl.h>",
"#include <ssl.h>\n#include <x509v3.h>"
);
// SourcePatcher::patchFile('1006_openssl1.1_autoverify.patch', $this->source_dir);
SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir); */
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLINCLUDE=/usr/include/openssl', 'SSLINCLUDE=' . BUILD_INCLUDE_PATH);
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLLIB=/usr/lib', 'SSLLIB=' . BUILD_LIB_PATH);
return true;
}
/**
* @throws RuntimeException
*/
protected function build(): void
{
if ($this->builder->getLib('openssl')) {
$ssl_options = 'SPECIALAUTHENTICATORS=ssl SSLTYPE=unix.nopwd SSLINCLUDE=' . BUILD_INCLUDE_PATH . ' SSLLIB=' . BUILD_LIB_PATH;
} else {
$ssl_options = 'SSLTYPE=none';
}
shell()->cd($this->source_dir)
->exec('make clean')
->exec('touch ip6')
->exec(
"yes | make slx {$ssl_options}"
);
try {
shell()
->exec("cp -rf {$this->source_dir}/c-client/c-client.a " . BUILD_LIB_PATH . '/libc-client.a')
->exec("cp -rf {$this->source_dir}/c-client/*.c " . BUILD_LIB_PATH . '/')
->exec("cp -rf {$this->source_dir}/c-client/*.h " . BUILD_INCLUDE_PATH . '/')
->exec("cp -rf {$this->source_dir}/src/osdep/unix/*.h " . BUILD_INCLUDE_PATH . '/');
} catch (\Throwable) {
// last command throws an exception, no idea why since it works
}
}
}

View File

@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
class imap extends MacOSLibraryBase
{
public const NAME = 'imap';
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function patchBeforeBuild(): bool
{
$cc = getenv('CC') ?: 'clang';
SourcePatcher::patchFile('0001_imap_macos.patch', $this->source_dir);
// FileSystem::replaceFileStr($this->source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', '');
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', 'CC=cc', "CC={$cc}");
/* FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto');
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto', '-lcrypto -lz');
FileSystem::replaceFileStr(
$this->source_dir . '/src/osdep/unix/ssl_unix.c',
"#include <x509v3.h>\n#include <ssl.h>",
"#include <ssl.h>\n#include <x509v3.h>"
);
// SourcePatcher::patchFile('1006_openssl1.1_autoverify.patch', $this->source_dir);
SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir); */
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLINCLUDE=/usr/include/openssl', 'SSLINCLUDE=' . BUILD_INCLUDE_PATH);
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLLIB=/usr/lib', 'SSLLIB=' . BUILD_LIB_PATH);
return true;
}
/**
* @throws RuntimeException
*/
protected function build(): void
{
if ($this->builder->getLib('openssl')) {
$ssl_options = 'SPECIALAUTHENTICATORS=ssl SSLTYPE=unix.nopwd SSLINCLUDE=' . BUILD_INCLUDE_PATH . ' SSLLIB=' . BUILD_LIB_PATH;
} else {
$ssl_options = 'SSLTYPE=none';
}
shell()->cd($this->source_dir)
->exec('make clean')
->exec('touch ip6')
->exec(
"yes | EXTRACFLAGS='-Wimplicit-function-declaration -include $(xcrun --show-sdk-path)/usr/include/poll.h -include $(xcrun --show-sdk-path)/usr/include/time.h -include $(xcrun --show-sdk-path)/usr/include/utime.h' make osx {$ssl_options}"
);
try {
shell()
->exec("cp -rf {$this->source_dir}/c-client/c-client.a " . BUILD_LIB_PATH . '/libc-client.a')
->exec("cp -rf {$this->source_dir}/c-client/*.c " . BUILD_LIB_PATH . '/')
->exec("cp -rf {$this->source_dir}/c-client/*.h " . BUILD_INCLUDE_PATH . '/')
->exec("cp -rf {$this->source_dir}/src/osdep/unix/*.h " . BUILD_INCLUDE_PATH . '/');
} catch (\Throwable) {
// last command throws an exception, no idea why since it works
}
}
}

View File

@ -26,6 +26,7 @@ trait freetype
$suggested .= ' ';
shell()->cd($this->source_dir)
->exec('sh autogen.sh')
->exec(
'./configure ' .
'--enable-static --disable-shared --without-harfbuzz --prefix= ' .

View File

@ -24,7 +24,6 @@ trait postgresql
$optional_packages = [
'zstd' => 'libzstd',
'ldap' => 'ldap',
'libpam' => 'libpam',
'libxslt' => 'libxslt',
'icu' => 'icu-i18n',
];
@ -74,12 +73,12 @@ trait postgresql
'--with-libxml ' .
($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') .
($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
($this->builder->getLib('libpam') ? '--with-pam ' : '--without-pam ') .
($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') .
($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') .
'--without-lz4 ' .
'--without-perl ' .
'--without-python ' .
'--without-pam ' .
'--without-bonjour ' .
'--without-tcl '
);

View File

@ -36,7 +36,7 @@ class LinuxToolCheckList
'git', 'autoconf', 'automake',
'tar', 'unzip', 'gzip', 'gcc',
'bzip2', 'cmake', 'patch',
'xz', 'wget', // to get musl
'xz',
];
/** @noinspection PhpUnused */
@ -47,8 +47,7 @@ class LinuxToolCheckList
$required = match ($distro['dist']) {
'alpine' => self::TOOLS_ALPINE,
'almalinux' => self::TOOLS_RHEL,
'rhel' => self::TOOLS_RHEL,
'redhat' => self::TOOLS_RHEL,
default => self::TOOLS_DEBIAN,
};
$missing = [];
@ -61,8 +60,7 @@ class LinuxToolCheckList
return match ($distro['dist']) {
'ubuntu',
'alpine',
'rhel',
'almalinux',
'redhat',
'debian' => CheckResult::fail(implode(', ', $missing) . ' not installed on your system', 'install-linux-tools', [$distro, $missing]),
default => CheckResult::fail(implode(', ', $missing) . ' not installed on your system'),
};
@ -74,11 +72,10 @@ class LinuxToolCheckList
#[AsCheckItem('if necessary packages are installed', limit_os: 'Linux')]
public function checkSystemOSPackages(): ?CheckResult
{
$distro = SystemUtil::getOSRelease();
if ($distro['dist'] === 'alpine') {
if (SystemUtil::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', [$distro, ['linux-headers']]);
return CheckResult::fail('linux-headers not installed on your system', 'install-linux-tools', [SystemUtil::getOSRelease(), ['linux-headers']]);
}
}
return CheckResult::ok();
@ -94,8 +91,7 @@ class LinuxToolCheckList
$install_cmd = match ($distro['dist']) {
'ubuntu', 'debian' => 'apt-get install -y',
'alpine' => 'apk add',
'rhel' => 'dnf install -y',
'almalinux' => 'dnf install -y',
'redhat' => 'dnf install -y',
default => throw new RuntimeException('Current linux distro does not have an auto-install script for musl packages yet.'),
};
$prefix = '';
@ -104,8 +100,8 @@ class LinuxToolCheckList
logger()->warning('Current user is not root, using sudo for running command');
}
try {
$is_rhel = in_array($distro['dist'], ['rhel', 'almalinux']);
$to_install = $is_rhel ? $missing : str_replace('xz', 'xz-utils', $missing);
$is_debian = in_array($distro['dist'], ['debian', 'ubuntu']);
$to_install = $is_debian ? str_replace('xz', 'xz-utils', $missing) : $missing;
shell(true)->exec($prefix . $install_cmd . ' ' . implode(' ', $to_install));
} catch (RuntimeException) {
return false;

View File

@ -0,0 +1,220 @@
From 5ab3bd7fa858eec0626a9dd0117ca3b050ef4660 Mon Sep 17 00:00:00 2001
From: crazywhalecc <jesse2061@outlook.com>
Date: Mon, 13 Nov 2023 00:00:52 +0800
Subject: [PATCH] make macOS static compile happy
---
src/c-client/netmsg.c | 1 +
src/c-client/nntp.c | 1 +
src/osdep/amiga/dummy.c | 1 +
src/osdep/amiga/mbx.c | 1 +
src/osdep/amiga/mh.c | 1 +
src/osdep/amiga/mtx.c | 1 +
src/osdep/amiga/unix.c | 1 +
src/osdep/unix/dummy.c | 1 +
src/osdep/unix/mbx.c | 1 +
src/osdep/unix/mh.c | 1 +
src/osdep/unix/mmdf.c | 1 +
src/osdep/unix/mtx.c | 1 +
src/osdep/unix/mx.c | 1 +
src/osdep/unix/tcp_unix.c | 1 +
src/osdep/unix/tenex.c | 2 ++
src/osdep/unix/unix.c | 1 +
16 files changed, 17 insertions(+)
diff --git a/src/c-client/netmsg.c b/src/c-client/netmsg.c
index 187e4eb..f316d0b 100644
--- a/src/c-client/netmsg.c
+++ b/src/c-client/netmsg.c
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <errno.h>
+#include <time.h>
extern int errno; /* just in case */
#include "c-client.h"
#include "netmsg.h"
diff --git a/src/c-client/nntp.c b/src/c-client/nntp.c
index fe90edb..b2f7536 100644
--- a/src/c-client/nntp.c
+++ b/src/c-client/nntp.c
@@ -29,6 +29,7 @@
#include <ctype.h>
#include <stdio.h>
+#include <time.h>
#include "c-client.h"
#include "newsrc.h"
#include "netmsg.h"
diff --git a/src/osdep/amiga/dummy.c b/src/osdep/amiga/dummy.c
index b003a0b..2c65824 100644
--- a/src/osdep/amiga/dummy.c
+++ b/src/osdep/amiga/dummy.c
@@ -35,6 +35,7 @@ extern int errno; /* just in case */
#include "osdep.h"
#include <pwd.h>
#include <sys/stat.h>
+#include <time.h>
#include "dummy.h"
#include "misc.h"
diff --git a/src/osdep/amiga/mbx.c b/src/osdep/amiga/mbx.c
index 1ece5d8..2495965 100644
--- a/src/osdep/amiga/mbx.c
+++ b/src/osdep/amiga/mbx.c
@@ -43,6 +43,7 @@ extern int errno; /* just in case */
#include <pwd.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <utime.h>
#include "misc.h"
#include "dummy.h"
#include "fdstring.h"
diff --git a/src/osdep/amiga/mh.c b/src/osdep/amiga/mh.c
index 0226b7a..e7c907a 100644
--- a/src/osdep/amiga/mh.c
+++ b/src/osdep/amiga/mh.c
@@ -36,6 +36,7 @@ extern int errno; /* just in case */
#include <pwd.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <utime.h>
#include "misc.h"
#include "dummy.h"
#include "fdstring.h"
diff --git a/src/osdep/amiga/mtx.c b/src/osdep/amiga/mtx.c
index 8e6f76e..ca7b368 100644
--- a/src/osdep/amiga/mtx.c
+++ b/src/osdep/amiga/mtx.c
@@ -43,6 +43,7 @@ extern int errno; /* just in case */
#include <pwd.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <utime.h>
#include "misc.h"
#include "dummy.h"
#include "fdstring.h"
diff --git a/src/osdep/amiga/unix.c b/src/osdep/amiga/unix.c
index be3c437..c755fe7 100644
--- a/src/osdep/amiga/unix.c
+++ b/src/osdep/amiga/unix.c
@@ -46,6 +46,7 @@ extern int errno; /* just in case */
#include "osdep.h"
#include <time.h>
#include <sys/stat.h>
+#include <utime.h>
#include "unix.h"
#include "pseudo.h"
#include "fdstring.h"
diff --git a/src/osdep/unix/dummy.c b/src/osdep/unix/dummy.c
index b003a0b..2c65824 100644
--- a/src/osdep/unix/dummy.c
+++ b/src/osdep/unix/dummy.c
@@ -35,6 +35,7 @@ extern int errno; /* just in case */
#include "osdep.h"
#include <pwd.h>
#include <sys/stat.h>
+#include <time.h>
#include "dummy.h"
#include "misc.h"
diff --git a/src/osdep/unix/mbx.c b/src/osdep/unix/mbx.c
index 1ece5d8..2495965 100644
--- a/src/osdep/unix/mbx.c
+++ b/src/osdep/unix/mbx.c
@@ -43,6 +43,7 @@ extern int errno; /* just in case */
#include <pwd.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <utime.h>
#include "misc.h"
#include "dummy.h"
#include "fdstring.h"
diff --git a/src/osdep/unix/mh.c b/src/osdep/unix/mh.c
index 0226b7a..e7c907a 100644
--- a/src/osdep/unix/mh.c
+++ b/src/osdep/unix/mh.c
@@ -36,6 +36,7 @@ extern int errno; /* just in case */
#include <pwd.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <utime.h>
#include "misc.h"
#include "dummy.h"
#include "fdstring.h"
diff --git a/src/osdep/unix/mmdf.c b/src/osdep/unix/mmdf.c
index e962434..8cc9fae 100644
--- a/src/osdep/unix/mmdf.c
+++ b/src/osdep/unix/mmdf.c
@@ -34,6 +34,7 @@ extern int errno; /* just in case */
#include "osdep.h"
#include <time.h>
#include <sys/stat.h>
+#include <utime.h>
#include "pseudo.h"
#include "fdstring.h"
#include "misc.h"
diff --git a/src/osdep/unix/mtx.c b/src/osdep/unix/mtx.c
index 8e6f76e..ca7b368 100644
--- a/src/osdep/unix/mtx.c
+++ b/src/osdep/unix/mtx.c
@@ -43,6 +43,7 @@ extern int errno; /* just in case */
#include <pwd.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <utime.h>
#include "misc.h"
#include "dummy.h"
#include "fdstring.h"
diff --git a/src/osdep/unix/mx.c b/src/osdep/unix/mx.c
index 4549527..9d444c9 100644
--- a/src/osdep/unix/mx.c
+++ b/src/osdep/unix/mx.c
@@ -36,6 +36,7 @@ extern int errno; /* just in case */
#include <pwd.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <utime.h>
#include "misc.h"
#include "dummy.h"
#include "fdstring.h"
diff --git a/src/osdep/unix/tcp_unix.c b/src/osdep/unix/tcp_unix.c
index 5bad706..5d6cd03 100644
--- a/src/osdep/unix/tcp_unix.c
+++ b/src/osdep/unix/tcp_unix.c
@@ -27,6 +27,7 @@
*/
#include "ip_unix.c"
+#include <poll.h>
#undef write /* don't use redefined write() */
diff --git a/src/osdep/unix/tenex.c b/src/osdep/unix/tenex.c
index eee61fb..61760f0 100644
--- a/src/osdep/unix/tenex.c
+++ b/src/osdep/unix/tenex.c
@@ -46,6 +46,8 @@ extern int errno; /* just in case */
#include "mail.h"
#include "osdep.h"
#include <sys/stat.h>
+#include <time.h>
+#include <utime.h>
#include "misc.h"
#include "dummy.h"
diff --git a/src/osdep/unix/unix.c b/src/osdep/unix/unix.c
index be3c437..c755fe7 100644
--- a/src/osdep/unix/unix.c
+++ b/src/osdep/unix/unix.c
@@ -46,6 +46,7 @@ extern int errno; /* just in case */
#include "osdep.h"
#include <time.h>
#include <sys/stat.h>
+#include <utime.h>
#include "unix.h"
#include "pseudo.h"
#include "fdstring.h"
--
2.39.3 (Apple Git-145)

View File

@ -0,0 +1,8 @@
<?php
declare(strict_types=1);
# If you want to test new extensions here, just modify it.
$extensions = 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip';
echo $extensions;