Files
static-php-cli/src/SPC/builder/unix/library/fastlz.php

26 lines
845 B
PHP
Raw Normal View History

2025-06-12 10:46:26 +07:00
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\BuildFailureException;
2025-06-12 10:46:26 +07:00
trait fastlz
{
protected function build(): void
{
2026-05-04 20:00:25 +07:00
$extra = trim((string) getenv('SPC_DEFAULT_C_FLAGS'));
2025-06-12 10:46:26 +07:00
shell()->cd($this->source_dir)->initializeEnv($this)
2026-05-04 20:00:25 +07:00
->exec((getenv('CC') ?: 'cc') . " -c {$extra} fastlz.c -o fastlz.o")
2025-06-12 10:48:15 +07:00
->exec((getenv('AR') ?: 'ar') . ' rcs libfastlz.a fastlz.o');
2025-06-12 10:46:26 +07:00
if (!copy($this->source_dir . '/fastlz.h', BUILD_INCLUDE_PATH . '/fastlz.h')) {
throw new BuildFailureException('Failed to copy fastlz.h, file does not exist');
2025-06-12 10:46:26 +07:00
}
if (!copy($this->source_dir . '/libfastlz.a', BUILD_LIB_PATH . '/libfastlz.a')) {
throw new BuildFailureException('Failed to copy libfastlz.a, file does not exist');
2025-06-12 10:46:26 +07:00
}
}
}