mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add re2c build for spc-gnu-docker
This commit is contained in:
parent
3c972ac905
commit
601444d0a5
@ -101,17 +101,20 @@ RUN curl -o cmake.tgz -#fSL https://github.com/Kitware/CMake/releases/download/v
|
||||
tar -xzf cmake.tgz -C /cmake --strip-components 1
|
||||
|
||||
WORKDIR /app
|
||||
ADD ./src /app/src
|
||||
COPY ./composer.* /app/
|
||||
ADD ./bin/setup-runtime /app/bin/setup-runtime
|
||||
ADD ./bin/spc /app/bin/spc
|
||||
RUN /app/bin/setup-runtime
|
||||
ADD ./src /app/src
|
||||
RUN /app/bin/php /app/bin/composer install --no-dev
|
||||
ENV SPC_LIBC=glibc
|
||||
ENV PATH="/app/bin:/cmake/bin:/opt/rh/devtoolset-10/root/usr/bin:\$PATH"
|
||||
|
||||
ADD ./config/env.ini /app/config/env.ini
|
||||
ADD ./config /app/config
|
||||
RUN CC=gcc bin/spc doctor --auto-fix --debug
|
||||
RUN if [ -f /app/buildroot/bin/re2c ]; then \
|
||||
cp /app/buildroot/bin/re2c /usr/local/bin/re2c ;\
|
||||
fi
|
||||
|
||||
RUN curl -o make.tgz -fsSL https://ftp.gnu.org/gnu/make/make-4.4.tar.gz && \
|
||||
tar -zxvf make.tgz && \
|
||||
@ -128,9 +131,6 @@ RUN curl -o automake.tgz -fsSL https://ftp.gnu.org/gnu/automake/automake-1.17.ta
|
||||
make && \
|
||||
make install && \
|
||||
ln -sf /usr/local/bin/automake /usr/bin/automake
|
||||
|
||||
RUN bin/spc download re2c && \
|
||||
bin/spc build:libs re2c
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
@ -10,6 +10,23 @@ trait re2c
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
UnixCMakeExecutor::create($this)->build();
|
||||
UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs(
|
||||
'-DRE2C_BUILD_TESTS=OFF',
|
||||
'-DRE2C_BUILD_EXAMPLES=OFF',
|
||||
'-DRE2C_BUILD_DOCS=OFF',
|
||||
'-DRE2C_BUILD_RE2D=OFF',
|
||||
'-DRE2C_BUILD_RE2GO=OFF',
|
||||
'-DRE2C_BUILD_RE2HS=OFF',
|
||||
'-DRE2C_BUILD_RE2JAVA=OFF',
|
||||
'-DRE2C_BUILD_RE2JS=OFF',
|
||||
'-DRE2C_BUILD_RE2OCAML=OFF',
|
||||
'-DRE2C_BUILD_RE2PY=OFF',
|
||||
'-DRE2C_BUILD_RE2RUST=OFF',
|
||||
'-DRE2C_BUILD_RE2SWIFT=OFF',
|
||||
'-DRE2C_BUILD_RE2V=OFF',
|
||||
'-DRE2C_BUILD_RE2ZIG=OFF',
|
||||
)
|
||||
->build();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\doctor;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_METHOD)]
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||||
class AsCheckItem
|
||||
{
|
||||
public mixed $callback = null;
|
||||
|
||||
44
src/SPC/doctor/item/Re2cVersionCheck.php
Normal file
44
src/SPC/doctor/item/Re2cVersionCheck.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\doctor\item;
|
||||
|
||||
use SPC\builder\BuilderProvider;
|
||||
use SPC\builder\traits\UnixSystemUtilTrait;
|
||||
use SPC\doctor\AsCheckItem;
|
||||
use SPC\doctor\AsFixItem;
|
||||
use SPC\doctor\CheckResult;
|
||||
use SPC\store\Downloader;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
class Re2cVersionCheck
|
||||
{
|
||||
use UnixSystemUtilTrait;
|
||||
|
||||
#[AsCheckItem('if re2c version >= 1.0.3', limit_os: 'Linux', level: 20)]
|
||||
#[AsCheckItem('if re2c version >= 1.0.3', limit_os: 'Darwin', level: 20)]
|
||||
public function checkRe2cVersion(): ?CheckResult
|
||||
{
|
||||
$ver = shell()->execWithResult('re2c --version', false);
|
||||
// match version: re2c X.X(.X)
|
||||
if ($ver[0] !== 0 || !preg_match('/re2c\s+(\d+\.\d+(\.\d+)?)/', $ver[1][0], $matches)) {
|
||||
return CheckResult::fail('Failed to get re2c version', 'build-re2c');
|
||||
}
|
||||
$version_string = $matches[1];
|
||||
if (version_compare($version_string, '1.0.3') < 0) {
|
||||
return CheckResult::fail('re2c version is too low (' . $version_string . ')', 'build-re2c');
|
||||
}
|
||||
return CheckResult::ok($version_string);
|
||||
}
|
||||
|
||||
#[AsFixItem('build-re2c')]
|
||||
public function buildRe2c(): bool
|
||||
{
|
||||
Downloader::downloadSource('re2c');
|
||||
$builder = BuilderProvider::makeBuilderByInput(new ArgvInput([]));
|
||||
$builder->proveLibs(['re2c']);
|
||||
$builder->setupLibs();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user